mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
Add 'G' option to dial (bug #3786)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5196 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -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,6 +639,7 @@ 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");
|
||||
@@ -801,6 +803,28 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
|
||||
}
|
||||
}
|
||||
|
||||
/* 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) {
|
||||
|
Reference in New Issue
Block a user