aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-08-15 04:38:39 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-08-15 04:38:39 +0000
commita1136fedf44ba8d0bada48295ac00961696b4bf5 (patch)
tree14f5bc090ee5daef3022a525dcf8035720d01227 /apps
parenta34be8cd3f45e4c2f4f661c29f0810f4a379576e (diff)
Asterisk:
#72 - Should eliminate probs on VMWI #41 - Dynamic add survives reload #73 - Make festival honor its arguments #93 - Make events on FXO interfaces more logical #26 - Prefer "bindaddr" to logical address for registrations ??? - Record crashes AGI git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1338 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rwxr-xr-xapps/app_agi.c6
-rwxr-xr-xapps/app_enumlookup.c1
-rwxr-xr-xapps/app_festival.c31
-rwxr-xr-xapps/app_queue.c25
-rwxr-xr-xapps/app_voicemail2.c1
5 files changed, 43 insertions, 21 deletions
diff --git a/apps/app_agi.c b/apps/app_agi.c
index 7c7b653f2..3e332afc5 100755
--- a/apps/app_agi.c
+++ b/apps/app_agi.c
@@ -452,13 +452,13 @@ static int handle_recordfile(struct ast_channel *chan, AGI *agi, int argc, char
int res = 0;
int ms;
- struct ast_dsp *sildet; /* silence detector dsp */
+ struct ast_dsp *sildet=NULL; /* silence detector dsp */
int totalsilence = 0;
int dspsilence = 0;
int silence = 0; /* amount of silence to allow */
int gotsilence = 0; /* did we timeout for silence? */
- char *silencestr;
- int rfmt;
+ char *silencestr=NULL;
+ int rfmt=0;
/* XXX EAGI FIXME XXX */
diff --git a/apps/app_enumlookup.c b/apps/app_enumlookup.c
index d547f8a7c..4f132a518 100755
--- a/apps/app_enumlookup.c
+++ b/apps/app_enumlookup.c
@@ -22,6 +22,7 @@
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
+#include <ctype.h>
#include <pthread.h>
diff --git a/apps/app_festival.c b/apps/app_festival.c
index 23d7dc10f..acc268e36 100755
--- a/apps/app_festival.c
+++ b/apps/app_festival.c
@@ -48,7 +48,7 @@ static char *synopsis = "Say text to the user";
static char *descrip =
" Festival(text[|intkeys]): Connect to Festival, send the argument, get back the waveform,"
"play it to the user, allowing any given interrupt keys to immediately terminate and return\n"
-"the value.\n";
+"the value, or 'any' to allow any number back (useful in dialplan)\n";
STANDARD_LOCAL_USER;
@@ -122,7 +122,7 @@ static int send_waveform_to_fd(char *waveform, int length, int fd) {
}
-static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, int length) {
+static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, int length, char *intkeys) {
int res=0;
int fds[2];
int ms = -1;
@@ -170,9 +170,11 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in
}
if (f->frametype == AST_FRAME_DTMF) {
ast_log(LOG_DEBUG, "User pressed a key\n");
- ast_frfree(f);
- res = 0;
- break;
+ if (strchr(intkeys, f->subclass)) {
+ res = f->subclass;
+ ast_frfree(f);
+ break;
+ }
}
if (f->frametype == AST_FRAME_VOICE) {
/* Treat as a generator */
@@ -224,7 +226,7 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in
-static int festival_exec(struct ast_channel *chan, void *data)
+static int festival_exec(struct ast_channel *chan, void *vdata)
{
int usecache;
int res=0;
@@ -253,9 +255,11 @@ static int festival_exec(struct ast_channel *chan, void *data)
int readcache=0;
int writecache=0;
int strln;
- int fdesc;
+ int fdesc = -1;
char buffer[16384];
- int seekpos;
+ int seekpos = 0;
+ char data[256] = "";
+ char *intstr;
struct ast_config *cfg;
cfg = ast_load(FESTIVAL_CONFIG);
@@ -285,10 +289,17 @@ static int festival_exec(struct ast_channel *chan, void *data)
- if (!data) {
+ if (!vdata || !strlen(vdata)) {
ast_log(LOG_WARNING, "festival requires an argument (text)\n");
return -1;
}
+ strncpy(data, vdata, sizeof(data) - 1);
+ if ((intstr = strchr(data, '|'))) {
+ *intstr = '\0';
+ intstr++;
+ if (!strcasecmp(intstr, "any"))
+ intstr = AST_DIGIT_ANY;
+ }
LOCAL_USER_ADD(u);
ast_log(LOG_WARNING, "Text passed to festival server : %s\n",(char *)data);
/* Connect to local festival server */
@@ -398,7 +409,7 @@ static int festival_exec(struct ast_channel *chan, void *data)
if (strcmp(ack,"WV\n") == 0) { /* receive a waveform */
ast_log(LOG_WARNING,"Festival WV command");
waveform = socket_receive_file_to_buff(fd,&filesize);
- send_waveform_to_channel(chan,waveform,filesize);
+ send_waveform_to_channel(chan,waveform,filesize, intstr);
free(waveform);
res=0;
break;
diff --git a/apps/app_queue.c b/apps/app_queue.c
index e4dc2a4ff..1b5088c95 100755
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -140,6 +140,7 @@ struct member {
char loc[256]; /* Location */
int penalty; /* Are we a last resort? */
int calls;
+ int dynamic; /* Are we dynamically added? */
time_t lastcall; /* When last successful call was hungup */
struct member *next; /* Next member */
};
@@ -245,14 +246,22 @@ ast_log(LOG_NOTICE, "Queue '%s' Join, Channel '%s', Position '%d'\n", q->name, q
static void free_members(struct ast_call_queue *q)
{
- struct member *curm, *next;
+ /* Free non-dynamic members */
+ struct member *curm, *next, *prev;
curm = q->members;
+ prev = NULL;
while(curm) {
next = curm->next;
- free(curm);
+ if (!curm->dynamic) {
+ if (prev)
+ prev->next = next;
+ else
+ q->members = next;
+ free(curm);
+ } else
+ prev = curm;
curm = next;
}
- q->members = NULL;
}
static void destroy_queue(struct ast_call_queue *q)
@@ -1044,9 +1053,10 @@ static int aqm_exec(struct ast_channel *chan, void *data)
save = q->members ;
q->members = create_queue_node( interface ) ;
- if( q->members != NULL )
+ if( q->members != NULL ) {
+ q->members->dynamic = 1;
q->members->next = save ;
- else
+ } else
q->members = save ;
ast_log(LOG_NOTICE, "Added interface '%s' to queue '%s'\n", interface, queuename);
@@ -1182,7 +1192,6 @@ static void reload_queues(void)
/* Mark all queues as dead for the moment */
q = queues;
while(q) {
- q->dead = 1;
q = q->next;
}
/* Chug through config file */
@@ -1340,9 +1349,11 @@ static int queues_show(int fd, int argc, char **argv)
ast_cli(fd, " Members: \n");
for (mem = q->members; mem; mem = mem->next) {
if (mem->penalty)
- snprintf(max, sizeof(max), " with penalty %d", mem->penalty);
+ snprintf(max, sizeof(max) - 20, " with penalty %d", mem->penalty);
else
strcpy(max, "");
+ if (mem->dynamic)
+ strcat(max, " (dynamic)");
if (mem->calls) {
snprintf(calls, sizeof(calls), " has taken %d calls (last was %ld secs ago)",
mem->calls, time(NULL) - mem->lastcall);
diff --git a/apps/app_voicemail2.c b/apps/app_voicemail2.c
index 2dd8d0747..08fe3bc84 100755
--- a/apps/app_voicemail2.c
+++ b/apps/app_voicemail2.c
@@ -1793,7 +1793,6 @@ forward_message(struct ast_channel *chan, char *context, char *dir, int curmsg,
if ((res = ast_readstring(chan, username, sizeof(username) - 1, 2000, 10000, "#") < 0))
break;
if ((receiver = find_user(&srec, context, username))) {
- printf("Got %d\n", atoi(username));
/* if (play_and_wait(chan, "vm-savedto"))
break;
*/