[asterisk-commits] mjordan: trunk r396201 - /trunk/res/res_pjsip_outbound_registration.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 5 14:01:47 CDT 2013


Author: mjordan
Date: Mon Aug  5 14:01:45 2013
New Revision: 396201

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=396201
Log:
Add AMI registration events for PJSIP outbound registration attempts

This patch adds AMI events whenever an outbound registration attempt succeeds
or fails from res_pjsip_outbound_registration. This brings it inline with
the existing SIP channel driver and IAX channel driver.

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


Modified:
    trunk/res/res_pjsip_outbound_registration.c

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=396201&r1=396200&r2=396201
==============================================================================
--- trunk/res/res_pjsip_outbound_registration.c (original)
+++ trunk/res/res_pjsip_outbound_registration.c Mon Aug  5 14:01:45 2013
@@ -31,6 +31,7 @@
 #include "asterisk/module.h"
 #include "asterisk/taskprocessor.h"
 #include "asterisk/cli.h"
+#include "asterisk/stasis_system.h"
 
 /*** DOCUMENTATION
 	<configInfo name="res_pjsip_outbound_registration" language="en_US">
@@ -119,6 +120,14 @@
 	SIP_REGISTRATION_REJECTED_PERMANENT,
 	/*! \brief Registration has been stopped */
 	SIP_REGISTRATION_STOPPED,
+};
+
+static const char *sip_outbound_registration_status_str[] = {
+	[SIP_REGISTRATION_UNREGISTERED] = "Unregistered",
+	[SIP_REGISTRATION_REGISTERED] = "Registered",
+	[SIP_REGISTRATION_REJECTED_TEMPORARY] = "Rejected",
+	[SIP_REGISTRATION_REJECTED_PERMANENT] = "Rejected",
+	[SIP_REGISTRATION_STOPPED] = "Stopped",
 };
 
 /*! \brief Outbound registration client state information (persists for lifetime of regc) */
@@ -386,6 +395,8 @@
 			response->code, server_uri, client_uri);
 	}
 
+	ast_system_publish_registry("PJSIP", client_uri, server_uri, sip_outbound_registration_status_str[response->client_state->status], NULL);
+
 	/* If deferred destruction is in use see if we need to destroy now */
 	if (response->client_state->destroy) {
 		handle_client_state_destruction(response->client_state);




More information about the asterisk-commits mailing list