aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGES6
-rw-r--r--apps/app_queue.c91
-rw-r--r--configs/queues.conf.sample16
3 files changed, 92 insertions, 21 deletions
diff --git a/CHANGES b/CHANGES
index 10711760c..1c1fa07b7 100644
--- a/CHANGES
+++ b/CHANGES
@@ -417,6 +417,12 @@ Queue changes
* New configuration option: randomperiodicannounce. If a list of periodic announcements is
specified by the periodic-announce option, then one will be chosen randomly when it is time
to play a periodic announcment
+ * New configuration options: announce-position now takes two more values in addition to "yes" and
+ "no." Two new options, "limit" and "more," are allowed. These are tied to another option,
+ announce-position-limit. By setting announce-position to "limit" callers will only have their
+ position announced if their position is less than what is specified by announce-position-limit.
+ If announce-position is set to "more" then callers beyond the position specified by announce-position-limit
+ will be told that their are more than announce-position-limit callers waiting.
MeetMe Changes
--------------
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 1624529c6..ad87ad586 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -407,6 +407,11 @@ struct penalty_rule {
AST_LIST_ENTRY(penalty_rule) list; /*!< Next penalty_rule */
};
+#define ANNOUNCEPOSITION_YES 1 /*!< We announce position */
+#define ANNOUNCEPOSITION_NO 2 /*!< We don't announce position */
+#define ANNOUNCEPOSITION_MORE_THAN 3 /*!< We say "Currently there are more than <limit>" */
+#define ANNOUNCEPOSITION_LIMIT 4 /*!< We not announce position more than <limit> */
+
struct call_queue {
AST_DECLARE_STRING_FIELDS(
/*! Queue name */
@@ -429,6 +434,10 @@ struct call_queue {
AST_STRING_FIELD(sound_thereare);
/*! Sound file: "calls waiting to speak to a representative." (def. queue-callswaiting) */
AST_STRING_FIELD(sound_calls);
+ /*! Sound file: "Currently there are more than" (def. queue-quantity1) */
+ AST_STRING_FIELD(queue_quantity1);
+ /*! Sound file: "callers waiting to speak with a representative" (def. queue-quantity2) */
+ AST_STRING_FIELD(queue_quantity2);
/*! Sound file: "The current estimated total holdtime is" (def. queue-holdtime) */
AST_STRING_FIELD(sound_holdtime);
/*! Sound file: "minutes." (def. queue-minutes) */
@@ -458,11 +467,12 @@ struct call_queue {
unsigned int wrapped:1;
unsigned int timeoutrestart:1;
unsigned int announceholdtime:2;
- unsigned int announceposition:1;
+ unsigned int announceposition:3;
int strategy:4;
unsigned int maskmemberstatus:1;
unsigned int realtime:1;
unsigned int found:1;
+ int announcepositionlimit; /*!< How many positions we announce? */
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 */
@@ -926,8 +936,9 @@ static void init_queue(struct call_queue *q)
q->maxlen = 0;
q->announcefrequency = 0;
q->minannouncefrequency = DEFAULT_MIN_ANNOUNCE_FREQUENCY;
- q->announceholdtime = 0;
q->announceholdtime = 1;
+ q->announcepositionlimit = 10; /* Default 10 positions */
+ q->announceposition = ANNOUNCEPOSITION_YES; /* Default yes */
q->roundingseconds = 0; /* Default - don't announce seconds */
q->servicelevel = 0;
q->ringinuse = 1;
@@ -962,6 +973,8 @@ static void init_queue(struct call_queue *q)
ast_string_field_set(q, sound_next, "queue-youarenext");
ast_string_field_set(q, sound_thereare, "queue-thereare");
ast_string_field_set(q, sound_calls, "queue-callswaiting");
+ ast_string_field_set(q, queue_quantity1, "queue-quantity1");
+ ast_string_field_set(q, queue_quantity2, "queue-quantity2");
ast_string_field_set(q, sound_holdtime, "queue-holdtime");
ast_string_field_set(q, sound_minutes, "queue-minutes");
ast_string_field_set(q, sound_minute, "queue-minute");
@@ -1195,6 +1208,10 @@ static void queue_set_param(struct call_queue *q, const char *param, const char
ast_string_field_set(q, sound_thereare, val);
} else if (!strcasecmp(param, "queue-callswaiting")) {
ast_string_field_set(q, sound_calls, val);
+ } else if (!strcasecmp(param, "queue-quantity1")) {
+ ast_string_field_set(q, queue_quantity1, val);
+ } else if (!strcasecmp(param, "queue-quantity2")) {
+ ast_string_field_set(q, queue_quantity2, val);
} else if (!strcasecmp(param, "queue-holdtime")) {
ast_string_field_set(q, sound_holdtime, val);
} else if (!strcasecmp(param, "queue-minutes")) {
@@ -1237,7 +1254,16 @@ static void queue_set_param(struct call_queue *q, const char *param, const char
else
q->announceholdtime = 0;
} else if (!strcasecmp(param, "announce-position")) {
- q->announceposition = ast_true(val);
+ if (!strcasecmp(val, "limit"))
+ q->announceposition = ANNOUNCEPOSITION_LIMIT;
+ else if (!strcasecmp(val, "more"))
+ q->announceposition = ANNOUNCEPOSITION_MORE_THAN;
+ else if (ast_true(val))
+ q->announceposition = ANNOUNCEPOSITION_YES;
+ else
+ q->announceposition = ANNOUNCEPOSITION_NO;
+ } else if (!strcasecmp(param, "announce-position-limit")) {
+ q->announcepositionlimit = atoi(val);
} else if (!strcasecmp(param, "periodic-announce")) {
if (strchr(val, ',')) {
char *s, *buf = ast_strdupa(val);
@@ -1802,7 +1828,7 @@ static int valid_exit(struct queue_ent *qe, char digit)
static int say_position(struct queue_ent *qe, int ringing)
{
- int res = 0, avgholdmins, avgholdsecs;
+ int res = 0, avgholdmins, avgholdsecs, announceposition = 0;
time_t now;
/* Let minannouncefrequency seconds pass between the start of each position announcement */
@@ -1819,7 +1845,15 @@ static int say_position(struct queue_ent *qe, int ringing)
} else {
ast_moh_stop(qe->chan);
}
- if (qe->parent->announceposition) {
+
+ if (qe->parent->announceposition == ANNOUNCEPOSITION_YES ||
+ qe->parent->announceposition == ANNOUNCEPOSITION_MORE_THAN ||
+ (qe->parent->announceposition == ANNOUNCEPOSITION_LIMIT &&
+ qe->pos <= qe->parent->announcepositionlimit))
+ announceposition = 1;
+
+
+ if (announceposition == 1) {
/* Say we're next, if we are */
if (qe->pos == 1) {
res = play_file(qe->chan, qe->parent->sound_next);
@@ -1828,15 +1862,33 @@ static int say_position(struct queue_ent *qe, int ringing)
else
goto posout;
} else {
- res = play_file(qe->chan, qe->parent->sound_thereare);
- if (res)
- goto playout;
- res = ast_say_number(qe->chan, qe->pos, AST_DIGIT_ANY, qe->chan->language, NULL); /* Needs gender */
- if (res)
- goto playout;
- res = play_file(qe->chan, qe->parent->sound_calls);
- if (res)
- goto playout;
+ if (qe->parent->announceposition == ANNOUNCEPOSITION_MORE_THAN && qe->pos > qe->parent->announcepositionlimit){
+ /* More than Case*/
+ res = play_file(qe->chan, qe->parent->queue_quantity1);
+ if (res)
+ goto playout;
+ res = ast_say_number(qe->chan, qe->parent->announcepositionlimit, AST_DIGIT_ANY, qe->chan->language, NULL); /* Needs gender */
+ if (res)
+ goto playout;
+ } else {
+ /* Normal Case */
+ res = play_file(qe->chan, qe->parent->sound_thereare);
+ if (res)
+ goto playout;
+ res = ast_say_number(qe->chan, qe->pos, AST_DIGIT_ANY, qe->chan->language, NULL); /* Needs gender */
+ if (res)
+ goto playout;
+ }
+ if (qe->parent->announceposition == ANNOUNCEPOSITION_MORE_THAN && qe->pos > qe->parent->announcepositionlimit){
+ /* More than Case*/
+ res = play_file(qe->chan, qe->parent->queue_quantity2);
+ if (res)
+ goto playout;
+ } else {
+ res = play_file(qe->chan, qe->parent->sound_calls);
+ if (res)
+ goto playout;
+ }
}
}
/* Round hold time to nearest minute */
@@ -1888,12 +1940,13 @@ static int say_position(struct queue_ent *qe, int ringing)
}
posout:
- if (qe->parent->announceposition) {
- ast_verb(3, "Told %s in %s their queue position (which was %d)\n",
- qe->chan->name, qe->parent->name, qe->pos);
+ if (announceposition == 1){
+ if (qe->parent->announceposition) {
+ ast_verb(3, "Told %s in %s their queue position (which was %d)\n",
+ qe->chan->name, qe->parent->name, qe->pos);
+ }
+ res = play_file(qe->chan, qe->parent->sound_thanks);
}
- res = play_file(qe->chan, qe->parent->sound_thanks);
-
playout:
if ((res > 0 && !valid_exit(qe, res)) || res < 0)
res = 0;
diff --git a/configs/queues.conf.sample b/configs/queues.conf.sample
index 0b171f6ef..3d826ce7f 100644
--- a/configs/queues.conf.sample
+++ b/configs/queues.conf.sample
@@ -221,11 +221,23 @@ shared_lastcall=no
;announce-holdtime = yes|no|once
;
; Queue position announce?
-; Either yes or no. If turned off, only the holdtime will be announced (as
-; configured in announce-holdtime)
+; Valid values are "yes," "no," "limit," or "more." If set to "no," then the caller's position will
+; never be announced. If "yes," then the caller's position in the queue will be announced
+; to the caller. If set to "more," then if the number of callers is more than the number
+; specified by the announce-position-limit option, then the caller will hear that there
+; are more than that many callers waiting (i.e. if a caller number 6 is in a queue with the
+; announce-position-limit set to 5, then that caller will hear that there are more than 5
+; callers waiting). If set to "limit," then only callers within the limit specified by announce-position-limit
+; will have their position announced.
;
;announce-position = yes
;
+; If you have specified "limit" or "more" for the announce-position option, then the following
+; value is what is used to determine what announcement to play to waiting callers. If you have
+; set the announce-position option to anything else, then this will have no bearing on queue operation
+;
+;announce-position-limit = 5
+;
; What's the rounding time for the seconds?
; If this is non-zero, then we announce the seconds as well as the minutes
; rounded to this value.