[asterisk-commits] mmichelson: trunk r114906 - in /trunk: ./ apps/ configs/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 30 14:30:42 CDT 2008


Author: mmichelson
Date: Wed Apr 30 14:30:41 2008
New Revision: 114906

URL: http://svn.digium.com/view/asterisk?view=rev&rev=114906
Log:
Adding new configuration options to app_queue. This adds two new values
to announce-position, "limit" and "more," as well as a new option, 
announce-position-limit. For more information on the use of these options,
see CHANGES or configs/queues.conf.sample.

(closes issue #10991)
Reported by: slavon
Patches:
      app_q.diff uploaded by slavon (license 288)
Tested by: slavon, putnopvut


Modified:
    trunk/CHANGES
    trunk/apps/app_queue.c
    trunk/configs/queues.conf.sample

Modified: trunk/CHANGES
URL: http://svn.digium.com/view/asterisk/trunk/CHANGES?view=diff&rev=114906&r1=114905&r2=114906
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Wed Apr 30 14:30:41 2008
@@ -417,6 +417,12 @@
   * 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
 --------------

Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?view=diff&rev=114906&r1=114905&r2=114906
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Wed Apr 30 14:30:41 2008
@@ -407,6 +407,11 @@
 	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 @@
 		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 @@
 	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 @@
 	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 @@
 	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 @@
 		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 @@
 		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 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 @@
 	} 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 @@
 			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 @@
 	}
 
 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);
-	}
-	res = play_file(qe->chan, qe->parent->sound_thanks);
-
+	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);
+	}
 playout:
 	if ((res > 0 && !valid_exit(qe, res)) || res < 0)
 		res = 0;

Modified: trunk/configs/queues.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/queues.conf.sample?view=diff&rev=114906&r1=114905&r2=114906
==============================================================================
--- trunk/configs/queues.conf.sample (original)
+++ trunk/configs/queues.conf.sample Wed Apr 30 14:30:41 2008
@@ -221,10 +221,22 @@
 ;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




More information about the asterisk-commits mailing list