summaryrefslogtreecommitdiff
path: root/channels/chan_pjsip.c
diff options
context:
space:
mode:
authorKevin Harwell <kharwell@digium.com>2014-01-16 16:46:00 +0000
committerKevin Harwell <kharwell@digium.com>2014-01-16 16:46:00 +0000
commit3373a5332bd63aedb8a0d0cd2e8cfa94281e5072 (patch)
tree2f9215c8814452e40bd3687d9651fa3f197afdb8 /channels/chan_pjsip.c
parent3c90fc0bfd1a982a4f938d2aa61d3e370c8a9820 (diff)
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 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405644 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_pjsip.c')
-rw-r--r--channels/chan_pjsip.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index 4a1a6aa2f..56a418154 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -1874,6 +1874,13 @@ static int chan_pjsip_incoming_ack(struct ast_sip_session *session, struct pjsip
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 struct ast_custom_function media_offer_function = {
*/
static int load_module(void)
{
+ struct ao2_container *endpoints;
+
if (!(chan_pjsip_tech.capabilities = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_DECLINE;
}
@@ -1938,6 +1947,13 @@ static int load_module(void)
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;
end: