Index: apps/app_queue.c =================================================================== --- apps/app_queue.c (revision 84776) +++ apps/app_queue.c (working copy) @@ -317,6 +317,7 @@ int max_penalty; /*!< Limit the members that can take this call to this penalty or lower */ time_t start; /*!< When we started holding */ time_t expire; /*!< When this entry should expire (time out of queue) */ + time_t expireringing; /*!< When the ringing should expire (if 'r' option is set) */ struct ast_channel *chan; /*!< Our channel */ struct queue_ent *next; /*!< The next queue entry */ }; @@ -375,6 +376,7 @@ int announcefrequency; /*!< How often to announce their position */ int minannouncefrequency; /*!< The minimum number of seconds between position announcements (def. 15) */ int periodicannouncefrequency; /*!< How often to play periodic announcement */ + int ringexpiry; /*!< How many seconds should we wait till the ring expires (if 'r' option is set) */ int roundingseconds; /*!< How many seconds do we round to? */ int holdtime; /*!< Current avg holdtime, based on recursive boxcar filter */ int callscompleted; /*!< Number of queue calls completed */ @@ -814,6 +816,7 @@ q->context[0] = '\0'; q->monfmt[0] = '\0'; q->periodicannouncefrequency = 0; + q->ringexpiry = 0; q->sound_callerannounce[0] = '\0'; /* Default, don't announce the caller that he has been answered */ if(!q->members) q->members = ao2_container_alloc(37, member_hash_fn, member_cmp_fn); @@ -1025,6 +1028,8 @@ } } else if (!strcasecmp(param, "periodic-announce-frequency")) { q->periodicannouncefrequency = atoi(val); + } else if (!strcasecmp(param, "ringexpiry")) { + q->ringexpiry = atoi(val); } else if (!strcasecmp(param, "retry")) { q->retry = atoi(val); if (q->retry <= 0) @@ -2427,6 +2432,10 @@ break; } + /* The channel ringing has expired, start moh */ + if (ringing && (qe->expireringing && (time(NULL) > qe->expireringing))) + break; + stat = get_member_status(qe->parent, qe->max_penalty); /* leave the queue if no agents, if enabled */ @@ -3703,6 +3712,8 @@ if (args.options && (strchr(args.options, 'r'))) ringing = 1; + else + qe.expireringing = 0; if (args.options && (strchr(args.options, 'c'))) qcontinue = 1; @@ -3721,6 +3732,10 @@ if (!join_queue(args.queuename, &qe, &reason)) { ast_queue_log(args.queuename, chan->uniqueid, "NONE", "ENTERQUEUE", "%s|%s", S_OR(args.url, ""), S_OR(chan->cid.cid_num, "")); + + if (ringing && qe.parent->ringexpiry) + qe.expireringing = qe.start + qe.parent->ringexpiry; + check_turns: if (ringing) { ast_indicate(chan, AST_CONTROL_RINGING); @@ -3754,6 +3769,14 @@ break; } + /* The channel ringing has expired, start moh */ + if (ringing && (qe.expireringing && (time(NULL) > qe.expireringing))) { + /* Start the music on hold (done after falling through) */ + ringing = 0; + qe.expireringing = 0; + ast_indicate(chan, -1); + } + if (makeannouncement) { /* Make a position announcement, if enabled */ if (qe.parent->announcefrequency) Index: configs/queues.conf.sample =================================================================== --- configs/queues.conf.sample (revision 84776) +++ configs/queues.conf.sample (working copy) @@ -329,6 +329,13 @@ ; ; ringinuse = no ; +; When the 'r' option is passed to the Queue() you can expire the ringing +; then start music on hold. If you use this with periodic-announce-frequency +; and set it to the same value, when the ring expires it will play the +; periodic announce then start the music on hold. +; +; ringexpiry = 10 +; ; If you wish to have a delay before the member is connected to the caller (or ; before the member hears any announcement messages), set this to the number of ; seconds to delay.