diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-03-17 22:39:04 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-03-17 22:39:04 +0000 |
commit | ce4548667a38ea22f537c3dae9c368cabf6b8ef6 (patch) | |
tree | 0b4e00835781db41b167b840f81ee3ea1af514e1 | |
parent | e22fd68e660e95bcd368822a71af3dceb466e242 (diff) |
Add 'G' option to dial (bug #3786)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5196 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-x | apps/app_dial.c | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c index ed2979eed..9ee512ca5 100755 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -89,6 +89,7 @@ static char *descrip = " 'C' -- reset call detail record for this call.\n" " 'P[(x)]' -- privacy mode, using 'x' as database if provided.\n" " 'g' -- goes on in context if the destination channel hangs up\n" +" 'G(context^exten^pri)' -- If the call is answered transfer both parties to the specified exten.\n" " 'A(x)' -- play an announcement to the called party, using x as file\n" " 'S(x)' -- hangup the call after x seconds AFTER called party picked up\n" " 'D([digits])' -- Send DTMF digit string *after* called party has answered\n" @@ -638,7 +639,8 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags int digit = 0, result = 0; time_t start_time, answer_time, end_time; struct ast_app *app = NULL; - + char *dblgoto = NULL; + if (!data) { ast_log(LOG_WARNING, "Dial requires an argument (technology1/number1&technology2/number2...|optional timeout|options)\n"); return -1; @@ -800,7 +802,29 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags announce = 0; } } - + + /* Get the goto from the dial option string */ + if ((mac = strstr(transfer, "G("))) { + + + dblgoto = ast_strdupa(mac + 2); + while (*mac && (*mac != ')')) + *(mac++) = 'X'; + if (*mac) + *mac = 'X'; + else { + ast_log(LOG_WARNING, "Could not find exten to which we should jump.\n"); + dblgoto = NULL; + } + mac = strchr(dblgoto, ')'); + if (mac) + *mac = '\0'; + else { + ast_log(LOG_WARNING, "Goto flag set without trailing ')'\n"); + dblgoto = NULL; + } + } + /* Get the macroname from the dial option string */ if ((mac = strstr(transfer, "M("))) { hasmacro = 1; @@ -1143,6 +1167,21 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags } else res = 0; + if (chan && peer && dblgoto) { + for (mac=dblgoto; *mac; mac++) { + if(*mac == '^') { + *mac = '|'; + } + } + ast_parseable_goto(chan, dblgoto); + ast_parseable_goto(peer, dblgoto); + peer->priority++; + ast_pbx_start(peer); + hanguptree(outgoing, NULL); + LOCAL_USER_REMOVE(u); + return 0; + } + if (hasmacro && macroname) { res = ast_autoservice_start(chan); if (res) { |