[svn-commits] mmichelson: branch 13 r430776 - /branches/13/main/pbx.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jan 19 12:05:23 CST 2015


Author: mmichelson
Date: Mon Jan 19 12:05:15 2015
New Revision: 430776

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=430776
Log:
Call extension state callbacks at hint creation.

When a hint gets created, any subsequent device or presence
state changes result in extension status events getting sent
out to interested parties. However, at the time of hint creation,
no such event gets sent out, so watchers of extension state are
potentially left in the dark until the first state change after
hint creation.

Patch contributed by John Hardin (License #6512)


Modified:
    branches/13/main/pbx.c

Modified: branches/13/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/branches/13/main/pbx.c?view=diff&rev=430776&r1=430775&r2=430776
==============================================================================
--- branches/13/main/pbx.c (original)
+++ branches/13/main/pbx.c Mon Jan 19 12:05:15 2015
@@ -5829,6 +5829,24 @@
 			ast_get_context_name(ast_get_extension_context(e)));
 	}
 
+	/* if not dynamic */
+	if (!(strstr(e->app, "${") && e->exten[0] == '_')) {
+		struct ast_state_cb *state_cb;
+		struct ao2_iterator cb_iter;
+
+		/* For general callbacks */
+		cb_iter = ao2_iterator_init(statecbs, 0);
+		for (; (state_cb = ao2_iterator_next(&cb_iter)); ao2_ref(state_cb, -1)) {
+			execute_state_callback(state_cb->change_cb,
+					ast_get_context_name(ast_get_extension_context(e)),
+					ast_get_extension_name(e),
+					state_cb->data,
+					AST_HINT_UPDATE_DEVICE,
+					hint_new,
+					NULL);
+		}
+		ao2_iterator_destroy(&cb_iter);
+	}
 	ao2_unlock(hints);
 	ao2_ref(hint_new, -1);
 




More information about the svn-commits mailing list