mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
Add absolute timeout option to dial that applies when call is up (bug #1107)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2357 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -67,6 +67,7 @@ static char *descrip =
|
|||||||
" 'P[(x)]' -- privacy mode, using 'x' as database if provided.\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' -- goes on in context if the destination channel hangs up\n"
|
||||||
" 'A(x)' -- play an announcement to the called party, using x as file\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"
|
||||||
" In addition to transferring the call, a call may be parked and then picked\n"
|
" In addition to transferring the call, a call may be parked and then picked\n"
|
||||||
"up by another user.\n"
|
"up by another user.\n"
|
||||||
" The optional URL will be sent to the called party if the channel supports\n"
|
" The optional URL will be sent to the called party if the channel supports\n"
|
||||||
@@ -377,9 +378,12 @@ static int dial_exec(struct ast_channel *chan, void *data)
|
|||||||
struct varshead *headp, *newheadp;
|
struct varshead *headp, *newheadp;
|
||||||
struct ast_var_t *newvar;
|
struct ast_var_t *newvar;
|
||||||
int go_on=0;
|
int go_on=0;
|
||||||
|
unsigned int calldurationlimit=0;
|
||||||
|
char *cdl;
|
||||||
|
time_t now;
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
ast_log(LOG_WARNING, "Dial requires an argument (technology1/number1&technology2/number2...|optional timeout)\n");
|
ast_log(LOG_WARNING, "Dial requires an argument (technology1/number1&technology2/number2...|optional timeout|options)\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,6 +392,7 @@ static int dial_exec(struct ast_channel *chan, void *data)
|
|||||||
strncpy(info, (char *)data, sizeof(info) - 1);
|
strncpy(info, (char *)data, sizeof(info) - 1);
|
||||||
peers = info;
|
peers = info;
|
||||||
if (peers) {
|
if (peers) {
|
||||||
|
|
||||||
timeout = strchr(info, '|');
|
timeout = strchr(info, '|');
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
*timeout = '\0';
|
*timeout = '\0';
|
||||||
@@ -416,6 +421,13 @@ static int dial_exec(struct ast_channel *chan, void *data)
|
|||||||
|
|
||||||
|
|
||||||
if (transfer) {
|
if (transfer) {
|
||||||
|
/* Extract call duration limit */
|
||||||
|
if ((cdl = strstr(transfer, "S("))) {
|
||||||
|
calldurationlimit=atoi(cdl+2);
|
||||||
|
if (option_verbose > 2)
|
||||||
|
ast_verbose(VERBOSE_PREFIX_3 "Setting call duration limit to %i seconds.\n",calldurationlimit);
|
||||||
|
}
|
||||||
|
|
||||||
/* XXX ANNOUNCE SUPPORT */
|
/* XXX ANNOUNCE SUPPORT */
|
||||||
if ((ann = strstr(transfer, "A("))) {
|
if ((ann = strstr(transfer, "A("))) {
|
||||||
announce = 1;
|
announce = 1;
|
||||||
@@ -700,6 +712,10 @@ static int dial_exec(struct ast_channel *chan, void *data)
|
|||||||
// Ok, done. stop autoservice
|
// Ok, done. stop autoservice
|
||||||
res2 = ast_autoservice_stop(chan);
|
res2 = ast_autoservice_stop(chan);
|
||||||
}
|
}
|
||||||
|
if (calldurationlimit > 0) {
|
||||||
|
time(&now);
|
||||||
|
chan->whentohangup = now + calldurationlimit;
|
||||||
|
}
|
||||||
res = ast_bridge_call(chan, peer, allowredir_in, allowredir_out, allowdisconnect);
|
res = ast_bridge_call(chan, peer, allowredir_in, allowredir_out, allowdisconnect);
|
||||||
|
|
||||||
if (res != AST_PBX_NO_HANGUP_PEER)
|
if (res != AST_PBX_NO_HANGUP_PEER)
|
||||||
|
Reference in New Issue
Block a user