res_pjsip: Add ActionID to events created as a result of PJSIP AMI actions

A number of various PJSIP AMI actions were failing to parse out and place the
ActionID into their responses. This patch updates the various PJSIP actions
such that the passed in ActionID is emitted on any event list complete events,
as well as any intermediate events created as a result of the action.

#ASTERISK-23947 #close
Reported by: Mark Michelson

Review: https://reviewboard.asterisk.org/r/3675/
........

Merged revisions 417460 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417461 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Matthew Jordan
2014-06-27 13:50:02 +00:00
parent 512e505dc3
commit 15dcaeef82
5 changed files with 42 additions and 25 deletions

View File

@@ -1102,7 +1102,7 @@ static int ami_outbound_registration_detail(void *obj, void *arg, int flags)
static int ami_show_outbound_registrations(struct mansession *s,
const struct message *m)
{
struct ast_sip_ami ami = { .s = s, .m = m };
struct ast_sip_ami ami = { .s = s, .m = m, .action_id = astman_get_header(m, "ActionID"), };
struct sip_ami_outbound ami_outbound = { .ami = &ami };
RAII_VAR(struct ao2_container *, regs, ast_sorcery_retrieve_by_fields(
ast_sip_get_sorcery(), "registration", AST_RETRIEVE_FLAG_MULTIPLE |
@@ -1119,9 +1119,11 @@ static int ami_show_outbound_registrations(struct mansession *s,
ao2_callback(regs, OBJ_NODATA, ami_outbound_registration_detail, &ami_outbound);
astman_append(s,
"Event: OutboundRegistrationDetailComplete\r\n"
"EventList: Complete\r\n"
astman_append(s, "Event: OutboundRegistrationDetailComplete\r\n");
if (!ast_strlen_zero(ami.action_id)) {
astman_append(s, "ActionID: %s\r\n", ami.action_id);
}
astman_append(s, "EventList: Complete\r\n"
"Registered: %d\r\n"
"NotRegistered: %d\r\n\r\n",
ami_outbound.registered,
@@ -1259,7 +1261,7 @@ static int load_module(void)
sip_outbound_registration_perform_all();
ast_manager_register_xml("PJSIPUnregister", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, ami_unregister);
ast_manager_register_xml("PJSIPShowRegistrationsOutbound", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING,ami_show_outbound_registrations);
ast_manager_register_xml("PJSIPShowRegistrationsOutbound", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, ami_show_outbound_registrations);
cli_formatter = ao2_alloc(sizeof(struct ast_sip_cli_formatter_entry), NULL);
if (!cli_formatter) {