[asterisk-commits] oej: branch oej/pinana-initialize-devstate-1.8 r410447 - in /team/oej/pinana-...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 11 07:08:11 CDT 2014


Author: oej
Date: Tue Mar 11 07:08:07 2014
New Revision: 410447

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=410447
Log:
Resetting

Modified:
    team/oej/pinana-initialize-devstate-1.8/include/asterisk/pbx.h
    team/oej/pinana-initialize-devstate-1.8/main/devicestate.c
    team/oej/pinana-initialize-devstate-1.8/main/pbx.c

Modified: team/oej/pinana-initialize-devstate-1.8/include/asterisk/pbx.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinana-initialize-devstate-1.8/include/asterisk/pbx.h?view=diff&rev=410447&r1=410446&r2=410447
==============================================================================
--- team/oej/pinana-initialize-devstate-1.8/include/asterisk/pbx.h (original)
+++ team/oej/pinana-initialize-devstate-1.8/include/asterisk/pbx.h Tue Mar 11 07:08:07 2014
@@ -496,6 +496,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-1.8/main/devicestate.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinana-initialize-devstate-1.8/main/devicestate.c?view=diff&rev=410447&r1=410446&r2=410447
==============================================================================
--- team/oej/pinana-initialize-devstate-1.8/main/devicestate.c (original)
+++ team/oej/pinana-initialize-devstate-1.8/main/devicestate.c Tue Mar 11 07:08:07 2014
@@ -382,6 +382,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-1.8/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinana-initialize-devstate-1.8/main/pbx.c?view=diff&rev=410447&r1=410446&r2=410447
==============================================================================
--- team/oej/pinana-initialize-devstate-1.8/main/pbx.c (original)
+++ team/oej/pinana-initialize-devstate-1.8/main/pbx.c Tue Mar 11 07:08:07 2014
@@ -5097,6 +5097,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);
+		}
+	}
+	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