[asterisk-commits] oej: branch oej/pinana-initialize-devstate-trunk r386868 - in /team/oej/pinan...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Apr 29 13:08:26 CDT 2013
Author: oej
Date: Mon Apr 29 13:08:23 2013
New Revision: 386868
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386868
Log:
Add init devstate functon.
https://issues.asterisk.org/jira/browse/ASTERISK-17065
Modified:
team/oej/pinana-initialize-devstate-trunk/include/asterisk/pbx.h
team/oej/pinana-initialize-devstate-trunk/main/devicestate.c
team/oej/pinana-initialize-devstate-trunk/main/pbx.c
Modified: team/oej/pinana-initialize-devstate-trunk/include/asterisk/pbx.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinana-initialize-devstate-trunk/include/asterisk/pbx.h?view=diff&rev=386868&r1=386867&r2=386868
==============================================================================
--- team/oej/pinana-initialize-devstate-trunk/include/asterisk/pbx.h (original)
+++ team/oej/pinana-initialize-devstate-trunk/include/asterisk/pbx.h Mon Apr 29 13:08:23 2013
@@ -657,6 +657,13 @@
int ast_str_get_hint(struct ast_str **hint, ssize_t hintsize, struct ast_str **name, ssize_t namesize,
struct ast_channel *c, const char *context, const char *exten);
+/*! \brief ast_hint_reinit_provider: Reinitialize hints for a provider after provider
+ * was added
+ *
+ * \param provider the provider identifier
+ */
+void ast_hint_reinit_provider(const char *provider);
+
/*!
* \brief Determine whether an extension exists
*
Modified: team/oej/pinana-initialize-devstate-trunk/main/devicestate.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinana-initialize-devstate-trunk/main/devicestate.c?view=diff&rev=386868&r1=386867&r2=386868
==============================================================================
--- team/oej/pinana-initialize-devstate-trunk/main/devicestate.c (original)
+++ team/oej/pinana-initialize-devstate-trunk/main/devicestate.c Mon Apr 29 13:08:23 2013
@@ -369,6 +369,9 @@
AST_RWLIST_INSERT_HEAD(&devstate_provs, devprov, list);
AST_RWLIST_UNLOCK(&devstate_provs);
+ /* Check if we have devices in the hint list that need initialization */
+ ast_hint_reinit_provider(label);
+
return 0;
}
Modified: team/oej/pinana-initialize-devstate-trunk/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinana-initialize-devstate-trunk/main/pbx.c?view=diff&rev=386868&r1=386867&r2=386868
==============================================================================
--- team/oej/pinana-initialize-devstate-trunk/main/pbx.c (original)
+++ team/oej/pinana-initialize-devstate-trunk/main/pbx.c Mon Apr 29 13:08:23 2013
@@ -5676,6 +5676,34 @@
return -1;
}
+/*! \brief ast_hint_reinit_provider: Reinitialize hints for a provider after provider
+ was added
+ */
+void ast_hint_reinit_provider(const char *provider)
+{
+ struct ast_hint *hint;
+ struct ao2_iterator i;
+ const char *hinttext;
+ char providerlabel[AST_MAX_EXTENSION];
+
+ snprintf(providerlabel, sizeof(providerlabel), "%s:", provider);
+
+ if (ao2_container_count(hints) == 0) {
+ return;
+ }
+
+ i = ao2_iterator_init(hints, 0);
+
+ for (hint = ao2_iterator_next(&i); hint; ao2_ref(hint, -1), hint = ao2_iterator_next(&i)) {
+ hinttext = ast_get_extension_app(hint->exten);
+ /* If we find the provider label in the hint, we need to reinitialize the hint */
+ if (strcasestr(hinttext, providerlabel)) {
+ ast_extension_state2(hint->exten, NULL);
+ }
+ }
+ ao2_iterator_destroy(&i);
+}
+
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
{
return pbx_extension_helper(c, NULL, context, exten, priority, NULL, callerid, E_MATCH, 0, 0);
More information about the asterisk-commits
mailing list