aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-07-31 16:05:12 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-07-31 16:05:12 +0000
commit5a3889ab94ce3f69c98806a80062619814fa943a (patch)
tree6286b48ff6fcbf3e247c4574bf45faf5a6842fe8 /apps
parent5a6e9221ba4879b296a21e879d8f48e9d404b14e (diff)
Merged revisions 134758 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r134758 | mmichelson | 2008-07-31 10:56:18 -0500 (Thu, 31 Jul 2008) | 16 lines Add more timeout checks into app_queue, specifically targeting areas where an unknown and potentially long time has just elapsed. Also added a check to try_calling() to return early if the timeout has elapsed instead of potentially setting a negative timeout for the call (thus making it have *no* timeout at all). (closes issue #13186) Reported by: miquel_cabrespina Patches: 13186.diff uploaded by putnopvut (license 60) Tested by: miquel_cabrespina ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@134759 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_queue.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 182f48503..eb7cf0f78 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -2887,6 +2887,12 @@ static int wait_our_turn(struct queue_ent *qe, int ringing, enum queue_result *r
(res = say_position(qe,ringing)))
break;
+ /* If we have timed out, break out */
+ if (qe->expire && (time(NULL) > qe->expire)) {
+ *reason = QUEUE_TIMEOUT;
+ break;
+ }
+
/* Make a periodic announcement, if enabled */
if (qe->parent->periodicannouncefrequency &&
(res = say_periodic_announcement(qe,ringing)))
@@ -2897,6 +2903,12 @@ static int wait_our_turn(struct queue_ent *qe, int ringing, enum queue_result *r
update_qe_rule(qe);
}
+ /* If we have timed out, break out */
+ if (qe->expire && (time(NULL) > qe->expire)) {
+ *reason = QUEUE_TIMEOUT;
+ break;
+ }
+
/* Wait a second before checking again */
if ((res = ast_waitfordigit(qe->chan, RECHECK * 1000))) {
if (res > 0 && !valid_exit(qe, res))
@@ -2904,6 +2916,12 @@ static int wait_our_turn(struct queue_ent *qe, int ringing, enum queue_result *r
else
break;
}
+
+ /* If we have timed out, break out */
+ if (qe->expire && (time(NULL) > qe->expire)) {
+ *reason = QUEUE_TIMEOUT;
+ break;
+ }
}
return res;
@@ -3220,6 +3238,15 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
tmpid[0] = 0;
meid[0] = 0;
time(&now);
+
+ /* If we've already exceeded our timeout, then just stop
+ * This should be extremely rare. queue_exec will take care
+ * of removing the caller and reporting the timeout as the reason.
+ */
+ if (qe->expire && now > qe->expire) {
+ res = 0;
+ goto out;
+ }
for (; options && *options; options++)
switch (*options) {
@@ -4699,6 +4726,15 @@ check_turns:
if (qe.parent->periodicannouncefrequency)
if ((res = say_periodic_announcement(&qe,ringing)))
goto stop;
+
+ /* Leave if we have exceeded our queuetimeout */
+ if (qe.expire && (time(NULL) > qe.expire)) {
+ record_abandoned(&qe);
+ reason = QUEUE_TIMEOUT;
+ res = 0;
+ ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHTIMEOUT", "%d", qe.pos);
+ break;
+ }
/* see if we need to move to the next penalty level for this queue */
while (qe.pr && ((time(NULL) - qe.start) > qe.pr->time)) {
@@ -4758,7 +4794,6 @@ check_turns:
/* If using dynamic realtime members, we should regenerate the member list for this queue */
update_realtime_members(qe.parent);
-
/* OK, we didn't get anybody; wait for 'retry' seconds; may get a digit to exit with */
res = wait_a_bit(&qe);
if (res)