You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
asterisk/patches/app_queue-R-option.patch

58 lines
2.9 KiB

--- apps/app_queue.c 2010-08-11 10:03:58.000000000 +0200
+++ apps/app_queue.c 2010-08-11 10:10:40.000000000 +0200
@@ -181,6 +181,7 @@
" 'W' -- allow the calling user to write the conversation to disk via Monitor\n"
" by pressing the automon sequence defined in the featuremap section in\n"
" features.conf\n"
+" 'R' -- Ring instead of playing MOH when a member channel is actually ringing.\n"
" In addition to transferring the call, a call may be parked and then picked\n"
"up by another user, by transferring to the parking lot extension. See features.conf.\n"
" The optional URL will be sent to the called party if the channel supports\n"
@@ -347,6 +348,7 @@
char announce[80]; /*!< Announcement to play for member when call is answered */
char context[AST_MAX_CONTEXT]; /*!< Context when user exits queue */
char digits[AST_MAX_EXTENSION]; /*!< Digits entered while in queue */
+ int ring_when_ringing; /*!< Should we only use ring indication when a channel is ringing? */
int valid_digits; /*!< Digits entered correspond to valid extension. Exited */
int pos; /*!< Where we are in the queue */
int prio; /*!< Our priority */
@@ -2243,6 +2245,12 @@
{
if (option_verbose > 2)
ast_verbose( VERBOSE_PREFIX_3 "Nobody picked up in %d ms\n", rnatime);
+ /* Stop ringing, and resume MOH if specified */
+ if (qe->ring_when_ringing) {
+ ast_indicate(qe->chan, -1);
+ ast_moh_start(qe->chan, qe->moh, NULL);
+ }
+
ast_queue_log(qe->parent->name, qe->chan->uniqueid, membername, "RINGNOANSWER", "%d", rnatime);
if (qe->parent->autopause && pause) {
if (!set_member_paused(qe->parent->name, interface, 1)) {
@@ -2448,6 +2456,12 @@
case AST_CONTROL_RINGING:
if (option_verbose > 2)
ast_verbose( VERBOSE_PREFIX_3 "%s is ringing\n", o->chan->name);
+ /* Start ring indication when the channel is ringing, if specified */
+ if (qe->ring_when_ringing) {
+ ast_moh_stop(qe->chan);
+ ast_indicate(qe->chan, AST_CONTROL_RINGING);
+ }
+
break;
case AST_CONTROL_OFFHOOK:
/* Ignore going off hook */
@@ -4154,6 +4168,12 @@
if (args.options && (strchr(args.options, 'r')))
ringing = 1;
+ if (ringing != 1 && args.options && (strchr(args.options, 'R'))) {
+ qe.ring_when_ringing = 1;
+ } else {
+ qe.ring_when_ringing = 0;
+ }
+
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);