[svn-commits] kharwell: trunk r405644 - in /trunk: ./ channels/chan_pjsip.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jan 16 10:46:02 CST 2014


Author: kharwell
Date: Thu Jan 16 10:46:00 2014
New Revision: 405644

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=405644
Log:
chan_pjsip: initial device state on endpoints is INVALID

When endpoints get loaded their device state gets set to 'INVALID' because the
channel driver has not been loaded yet.  Fixed by updating the device state for
every endpoint upon load of the channel driver.

(closes issue ASTERISK-23065)
Reported by: Rusty Newton
Review: https://reviewboard.asterisk.org/r/3123/
........

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

Modified:
    trunk/   (props changed)
    trunk/channels/chan_pjsip.c

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

Modified: trunk/channels/chan_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_pjsip.c?view=diff&rev=405644&r1=405643&r2=405644
==============================================================================
--- trunk/channels/chan_pjsip.c (original)
+++ trunk/channels/chan_pjsip.c Thu Jan 16 10:46:00 2014
@@ -1874,6 +1874,13 @@
 	return 0;
 }
 
+static int update_devstate(void *obj, void *arg, int flags)
+{
+	ast_devstate_changed(AST_DEVICE_UNKNOWN, AST_DEVSTATE_CACHABLE,
+			     "PJSIP/%s", ast_sorcery_object_get_id(obj));
+	return 0;
+}
+
 static struct ast_custom_function chan_pjsip_dial_contacts_function = {
 	.name = "PJSIP_DIAL_CONTACTS",
 	.read = pjsip_acf_dial_contacts_read,
@@ -1897,6 +1904,8 @@
  */
 static int load_module(void)
 {
+	struct ao2_container *endpoints;
+
 	if (!(chan_pjsip_tech.capabilities = ast_format_cap_alloc(0))) {
 		return AST_MODULE_LOAD_DECLINE;
 	}
@@ -1936,6 +1945,13 @@
 		ast_sip_session_unregister_supplement(&pbx_start_supplement);
 		ast_sip_session_unregister_supplement(&chan_pjsip_supplement);
 		goto end;
+	}
+
+	/* since endpoints are loaded before the channel driver their device
+	   states get set to 'invalid', so they need to be updated */
+	if ((endpoints = ast_sip_get_endpoints())) {
+		ao2_callback(endpoints, OBJ_NODATA, update_devstate, NULL);
+		ao2_ref(endpoints, -1);
 	}
 
 	return 0;




More information about the svn-commits mailing list