[asterisk-commits] mmichelson: branch mmichelson/digit_manipulation r198593 - in /team/mmichelso...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 1 11:42:20 CDT 2009


Author: mmichelson
Date: Mon Jun  1 11:42:16 2009
New Revision: 198593

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=198593
Log:
Use pbx_findapp in order to run a macro instead of what was there before.


Modified:
    team/mmichelson/digit_manipulation/apps/app_macro.c
    team/mmichelson/digit_manipulation/include/asterisk/app.h
    team/mmichelson/digit_manipulation/main/app.c

Modified: team/mmichelson/digit_manipulation/apps/app_macro.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/mmichelson/digit_manipulation/apps/app_macro.c?view=diff&rev=198593&r1=198592&r2=198593
==============================================================================
--- team/mmichelson/digit_manipulation/apps/app_macro.c (original)
+++ team/mmichelson/digit_manipulation/apps/app_macro.c Mon Jun  1 11:42:16 2009
@@ -610,21 +610,6 @@
 	return MACRO_EXIT_RESULT;
 }
 
-static int external_run_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const char * const macro_name, const char * const macro_args)
-{
-	int res;
-	char buf[1024];
-	if (autoservice_chan) {
-		ast_autoservice_start(autoservice_chan);
-	}
-	snprintf(buf, sizeof(buf), "%s%s%s", macro_name, ast_strlen_zero(macro_args) ? "" : ",", S_OR(macro_args, ""));
-	res = macro_exec(macro_chan, buf);
-	if (autoservice_chan) {
-		ast_autoservice_stop(autoservice_chan);
-	}
-	return res;
-}
-
 static int unload_module(void)
 {
 	int res;
@@ -633,7 +618,6 @@
 	res |= ast_unregister_application(exit_app);
 	res |= ast_unregister_application(app);
 	res |= ast_unregister_application(exclusive_app);
-	ast_uninstall_macro_functions();
 
 	return res;
 }
@@ -646,7 +630,6 @@
 	res |= ast_register_application_xml(if_app, macroif_exec);
 	res |= ast_register_application_xml(exclusive_app, macroexclusive_exec);
 	res |= ast_register_application_xml(app, macro_exec);
-	ast_install_macro_functions(external_run_macro);
 
 	return res;
 }

Modified: team/mmichelson/digit_manipulation/include/asterisk/app.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/mmichelson/digit_manipulation/include/asterisk/app.h?view=diff&rev=198593&r1=198592&r2=198593
==============================================================================
--- team/mmichelson/digit_manipulation/include/asterisk/app.h (original)
+++ team/mmichelson/digit_manipulation/include/asterisk/app.h Mon Jun  1 11:42:16 2009
@@ -108,9 +108,6 @@
 /*! \brief Full version with audiofd and controlfd.  NOTE: returns '2' on ctrlfd available, not '1' like other full functions */
 int ast_app_getdata_full(struct ast_channel *c, const char *prompt, char *s, int maxlen, int timeout, int audiofd, int ctrlfd);
 
-void ast_install_macro_functions(int (*run_macro_func)(struct ast_channel *, struct ast_channel *, const char * const, const char * const));
-void ast_uninstall_macro_functions(void);
-
 /*!
  * \brief Run a macro on a channel, placing a second channel into autoservice.
  *

Modified: team/mmichelson/digit_manipulation/main/app.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/mmichelson/digit_manipulation/main/app.c?view=diff&rev=198593&r1=198592&r2=198593
==============================================================================
--- team/mmichelson/digit_manipulation/main/app.c (original)
+++ team/mmichelson/digit_manipulation/main/app.c Mon Jun  1 11:42:16 2009
@@ -203,24 +203,25 @@
 	return res;
 }
 
-static int (*ast_run_macro_func)(struct ast_channel *, struct ast_channel *, const char * const, const char * const) = NULL;
-
-void ast_install_macro_functions(int (*run_macro_func)(struct ast_channel *, struct ast_channel *, const char * const, const char * const))
-{
-	ast_run_macro_func = run_macro_func;
-}
-
-void ast_uninstall_macro_functions(void)
-{
-	ast_run_macro_func = NULL;
-}
-
 int ast_app_run_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const char * const macro_name, const char * const macro_args)
 {
-	if (ast_run_macro_func) {
-		return ast_run_macro_func(autoservice_chan, macro_chan, macro_name, macro_args);
-	}
-	return -1;
+	struct ast_app *macro_app;
+	int res;
+	char buf[1024];
+
+	macro_app = pbx_findapp("Macro");
+	if (!macro_app) {
+		return -1;
+	}
+	snprintf(buf, sizeof(buf), "%s%s%s", macro_name, ast_strlen_zero(macro_args) ? "" : ",", S_OR(macro_args, ""));
+	if (autoservice_chan) {
+		ast_autoservice_start(autoservice_chan);
+	}
+	res = pbx_exec(macro_chan, macro_app, buf);
+	if (autoservice_chan) {
+		ast_autoservice_stop(autoservice_chan);
+	}
+	return res;
 }
 
 static int (*ast_has_voicemail_func)(const char *mailbox, const char *folder) = NULL;




More information about the asterisk-commits mailing list