[asterisk-commits] murf: branch group/replace_macro_with_gosub_in_dial r70355 - /team/group/repl...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 20 11:50:07 CDT 2007


Author: murf
Date: Wed Jun 20 11:50:07 2007
New Revision: 70355

URL: http://svn.digium.com/view/asterisk?view=rev&rev=70355
Log:
the little fix I need to make to put together proper gosub args

Modified:
    team/group/replace_macro_with_gosub_in_dial/apps/app_dial.c

Modified: team/group/replace_macro_with_gosub_in_dial/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/group/replace_macro_with_gosub_in_dial/apps/app_dial.c?view=diff&rev=70355&r1=70354&r2=70355
==============================================================================
--- team/group/replace_macro_with_gosub_in_dial/apps/app_dial.c (original)
+++ team/group/replace_macro_with_gosub_in_dial/apps/app_dial.c Wed Jun 20 11:50:07 2007
@@ -194,9 +194,7 @@
 "           GOSUB_RESULT to specify the following actions after the Gosub returns.\n" 
 "           * ABORT        Hangup both legs of the call.\n"
 "           * CONGESTION   Behave as if line congestion was encountered.\n"
-"           * BUSY         Behave as if a busy signal was encountered. This will also\n"
-"                          have the application jump to priority n+101 if the\n"
-"                          'j' option is set.\n"
+"           * BUSY         Behave as if a busy signal was encountered.\n"
 "           * CONTINUE     Hangup the called party and allow the calling party\n"
 "                          to continue dialplan execution at the next priority.\n"
 "           * GOTO:<context>^<exten>^<priority> - Transfer the call to the\n"
@@ -1634,6 +1632,8 @@
 		if (ast_test_flag(&opts, OPT_CALLEE_GOSUB) && !ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GOSUB])) {
 			struct ast_app *theapp;
 			const char *gosub_result;
+			char *gosub_args, *gosub_argstart;
+			ast_log(LOG_ERROR, "In OPT_CALLEE_GOSUB code!\n");
 
 			res = ast_autoservice_start(chan);
 			if (res) {
@@ -1645,9 +1645,27 @@
 
 			if (theapp && !res) {	/* XXX why check res here ? */
 				replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GOSUB]);
-				res = pbx_exec(peer, theapp, opt_args[OPT_ARG_CALLEE_GOSUB]);
-				if (option_debug)
-					ast_log(LOG_DEBUG, "Gosub exited with status %d\n", res);
+				ast_log(LOG_ERROR, "Gosub stuff is: %s\n", opt_args[OPT_ARG_CALLEE_GOSUB]);
+				gosub_argstart = strchr(opt_args[OPT_ARG_CALLEE_GOSUB],'|');
+				if (gosub_argstart) {
+					*gosub_argstart = 0;
+					asprintf(&gosub_args, "%s|s|1(%s)", opt_args[OPT_ARG_CALLEE_GOSUB], gosub_argstart+1);
+					*gosub_argstart = '|';
+				} else {
+					asprintf(&gosub_args, "%s|s|1", opt_args[OPT_ARG_CALLEE_GOSUB]);
+				}
+				ast_log(LOG_ERROR, "Gosub_args is: %s\n", gosub_args);
+				if (gosub_args) {
+					
+					ast_log(LOG_ERROR, "About to pbx_exec!\n");
+					res = pbx_exec(peer, theapp, gosub_args);
+					ast_log(LOG_ERROR, "pbx_exec returns %d!\n", res);
+					free(gosub_args);
+					if (option_debug)
+						ast_log(LOG_DEBUG, "Gosub exited with status %d\n", res);
+				} else
+					ast_log(LOG_ERROR, "Could not Allocate string for Gosub arguments -- Gosub Call Aborted!\n");
+				
 				res = 0;
 			} else {
 				ast_log(LOG_ERROR, "Could not find application Gosub\n");




More information about the asterisk-commits mailing list