aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-09-25 14:22:27 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-09-25 14:22:27 +0000
commitdd430e42f72393c654eaeb4eb365b0446eeaed46 (patch)
treed8a798b0062eca833e4caf5b0a86c08acd44a8a9
parent0df2499ae3a9b647bbe97c3ef0982a23f8c2b9c3 (diff)
Make holdtime announcement say "less than 2 minutes" instead of "1 minutes" (bug #2500)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3834 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xapps/app_queue.c10
-rwxr-xr-xres/res_agi.c63
-rwxr-xr-xsounds.txt2
-rwxr-xr-xsounds/queue-less-than.gsmbin0 -> 1419 bytes
4 files changed, 72 insertions, 3 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index a2f2ae53c..542ede246 100755
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -208,6 +208,7 @@ struct ast_call_queue {
char sound_calls[80]; /* Sound file: "calls waiting to speak to a representative." (def. queue-callswaiting)*/
char sound_holdtime[80]; /* Sound file: "The current estimated total holdtime is" (def. queue-holdtime) */
char sound_minutes[80]; /* Sound file: "minutes." (def. queue-minutes) */
+ 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) */
@@ -434,7 +435,11 @@ static int say_position(struct queue_ent *qe)
if ((avgholdmins+avgholdsecs) > 0 && (qe->parent->announceholdtime) && (!(qe->parent->announceholdtime==1 && qe->last_pos)) ) {
res += play_file(qe->chan, qe->parent->sound_holdtime);
if(avgholdmins>0) {
- res += ast_say_number(qe->chan, avgholdmins, AST_DIGIT_ANY, qe->chan->language, (char*) NULL);
+ if (avgholdmins < 2) {
+ res += play_file(qe->chan, qe->parent->sound_lessthan);
+ res += ast_say_number(qe->chan, 2, AST_DIGIT_ANY, qe->chan->language, (char *)NULL);
+ } else
+ res += ast_say_number(qe->chan, avgholdmins, AST_DIGIT_ANY, qe->chan->language, (char*) NULL);
res += play_file(qe->chan, qe->parent->sound_minutes);
}
if(avgholdsecs>0) {
@@ -1776,6 +1781,7 @@ static void reload_queues(void)
strncpy(q->sound_minutes, "queue-minutes", sizeof(q->sound_minutes) - 1);
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-lessthan", sizeof(q->sound_lessthan) - 1);
prev = q->members;
if (prev) {
/* find the end of any dynamic members */
@@ -1836,6 +1842,8 @@ static void reload_queues(void)
strncpy(q->sound_minutes, var->value, sizeof(q->sound_minutes) - 1);
} else if (!strcasecmp(var->name, "queue-seconds")) {
strncpy(q->sound_seconds, var->value, sizeof(q->sound_seconds) - 1);
+ } else if (!strcasecmp(var->name, "queue-lessthan")) {
+ 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, "announce-frequency")) {
diff --git a/res/res_agi.c b/res/res_agi.c
index 2a58a5bf5..b50470817 100755
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -38,6 +38,7 @@
#include <asterisk/app.h>
#include <asterisk/dsp.h>
#include <asterisk/musiconhold.h>
+#include <asterisk/manager.h>
#include <asterisk/utils.h>
#include <asterisk/lock.h>
#include <asterisk/agi.h>
@@ -48,7 +49,7 @@
#define MAX_COMMANDS 128
/* Recycle some stuff from the CLI interface */
-#define fdprintf ast_cli
+#define fdprintf agi_debug_cli
static char *tdesc = "Asterisk Gateway Interface (AGI)";
@@ -74,6 +75,8 @@ static char *descrip =
"on file descriptor 3\n\n"
"Use the CLI command 'show agi' to list available agi commands\n";
+static int agidebug = 0;
+
STANDARD_LOCAL_USER;
LOCAL_USER_DECL;
@@ -86,6 +89,25 @@ LOCAL_USER_DECL;
#define AGI_PORT 4573
+static void agi_debug_cli(int fd, char *fmt, ...)
+{
+ char *stuff;
+ int res = 0;
+
+ va_list ap;
+ va_start(ap, fmt);
+ res = vasprintf(&stuff, fmt, ap);
+ va_end(ap);
+ if (res == -1) {
+ ast_log(LOG_ERROR, "Out of memory\n");
+ } else {
+ if (agidebug)
+ ast_verbose("AGI Tx >> %s", stuff);
+ ast_carefulwrite(fd, stuff, strlen(stuff), 100);
+ free(stuff);
+ }
+}
+
static int launch_netscript(char *agiurl, char *argv[], int *fds, int *efd, int *opid)
{
int s;
@@ -961,6 +983,38 @@ static int handle_dbdeltree(struct ast_channel *chan, AGI *agi, int argc, char *
return RESULT_SUCCESS;
}
+static char debug_usage[] =
+"Usage: agi debug\n"
+" Enables dumping of AGI transactions for debugging purposes\n";
+
+static char no_debug_usage[] =
+"Usage: agi no debug\n"
+" Disables dumping of AGI transactions for debugging purposes\n";
+
+static int agi_do_debug(int fd, int argc, char *argv[])
+{
+ if (argc != 2)
+ return RESULT_SHOWUSAGE;
+ agidebug = 1;
+ ast_cli(fd, "AGI Debugging Enabled\n");
+ return RESULT_SUCCESS;
+}
+
+static int agi_no_debug(int fd, int argc, char *argv[])
+{
+ if (argc != 3)
+ return RESULT_SHOWUSAGE;
+ agidebug = 0;
+ ast_cli(fd, "AGI Debugging Disabled\n");
+ return RESULT_SUCCESS;
+}
+
+static struct ast_cli_entry cli_debug =
+ { { "agi", "debug", NULL }, agi_do_debug, "Enable AGI debugging", debug_usage };
+
+static struct ast_cli_entry cli_no_debug =
+ { { "agi", "no", "debug", NULL }, agi_no_debug, "Disable AGI debugging", no_debug_usage };
+
static int handle_noop(struct ast_channel *chan, AGI *agi, int arg, char *argv[])
{
fdprintf(agi->fd, "200 result=0\n");
@@ -1469,7 +1523,8 @@ static int run_agi(struct ast_channel *chan, char *request, AGI *agi, int pid, i
/* get rid of trailing newline, if any */
if (*buf && buf[strlen(buf) - 1] == '\n')
buf[strlen(buf) - 1] = 0;
-
+ if (agidebug)
+ ast_verbose("AGI Rx << %s\n", buf);
returnstatus |= agi_handle_command(chan, agi, buf);
/* If the handle_command returns -1, we need to stop */
if ((returnstatus < 0) || (returnstatus == AST_PBX_KEEPALIVE)) {
@@ -1672,6 +1727,8 @@ int unload_module(void)
STANDARD_HANGUP_LOCALUSERS;
ast_cli_unregister(&showagi);
ast_cli_unregister(&dumpagihtml);
+ ast_cli_unregister(&cli_debug);
+ ast_cli_unregister(&cli_no_debug);
ast_unregister_application(eapp);
ast_unregister_application(deadapp);
return ast_unregister_application(app);
@@ -1681,6 +1738,8 @@ int load_module(void)
{
ast_cli_register(&showagi);
ast_cli_register(&dumpagihtml);
+ ast_cli_register(&cli_debug);
+ ast_cli_register(&cli_no_debug);
ast_register_application(deadapp, deadagi_exec, deadsynopsis, descrip);
ast_register_application(eapp, eagi_exec, esynopsis, descrip);
return ast_register_application(app, agi_exec, synopsis, descrip);
diff --git a/sounds.txt b/sounds.txt
index c988e1c84..579792026 100755
--- a/sounds.txt
+++ b/sounds.txt
@@ -636,3 +636,5 @@
%conf-unlockednow.gsm%The conference is now unlocked
%vm-leavemsg.gsm% Press 5 to send a voicemail message
+
+%queue-less-than.gsm%less than
diff --git a/sounds/queue-less-than.gsm b/sounds/queue-less-than.gsm
new file mode 100755
index 000000000..38875ed66
--- /dev/null
+++ b/sounds/queue-less-than.gsm
Binary files differ