summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/asterisk/res_pjsip.h2
-rw-r--r--res/res_pjsip/pjsip_configuration.c23
-rw-r--r--res/res_pjsip_outbound_registration.c12
-rw-r--r--res/res_pjsip_pubsub.c20
-rw-r--r--res/res_pjsip_registrar.c10
5 files changed, 42 insertions, 25 deletions
diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h
index de654ee8d..4a3a84a8a 100644
--- a/include/asterisk/res_pjsip.h
+++ b/include/asterisk/res_pjsip.h
@@ -1719,6 +1719,8 @@ struct ast_sip_ami {
struct mansession *s;
/*! Manager message */
const struct message *m;
+ /*! Manager Action ID */
+ const char *action_id;
/*! user specified argument data */
void *arg;
};
diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c
index ea3326969..b2ce4fe7e 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -1024,6 +1024,9 @@ struct ast_str *ast_sip_create_ami_event(const char *event, struct ast_sip_ami *
}
ast_str_set(&buf, 0, "Event: %s\r\n", event);
+ if (!ast_strlen_zero(ami->action_id)) {
+ ast_str_append(&buf, 0, "ActionID: %s\r\n", ami->action_id);
+ }
return buf;
}
@@ -1104,7 +1107,7 @@ static int format_ami_endpoint(const struct ast_sip_endpoint *endpoint,
static int ami_show_endpoint(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"), };
RAII_VAR(struct ast_sip_endpoint *, endpoint, NULL, ao2_cleanup);
const char *endpoint_name = astman_get_header(m, "Endpoint");
int count = 0;
@@ -1136,9 +1139,11 @@ static int ami_show_endpoint(struct mansession *s, const struct message *m)
endpoint_name);
}
- astman_append(s,
- "Event: EndpointDetailComplete\r\n"
- "EventList: Complete\r\n"
+ astman_append(s, "Event: EndpointDetailComplete\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"
"ListItems: %d\r\n\r\n", count + 1);
return 0;
}
@@ -1197,7 +1202,7 @@ static int format_ami_endpoints(void *obj, void *arg, int flags)
static int ami_show_endpoints(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"), };
RAII_VAR(struct ao2_container *, endpoints, NULL, ao2_cleanup);
int num;
@@ -1216,9 +1221,11 @@ static int ami_show_endpoints(struct mansession *s, const struct message *m)
ao2_callback(endpoints, OBJ_NODATA, format_ami_endpoints, &ami);
- astman_append(s,
- "Event: EndpointListComplete\r\n"
- "EventList: Complete\r\n"
+ astman_append(s, "Event: EndpointListComplete\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"
"ListItems: %d\r\n\r\n", num);
return 0;
}
diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c
index 7002a13cd..bf03094f7 100644
--- a/res/res_pjsip_outbound_registration.c
+++ b/res/res_pjsip_outbound_registration.c
@@ -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) {
diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c
index 39846823e..9032bd3f6 100644
--- a/res/res_pjsip_pubsub.c
+++ b/res/res_pjsip_pubsub.c
@@ -1966,7 +1966,7 @@ static int ami_subscription_detail_outbound(struct ast_sip_subscription *sub, vo
static int ami_show_subscriptions_inbound(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"), };
int num;
astman_send_listack(s, m, "Following are Events for "
@@ -1974,16 +1974,18 @@ static int ami_show_subscriptions_inbound(struct mansession *s, const struct mes
num = for_each_subscription(ami_subscription_detail_inbound, &ami);
- astman_append(s,
- "Event: InboundSubscriptionDetailComplete\r\n"
- "EventList: Complete\r\n"
+ astman_append(s, "Event: InboundSubscriptionDetailComplete\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"
"ListItems: %d\r\n\r\n", num);
return 0;
}
static int ami_show_subscriptions_outbound(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"), };
int num;
astman_send_listack(s, m, "Following are Events for "
@@ -1991,9 +1993,11 @@ static int ami_show_subscriptions_outbound(struct mansession *s, const struct me
num = for_each_subscription(ami_subscription_detail_outbound, &ami);
- astman_append(s,
- "Event: OutboundSubscriptionDetailComplete\r\n"
- "EventList: Complete\r\n"
+ astman_append(s, "Event: OutboundSubscriptionDetailComplete\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"
"ListItems: %d\r\n\r\n", num);
return 0;
}
diff --git a/res/res_pjsip_registrar.c b/res/res_pjsip_registrar.c
index 962895b60..f7d082c18 100644
--- a/res/res_pjsip_registrar.c
+++ b/res/res_pjsip_registrar.c
@@ -765,15 +765,17 @@ static int ami_registrations_endpoints(void *arg)
static int ami_show_registrations(struct mansession *s, const struct message *m)
{
int count = 0;
- struct ast_sip_ami ami = { .s = s, .m = m, .arg = &count };
+ struct ast_sip_ami ami = { .s = s, .m = m, .arg = &count, .action_id = astman_get_header(m, "ActionID"), };
astman_send_listack(s, m, "Following are Events for each Inbound "
"registration", "start");
ami_registrations_endpoints(&ami);
- astman_append(s,
- "Event: InboundRegistrationDetailComplete\r\n"
- "EventList: Complete\r\n"
+ astman_append(s, "Event: InboundRegistrationDetailComplete\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"
"ListItems: %d\r\n\r\n", count);
return 0;
}