[svn-commits] tilghman: branch group/replace_macro_with_gosub_in_dial r70357 - /team/group/...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Jun 20 12:22:50 CDT 2007
Author: tilghman
Date: Wed Jun 20 12:22:50 2007
New Revision: 70357
URL: http://svn.digium.com/view/asterisk?view=rev&rev=70357
Log:
This should allow U(label) to work for Gosub
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=70357&r1=70356&r2=70357
==============================================================================
--- 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 12:22:50 2007
@@ -224,6 +224,10 @@
" The 'dialargs' are specified in the same format that arguments are provided\n"
"to the Dial application.\n";
+static char *kapp = "KeepAlive";
+static char *ksynopsis = "DO NOT USE";
+static char *kdescrip = "";
+
enum {
OPT_ANNOUNCE = (1 << 0),
OPT_RESETCDR = (1 << 1),
@@ -1645,20 +1649,26 @@
if (theapp && !res) { /* XXX why check res here ? */
replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GOSUB]);
+
+ /* Set where we came from */
+ ast_copy_string(peer->context, "app_dial_gosub_virtual_context", sizeof(peer->context));
+ ast_copy_string(peer->exten, "s", sizeof(peer->exten));
+ peer->priority = 0;
+
ast_log(LOG_ERROR, "Gosub stuff is: %s\n", opt_args[OPT_ARG_CALLEE_GOSUB]);
- gosub_argstart = strchr(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);
+ 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);
+ ast_log(LOG_DEBUG, "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_pbx_run(peer);
ast_log(LOG_ERROR, "pbx_exec returns %d!\n", res);
free(gosub_args);
if (option_debug)
@@ -1928,26 +1938,47 @@
return res;
}
+static int keepalive_exec(struct ast_channel *chan, void *data)
+{
+ return AST_PBX_KEEPALIVE;
+}
+
static int unload_module(void)
{
int res;
+ struct ast_context *con;
res = ast_unregister_application(app);
res |= ast_unregister_application(rapp);
+ res |= ast_unregister_application(kapp);
ast_module_user_hangup_all();
+
+ if ((con = ast_context_find("app_dial_gosub_virtual_context"))) {
+ ast_context_remove_extension2(con, "s", 1, NULL);
+ }
+
+ return res;
+}
+
+static int load_module(void)
+{
+ int res;
+ struct ast_context *con;
+
+ con = ast_context_find("app_dial_gosub_virtual_context");
+ if (!con)
+ con = ast_context_create(NULL, "app_dial_gosub_virtual_context", "app_dial");
+ if (!con)
+ ast_log(LOG_ERROR, "Dial virtual context 'app_dial_gosub_virtual_context' does not exist and unable to create\n");
+ else
+ ast_add_extension2(con, 1, "s", 1, NULL, NULL, "KeepAlive", ast_strdup(""), ast_free, "app_dial");
+
+ res = ast_register_application(app, dial_exec, synopsis, descrip);
+ res |= ast_register_application(rapp, retrydial_exec, rsynopsis, rdescrip);
+ res |= ast_register_application(kapp, keepalive_exec, ksynopsis, kdescrip);
return res;
}
-static int load_module(void)
-{
- int res;
-
- res = ast_register_application(app, dial_exec, synopsis, descrip);
- res |= ast_register_application(rapp, retrydial_exec, rsynopsis, rdescrip);
-
- return res;
-}
-
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Dialing Application");
More information about the svn-commits
mailing list