[asterisk-commits] oej: branch oej/pinana-initialize-devstate-1.4 r297580 - in /team/oej/pinana-...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Dec 4 07:23:20 CST 2010


Author: oej
Date: Sat Dec  4 07:23:13 2010
New Revision: 297580

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=297580
Log:
Code from project pinana exposing a bug in the device/extensionstate architecture and fixing itCode from project pinana exposing a bug in the device/extensionstate architecture and fixing it..

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

Modified: team/oej/pinana-initialize-devstate-1.4/include/asterisk/pbx.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinana-initialize-devstate-1.4/include/asterisk/pbx.h?view=diff&rev=297580&r1=297579&r2=297580
==============================================================================
--- team/oej/pinana-initialize-devstate-1.4/include/asterisk/pbx.h (original)
+++ team/oej/pinana-initialize-devstate-1.4/include/asterisk/pbx.h Sat Dec  4 07:23:13 2010
@@ -381,6 +381,13 @@
 int ast_get_hint(char *hint, int maxlen, char *name, int maxnamelen, 
 	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.4/main/devicestate.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinana-initialize-devstate-1.4/main/devicestate.c?view=diff&rev=297580&r1=297579&r2=297580
==============================================================================
--- team/oej/pinana-initialize-devstate-1.4/main/devicestate.c (original)
+++ team/oej/pinana-initialize-devstate-1.4/main/devicestate.c Sat Dec  4 07:23:13 2010
@@ -197,6 +197,9 @@
 	AST_LIST_INSERT_HEAD(&devstate_provs, devprov, list);
 	AST_LIST_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.4/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinana-initialize-devstate-1.4/main/pbx.c?view=diff&rev=297580&r1=297579&r2=297580
==============================================================================
--- team/oej/pinana-initialize-devstate-1.4/main/pbx.c (original)
+++ team/oej/pinana-initialize-devstate-1.4/main/pbx.c Sat Dec  4 07:23:13 2010
@@ -2328,6 +2328,34 @@
 		return -1;
 	}
 	return 0;
+}
+
+/*! \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)




More information about the asterisk-commits mailing list