Index: apps/app_queue.c
===================================================================
--- apps/app_queue.c (revision 232810)
+++ apps/app_queue.c (working copy)
@@ -153,6 +153,9 @@
+
@@ -807,6 +810,8 @@
int pos; /*!< Where we are in the queue */
int prio; /*!< Our priority */
int last_pos_said; /*!< Last position we told the user */
+ int ringing; /*!< Are we ringing or using MOH? */
+ int ring_when_ringing; /*!< Should we only use ring indication when a channel is ringing? */
time_t last_periodic_announce_time; /*!< The last time we played a periodic announcement */
int last_periodic_announce_sound; /*!< The last periodic announcement we made */
time_t last_pos; /*!< Last time we told the user their position */
@@ -3086,6 +3091,13 @@
static void rna(int rnatime, struct queue_ent *qe, char *interface, char *membername, int pause)
{
ast_verb(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);
+ }
+
if (qe->parent->eventwhencalled) {
char vars[2048];
@@ -3386,6 +3398,12 @@
break;
case AST_CONTROL_RINGING:
ast_verb(3, "%s is ringing\n", ochan_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 */
@@ -5508,9 +5526,19 @@
}
ast_channel_unlock(chan);
- if (args.options && (strchr(args.options, 'r')))
+ if (args.options && (strchr(args.options, 'r'))) {
ringing = 1;
+ qe.ringing = 1;
+ } else {
+ qe.ringing = 0;
+ }
+ if (ringing != 1 && args.options && (strchr(args.options, 'R'))) {
+ qe.ring_when_ringing = 1;
+ } else {
+ qe.ring_when_ringing = 0;
+ }
+
if (args.options && (strchr(args.options, 'c')))
qcontinue = 1;