Add 'c' option to app_queue which allows for continuing in the dialplan if the callee hangs up.

Issue 9284, patch by lyl, modified a little bit by me (I felt 'continue' was better than 'keepalive')


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@64243 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Jason Parker 2007-05-14 17:38:36 +00:00
parent f02ea9e076
commit 83c00e346e
1 changed files with 11 additions and 1 deletions

View File

@ -134,6 +134,7 @@ static char *descrip =
"This application will return to the dialplan if the queue does not exist, or\n"
"any of the join options cause the caller to not enter the queue.\n"
"The option string may contain zero or more of the following characters:\n"
" 'c' -- continue in the dialplan if the callee hangs up.\n"
" 'd' -- data-quality (modem) call (minimum delay).\n"
" 'h' -- allow callee to hang up by pressing *.\n"
" 'H' -- allow caller to hang up by pressing *.\n"
@ -158,7 +159,7 @@ static char *descrip =
"seconds, checked between each queues.conf 'timeout' and 'retry' cycle.\n"
" This application sets the following channel variable upon completion:\n"
" QUEUESTATUS The status of the call as a text string, one of\n"
" TIMEOUT | FULL | JOINEMPTY | LEAVEEMPTY | JOINUNAVAIL | LEAVEUNAVAIL\n";
" TIMEOUT | FULL | JOINEMPTY | LEAVEEMPTY | JOINUNAVAIL | LEAVEUNAVAIL | CONTINUE\n";
static char *app_aqm = "AddQueueMember" ;
static char *app_aqm_synopsis = "Dynamically adds queue members" ;
@ -264,6 +265,7 @@ enum queue_result {
QUEUE_JOINUNAVAIL = 4,
QUEUE_LEAVEUNAVAIL = 5,
QUEUE_FULL = 6,
QUEUE_CONTINUE = 7,
};
const struct {
@ -277,6 +279,7 @@ const struct {
{ QUEUE_JOINUNAVAIL, "JOINUNAVAIL" },
{ QUEUE_LEAVEUNAVAIL, "LEAVEUNAVAIL" },
{ QUEUE_FULL, "FULL" },
{ QUEUE_CONTINUE, "CONTINUE" },
};
/*! \brief We define a custom "local user" structure because we
@ -3409,6 +3412,7 @@ static int queue_exec(struct ast_channel *chan, void *data)
const char *user_priority;
const char *max_penalty_str;
int prio;
int qcontinue = 0;
int max_penalty;
enum queue_result reason = QUEUE_UNKNOWN;
/* whether to exit Queue application after the timeout hits */
@ -3482,6 +3486,9 @@ static int queue_exec(struct ast_channel *chan, void *data)
if (args.options && (strchr(args.options, 'r')))
ringing = 1;
if (args.options && (strchr(args.options, 'c')))
qcontinue = 1;
if (option_debug)
ast_log(LOG_DEBUG, "queue: %s, options: %s, url: %s, announce: %s, expires: %ld, priority: %d\n",
args.queuename, args.options, args.url, args.announceoverride, (long)qe.expire, prio);
@ -3576,6 +3583,9 @@ check_turns:
ast_queue_log(args.queuename, chan->uniqueid, "NONE", "ABANDON",
"%d|%d|%ld", qe.pos, qe.opos,
(long) time(NULL) - qe.start);
} else if (qcontinue) {
reason = QUEUE_CONTINUE;
res = 0;
}
} else if (valid_exit(&qe, res)) {
ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%s|%d|%d|%ld",