Change the queue holdtime announcement to happen at any interval (not just greater...
authorMark Michelson <mmichelson@digium.com>
Thu, 14 Feb 2008 20:46:00 +0000 (20:46 +0000)
committerMark Michelson <mmichelson@digium.com>
Thu, 14 Feb 2008 20:46:00 +0000 (20:46 +0000)
the saying of less-than for holdtime announcements since it can lead to awkward holdtime announcements. Using
'1' as a queue-round-seconds value is no longer valid.

(closes issue #9736)
Reported by: caio1982
Patches:
      queue_announce5.diff uploaded by caio1982 (license 22)
  Tested by: caio1982, putnopvut

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103687 65c4cc65-6c06-0410-ace0-fbb531ad65f3

UPGRADE.txt
apps/app_queue.c
configs/queues.conf.sample

index 0c7508e..d1832d5 100644 (file)
@@ -160,6 +160,9 @@ Configuration:
   lowcost and other is not acceptable now. Look into qos.tex for description of 
   this parameter.
 
+* queues.conf: the queue-lessthan sound file option is no longer available, and the
+  queue-round-seconds option no longer takes '1' as a valid parameter.
+
 Manager:
 
 * Manager has been upgraded to version 1.1 with a lot of changes. 
index bf0f13b..761d0cf 100644 (file)
@@ -431,8 +431,8 @@ struct call_queue {
                AST_STRING_FIELD(sound_holdtime);
                /*! Sound file: "minutes." (def. queue-minutes) */
                AST_STRING_FIELD(sound_minutes);
-               /*! Sound file: "less-than" (def. queue-lessthan) */
-               AST_STRING_FIELD(sound_lessthan);
+               /*! Sound file: "minute." (def. queue-minute) */
+               AST_STRING_FIELD(sound_minute);
                /*! Sound file: "seconds." (def. queue-seconds) */
                AST_STRING_FIELD(sound_seconds);
                /*! Sound file: "Thank you for your patience." (def. queue-thankyou) */
@@ -939,9 +939,9 @@ static void init_queue(struct call_queue *q)
        ast_string_field_set(q, sound_calls, "queue-callswaiting");
        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");
        ast_string_field_set(q, sound_seconds, "queue-seconds");
        ast_string_field_set(q, sound_thanks, "queue-thankyou");
-       ast_string_field_set(q, sound_lessthan, "queue-less-than");
        ast_string_field_set(q, sound_reporthold, "queue-reporthold");
 
        if ((q->sound_periodicannounce[0] = ast_str_create(32)))
@@ -1165,10 +1165,10 @@ static void queue_set_param(struct call_queue *q, const char *param, const char
                ast_string_field_set(q, sound_holdtime, val);
        } else if (!strcasecmp(param, "queue-minutes")) {
                ast_string_field_set(q, sound_minutes, val);
+       } else if (!strcasecmp(param, "queue-minute")) {
+               ast_string_field_set(q, sound_minute, val);
        } else if (!strcasecmp(param, "queue-seconds")) {
                ast_string_field_set(q, sound_seconds, val);
-       } else if (!strcasecmp(param, "queue-lessthan")) {
-               ast_string_field_set(q, sound_lessthan, val);
        } else if (!strcasecmp(param, "queue-thankyou")) {
                ast_string_field_set(q, sound_thanks, val);
        } else if (!strcasecmp(param, "queue-callerannounce")) {
@@ -1183,7 +1183,7 @@ static void queue_set_param(struct call_queue *q, const char *param, const char
        } else if (!strcasecmp(param, "announce-round-seconds")) {
                q->roundingseconds = atoi(val);
                /* Rounding to any other values just doesn't make sense... */
-               if (!(q->roundingseconds == 0 || q->roundingseconds == 1 || q->roundingseconds == 5 || q->roundingseconds == 10
+               if (!(q->roundingseconds == 0 || q->roundingseconds == 5 || q->roundingseconds == 10
                        || q->roundingseconds == 15 || q->roundingseconds == 20 || q->roundingseconds == 30)) {
                        if (linenum >= 0) {
                                ast_log(LOG_WARNING, "'%s' isn't a valid value for %s "
@@ -1791,7 +1791,7 @@ static int say_position(struct queue_ent *qe, int ringing)
                avgholdsecs = 0;
        }
 
-       ast_verb(3, "Hold time for %s is %d minutes %d seconds\n", qe->parent->name, avgholdmins, avgholdsecs);
+       ast_verb(3, "Hold time for %s is %d minute(s) %d seconds\n", qe->parent->name, avgholdmins, avgholdsecs);
 
        /* If the hold time is >1 min, if it's enabled, and if it's not
           supposed to be only once and we have already said it, say it */
@@ -1801,27 +1801,23 @@ static int say_position(struct queue_ent *qe, int ringing)
                if (res)
                        goto playout;
 
-               if (avgholdmins > 0) {
-                       if (avgholdmins < 2) {
-                               res = play_file(qe->chan, qe->parent->sound_lessthan);
-                               if (res)
-                                       goto playout;
+               if (avgholdmins > 1) {
+                       res = ast_say_number(qe->chan, avgholdmins, AST_DIGIT_ANY, qe->chan->language, NULL);
+                       if (res)
+                               goto playout;
 
-                               res = ast_say_number(qe->chan, 2, AST_DIGIT_ANY, qe->chan->language, NULL);
+                       if (avgholdmins == 1) {
+                               res = play_file(qe->chan, qe->parent->sound_minute);
                                if (res)
                                        goto playout;
                        } else {
-                               res = ast_say_number(qe->chan, avgholdmins, AST_DIGIT_ANY, qe->chan->language, NULL);
+                               res = play_file(qe->chan, qe->parent->sound_minutes);
                                if (res)
                                        goto playout;
                        }
-                       
-                       res = play_file(qe->chan, qe->parent->sound_minutes);
-                       if (res)
-                               goto playout;
                }
-               if (avgholdsecs>0) {
-                       res = ast_say_number(qe->chan, avgholdsecs, AST_DIGIT_ANY, qe->chan->language, NULL);
+               if (avgholdsecs > 1) {
+                       res = ast_say_number(qe->chan, avgholdmins > 1 ? avgholdsecs : avgholdmins * 60 + avgholdsecs, AST_DIGIT_ANY, qe->chan->language, NULL);
                        if (res)
                                goto playout;
 
@@ -3262,16 +3258,22 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
                                }
                                if (!res2 && qe->parent->reportholdtime) {
                                        if (!play_file(peer, qe->parent->sound_reporthold)) {
-                                               int holdtime;
+                                               int holdtime, holdtimesecs;
 
                                                time(&now);
                                                holdtime = abs((now - qe->start) / 60);
-                                               if (holdtime < 2) {
-                                                       play_file(peer, qe->parent->sound_lessthan);
-                                                       ast_say_number(peer, 2, AST_DIGIT_ANY, peer->language, NULL);
-                                               } else
+                                               holdtimesecs = abs((now - qe->start));
+                                               if (holdtime == 1) {
+                                                       ast_say_number(peer, holdtime, AST_DIGIT_ANY, peer->language, NULL);
+                                                       play_file(peer, qe->parent->sound_minute);
+                                               } else {
                                                        ast_say_number(peer, holdtime, AST_DIGIT_ANY, peer->language, NULL);
-                                               play_file(peer, qe->parent->sound_minutes);
+                                                       play_file(peer, qe->parent->sound_minutes);
+                                               }
+                                               if (holdtimesecs > 1) {
+                                                       ast_say_number(peer, holdtimesecs, AST_DIGIT_ANY, peer->language, NULL);
+                                                       play_file(peer, qe->parent->sound_seconds);
+                                               }
                                        }
                                }
                        }
@@ -4275,7 +4277,7 @@ static void copy_rules(struct queue_ent *qe, const char *rulename)
  * 4. Attempt to call a queue member
  * 5. If 4. did not result in a bridged call, then check for between
  *    call options such as periodic announcements etc.
- * 6. Try 4 again uless some condition (such as an expiration time) causes us to 
+ * 6. Try 4 again unless some condition (such as an expiration time) causes us to 
  *    exit the queue.
  */
 static int queue_exec(struct ast_channel *chan, void *data)
index fb4e9bd..bef075b 100644 (file)
@@ -212,8 +212,7 @@ shared_lastcall=no
 ;
 ; Should we include estimated hold time in position announcements?
 ; Either yes, no, or only once.
-; Hold time will be announced as the estimated time, 
-; or "less than 2 minutes" when appropriate.
+; Hold time will be announced as the estimated time.
 ;
 ;announce-holdtime = yes|no|once
 ;
@@ -226,7 +225,7 @@ shared_lastcall=no
 ; 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.
-; Valid values are 0, 1, 5, 10, 15, 20, and 30.
+; Valid values are 0, 5, 10, 15, 20, and 30.
 ;
 ; announce-round-seconds = 10
 ;
@@ -247,8 +246,6 @@ shared_lastcall=no
 ;queue-seconds = queue-seconds
                        ;       ("Thank you for your patience.")
 ;queue-thankyou = queue-thankyou
-                       ;       ("less than")
-;queue-lessthan = queue-less-than
                        ;       ("Hold time")
 ;queue-reporthold = queue-reporthold
                        ;       ("All reps busy / wait for next")