From de1b42b6bf18f9cfcd918080c0825b96b18ede7a Mon Sep 17 00:00:00 2001 From: Mark Spencer Date: Sun, 3 Oct 2004 16:46:06 +0000 Subject: [PATCH] Add reporting of actual hold time (bug #2564) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3900 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_queue.c | 33 ++++++++++++++++++++++++++------- configs/queues.conf.sample | 7 +++++++ sounds.txt | 2 ++ sounds/queue-reporthold.gsm | Bin 0 -> 1188 bytes 4 files changed, 35 insertions(+), 7 deletions(-) create mode 100755 sounds/queue-reporthold.gsm diff --git a/apps/app_queue.c b/apps/app_queue.c index daea410be8..35c9bc0e74 100755 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -211,6 +211,7 @@ struct ast_call_queue { char sound_lessthan[80]; /* Sound file: "less-than" (def. queue-lessthan) */ char sound_seconds[80]; /* Sound file: "seconds." (def. queue-seconds) */ char sound_thanks[80]; /* Sound file: "Thank you for your patience." (def. queue-thankyou) */ + char sound_reporthold[80]; /* Sound file: "Hold time" (def. queue-reporthold) */ int count; /* How many entries are in the queue */ int maxlen; /* Max number of entries in queue */ @@ -227,6 +228,7 @@ struct ast_call_queue { int joinempty; /* Do we care if the queue has no members? */ int eventwhencalled; /* Generate an event when the agent is called (before pickup) */ int leavewhenempty; /* If all agents leave the queue, remove callers from the queue */ + int reportholdtime; /* Should we report caller hold time to member? */ struct member *members; /* Member channels to be tried */ struct queue_ent *head; /* Start of the actual queue */ @@ -1160,16 +1162,28 @@ static int try_calling(struct queue_ent *qe, char *options, char *announceoverri member = lpeer->member; hanguptree(outgoing, peer); outgoing = NULL; - if (announce) { + if (announce || qe->parent->reportholdtime) { int res2; res2 = ast_autoservice_start(qe->chan); if (!res2) { - res2 = ast_streamfile(peer, announce, peer->language); - if (!res2) - res2 = ast_waitstream(peer, ""); - else { - ast_log(LOG_WARNING, "Announcement file '%s' is unavailable, continuing anyway...\n", announce); - res2 = 0; + if (announce) { + if (play_file(peer, announce)) + ast_log(LOG_WARNING, "Announcement file '%s' is unavailable, continuing anyway...\n", announce); + } + if (qe->parent->reportholdtime) { + if (!play_file(peer, qe->parent->sound_reporthold)) { + int holdtime; + time_t now; + + 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 + ast_say_number(peer, holdtime, AST_DIGIT_ANY, peer->language, NULL); + play_file(peer, qe->parent->sound_minutes); + } } } res2 |= ast_autoservice_stop(qe->chan); @@ -1803,6 +1817,7 @@ static void reload_queues(void) strncpy(q->sound_seconds, "queue-seconds", sizeof(q->sound_seconds) - 1); strncpy(q->sound_thanks, "queue-thankyou", sizeof(q->sound_thanks) - 1); strncpy(q->sound_lessthan, "queue-less-than", sizeof(q->sound_lessthan) - 1); + strncpy(q->sound_reporthold, "queue-reporthold", sizeof(q->sound_reporthold) - 1); prev = q->members; if (prev) { /* find the end of any dynamic members */ @@ -1867,6 +1882,8 @@ static void reload_queues(void) strncpy(q->sound_lessthan, var->value, sizeof(q->sound_lessthan) - 1); } else if (!strcasecmp(var->name, "queue-thankyou")) { strncpy(q->sound_thanks, var->value, sizeof(q->sound_thanks) - 1); + } else if (!strcasecmp(var->name, "queue-reporthold")) { + strncpy(q->sound_reporthold, var->value, sizeof(q->sound_reporthold) - 1); } else if (!strcasecmp(var->name, "announce-frequency")) { q->announcefrequency = atoi(var->value); } else if (!strcasecmp(var->name, "announce-round-seconds")) { @@ -1897,6 +1914,8 @@ static void reload_queues(void) q->leavewhenempty = ast_true(var->value); } else if (!strcasecmp(var->name, "eventwhencalled")) { q->eventwhencalled = ast_true(var->value); + } else if (!strcasecmp(var->name, "reportholdtime")) { + q->reportholdtime = ast_true(var->value); } else { ast_log(LOG_WARNING, "Unknown keyword in queue '%s': %s at line %d of queue.conf\n", cat, var->name, var->lineno); } diff --git a/configs/queues.conf.sample b/configs/queues.conf.sample index e6e5445313..d22e385b58 100755 --- a/configs/queues.conf.sample +++ b/configs/queues.conf.sample @@ -93,6 +93,7 @@ ;queue-seconds = queue-seconds ; ("seconds.") ;queue-thankyou = queue-thankyou ; ("Thank you for your patience.") ;queue-lessthan = queue-less-than ; ("less than") +;queue-reporthold = queue-reporthold ; ("Hold time") ; ; Calls may be recorded using Asterisk's monitor resource ; This can be enabled from within the Queue application, starting recording @@ -123,6 +124,12 @@ ; ; eventwhencalled = yes ; +; If you wish to report the caller's hold time to the member before they are connected +; to the caller, set this to yes. +; +; reportholdtime = no +; +; ; Each member of this call queue is listed on a separate line in ; the form technology/dialstring. "member" means a normal member of a ; queue. An optional penalty may be specified after a comma, such that diff --git a/sounds.txt b/sounds.txt index 5797920267..e90a7d1323 100755 --- a/sounds.txt +++ b/sounds.txt @@ -82,6 +82,8 @@ %queue-holdtime.gsm%The estimated hold time is currently +%queue-reporthold.gsm%Hold time + %queue-minutes.gsm%Minutes %queue-seconds.gsm%Seconds diff --git a/sounds/queue-reporthold.gsm b/sounds/queue-reporthold.gsm new file mode 100755 index 0000000000000000000000000000000000000000..8b0254ba0142f62a1e922e09a5e49ad59bcc7f7b GIT binary patch literal 1188 zcmV;V1Y7&np+eh4!iYASE>B!hC5ef#dfl5Rxsr_DtYd08lyAu5)?-^z1!BgkL}UK! zQRz6`Qa8%7h-e%Ud$N+rSXxDO?ABw00!~ziEXz!7Wum1!8U_z6)Qald38|k@s7X{v zo;K8`iOP(Q$j++_9<`FkzNA74m$r$<;e|)1prz+ULMPVKZ&BUTq~*B<4L&{Kr%7B) zIHsQESky^#GwQ`z6e)Ex()3AQQ<}s~R4ch;lB3#V7Da33qeR*C=;fCogwJwGVbe2l zVdCEc7;=?OP>P4#({+JetAj$u z?2<5~#Ui@nh&tSZVp$NC%XEQ4)*W)oBGWZ_9xH(&3nZ4fUBMx`?NmIazd_3ASvewq zLNsfQ*3i=Qai%K00ledtv@E+p*D_*PqkAFvgpXINx4|g%R#NEF^h$2oc_LceVM!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