[svn-commits] mjordan: trunk r417461 - in /trunk: ./ include/asterisk/ res/ res/res_pjsip/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Jun 27 08:50:06 CDT 2014


Author: mjordan
Date: Fri Jun 27 08:50:02 2014
New Revision: 417461

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=417461
Log:
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

Modified:
    trunk/   (props changed)
    trunk/include/asterisk/res_pjsip.h
    trunk/res/res_pjsip/pjsip_configuration.c
    trunk/res/res_pjsip_outbound_registration.c
    trunk/res/res_pjsip_pubsub.c
    trunk/res/res_pjsip_registrar.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: trunk/include/asterisk/res_pjsip.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/res_pjsip.h?view=diff&rev=417461&r1=417460&r2=417461
==============================================================================
--- trunk/include/asterisk/res_pjsip.h (original)
+++ trunk/include/asterisk/res_pjsip.h Fri Jun 27 08:50:02 2014
@@ -1719,6 +1719,8 @@
 	struct mansession *s;
 	/*! Manager message */
 	const struct message *m;
+	/*! Manager Action ID */
+	const char *action_id;
 	/*! user specified argument data */
 	void *arg;
 };

Modified: trunk/res/res_pjsip/pjsip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip/pjsip_configuration.c?view=diff&rev=417461&r1=417460&r2=417461
==============================================================================
--- trunk/res/res_pjsip/pjsip_configuration.c (original)
+++ trunk/res/res_pjsip/pjsip_configuration.c Fri Jun 27 08:50:02 2014
@@ -1024,6 +1024,9 @@
 	}
 
 	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 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 @@
 			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 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 @@
 
 	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;
 }

Modified: trunk/res/res_pjsip_outbound_registration.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip_outbound_registration.c?view=diff&rev=417461&r1=417460&r2=417461
==============================================================================
--- trunk/res/res_pjsip_outbound_registration.c (original)
+++ trunk/res/res_pjsip_outbound_registration.c Fri Jun 27 08:50:02 2014
@@ -1102,7 +1102,7 @@
 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 @@
 
 	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 @@
 	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) {

Modified: trunk/res/res_pjsip_pubsub.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip_pubsub.c?view=diff&rev=417461&r1=417460&r2=417461
==============================================================================
--- trunk/res/res_pjsip_pubsub.c (original)
+++ trunk/res/res_pjsip_pubsub.c Fri Jun 27 08:50:02 2014
@@ -1966,7 +1966,7 @@
 
 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 @@
 
 	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 @@
 
 	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;
 }

Modified: trunk/res/res_pjsip_registrar.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip_registrar.c?view=diff&rev=417461&r1=417460&r2=417461
==============================================================================
--- trunk/res/res_pjsip_registrar.c (original)
+++ trunk/res/res_pjsip_registrar.c Fri Jun 27 08:50:02 2014
@@ -765,15 +765,17 @@
 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;
 }




More information about the svn-commits mailing list