Mostly cleanup of documentation to substitute the pipe with the comma, but a few other formatting cleanups, too.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77808 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.0
Tilghman Lesher 18 years ago
parent 3aaf122439
commit 20bbd09de3

@ -47,9 +47,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
static char *app = "AMD"; static char *app = "AMD";
static char *synopsis = "Attempts to detect answering machines"; static char *synopsis = "Attempts to detect answering machines";
static char *descrip = static char *descrip =
" AMD([initialSilence][|greeting][|afterGreetingSilence][|totalAnalysisTime]\n" " AMD([initialSilence],[greeting],[afterGreetingSilence],[totalAnalysisTime]\n"
" [|minimumWordLength][|betweenWordsSilence][|maximumNumberOfWords]\n" " ,[minimumWordLength],[betweenWordsSilence],[maximumNumberOfWords]\n"
" [|silenceThreshold])\n" " ,[silenceThreshold])\n"
" This application attempts to detect answering machines at the beginning\n" " This application attempts to detect answering machines at the beginning\n"
" of outbound calls. Simply call this application after the call\n" " of outbound calls. Simply call this application after the call\n"
" has been answered (outbound only, of course).\n" " has been answered (outbound only, of course).\n"

@ -66,7 +66,7 @@ static char *app = "Authenticate";
static char *synopsis = "Authenticate a user"; static char *synopsis = "Authenticate a user";
static char *descrip = static char *descrip =
" Authenticate(password[|options[|maxdigits]]): This application asks the caller\n" " Authenticate(password[,options[,maxdigits]]): This application asks the caller\n"
"to enter a given password in order to continue dialplan execution. If the password\n" "to enter a given password in order to continue dialplan execution. If the password\n"
"begins with the '/' character, it is interpreted as a file which contains a list of\n" "begins with the '/' character, it is interpreted as a file which contains a list of\n"
"valid passwords, listed 1 password per line in the file.\n" "valid passwords, listed 1 password per line in the file.\n"

@ -53,7 +53,7 @@ static char *app = "ChanIsAvail";
static char *synopsis = "Check channel availability"; static char *synopsis = "Check channel availability";
static char *descrip = static char *descrip =
" ChanIsAvail(Technology/resource[&Technology2/resource2...][|options]): \n" " ChanIsAvail(Technology/resource[&Technology2/resource2...][,options]): \n"
"This application will check to see if any of the specified channels are\n" "This application will check to see if any of the specified channels are\n"
"available. The following variables will be set by this application:\n" "available. The following variables will be set by this application:\n"
" ${AVAILCHAN} - the name of the available channel, if one exists\n" " ${AVAILCHAN} - the name of the available channel, if one exists\n"

@ -56,7 +56,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
static const char *tdesc = "Listen to a channel, and optionally whisper into it"; static const char *tdesc = "Listen to a channel, and optionally whisper into it";
static const char *app_chan = "ChanSpy"; static const char *app_chan = "ChanSpy";
static const char *desc_chan = static const char *desc_chan =
" ChanSpy([chanprefix][|options]): This application is used to listen to the\n" " ChanSpy([chanprefix][,options]): This application is used to listen to the\n"
"audio from an Asterisk channel. This includes the audio coming in and\n" "audio from an Asterisk channel. This includes the audio coming in and\n"
"out of the channel being spied on. If the 'chanprefix' parameter is specified,\n" "out of the channel being spied on. If the 'chanprefix' parameter is specified,\n"
"only channels beginning with this string will be spied upon.\n" "only channels beginning with this string will be spied upon.\n"
@ -97,7 +97,7 @@ static const char *desc_chan =
static const char *app_ext = "ExtenSpy"; static const char *app_ext = "ExtenSpy";
static const char *desc_ext = static const char *desc_ext =
" ExtenSpy(exten[@context][|options]): This application is used to listen to the\n" " ExtenSpy(exten[@context][,options]): This application is used to listen to the\n"
"audio from an Asterisk channel. This includes the audio coming in and\n" "audio from an Asterisk channel. This includes the audio coming in and\n"
"out of the channel being spied on. Only channels created by outgoing calls for the\n" "out of the channel being spied on. Only channels created by outgoing calls for the\n"
"specified extension will be selected for spying. If the optional context is not\n" "specified extension will be selected for spying. If the optional context is not\n"

@ -49,7 +49,7 @@ static const char *app = "ControlPlayback";
static const char *synopsis = "Play a file with fast forward and rewind"; static const char *synopsis = "Play a file with fast forward and rewind";
static const char *descrip = static const char *descrip =
" ControlPlayback(file[|skipms[|ff[|rew[|stop[|pause[|restart|options]]]]]]]):\n" " ControlPlayback(file[,skipms[,ff[,rew[,stop[,pause[,restart,options]]]]]]]):\n"
"This application will play back the given filename. By default, the '*' key\n" "This application will play back the given filename. By default, the '*' key\n"
"can be used to rewind, and the '#' key can be used to fast-forward.\n" "can be used to rewind, and the '#' key can be used to fast-forward.\n"
"Parameters:\n" "Parameters:\n"

@ -48,7 +48,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
static char *app = "Dictate"; static char *app = "Dictate";
static char *synopsis = "Virtual Dictation Machine"; static char *synopsis = "Virtual Dictation Machine";
static char *desc = " Dictate([<base_dir>[|<filename>]])\n" static char *desc = " Dictate([<base_dir>[,<filename>]])\n"
"Start dictation machine using optional base dir for files.\n"; "Start dictation machine using optional base dir for files.\n";

@ -59,7 +59,7 @@ static char *app = "Directory";
static char *synopsis = "Provide directory of voicemail extensions"; static char *synopsis = "Provide directory of voicemail extensions";
static char *descrip = static char *descrip =
" Directory(vm-context[|dial-context[|options]]): This application will present\n" " Directory(vm-context[,dial-context[,options]]): This application will present\n"
"the calling channel with a directory of extensions from which they can search\n" "the calling channel with a directory of extensions from which they can search\n"
"by name. The list of names and corresponding extensions is retrieved from the\n" "by name. The list of names and corresponding extensions is retrieved from the\n"
"voicemail configuration file, voicemail.conf.\n" "voicemail configuration file, voicemail.conf.\n"

@ -55,8 +55,8 @@ static char *app = "DISA";
static char *synopsis = "DISA (Direct Inward System Access)"; static char *synopsis = "DISA (Direct Inward System Access)";
static char *descrip = static char *descrip =
"DISA(<numeric passcode>[|<context>[|<cid>[|mailbox[|options]]]]) or\n" "DISA(<numeric passcode>[,<context>[,<cid>[,mailbox[,options]]]]) or\n"
"DISA(<filename>[||||options])\n" "DISA(<filename>[,,,,options])\n"
"The DISA, Direct Inward System Access, application allows someone from \n" "The DISA, Direct Inward System Access, application allows someone from \n"
"outside the telephone switch (PBX) to obtain an \"internal\" system \n" "outside the telephone switch (PBX) to obtain an \"internal\" system \n"
"dialtone and to place calls from it as if they were placing a call from \n" "dialtone and to place calls from it as if they were placing a call from \n"

@ -58,77 +58,77 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/utils.h" #include "asterisk/utils.h"
#include "asterisk/lock.h" #include "asterisk/lock.h"
#include "asterisk/options.h" #include "asterisk/options.h"
#include "asterisk/app.h"
#define FESTIVAL_CONFIG "festival.conf" #define FESTIVAL_CONFIG "festival.conf"
#define MAXLEN 180
#define MAXFESTLEN 2048
static char *app = "Festival"; static char *app = "Festival";
static char *synopsis = "Say text to the user"; static char *synopsis = "Say text to the user";
static char *descrip = static char *descrip =
" Festival(text[|intkeys]): Connect to Festival, send the argument, get back the waveform," " 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" "play it to the user, allowing any given interrupt keys to immediately terminate and return\n"
"the value, or 'any' to allow any number back (useful in dialplan)\n"; "the value, or 'any' to allow any number back (useful in dialplan)\n";
static char *socket_receive_file_to_buff(int fd,int *size) static char *socket_receive_file_to_buff(int fd, int *size)
{ {
/* Receive file (probably a waveform file) from socket using */ /* Receive file (probably a waveform file) from socket using
/* Festival key stuff technique, but long winded I know, sorry */ * Festival key stuff technique, but long winded I know, sorry
/* but will receive any file without closing the stream or */ * but will receive any file without closing the stream or
/* using OOB data */ * using OOB data
static char *file_stuff_key = "ft_StUfF_key"; /* must == Festival's key */ */
char *buff; static char *file_stuff_key = "ft_StUfF_key"; /* must == Festival's key */
int bufflen; char *buff, *tmp;
int n,k,i; int bufflen;
char c; int n,k,i;
char c;
bufflen = 1024;
if (!(buff = ast_malloc(bufflen)))
{
/* TODO: Handle memory allocation failure */
}
*size=0;
for (k=0; file_stuff_key[k] != '\0';)
{
n = read(fd,&c,1);
if (n==0) break; /* hit stream eof before end of file */
if ((*size)+k+1 >= bufflen)
{ /* +1 so you can add a NULL if you want */
bufflen += bufflen/4;
if (!(buff = ast_realloc(buff, bufflen)))
{
/* TODO: Handle memory allocation failure */
}
}
if (file_stuff_key[k] == c)
k++;
else if ((c == 'X') && (file_stuff_key[k+1] == '\0'))
{ /* It looked like the key but wasn't */
for (i=0; i < k; i++,(*size)++)
buff[*size] = file_stuff_key[i];
k=0;
/* omit the stuffed 'X' */
}
else
{
for (i=0; i < k; i++,(*size)++)
buff[*size] = file_stuff_key[i];
k=0;
buff[*size] = c;
(*size)++;
}
}
return buff;
}
static int send_waveform_to_fd(char *waveform, int length, int fd) { bufflen = 1024;
if (!(buff = ast_malloc(bufflen)))
return NULL;
*size = 0;
for (k = 0; file_stuff_key[k] != '\0';) {
n = read(fd, &c, 1);
if (n == 0)
break; /* hit stream eof before end of file */
if ((*size) + k + 1 >= bufflen) {
/* +1 so you can add a terminating NULL if you want */
bufflen += bufflen / 4;
if (!(tmp = ast_realloc(buff, bufflen))) {
ast_free(buff);
return NULL;
}
buff = tmp;
}
if (file_stuff_key[k] == c)
k++;
else if ((c == 'X') && (file_stuff_key[k+1] == '\0')) {
/* It looked like the key but wasn't */
for (i = 0; i < k; i++, (*size)++)
buff[*size] = file_stuff_key[i];
k = 0;
/* omit the stuffed 'X' */
} else {
for (i = 0; i < k; i++, (*size)++)
buff[*size] = file_stuff_key[i];
k = 0;
buff[*size] = c;
(*size)++;
}
}
return buff;
}
int res; static int send_waveform_to_fd(char *waveform, int length, int fd)
int x; {
int res;
int x;
#ifdef __PPC__ #ifdef __PPC__
char c; char c;
#endif #endif
@ -137,41 +137,37 @@ static int send_waveform_to_fd(char *waveform, int length, int fd) {
sigfillset(&fullset); sigfillset(&fullset);
pthread_sigmask(SIG_BLOCK, &fullset, &oldset); pthread_sigmask(SIG_BLOCK, &fullset, &oldset);
res = fork(); res = fork();
if (res < 0) if (res < 0)
ast_log(LOG_WARNING, "Fork failed\n"); ast_log(LOG_WARNING, "Fork failed\n");
if (res) { if (res) {
pthread_sigmask(SIG_SETMASK, &oldset, NULL); pthread_sigmask(SIG_SETMASK, &oldset, NULL);
return res; return res;
}
for (x = 0; x < 256; x++) {
if (x != fd)
close(x);
} }
for (x=0;x<256;x++) {
if (x != fd)
close(x);
}
if (ast_opt_high_priority) if (ast_opt_high_priority)
ast_set_priority(0); ast_set_priority(0);
signal(SIGPIPE, SIG_DFL); signal(SIGPIPE, SIG_DFL);
pthread_sigmask(SIG_UNBLOCK, &fullset, NULL); pthread_sigmask(SIG_UNBLOCK, &fullset, NULL);
/*IAS */
#ifdef __PPC__ #ifdef __PPC__
for( x=0; x<length; x+=2) for (x = 0; x < length; x += 2) {
{ c = *(waveform + x + 1);
c = *(waveform+x+1); *(waveform + x + 1) = *(waveform + x);
*(waveform+x+1)=*(waveform+x); *(waveform + x) = c;
*(waveform+x)=c;
} }
#endif #endif
write(fd, waveform, length);
write(fd,waveform,length);
close(fd); close(fd);
exit(0); exit(0);
} }
static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, int length, char *intkeys)
static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, int length, char *intkeys) { {
int res=0; int res = 0;
int fds[2]; int fds[2];
int ms = -1;
int pid = -1; int pid = -1;
int needed = 0; int needed = 0;
int owriteformat; int owriteformat;
@ -183,12 +179,12 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in
} myf = { } myf = {
.f = { 0, }, .f = { 0, },
}; };
if (pipe(fds)) { if (pipe(fds)) {
ast_log(LOG_WARNING, "Unable to create pipe\n"); ast_log(LOG_WARNING, "Unable to create pipe\n");
return -1; return -1;
} }
/* Answer if it's not already going */ /* Answer if it's not already going */
if (chan->_state != AST_STATE_UP) if (chan->_state != AST_STATE_UP)
ast_answer(chan); ast_answer(chan);
@ -202,14 +198,13 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in
return -1; return -1;
} }
res=send_waveform_to_fd(waveform,length,fds[1]); res = send_waveform_to_fd(waveform, length, fds[1]);
if (res >= 0) { if (res >= 0) {
pid = res; pid = res;
/* Order is important -- there's almost always going to be mp3... we want to prioritize the /* Order is important -- there's almost always going to be mp3... we want to prioritize the
user */ user */
for (;;) { for (;;) {
ms = 1000; res = ast_waitfor(chan, 1000);
res = ast_waitfor(chan, ms);
if (res < 1) { if (res < 1) {
res = -1; res = -1;
break; break;
@ -252,7 +247,7 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in
} }
if (res < needed) { /* last frame */ if (res < needed) { /* last frame */
ast_debug(1, "Last frame\n"); ast_debug(1, "Last frame\n");
res=0; res = 0;
ast_frfree(f); ast_frfree(f);
break; break;
} }
@ -267,24 +262,20 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in
close(fds[0]); close(fds[0]);
close(fds[1]); close(fds[1]);
/* if (pid > -1) */ #if 0
/* kill(pid, SIGKILL); */ if (pid > -1)
kill(pid, SIGKILL);
#endif
if (!res && owriteformat) if (!res && owriteformat)
ast_set_write_format(chan, owriteformat); ast_set_write_format(chan, owriteformat);
return res; return res;
} }
#define MAXLEN 180
#define MAXFESTLEN 2048
static int festival_exec(struct ast_channel *chan, void *vdata) static int festival_exec(struct ast_channel *chan, void *vdata)
{ {
int usecache; int usecache;
int res=0; int res = 0;
struct sockaddr_in serv_addr; struct sockaddr_in serv_addr;
struct hostent *serverhost; struct hostent *serverhost;
struct ast_hostent ahp; struct ast_hostent ahp;
int fd; int fd;
@ -293,7 +284,7 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
const char *cachedir; const char *cachedir;
const char *temp; const char *temp;
const char *festivalcommand; const char *festivalcommand;
int port=1314; int port = 1314;
int n; int n;
char ack[4]; char ack[4];
char *waveform; char *waveform;
@ -306,16 +297,19 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
char MD5Hex[33] = ""; char MD5Hex[33] = "";
char koko[4] = ""; char koko[4] = "";
char cachefile[MAXFESTLEN]=""; char cachefile[MAXFESTLEN]="";
int readcache=0; int readcache = 0;
int writecache=0; int writecache = 0;
int strln; int strln;
int fdesc = -1; int fdesc = -1;
char buffer[16384]; char buffer[16384];
int seekpos = 0; int seekpos = 0;
char *data; char *data;
char *intstr;
struct ast_config *cfg; struct ast_config *cfg;
char *newfestivalcommand; char *newfestivalcommand;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(text);
AST_APP_ARG(interrupt);
);
if (ast_strlen_zero(vdata)) { if (ast_strlen_zero(vdata)) {
ast_log(LOG_WARNING, "festival requires an argument (text)\n"); ast_log(LOG_WARNING, "festival requires an argument (text)\n");
@ -336,7 +330,7 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
port = atoi(temp); port = atoi(temp);
} }
if (!(temp = ast_variable_retrieve(cfg, "general", "usecache"))) { if (!(temp = ast_variable_retrieve(cfg, "general", "usecache"))) {
usecache=0; usecache = 0;
} else { } else {
usecache = ast_true(temp); usecache = ast_true(temp);
} }
@ -364,22 +358,18 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
} }
data = ast_strdupa(vdata); data = ast_strdupa(vdata);
AST_STANDARD_APP_ARGS(args, data);
intstr = strchr(data, '|'); if (args.interrupt && !strcasecmp(args.interrupt, "any"))
if (intstr) { args.interrupt = AST_DIGIT_ANY;
*intstr = '\0';
intstr++; ast_debug(1, "Text passed to festival server : %s\n", args.text);
if (!strcasecmp(intstr, "any"))
intstr = AST_DIGIT_ANY;
}
ast_debug(1, "Text passed to festival server : %s\n",(char *)data);
/* Connect to local festival server */ /* Connect to local festival server */
fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (fd < 0) { if (fd < 0) {
ast_log(LOG_WARNING,"festival_client: can't get socket\n"); ast_log(LOG_WARNING, "festival_client: can't get socket\n");
ast_config_destroy(cfg); ast_config_destroy(cfg);
return -1; return -1;
} }
@ -390,139 +380,137 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
/* its a name rather than an ipnum */ /* its a name rather than an ipnum */
serverhost = ast_gethostbyname(host, &ahp); serverhost = ast_gethostbyname(host, &ahp);
if (serverhost == (struct hostent *)0) { if (serverhost == NULL) {
ast_log(LOG_WARNING,"festival_client: gethostbyname failed\n"); ast_log(LOG_WARNING, "festival_client: gethostbyname failed\n");
ast_config_destroy(cfg); ast_config_destroy(cfg);
return -1; return -1;
} }
memmove(&serv_addr.sin_addr,serverhost->h_addr, serverhost->h_length); memmove(&serv_addr.sin_addr, serverhost->h_addr, serverhost->h_length);
} }
serv_addr.sin_family = AF_INET; serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(port); serv_addr.sin_port = htons(port);
if (connect(fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) != 0) { if (connect(fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) != 0) {
ast_log(LOG_WARNING,"festival_client: connect to server failed\n"); ast_log(LOG_WARNING, "festival_client: connect to server failed\n");
ast_config_destroy(cfg); ast_config_destroy(cfg);
return -1; return -1;
} }
/* Compute MD5 sum of string */ /* Compute MD5 sum of string */
MD5Init(&md5ctx); MD5Init(&md5ctx);
MD5Update(&md5ctx,(unsigned char const *)data,strlen(data)); MD5Update(&md5ctx, (unsigned char *)args.text, strlen(args.text));
MD5Final(MD5Res,&md5ctx); MD5Final(MD5Res, &md5ctx);
MD5Hex[0] = '\0'; MD5Hex[0] = '\0';
/* Convert to HEX and look if there is any matching file in the cache /* Convert to HEX and look if there is any matching file in the cache
directory */ directory */
for (i=0;i<16;i++) { for (i = 0; i < 16; i++) {
snprintf(koko, sizeof(koko), "%X",MD5Res[i]); snprintf(koko, sizeof(koko), "%X", MD5Res[i]);
strncat(MD5Hex, koko, sizeof(MD5Hex) - strlen(MD5Hex) - 1); strncat(MD5Hex, koko, sizeof(MD5Hex) - strlen(MD5Hex) - 1);
} }
readcache=0; readcache = 0;
writecache=0; writecache = 0;
if (strlen(cachedir)+strlen(MD5Hex)+1<=MAXFESTLEN && (usecache==-1)) { if (strlen(cachedir) + strlen(MD5Hex) + 1 <= MAXFESTLEN && (usecache == -1)) {
snprintf(cachefile, sizeof(cachefile), "%s/%s", cachedir, MD5Hex); snprintf(cachefile, sizeof(cachefile), "%s/%s", cachedir, MD5Hex);
fdesc=open(cachefile,O_RDWR); fdesc = open(cachefile, O_RDWR);
if (fdesc==-1) { if (fdesc == -1) {
fdesc=open(cachefile,O_CREAT|O_RDWR,AST_FILE_MODE); fdesc = open(cachefile, O_CREAT | O_RDWR, AST_FILE_MODE);
if (fdesc!=-1) { if (fdesc != -1) {
writecache=1; writecache = 1;
strln=strlen((char *)data); strln = strlen(args.text);
ast_debug(1,"line length : %d\n",strln); ast_debug(1, "line length : %d\n", strln);
write(fdesc,&strln,sizeof(int)); write(fdesc, &strln, sizeof(strln));
write(fdesc,data,strln); write(fdesc, args.text, strln);
seekpos=lseek(fdesc,0,SEEK_CUR); seekpos = lseek(fdesc, 0, SEEK_CUR);
ast_debug(1,"Seek position : %d\n",seekpos); ast_debug(1, "Seek position : %d\n", seekpos);
} }
} else { } else {
read(fdesc,&strln,sizeof(int)); read(fdesc, &strln, sizeof(strln));
ast_debug(1,"Cache file exists, strln=%d, strlen=%d\n",strln,(int)strlen((char *)data)); ast_debug(1, "Cache file exists, strln=%d, strlen=%d\n", strln, (int)strlen(args.text));
if (strlen((char *)data)==strln) { if (strlen(args.text) == strln) {
ast_debug(1,"Size OK\n"); ast_debug(1, "Size OK\n");
read(fdesc,&bigstring,strln); read(fdesc, &bigstring, strln);
bigstring[strln] = 0; bigstring[strln] = 0;
if (strcmp(bigstring,data)==0) { if (strcmp(bigstring, args.text) == 0) {
readcache=1; readcache = 1;
} else { } else {
ast_log(LOG_WARNING,"Strings do not match\n"); ast_log(LOG_WARNING, "Strings do not match\n");
} }
} else { } else {
ast_log(LOG_WARNING,"Size mismatch\n"); ast_log(LOG_WARNING, "Size mismatch\n");
} }
} }
} }
if (readcache==1) { if (readcache == 1) {
close(fd); close(fd);
fd=fdesc; fd = fdesc;
ast_debug(1,"Reading from cache...\n"); ast_debug(1, "Reading from cache...\n");
} else { } else {
ast_debug(1,"Passing text to festival...\n"); ast_debug(1, "Passing text to festival...\n");
fs=fdopen(dup(fd),"wb"); fs = fdopen(dup(fd), "wb");
fprintf(fs,festivalcommand,(char *)data); fprintf(fs, festivalcommand, args.text);
fflush(fs); fflush(fs);
fclose(fs); fclose(fs);
} }
/* Write to cache and then pass it down */ /* Write to cache and then pass it down */
if (writecache==1) { if (writecache == 1) {
ast_debug(1,"Writing result to cache...\n"); ast_debug(1, "Writing result to cache...\n");
while ((strln=read(fd,buffer,16384))!=0) { while ((strln = read(fd, buffer, 16384)) != 0) {
write(fdesc,buffer,strln); write(fdesc, buffer, strln);
} }
close(fd); close(fd);
close(fdesc); close(fdesc);
fd=open(cachefile,O_RDWR); fd = open(cachefile, O_RDWR);
lseek(fd,seekpos,SEEK_SET); lseek(fd, seekpos, SEEK_SET);
} }
ast_debug(1,"Passing data to channel...\n"); ast_debug(1, "Passing data to channel...\n");
/* Read back info from server */ /* Read back info from server */
/* This assumes only one waveform will come back, also LP is unlikely */ /* This assumes only one waveform will come back, also LP is unlikely */
wave = 0; wave = 0;
do { do {
int read_data; int read_data;
for (n=0; n < 3; ) for (n = 0; n < 3; ) {
{ read_data = read(fd, ack + n, 3 - n);
read_data = read(fd,ack+n,3-n); /* this avoids falling in infinite loop
/* this avoids falling in infinite loop * in case that festival server goes down
* in case that festival server goes down */
* */ if (read_data == -1) {
if ( read_data == -1 ) ast_log(LOG_WARNING, "Unable to read from cache/festival fd\n");
{ close(fd);
ast_log(LOG_WARNING,"Unable to read from cache/festival fd\n"); ast_config_destroy(cfg);
close(fd); return -1;
ast_config_destroy(cfg); }
return -1; n += read_data;
} }
n += read_data;
}
ack[3] = '\0'; ack[3] = '\0';
if (strcmp(ack,"WV\n") == 0) { /* receive a waveform */ if (strcmp(ack, "WV\n") == 0) { /* receive a waveform */
ast_debug(1,"Festival WV command\n"); ast_debug(1, "Festival WV command\n");
waveform = socket_receive_file_to_buff(fd,&filesize); if ((waveform = socket_receive_file_to_buff(fd, &filesize))) {
res = send_waveform_to_channel(chan,waveform,filesize, intstr); res = send_waveform_to_channel(chan, waveform, filesize, args.interrupt);
ast_free(waveform); ast_free(waveform);
}
break; break;
} } else if (strcmp(ack, "LP\n") == 0) { /* receive an s-expr */
else if (strcmp(ack,"LP\n") == 0) { /* receive an s-expr */ ast_debug(1, "Festival LP command\n");
ast_debug(1,"Festival LP command\n"); if ((waveform = socket_receive_file_to_buff(fd, &filesize))) {
waveform = socket_receive_file_to_buff(fd,&filesize); waveform[filesize] = '\0';
waveform[filesize]='\0'; ast_log(LOG_WARNING, "Festival returned LP : %s\n", waveform);
ast_log(LOG_WARNING,"Festival returned LP : %s\n",waveform); ast_free(waveform);
ast_free(waveform); }
} else if (strcmp(ack,"ER\n") == 0) { /* server got an error */ } else if (strcmp(ack, "ER\n") == 0) { /* server got an error */
ast_log(LOG_WARNING,"Festival returned ER\n"); ast_log(LOG_WARNING, "Festival returned ER\n");
res=-1; res = -1;
break; break;
} }
} while (strcmp(ack,"OK\n") != 0); } while (strcmp(ack, "OK\n") != 0);
close(fd); close(fd);
ast_config_destroy(cfg); ast_config_destroy(cfg);
return res; return res;
} }
static int unload_module(void) static int unload_module(void)

@ -61,7 +61,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
static char *app = "FollowMe"; static char *app = "FollowMe";
static char *synopsis = "Find-Me/Follow-Me application"; static char *synopsis = "Find-Me/Follow-Me application";
static char *descrip = static char *descrip =
" FollowMe(followmeid|options):\n" " FollowMe(followmeid,options):\n"
"This application performs Find-Me/Follow-Me functionality for the caller\n" "This application performs Find-Me/Follow-Me functionality for the caller\n"
"as defined in the profile matching the <followmeid> parameter in\n" "as defined in the profile matching the <followmeid> parameter in\n"
"followme.conf. If the specified <followmeid> profile doesn't exist in\n" "followme.conf. If the specified <followmeid> profile doesn't exist in\n"

@ -49,43 +49,30 @@ static char *app = "SendImage";
static char *synopsis = "Send an image file"; static char *synopsis = "Send an image file";
static char *descrip = static char *descrip =
" SendImage(filename): Sends an image on a channel. \n" " SendImage(filename): Sends an image on a channel.\n"
"If the channel supports image transport but the image send\n" "If the channel supports image transport but the image send fails, the channel\n"
"fails, the channel will be hung up. Otherwise, the dialplan\n" "will be hung up. Otherwise, the dialplan continues execution. This\n"
"continues execution.\n" "application sets the following channel variable upon completion:\n"
"This application sets the following channel variable upon completion:\n" " SENDIMAGESTATUS The status is the result of the attempt, one of:\n"
" SENDIMAGESTATUS The status is the result of the attempt as a text string, one of\n" " OK | NOSUPPORT \n";
" OK | NOSUPPORT \n";
static int sendimage_exec(struct ast_channel *chan, void *data) static int sendimage_exec(struct ast_channel *chan, void *data)
{ {
int res = 0; int res = 0;
char *parse;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(filename);
AST_APP_ARG(options);
);
parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse); if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "SendImage requires an argument (filename)\n");
if (ast_strlen_zero(args.filename)) {
ast_log(LOG_WARNING, "SendImage requires an argument (filename[|options])\n");
return -1; return -1;
} }
if (args.options) {
}
if (!ast_supports_images(chan)) { if (!ast_supports_images(chan)) {
/* Does not support transport */ /* Does not support transport */
pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "NOSUPPORT"); pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "NOSUPPORT");
return 0; return 0;
} }
if (!(res = ast_send_image(chan, args.filename))) if (!(res = ast_send_image(chan, data)))
pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "OK"); pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "OK");
return res; return res;

@ -51,7 +51,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#define MACRO_EXIT_RESULT 1024 #define MACRO_EXIT_RESULT 1024
static char *descrip = static char *descrip =
" Macro(macroname|arg1|arg2...): Executes a macro using the context\n" " Macro(macroname,arg1,arg2...): Executes a macro using the context\n"
"'macro-<macroname>', jumping to the 's' extension of that context and\n" "'macro-<macroname>', jumping to the 's' extension of that context and\n"
"executing each step, then returning when the steps end. \n" "executing each step, then returning when the steps end. \n"
"The calling extension, context, and priority are stored in ${MACRO_EXTEN}, \n" "The calling extension, context, and priority are stored in ${MACRO_EXTEN}, \n"
@ -76,13 +76,13 @@ static char *descrip =
" (now allows arguments like a Macro) with explict Return() calls instead.\n"; " (now allows arguments like a Macro) with explict Return() calls instead.\n";
static char *if_descrip = static char *if_descrip =
" MacroIf(<expr>?macroname_a[|arg1][:macroname_b[|arg1]])\n" " MacroIf(<expr>?macroname_a[,arg1][:macroname_b[,arg1]])\n"
"Executes macro defined in <macroname_a> if <expr> is true\n" "Executes macro defined in <macroname_a> if <expr> is true\n"
"(otherwise <macroname_b> if provided)\n" "(otherwise <macroname_b> if provided)\n"
"Arguments and return values as in application macro()\n"; "Arguments and return values as in application macro()\n";
static char *exclusive_descrip = static char *exclusive_descrip =
" MacroExclusive(macroname|arg1|arg2...):\n" " MacroExclusive(macroname,arg1,arg2...):\n"
"Executes macro defined in the context 'macro-macroname'\n" "Executes macro defined in the context 'macro-macroname'\n"
"Only one call at a time may run the macro.\n" "Only one call at a time may run the macro.\n"
"(we'll wait if another call is busy executing in the Macro)\n" "(we'll wait if another call is busy executing in the Macro)\n"
@ -168,7 +168,7 @@ static int _macro_exec(struct ast_channel *chan, void *data, int exclusive)
char *save_macro_offset; char *save_macro_offset;
if (ast_strlen_zero(data)) { if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Macro() requires arguments. See \"show application macro\" for help.\n"); ast_log(LOG_WARNING, "Macro() requires arguments. See \"core show application macro\" for help.\n");
return -1; return -1;
} }

@ -263,7 +263,7 @@ static const char *descrip =
" '1' -- do not play message when first person enters\n"; " '1' -- do not play message when first person enters\n";
static const char *descrip2 = static const char *descrip2 =
" MeetMeCount(confno[|var]): Plays back the number of users in the specified\n" " MeetMeCount(confno[,var]): Plays back the number of users in the specified\n"
"MeetMe conference. If var is specified, playback will be skipped and the value\n" "MeetMe conference. If var is specified, playback will be skipped and the value\n"
"will be returned in the variable. Upon app completion, MeetMeCount will hangup\n" "will be returned in the variable. Upon app completion, MeetMeCount will hangup\n"
"the channel, unless priority n+1 exists, in which case priority progress will\n" "the channel, unless priority n+1 exists, in which case priority progress will\n"
@ -294,7 +294,7 @@ static const char *descrip3 =
""; "";
static const char *descrip4 = static const char *descrip4 =
" MeetMeChannelAdmin(channel|command): Run admin command for a specific\n" " MeetMeChannelAdmin(channel,command): Run admin command for a specific\n"
"channel in any coference.\n" "channel in any coference.\n"
" 'k' -- Kick the specified user out of the conference he is in\n" " 'k' -- Kick the specified user out of the conference he is in\n"
" 'm' -- Unmute the specified user\n" " 'm' -- Unmute the specified user\n"
@ -894,10 +894,10 @@ static int meetme_cmd(int fd, int argc, char **argv)
if (strstr(argv[1], "lock")) { if (strstr(argv[1], "lock")) {
if (strcmp(argv[1], "lock") == 0) { if (strcmp(argv[1], "lock") == 0) {
/* Lock */ /* Lock */
strncat(cmdline, "|L", sizeof(cmdline) - strlen(cmdline) - 1); strncat(cmdline, ",L", sizeof(cmdline) - strlen(cmdline) - 1);
} else { } else {
/* Unlock */ /* Unlock */
strncat(cmdline, "|l", sizeof(cmdline) - strlen(cmdline) - 1); strncat(cmdline, ",l", sizeof(cmdline) - strlen(cmdline) - 1);
} }
} else if (strstr(argv[1], "mute")) { } else if (strstr(argv[1], "mute")) {
if (argc < 4) if (argc < 4)
@ -905,17 +905,17 @@ static int meetme_cmd(int fd, int argc, char **argv)
if (strcmp(argv[1], "mute") == 0) { if (strcmp(argv[1], "mute") == 0) {
/* Mute */ /* Mute */
if (strcmp(argv[3], "all") == 0) { if (strcmp(argv[3], "all") == 0) {
strncat(cmdline, "|N", sizeof(cmdline) - strlen(cmdline) - 1); strncat(cmdline, ",N", sizeof(cmdline) - strlen(cmdline) - 1);
} else { } else {
strncat(cmdline, "|M|", sizeof(cmdline) - strlen(cmdline) - 1); strncat(cmdline, ",M,", sizeof(cmdline) - strlen(cmdline) - 1);
strncat(cmdline, argv[3], sizeof(cmdline) - strlen(cmdline) - 1); strncat(cmdline, argv[3], sizeof(cmdline) - strlen(cmdline) - 1);
} }
} else { } else {
/* Unmute */ /* Unmute */
if (strcmp(argv[3], "all") == 0) { if (strcmp(argv[3], "all") == 0) {
strncat(cmdline, "|n", sizeof(cmdline) - strlen(cmdline) - 1); strncat(cmdline, ",n", sizeof(cmdline) - strlen(cmdline) - 1);
} else { } else {
strncat(cmdline, "|m|", sizeof(cmdline) - strlen(cmdline) - 1); strncat(cmdline, ",m,", sizeof(cmdline) - strlen(cmdline) - 1);
strncat(cmdline, argv[3], sizeof(cmdline) - strlen(cmdline) - 1); strncat(cmdline, argv[3], sizeof(cmdline) - strlen(cmdline) - 1);
} }
} }
@ -924,12 +924,12 @@ static int meetme_cmd(int fd, int argc, char **argv)
return RESULT_SHOWUSAGE; return RESULT_SHOWUSAGE;
if (strcmp(argv[3], "all") == 0) { if (strcmp(argv[3], "all") == 0) {
/* Kick all */ /* Kick all */
strncat(cmdline, "|K", sizeof(cmdline) - strlen(cmdline) - 1); strncat(cmdline, ",K", sizeof(cmdline) - strlen(cmdline) - 1);
} else { } else {
/* Kick a single user */ /* Kick a single user */
strncat(cmdline, "|k|", sizeof(cmdline) - strlen(cmdline) - 1); strncat(cmdline, ",k,", sizeof(cmdline) - strlen(cmdline) - 1);
strncat(cmdline, argv[3], sizeof(cmdline) - strlen(cmdline) - 1); strncat(cmdline, argv[3], sizeof(cmdline) - strlen(cmdline) - 1);
} }
} else if(strcmp(argv[1], "list") == 0) { } else if(strcmp(argv[1], "list") == 0) {
int concise = ( 4 == argc && ( !strcasecmp(argv[3], "concise") ) ); int concise = ( 4 == argc && ( !strcasecmp(argv[3], "concise") ) );
/* List all the users in a conference */ /* List all the users in a conference */
@ -2450,7 +2450,7 @@ static struct ast_conference *find_conf(struct ast_channel *chan, char *confno,
if (!(parse = ast_strdupa(var->value))) if (!(parse = ast_strdupa(var->value)))
return NULL; return NULL;
AST_NONSTANDARD_APP_ARGS(args, parse, ','); AST_STANDARD_APP_ARGS(args, parse);
ast_log(LOG_NOTICE,"Will conf %s match %s?\n", confno, args.confno); ast_log(LOG_NOTICE,"Will conf %s match %s?\n", confno, args.confno);
if (!strcasecmp(args.confno, confno)) { if (!strcasecmp(args.confno, confno)) {
/* Bingo it's a valid conference */ /* Bingo it's a valid conference */
@ -3093,7 +3093,7 @@ static void *recordthread(void *args)
} }
ast_stopstream(cnf->lchan); ast_stopstream(cnf->lchan);
flags = O_CREAT|O_TRUNC|O_WRONLY; flags = O_CREAT | O_TRUNC | O_WRONLY;
cnf->recording = MEETME_RECORD_ACTIVE; cnf->recording = MEETME_RECORD_ACTIVE;
@ -3356,7 +3356,7 @@ static void *run_station(void *data)
trunk_ref->chan = NULL; trunk_ref->chan = NULL;
if (ast_atomic_dec_and_test((int *) &trunk_ref->trunk->active_stations) && if (ast_atomic_dec_and_test((int *) &trunk_ref->trunk->active_stations) &&
trunk_ref->state != SLA_TRUNK_STATE_ONHOLD_BYME) { trunk_ref->state != SLA_TRUNK_STATE_ONHOLD_BYME) {
strncat(conf_name, "|K", sizeof(conf_name) - strlen(conf_name) - 1); strncat(conf_name, ",K", sizeof(conf_name) - strlen(conf_name) - 1);
admin_exec(NULL, conf_name); admin_exec(NULL, conf_name);
trunk_ref->trunk->hold_stations = 0; trunk_ref->trunk->hold_stations = 0;
sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL); sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL);
@ -3374,7 +3374,7 @@ static void sla_stop_ringing_trunk(struct sla_ringing_trunk *ringing_trunk)
char buf[80]; char buf[80];
struct sla_station_ref *station_ref; struct sla_station_ref *station_ref;
snprintf(buf, sizeof(buf), "SLA_%s|K", ringing_trunk->trunk->name); snprintf(buf, sizeof(buf), "SLA_%s,K", ringing_trunk->trunk->name);
admin_exec(NULL, buf); admin_exec(NULL, buf);
sla_change_trunk_state(ringing_trunk->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL); sla_change_trunk_state(ringing_trunk->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL);
@ -4374,7 +4374,7 @@ static int sla_station_exec(struct ast_channel *chan, void *data)
trunk_ref->chan = NULL; trunk_ref->chan = NULL;
if (ast_atomic_dec_and_test((int *) &trunk_ref->trunk->active_stations) && if (ast_atomic_dec_and_test((int *) &trunk_ref->trunk->active_stations) &&
trunk_ref->state != SLA_TRUNK_STATE_ONHOLD_BYME) { trunk_ref->state != SLA_TRUNK_STATE_ONHOLD_BYME) {
strncat(conf_name, "|K", sizeof(conf_name) - strlen(conf_name) - 1); strncat(conf_name, ",K", sizeof(conf_name) - strlen(conf_name) - 1);
admin_exec(NULL, conf_name); admin_exec(NULL, conf_name);
trunk_ref->trunk->hold_stations = 0; trunk_ref->trunk->hold_stations = 0;
sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL); sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL);

@ -686,8 +686,8 @@ static int base_encode(char *filename, FILE *so)
if (n> 0) { if (n> 0) {
ogroup[0]= dtable[igroup[0]>>2]; ogroup[0]= dtable[igroup[0]>>2];
ogroup[1]= dtable[((igroup[0]&3)<<4)|(igroup[1]>>4)]; ogroup[1]= dtable[((igroup[0]&3)<<4) | (igroup[1]>>4)];
ogroup[2]= dtable[((igroup[1]&0xF)<<2)|(igroup[2]>>6)]; ogroup[2]= dtable[((igroup[1]&0xF)<<2) | (igroup[2]>>6)];
ogroup[3]= dtable[igroup[2]&0x3F]; ogroup[3]= dtable[igroup[2]&0x3F];
if (n<3) { if (n<3) {
@ -1650,7 +1650,7 @@ static int minivm_notify_exec(struct ast_channel *chan, void *data)
ast_log(LOG_ERROR, "Out of memory\n"); ast_log(LOG_ERROR, "Out of memory\n");
return -1; return -1;
} }
argc = ast_app_separate_args(tmpptr, '|', argv, sizeof(argv) / sizeof(argv[0])); argc = ast_app_separate_args(tmpptr, ',', argv, sizeof(argv) / sizeof(argv[0]));
if (argc == 2 && !ast_strlen_zero(argv[1])) if (argc == 2 && !ast_strlen_zero(argv[1]))
template = argv[1]; template = argv[1];
@ -1720,7 +1720,7 @@ static int minivm_record_exec(struct ast_channel *chan, void *data)
ast_log(LOG_ERROR, "Out of memory\n"); ast_log(LOG_ERROR, "Out of memory\n");
return -1; return -1;
} }
argc = ast_app_separate_args(tmp, '|', argv, sizeof(argv) / sizeof(argv[0])); argc = ast_app_separate_args(tmp, ',', argv, sizeof(argv) / sizeof(argv[0]));
if (argc == 2) { if (argc == 2) {
if (ast_app_parse_options(minivm_app_options, &flags, opts, argv[1])) { if (ast_app_parse_options(minivm_app_options, &flags, opts, argv[1])) {
return -1; return -1;
@ -1782,7 +1782,7 @@ static int minivm_greet_exec(struct ast_channel *chan, void *data)
ast_log(LOG_ERROR, "Out of memory\n"); ast_log(LOG_ERROR, "Out of memory\n");
return -1; return -1;
} }
argc = ast_app_separate_args(tmpptr, '|', argv, sizeof(argv) / sizeof(argv[0])); argc = ast_app_separate_args(tmpptr, ',', argv, sizeof(argv) / sizeof(argv[0]));
if (argc == 2) { if (argc == 2) {
if (ast_app_parse_options(minivm_app_options, &flags, opts, argv[1])) if (ast_app_parse_options(minivm_app_options, &flags, opts, argv[1]))
@ -2001,7 +2001,7 @@ static int minivm_accmess_exec(struct ast_channel *chan, void *data)
ast_log(LOG_ERROR, "Out of memory\n"); ast_log(LOG_ERROR, "Out of memory\n");
error = TRUE; error = TRUE;
} else } else
argc = ast_app_separate_args(tmpptr, '|', argv, sizeof(argv) / sizeof(argv[0])); argc = ast_app_separate_args(tmpptr, ',', argv, sizeof(argv) / sizeof(argv[0]));
} }
if (argc <=1) { if (argc <=1) {

@ -60,7 +60,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
static const char *app = "MixMonitor"; static const char *app = "MixMonitor";
static const char *synopsis = "Record a call and mix the audio during the recording"; static const char *synopsis = "Record a call and mix the audio during the recording";
static const char *desc = "" static const char *desc = ""
" MixMonitor(<file>.<ext>[|<options>[|<command>]])\n\n" " MixMonitor(<file>.<ext>[,<options>[,<command>]])\n\n"
"Records the audio on the current channel to the specified file.\n" "Records the audio on the current channel to the specified file.\n"
"If the filename is an absolute path, uses that path, otherwise\n" "If the filename is an absolute path, uses that path, otherwise\n"
"creates the file in the configured monitoring directory from\n" "creates the file in the configured monitoring directory from\n"

@ -57,7 +57,7 @@ static const char *app_page= "Page";
static const char *page_synopsis = "Pages phones"; static const char *page_synopsis = "Pages phones";
static const char *page_descrip = static const char *page_descrip =
"Page(Technology/Resource&Technology2/Resource2[|options])\n" "Page(Technology/Resource&Technology2/Resource2[,options])\n"
" Places outbound calls to the given technology / resource and dumps\n" " Places outbound calls to the given technology / resource and dumps\n"
"them into a conference bridge as muted participants. The original\n" "them into a conference bridge as muted participants. The original\n"
"caller is dumped into the conference as a speaker and the room is\n" "caller is dumped into the conference as a speaker and the room is\n"
@ -113,7 +113,7 @@ static int page_exec(struct ast_channel *chan, void *data)
if (options) if (options)
ast_app_parse_options(page_opts, &flags, opts, options); ast_app_parse_options(page_opts, &flags, opts, options);
snprintf(meetmeopts, sizeof(meetmeopts), "MeetMe|%ud|%s%sqxdw(5)", confid, (ast_test_flag(&flags, PAGE_DUPLEX) ? "" : "m"), snprintf(meetmeopts, sizeof(meetmeopts), "MeetMe,%ud,%s%sqxdw(5)", confid, (ast_test_flag(&flags, PAGE_DUPLEX) ? "" : "m"),
(ast_test_flag(&flags, PAGE_RECORD) ? "r" : "") ); (ast_test_flag(&flags, PAGE_RECORD) ? "r" : "") );
/* Go through parsing/calling each device */ /* Go through parsing/calling each device */
@ -165,7 +165,7 @@ static int page_exec(struct ast_channel *chan, void *data)
} }
if (!res) { if (!res) {
snprintf(meetmeopts, sizeof(meetmeopts), "%ud|A%s%sqxd", confid, (ast_test_flag(&flags, PAGE_DUPLEX) ? "" : "t"), snprintf(meetmeopts, sizeof(meetmeopts), "%ud,A%s%sqxd", confid, (ast_test_flag(&flags, PAGE_DUPLEX) ? "" : "t"),
(ast_test_flag(&flags, PAGE_RECORD) ? "r" : "") ); (ast_test_flag(&flags, PAGE_RECORD) ? "r" : "") );
pbx_exec(chan, app, meetmeopts); pbx_exec(chan, app, meetmeopts);
} }

@ -57,7 +57,7 @@ static char *app = "ParkAndAnnounce";
static char *synopsis = "Park and Announce"; static char *synopsis = "Park and Announce";
static char *descrip = static char *descrip =
" ParkAndAnnounce(announce:template|timeout|dial|[return_context]):\n" " ParkAndAnnounce(announce:template,timeout,dial[,return_context]):\n"
"Park a call into the parkinglot and announce the call to another channel.\n" "Park a call into the parkinglot and announce the call to another channel.\n"
"\n" "\n"
"announce template: Colon-separated list of files to announce. The word PARKED\n" "announce template: Colon-separated list of files to announce. The word PARKED\n"

@ -52,7 +52,7 @@ static char *app = "Playback";
static char *synopsis = "Play a file"; static char *synopsis = "Play a file";
static char *descrip = static char *descrip =
" Playback(filename[&filename2...][|option]): Plays back given filenames (do not put\n" " Playback(filename[&filename2...][,option]): Plays back given filenames (do not put\n"
"extension). Options may also be included following a pipe symbol. The 'skip'\n" "extension). Options may also be included following a pipe symbol. The 'skip'\n"
"option causes the playback of the message to be skipped if the channel\n" "option causes the playback of the message to be skipped if the channel\n"
"is not in the 'up' state (i.e. it hasn't been answered yet). If 'skip' is \n" "is not in the 'up' state (i.e. it hasn't been answered yet). If 'skip' is \n"

@ -54,7 +54,7 @@ static char *app = "PrivacyManager";
static char *synopsis = "Require phone number to be entered, if no CallerID sent"; static char *synopsis = "Require phone number to be entered, if no CallerID sent";
static char *descrip = static char *descrip =
" PrivacyManager([maxretries[|minlength[|options]]]): If no Caller*ID \n" " PrivacyManager([maxretries[,minlength[,options]]]): If no Caller*ID \n"
"is sent, PrivacyManager answers the channel and asks the caller to\n" "is sent, PrivacyManager answers the channel and asks the caller to\n"
"enter their phone number. The caller is given 3 attempts to do so.\n" "enter their phone number. The caller is given 3 attempts to do so.\n"
"The application does nothing if Caller*ID was received on the channel.\n" "The application does nothing if Caller*ID was received on the channel.\n"

@ -130,7 +130,7 @@ static char *app = "Queue";
static char *synopsis = "Queue a call for a call queue"; static char *synopsis = "Queue a call for a call queue";
static char *descrip = static char *descrip =
" Queue(queuename[|options[|URL][|announceoverride][|timeout][|AGI][|macro][|gosub]):\n" " Queue(queuename[,options[,URL][,announceoverride][,timeout][,AGI][,macro][,gosub]):\n"
"Queues an incoming call in a particular call queue as defined in queues.conf.\n" "Queues an incoming call in a particular call queue as defined in queues.conf.\n"
"This application will return to the dialplan if the queue does not exist, or\n" "This application will return to the dialplan if the queue does not exist, or\n"
"any of the join options cause the caller to not enter the queue.\n" "any of the join options cause the caller to not enter the queue.\n"
@ -167,33 +167,33 @@ static char *descrip =
static char *app_aqm = "AddQueueMember" ; static char *app_aqm = "AddQueueMember" ;
static char *app_aqm_synopsis = "Dynamically adds queue members" ; static char *app_aqm_synopsis = "Dynamically adds queue members" ;
static char *app_aqm_descrip = static char *app_aqm_descrip =
" AddQueueMember(queuename[|interface[|penalty[|options[|membername]]]]):\n" " AddQueueMember(queuename[,interface[,penalty[,options[,membername]]]]):\n"
"Dynamically adds interface to an existing queue.\n" "Dynamically adds interface to an existing queue.\n"
"If the interface is already in the queue it will return an error.\n" "If the interface is already in the queue it will return an error.\n"
" This application sets the following channel variable upon completion:\n" " This application sets the following channel variable upon completion:\n"
" AQMSTATUS The status of the attempt to add a queue member as a \n" " AQMSTATUS The status of the attempt to add a queue member as a \n"
" text string, one of\n" " text string, one of\n"
" ADDED | MEMBERALREADY | NOSUCHQUEUE \n" " ADDED | MEMBERALREADY | NOSUCHQUEUE \n"
"Example: AddQueueMember(techsupport|SIP/3000)\n" "Example: AddQueueMember(techsupport,SIP/3000)\n"
""; "";
static char *app_rqm = "RemoveQueueMember" ; static char *app_rqm = "RemoveQueueMember" ;
static char *app_rqm_synopsis = "Dynamically removes queue members" ; static char *app_rqm_synopsis = "Dynamically removes queue members" ;
static char *app_rqm_descrip = static char *app_rqm_descrip =
" RemoveQueueMember(queuename[|interface[|options]]):\n" " RemoveQueueMember(queuename[,interface[,options]]):\n"
"Dynamically removes interface to an existing queue\n" "Dynamically removes interface to an existing queue\n"
"If the interface is NOT in the queue it will return an error.\n" "If the interface is NOT in the queue it will return an error.\n"
" This application sets the following channel variable upon completion:\n" " This application sets the following channel variable upon completion:\n"
" RQMSTATUS The status of the attempt to remove a queue member as a\n" " RQMSTATUS The status of the attempt to remove a queue member as a\n"
" text string, one of\n" " text string, one of\n"
" REMOVED | NOTINQUEUE | NOSUCHQUEUE \n" " REMOVED | NOTINQUEUE | NOSUCHQUEUE \n"
"Example: RemoveQueueMember(techsupport|SIP/3000)\n" "Example: RemoveQueueMember(techsupport,SIP/3000)\n"
""; "";
static char *app_pqm = "PauseQueueMember" ; static char *app_pqm = "PauseQueueMember" ;
static char *app_pqm_synopsis = "Pauses a queue member" ; static char *app_pqm_synopsis = "Pauses a queue member" ;
static char *app_pqm_descrip = static char *app_pqm_descrip =
" PauseQueueMember([queuename]|interface[|options]):\n" " PauseQueueMember([queuename],interface[,options]):\n"
"Pauses (blocks calls for) a queue member.\n" "Pauses (blocks calls for) a queue member.\n"
"The given interface will be paused in the given queue. This prevents\n" "The given interface will be paused in the given queue. This prevents\n"
"any calls from being sent from the queue to the interface until it is\n" "any calls from being sent from the queue to the interface until it is\n"
@ -204,12 +204,12 @@ static char *app_pqm_descrip =
" PQMSTATUS The status of the attempt to pause a queue member as a\n" " PQMSTATUS The status of the attempt to pause a queue member as a\n"
" text string, one of\n" " text string, one of\n"
" PAUSED | NOTFOUND\n" " PAUSED | NOTFOUND\n"
"Example: PauseQueueMember(|SIP/3000)\n"; "Example: PauseQueueMember(,SIP/3000)\n";
static char *app_upqm = "UnpauseQueueMember" ; static char *app_upqm = "UnpauseQueueMember" ;
static char *app_upqm_synopsis = "Unpauses a queue member" ; static char *app_upqm_synopsis = "Unpauses a queue member" ;
static char *app_upqm_descrip = static char *app_upqm_descrip =
" UnpauseQueueMember([queuename]|interface[|options]):\n" " UnpauseQueueMember([queuename],interface[,options]):\n"
"Unpauses (resumes calls to) a queue member.\n" "Unpauses (resumes calls to) a queue member.\n"
"This is the counterpart to PauseQueueMember and operates exactly the\n" "This is the counterpart to PauseQueueMember and operates exactly the\n"
"same way, except it unpauses instead of pausing the given interface.\n" "same way, except it unpauses instead of pausing the given interface.\n"
@ -217,14 +217,14 @@ static char *app_upqm_descrip =
" UPQMSTATUS The status of the attempt to unpause a queue \n" " UPQMSTATUS The status of the attempt to unpause a queue \n"
" member as a text string, one of\n" " member as a text string, one of\n"
" UNPAUSED | NOTFOUND\n" " UNPAUSED | NOTFOUND\n"
"Example: UnpauseQueueMember(|SIP/3000)\n"; "Example: UnpauseQueueMember(,SIP/3000)\n";
static char *app_ql = "QueueLog" ; static char *app_ql = "QueueLog" ;
static char *app_ql_synopsis = "Writes to the queue_log" ; static char *app_ql_synopsis = "Writes to the queue_log" ;
static char *app_ql_descrip = static char *app_ql_descrip =
" QueueLog(queuename|uniqueid|agent|event[|additionalinfo]):\n" " QueueLog(queuename,uniqueid,agent,event[,additionalinfo]):\n"
"Allows you to write your own events into the queue log\n" "Allows you to write your own events into the queue log\n"
"Example: QueueLog(101|${UNIQUEID}|${AGENT}|WENTONBREAK|600)\n"; "Example: QueueLog(101,${UNIQUEID},${AGENT},WENTONBREAK,600)\n";
/*! \brief Persistent Members astdb family */ /*! \brief Persistent Members astdb family */
static const char *pm_family = "Queue/PersistentMembers"; static const char *pm_family = "Queue/PersistentMembers";

@ -62,7 +62,7 @@ static char *app = "Read";
static char *synopsis = "Read a variable"; static char *synopsis = "Read a variable";
static char *descrip = static char *descrip =
" Read(variable[|filename[&filename2...]][|maxdigits][|option][|attempts][|timeout])\n\n" " Read(variable[,filename[&filename2...]][,maxdigits][,option][,attempts][,timeout])\n\n"
"Reads a #-terminated string of digits a certain number of times from the\n" "Reads a #-terminated string of digits a certain number of times from the\n"
"user in to the given variable.\n" "user in to the given variable.\n"
" filename -- file(s) to play before reading digits or tone with option i\n" " filename -- file(s) to play before reading digits or tone with option i\n"
@ -142,7 +142,7 @@ static int read_exec(struct ast_channel *chan, void *data)
ast_verb(3, "Accepting a maximum of %d digits.\n", maxdigits); ast_verb(3, "Accepting a maximum of %d digits.\n", maxdigits);
} }
if (ast_strlen_zero(arglist.variable)) { if (ast_strlen_zero(arglist.variable)) {
ast_log(LOG_WARNING, "Invalid! Usage: Read(variable[|filename][|maxdigits][|option][|attempts][|timeout])\n\n"); ast_log(LOG_WARNING, "Invalid! Usage: Read(variable[,filename][,maxdigits][,option][,attempts][,timeout])\n\n");
return -1; return -1;
} }
ts=NULL; ts=NULL;

@ -51,7 +51,7 @@ static char *app = "Record";
static char *synopsis = "Record to a file"; static char *synopsis = "Record to a file";
static char *descrip = static char *descrip =
" Record(filename.format|silence[|maxduration][|options])\n\n" " Record(filename.format,silence[,maxduration][,options])\n\n"
"Records from the channel into a given filename. If the file exists it will\n" "Records from the channel into a given filename. If the file exists it will\n"
"be overwritten.\n" "be overwritten.\n"
"- 'format' is the format of the file type to be recorded (wav, gsm, etc).\n" "- 'format' is the format of the file type to be recorded (wav, gsm, etc).\n"

@ -252,7 +252,7 @@ static char *app = "Rpt";
static char *synopsis = "Radio Repeater/Remote Base Control System"; static char *synopsis = "Radio Repeater/Remote Base Control System";
static char *descrip = static char *descrip =
" Rpt(nodename[|options]): Radio Remote Link or Remote Base Link Endpoint Process.\n" " Rpt(nodename[,options]): Radio Remote Link or Remote Base Link Endpoint Process.\n"
"\n" "\n"
" Not specifying an option puts it in normal endpoint mode (where source\n" " Not specifying an option puts it in normal endpoint mode (where source\n"
" IP and nodename are verified).\n" " IP and nodename are verified).\n"
@ -263,7 +263,7 @@ static char *descrip =
" this if you have checked security already (like with an IAX2\n" " this if you have checked security already (like with an IAX2\n"
" user/password or something).\n" " user/password or something).\n"
"\n" "\n"
" Rannounce-string[|timeout[|timeout-destination]] - Amateur Radio\n" " Rannounce-string[,timeout[,timeout-destination]] - Amateur Radio\n"
" Reverse Autopatch. Caller is put on hold, and announcement (as\n" " Reverse Autopatch. Caller is put on hold, and announcement (as\n"
" specified by the 'announce-string') is played on radio system.\n" " specified by the 'announce-string') is played on radio system.\n"
" Users of radio system can access autopatch, dial specified\n" " Users of radio system can access autopatch, dial specified\n"

@ -49,7 +49,7 @@ static char *app_datetime = "DateTime";
static char *sayunixtime_synopsis = "Says a specified time in a custom format"; static char *sayunixtime_synopsis = "Says a specified time in a custom format";
static char *sayunixtime_descrip = static char *sayunixtime_descrip =
"SayUnixTime([unixtime][|[timezone][|format]])\n" "SayUnixTime([unixtime][,[timezone][,format]])\n"
" unixtime: time, in seconds since Jan 1, 1970. May be negative.\n" " unixtime: time, in seconds since Jan 1, 1970. May be negative.\n"
" defaults to now.\n" " defaults to now.\n"
" timezone: timezone, see /usr/share/zoneinfo for a list.\n" " timezone: timezone, see /usr/share/zoneinfo for a list.\n"
@ -57,7 +57,7 @@ static char *sayunixtime_descrip =
" format: a format the time is to be said in. See voicemail.conf.\n" " format: a format the time is to be said in. See voicemail.conf.\n"
" defaults to \"ABdY 'digits/at' IMp\"\n"; " defaults to \"ABdY 'digits/at' IMp\"\n";
static char *datetime_descrip = static char *datetime_descrip =
"DateTime([unixtime][|[timezone][|format]])\n" "DateTime([unixtime][,[timezone][,format]])\n"
" unixtime: time, in seconds since Jan 1, 1970. May be negative.\n" " unixtime: time, in seconds since Jan 1, 1970. May be negative.\n"
" defaults to now.\n" " defaults to now.\n"
" timezone: timezone, see /usr/share/zoneinfo for a list.\n" " timezone: timezone, see /usr/share/zoneinfo for a list.\n"
@ -69,9 +69,9 @@ static char *datetime_descrip =
static int sayunixtime_exec(struct ast_channel *chan, void *data) static int sayunixtime_exec(struct ast_channel *chan, void *data)
{ {
AST_DECLARE_APP_ARGS(args, AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(timeval); AST_APP_ARG(timeval);
AST_APP_ARG(timezone); AST_APP_ARG(timezone);
AST_APP_ARG(format); AST_APP_ARG(format);
); );
char *parse; char *parse;
int res = 0; int res = 0;

@ -50,35 +50,32 @@ static char *app = "SendDTMF";
static char *synopsis = "Sends arbitrary DTMF digits"; static char *synopsis = "Sends arbitrary DTMF digits";
static char *descrip = static char *descrip =
" SendDTMF(digits[|timeout_ms]): Sends DTMF digits on a channel. \n" " SendDTMF(digits[,timeout_ms]): Sends DTMF digits on a channel. \n"
" Accepted digits: 0-9, *#abcd, w (.5s pause)\n" " Accepted digits: 0-9, *#abcd, w (.5s pause)\n"
" The application will either pass the assigned digits or terminate if it\n" " The application will either pass the assigned digits or terminate if it\n"
" encounters an error.\n"; " encounters an error.\n";
static int senddtmf_exec(struct ast_channel *chan, void *data) static int senddtmf_exec(struct ast_channel *chan, void *vdata)
{ {
int res = 0; int res = 0;
char *digits = NULL, *to = NULL; char *data;
int timeout = 250; int timeout;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(digits);
AST_APP_ARG(timeout);
);
if (ast_strlen_zero(data)) { if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "SendDTMF requires an argument (digits or *#aAbBcCdD)\n"); ast_log(LOG_WARNING, "SendDTMF requires an argument (digits or *#aAbBcCdD)\n");
return 0; return 0;
} }
digits = ast_strdupa(data); data = ast_strdupa(vdata);
AST_STANDARD_APP_ARGS(args, data);
if ((to = strchr(digits,'|'))) { timeout = atoi(args.timeout);
*to = '\0'; res = ast_dtmf_stream(chan, NULL, args.digits, timeout <= 0 ? 250 : timeout);
to++;
timeout = atoi(to);
}
if (timeout <= 0)
timeout = 250;
res = ast_dtmf_stream(chan,NULL,digits,timeout);
return res; return res;
} }

@ -51,7 +51,7 @@ static const char *app = "SendText";
static const char *synopsis = "Send a Text Message"; static const char *synopsis = "Send a Text Message";
static const char *descrip = static const char *descrip =
" SendText(text[|options]): Sends text to current channel (callee).\n" " SendText(text[,options]): Sends text to current channel (callee).\n"
"Result of transmission will be stored in the SENDTEXTSTATUS\n" "Result of transmission will be stored in the SENDTEXTSTATUS\n"
"channel variable:\n" "channel variable:\n"
" SUCCESS Transmission succeeded\n" " SUCCESS Transmission succeeded\n"
@ -71,7 +71,7 @@ static int sendtext_exec(struct ast_channel *chan, void *data)
); );
if (ast_strlen_zero(data)) { if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "SendText requires an argument (text[|options])\n"); ast_log(LOG_WARNING, "SendText requires an argument (text[,options])\n");
return -1; return -1;
} else } else
parse = ast_strdupa(data); parse = ast_strdupa(data);

@ -78,7 +78,7 @@ static char *app = "SMS";
static char *synopsis = "Communicates with SMS service centres and SMS capable analogue phones"; static char *synopsis = "Communicates with SMS service centres and SMS capable analogue phones";
static char *descrip = static char *descrip =
" SMS(name|[a][s][t][p(d)][r][o]|addr|body):\n" " SMS(name,[a][s][t][p(d)][r][o],addr,body):\n"
"SMS handles exchange of SMS data with a call to/from SMS capable\n" "SMS handles exchange of SMS data with a call to/from SMS capable\n"
"phone or SMS PSTN service center. Can send and/or receive SMS messages.\n" "phone or SMS PSTN service center. Can send and/or receive SMS messages.\n"
"Works to ETSI ES 201 912; compatible with BT SMS PSTN service in UK\n" "Works to ETSI ES 201 912; compatible with BT SMS PSTN service in UK\n"

@ -59,7 +59,7 @@ static char *speechstart_descrip =
"Tell the speech recognition engine that it should start trying to get results from audio being fed to it. This has no arguments.\n"; "Tell the speech recognition engine that it should start trying to get results from audio being fed to it. This has no arguments.\n";
static char *speechbackground_descrip = static char *speechbackground_descrip =
"SpeechBackground(Sound File|Timeout)\n" "SpeechBackground(Sound File,Timeout)\n"
"This application plays a sound file and waits for the person to speak. Once they start speaking playback of the file stops, and silence is heard.\n" "This application plays a sound file and waits for the person to speak. Once they start speaking playback of the file stops, and silence is heard.\n"
"Once they stop talking the processing sound is played to indicate the speech recognition engine is working.\n" "Once they stop talking the processing sound is played to indicate the speech recognition engine is working.\n"
"Once results are available the application returns and results (score and text) are available using dialplan functions.\n" "Once results are available the application returns and results (score and text) are available using dialplan functions.\n"
@ -82,7 +82,7 @@ static char *speechdestroy_descrip =
"again before calling any other application. It takes no arguments.\n"; "again before calling any other application. It takes no arguments.\n";
static char *speechload_descrip = static char *speechload_descrip =
"SpeechLoadGrammar(Grammar Name|Path)\n" "SpeechLoadGrammar(Grammar Name,Path)\n"
"Load a grammar only on the channel, not globally.\n" "Load a grammar only on the channel, not globally.\n"
"It takes the grammar name as first argument and path as second.\n"; "It takes the grammar name as first argument and path as second.\n";
@ -365,59 +365,60 @@ static int speech_create(struct ast_channel *chan, void *data)
return 0; return 0;
} }
/*! \brief SpeechLoadGrammar(Grammar Name|Path) Dialplan Application */ /*! \brief SpeechLoadGrammar(Grammar Name,Path) Dialplan Application */
static int speech_load(struct ast_channel *chan, void *data) static int speech_load(struct ast_channel *chan, void *vdata)
{ {
int res = 0, argc = 0; int res = 0;
struct ast_speech *speech = find_speech(chan); struct ast_speech *speech = find_speech(chan);
char *argv[2], *args = NULL, *name = NULL, *path = NULL; char *data;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(grammar);
AST_APP_ARG(path);
);
args = ast_strdupa(data); data = ast_strdupa(vdata);
AST_STANDARD_APP_ARGS(args, data);
if (speech == NULL) if (speech == NULL)
return -1; return -1;
/* Parse out arguments */ if (args.argc != 2)
argc = ast_app_separate_args(args, '|', argv, sizeof(argv) / sizeof(argv[0]));
if (argc != 2)
return -1; return -1;
name = argv[0];
path = argv[1];
/* Load the grammar locally on the object */ /* Load the grammar locally on the object */
res = ast_speech_grammar_load(speech, name, path); res = ast_speech_grammar_load(speech, args.grammar, args.path);
return res; return res;
} }
/*! \brief SpeechUnloadGrammar(Grammar Name) Dialplan Application */ /*! \brief SpeechUnloadGrammar(Grammar Name) Dialplan Application */
static int speech_unload(struct ast_channel *chan, void *data) static int speech_unload(struct ast_channel *chan, void *data)
{ {
int res = 0; int res = 0;
struct ast_speech *speech = find_speech(chan); struct ast_speech *speech = find_speech(chan);
if (speech == NULL) if (speech == NULL)
return -1; return -1;
/* Unload the grammar */ /* Unload the grammar */
res = ast_speech_grammar_unload(speech, data); res = ast_speech_grammar_unload(speech, data);
return res; return res;
} }
/*! \brief SpeechDeactivateGrammar(Grammar Name) Dialplan Application */ /*! \brief SpeechDeactivateGrammar(Grammar Name) Dialplan Application */
static int speech_deactivate(struct ast_channel *chan, void *data) static int speech_deactivate(struct ast_channel *chan, void *data)
{ {
int res = 0; int res = 0;
struct ast_speech *speech = find_speech(chan); struct ast_speech *speech = find_speech(chan);
if (speech == NULL) if (speech == NULL)
return -1; return -1;
/* Deactivate the grammar on the speech object */ /* Deactivate the grammar on the speech object */
res = ast_speech_grammar_deactivate(speech, data); res = ast_speech_grammar_deactivate(speech, data);
return res; return res;
} }
/*! \brief SpeechActivateGrammar(Grammar Name) Dialplan Application */ /*! \brief SpeechActivateGrammar(Grammar Name) Dialplan Application */
@ -452,11 +453,11 @@ static int speech_start(struct ast_channel *chan, void *data)
/*! \brief SpeechProcessingSound(Sound File) Dialplan Application */ /*! \brief SpeechProcessingSound(Sound File) Dialplan Application */
static int speech_processing_sound(struct ast_channel *chan, void *data) static int speech_processing_sound(struct ast_channel *chan, void *data)
{ {
int res = 0; int res = 0;
struct ast_speech *speech = find_speech(chan); struct ast_speech *speech = find_speech(chan);
if (speech == NULL) if (speech == NULL)
return -1; return -1;
if (speech->processing_sound != NULL) { if (speech->processing_sound != NULL) {
ast_free(speech->processing_sound); ast_free(speech->processing_sound);
@ -465,13 +466,13 @@ static int speech_processing_sound(struct ast_channel *chan, void *data)
speech->processing_sound = ast_strdup(data); speech->processing_sound = ast_strdup(data);
return res; return res;
} }
/*! \brief Helper function used by speech_background to playback a soundfile */ /*! \brief Helper function used by speech_background to playback a soundfile */
static int speech_streamfile(struct ast_channel *chan, const char *filename, const char *preflang) static int speech_streamfile(struct ast_channel *chan, const char *filename, const char *preflang)
{ {
struct ast_filestream *fs = NULL; struct ast_filestream *fs = NULL;
if (!(fs = ast_openstream(chan, filename, preflang))) if (!(fs = ast_openstream(chan, filename, preflang)))
return -1; return -1;
@ -481,50 +482,53 @@ static int speech_streamfile(struct ast_channel *chan, const char *filename, con
ast_playstream(fs); ast_playstream(fs);
return 0; return 0;
} }
/*! \brief SpeechBackground(Sound File|Timeout) Dialplan Application */ /*! \brief SpeechBackground(Sound File,Timeout) Dialplan Application */
static int speech_background(struct ast_channel *chan, void *data) static int speech_background(struct ast_channel *chan, void *data)
{ {
unsigned int timeout = 0; unsigned int timeout = 0;
int res = 0, done = 0, argc = 0, started = 0, quieted = 0, max_dtmf_len = 0; int res = 0, done = 0, started = 0, quieted = 0, max_dtmf_len = 0;
struct ast_speech *speech = find_speech(chan); struct ast_speech *speech = find_speech(chan);
struct ast_frame *f = NULL; struct ast_frame *f = NULL;
int oldreadformat = AST_FORMAT_SLINEAR; int oldreadformat = AST_FORMAT_SLINEAR;
char dtmf[AST_MAX_EXTENSION] = ""; char dtmf[AST_MAX_EXTENSION] = "";
time_t start, current; time_t start, current;
struct ast_datastore *datastore = NULL; struct ast_datastore *datastore = NULL;
char *argv[2], *args = NULL, *filename_tmp = NULL, *filename = NULL, tmp[2] = "", dtmf_terminator = '#'; char *parse, *filename_tmp = NULL, *filename = NULL, tmp[2] = "", dtmf_terminator = '#';
const char *tmp2 = NULL; const char *tmp2 = NULL;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(soundfile);
AST_APP_ARG(timeout);
);
args = ast_strdupa(data); parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
if (speech == NULL) if (speech == NULL)
return -1; return -1;
/* If channel is not already answered, then answer it */ /* If channel is not already answered, then answer it */
if (chan->_state != AST_STATE_UP && ast_answer(chan)) if (chan->_state != AST_STATE_UP && ast_answer(chan))
return -1; return -1;
/* Record old read format */ /* Record old read format */
oldreadformat = chan->readformat; oldreadformat = chan->readformat;
/* Change read format to be signed linear */ /* Change read format to be signed linear */
if (ast_set_read_format(chan, speech->format)) if (ast_set_read_format(chan, speech->format))
return -1; return -1;
/* Parse out options */ if (!ast_strlen_zero(args.soundfile)) {
argc = ast_app_separate_args(args, '|', argv, sizeof(argv) / sizeof(argv[0])); /* Yay sound file */
if (argc > 0) { filename_tmp = ast_strdupa(args.soundfile);
/* Yay sound file */ if (!ast_strlen_zero(args.timeout)) {
filename_tmp = ast_strdupa(argv[0]); if ((timeout = atoi(args.timeout)) == 0)
if (!ast_strlen_zero(argv[1])) {
if ((timeout = atoi(argv[1])) == 0)
timeout = -1; timeout = -1;
} else } else
timeout = 0; timeout = 0;
} }
/* See if the maximum DTMF length variable is set... we use a variable in case they want to carry it through their entire dialplan */ /* See if the maximum DTMF length variable is set... we use a variable in case they want to carry it through their entire dialplan */
if ((tmp2 = pbx_builtin_getvar_helper(chan, "SPEECH_DTMF_MAXLEN")) && !ast_strlen_zero(tmp2)) if ((tmp2 = pbx_builtin_getvar_helper(chan, "SPEECH_DTMF_MAXLEN")) && !ast_strlen_zero(tmp2))
@ -538,17 +542,17 @@ static int speech_background(struct ast_channel *chan, void *data)
dtmf_terminator = tmp2[0]; dtmf_terminator = tmp2[0];
} }
/* Before we go into waiting for stuff... make sure the structure is ready, if not - start it again */ /* Before we go into waiting for stuff... make sure the structure is ready, if not - start it again */
if (speech->state == AST_SPEECH_STATE_NOT_READY || speech->state == AST_SPEECH_STATE_DONE) { if (speech->state == AST_SPEECH_STATE_NOT_READY || speech->state == AST_SPEECH_STATE_DONE) {
ast_speech_change_state(speech, AST_SPEECH_STATE_NOT_READY); ast_speech_change_state(speech, AST_SPEECH_STATE_NOT_READY);
ast_speech_start(speech); ast_speech_start(speech);
} }
/* Ensure no streams are currently running */ /* Ensure no streams are currently running */
ast_stopstream(chan); ast_stopstream(chan);
/* Okay it's streaming so go into a loop grabbing frames! */ /* Okay it's streaming so go into a loop grabbing frames! */
while (done == 0) { while (done == 0) {
/* If the filename is null and stream is not running, start up a new sound file */ /* If the filename is null and stream is not running, start up a new sound file */
if (!quieted && (chan->streamid == -1 && chan->timingfunc == NULL) && (filename = strsep(&filename_tmp, "&"))) { if (!quieted && (chan->streamid == -1 && chan->timingfunc == NULL) && (filename = strsep(&filename_tmp, "&"))) {
/* Discard old stream information */ /* Discard old stream information */
@ -557,24 +561,23 @@ static int speech_background(struct ast_channel *chan, void *data)
speech_streamfile(chan, filename, chan->language); speech_streamfile(chan, filename, chan->language);
} }
/* Run scheduled stuff */ /* Run scheduled stuff */
ast_sched_runq(chan->sched); ast_sched_runq(chan->sched);
/* Yay scheduling */ /* Yay scheduling */
res = ast_sched_wait(chan->sched); res = ast_sched_wait(chan->sched);
if (res < 0) { if (res < 0)
res = 1000; res = 1000;
}
/* If there is a frame waiting, get it - if not - oh well */
/* If there is a frame waiting, get it - if not - oh well */ if (ast_waitfor(chan, res) > 0) {
if (ast_waitfor(chan, res) > 0) { f = ast_read(chan);
f = ast_read(chan); if (f == NULL) {
if (f == NULL) { /* The channel has hung up most likely */
/* The channel has hung up most likely */ done = 3;
done = 3; break;
break; }
} }
}
/* Do timeout check (shared between audio/dtmf) */ /* Do timeout check (shared between audio/dtmf) */
if ((!quieted || strlen(dtmf)) && started == 1) { if ((!quieted || strlen(dtmf)) && started == 1) {
@ -587,21 +590,21 @@ static int speech_background(struct ast_channel *chan, void *data)
} }
} }
/* Do checks on speech structure to see if it's changed */ /* Do checks on speech structure to see if it's changed */
ast_mutex_lock(&speech->lock); ast_mutex_lock(&speech->lock);
if (ast_test_flag(speech, AST_SPEECH_QUIET)) { if (ast_test_flag(speech, AST_SPEECH_QUIET)) {
if (chan->stream) if (chan->stream)
ast_stopstream(chan); ast_stopstream(chan);
ast_clear_flag(speech, AST_SPEECH_QUIET); ast_clear_flag(speech, AST_SPEECH_QUIET);
quieted = 1; quieted = 1;
} }
/* Check state so we can see what to do */ /* Check state so we can see what to do */
switch (speech->state) { switch (speech->state) {
case AST_SPEECH_STATE_READY: case AST_SPEECH_STATE_READY:
/* If audio playback has stopped do a check for timeout purposes */ /* If audio playback has stopped do a check for timeout purposes */
if (chan->streamid == -1 && chan->timingfunc == NULL) if (chan->streamid == -1 && chan->timingfunc == NULL)
ast_stopstream(chan); ast_stopstream(chan);
if (!quieted && chan->stream == NULL && timeout && started == 0 && !filename_tmp) { if (!quieted && chan->stream == NULL && timeout && started == 0 && !filename_tmp) {
if (timeout == -1) { if (timeout == -1) {
done = 1; done = 1;
if (f) if (f)
@ -610,14 +613,14 @@ static int speech_background(struct ast_channel *chan, void *data)
} }
time(&start); time(&start);
started = 1; started = 1;
} }
/* Write audio frame out to speech engine if no DTMF has been received */ /* Write audio frame out to speech engine if no DTMF has been received */
if (!strlen(dtmf) && f != NULL && f->frametype == AST_FRAME_VOICE) { if (!strlen(dtmf) && f != NULL && f->frametype == AST_FRAME_VOICE) {
ast_speech_write(speech, f->data, f->datalen); ast_speech_write(speech, f->data, f->datalen);
} }
break; break;
case AST_SPEECH_STATE_WAIT: case AST_SPEECH_STATE_WAIT:
/* Cue up waiting sound if not already playing */ /* Cue up waiting sound if not already playing */
if (!strlen(dtmf)) { if (!strlen(dtmf)) {
if (chan->stream == NULL) { if (chan->stream == NULL) {
if (speech->processing_sound != NULL) { if (speech->processing_sound != NULL) {
@ -634,8 +637,8 @@ static int speech_background(struct ast_channel *chan, void *data)
} }
} }
} }
break; break;
case AST_SPEECH_STATE_DONE: case AST_SPEECH_STATE_DONE:
/* Now that we are done... let's switch back to not ready state */ /* Now that we are done... let's switch back to not ready state */
ast_speech_change_state(speech, AST_SPEECH_STATE_NOT_READY); ast_speech_change_state(speech, AST_SPEECH_STATE_NOT_READY);
if (!strlen(dtmf)) { if (!strlen(dtmf)) {
@ -648,17 +651,17 @@ static int speech_background(struct ast_channel *chan, void *data)
ast_stopstream(chan); ast_stopstream(chan);
} }
} }
break; break;
default: default:
break; break;
} }
ast_mutex_unlock(&speech->lock); ast_mutex_unlock(&speech->lock);
/* Deal with other frame types */ /* Deal with other frame types */
if (f != NULL) { if (f != NULL) {
/* Free the frame we received */ /* Free the frame we received */
switch (f->frametype) { switch (f->frametype) {
case AST_FRAME_DTMF: case AST_FRAME_DTMF:
if (dtmf_terminator != '\0' && f->subclass == dtmf_terminator) { if (dtmf_terminator != '\0' && f->subclass == dtmf_terminator) {
done = 1; done = 1;
} else { } else {
@ -677,24 +680,24 @@ static int speech_background(struct ast_channel *chan, void *data)
if (max_dtmf_len && strlen(dtmf) == max_dtmf_len) if (max_dtmf_len && strlen(dtmf) == max_dtmf_len)
done = 1; done = 1;
} }
break; break;
case AST_FRAME_CONTROL: case AST_FRAME_CONTROL:
switch (f->subclass) { switch (f->subclass) {
case AST_CONTROL_HANGUP: case AST_CONTROL_HANGUP:
/* Since they hung up we should destroy the speech structure */ /* Since they hung up we should destroy the speech structure */
done = 3; done = 3;
default: default:
break; break;
} }
default: default:
break; break;
} }
ast_frfree(f); ast_frfree(f);
f = NULL; f = NULL;
} }
} }
if (strlen(dtmf)) { if (!ast_strlen_zero(dtmf)) {
/* We sort of make a results entry */ /* We sort of make a results entry */
speech->results = ast_calloc(1, sizeof(*speech->results)); speech->results = ast_calloc(1, sizeof(*speech->results));
if (speech->results != NULL) { if (speech->results != NULL) {
@ -704,20 +707,19 @@ static int speech_background(struct ast_channel *chan, void *data)
} }
} }
/* See if it was because they hung up */ /* See if it was because they hung up */
if (done == 3) { if (done == 3) {
/* Destroy speech structure */ /* Destroy speech structure */
ast_speech_destroy(speech); ast_speech_destroy(speech);
datastore = ast_channel_datastore_find(chan, &speech_datastore, NULL); datastore = ast_channel_datastore_find(chan, &speech_datastore, NULL);
if (datastore != NULL) { if (datastore != NULL)
ast_channel_datastore_remove(chan, datastore); ast_channel_datastore_remove(chan, datastore);
} } else {
} else { /* Channel is okay so restore read format */
/* Channel is okay so restore read format */ ast_set_read_format(chan, oldreadformat);
ast_set_read_format(chan, oldreadformat); }
}
return 0; return 0;
} }
@ -750,7 +752,7 @@ static int unload_module(void)
res |= ast_unregister_application("SpeechLoadGrammar"); res |= ast_unregister_application("SpeechLoadGrammar");
res |= ast_unregister_application("SpeechUnloadGrammar"); res |= ast_unregister_application("SpeechUnloadGrammar");
res |= ast_unregister_application("SpeechActivateGrammar"); res |= ast_unregister_application("SpeechActivateGrammar");
res |= ast_unregister_application("SpeechDeactivateGrammar"); res |= ast_unregister_application("SpeechDeactivateGrammar");
res |= ast_unregister_application("SpeechStart"); res |= ast_unregister_application("SpeechStart");
res |= ast_unregister_application("SpeechBackground"); res |= ast_unregister_application("SpeechBackground");
res |= ast_unregister_application("SpeechDestroy"); res |= ast_unregister_application("SpeechDestroy");
@ -773,7 +775,7 @@ static int load_module(void)
res |= ast_register_application("SpeechLoadGrammar", speech_load, "Load a Grammar", speechload_descrip); res |= ast_register_application("SpeechLoadGrammar", speech_load, "Load a Grammar", speechload_descrip);
res |= ast_register_application("SpeechUnloadGrammar", speech_unload, "Unload a Grammar", speechunload_descrip); res |= ast_register_application("SpeechUnloadGrammar", speech_unload, "Unload a Grammar", speechunload_descrip);
res |= ast_register_application("SpeechActivateGrammar", speech_activate, "Activate a Grammar", speechactivategrammar_descrip); res |= ast_register_application("SpeechActivateGrammar", speech_activate, "Activate a Grammar", speechactivategrammar_descrip);
res |= ast_register_application("SpeechDeactivateGrammar", speech_deactivate, "Deactivate a Grammar", speechdeactivategrammar_descrip); res |= ast_register_application("SpeechDeactivateGrammar", speech_deactivate, "Deactivate a Grammar", speechdeactivategrammar_descrip);
res |= ast_register_application("SpeechStart", speech_start, "Start recognizing voice in the audio stream", speechstart_descrip); res |= ast_register_application("SpeechStart", speech_start, "Start recognizing voice in the audio stream", speechstart_descrip);
res |= ast_register_application("SpeechBackground", speech_background, "Play a sound file and wait for speech to be recognized", speechbackground_descrip); res |= ast_register_application("SpeechBackground", speech_background, "Play a sound file and wait for speech to be recognized", speechbackground_descrip);
res |= ast_register_application("SpeechDestroy", speech_destroy, "End speech recognition", speechdestroy_descrip); res |= ast_register_application("SpeechDestroy", speech_destroy, "End speech recognition", speechdestroy_descrip);

@ -55,10 +55,10 @@ static const char *return_synopsis = "Return from gosub routine";
static const char *pop_synopsis = "Remove one address from gosub stack"; static const char *pop_synopsis = "Remove one address from gosub stack";
static const char *gosub_descrip = static const char *gosub_descrip =
"Gosub([[context|]exten|]priority[(arg1[|...][|argN])])\n" "Gosub([[context,]exten,]priority[(arg1[,...][,argN])])\n"
" Jumps to the label specified, saving the return address.\n"; " Jumps to the label specified, saving the return address.\n";
static const char *gosubif_descrip = static const char *gosubif_descrip =
"GosubIf(condition?labeliftrue[(arg1[|...])][:labeliffalse[(arg1[|...])]])\n" "GosubIf(condition?labeliftrue[(arg1[,...])][:labeliffalse[(arg1[,...])]])\n"
" If the condition is true, then jump to labeliftrue. If false, jumps to\n" " If the condition is true, then jump to labeliftrue. If false, jumps to\n"
"labeliffalse, if specified. In either case, a jump saves the return point\n" "labeliffalse, if specified. In either case, a jump saves the return point\n"
"in the dialplan, to be returned to with a Return.\n"; "in the dialplan, to be returned to with a Return.\n";

@ -50,7 +50,7 @@ static char *app = "BackgroundDetect";
static char *synopsis = "Background a file with talk detect"; static char *synopsis = "Background a file with talk detect";
static char *descrip = static char *descrip =
" BackgroundDetect(filename[|sil[|min|[max]]]): Plays back a given\n" " BackgroundDetect(filename[,sil[,min,[max]]]): Plays back a given\n"
"filename, waiting for interruption from a given digit (the digit must\n" "filename, waiting for interruption from a given digit (the digit must\n"
"start the beginning of a valid extension, or it will be ignored).\n" "start the beginning of a valid extension, or it will be ignored).\n"
"During the playback of the file, audio is monitored in the receive\n" "During the playback of the file, audio is monitored in the receive\n"

@ -51,7 +51,7 @@ static const char *app = "Transfer";
static const char *synopsis = "Transfer caller to remote extension"; static const char *synopsis = "Transfer caller to remote extension";
static const char *descrip = static const char *descrip =
" Transfer([Tech/]dest[|options]): Requests the remote caller be transferred\n" " Transfer([Tech/]dest[,options]): Requests the remote caller be transferred\n"
"to a given destination. If TECH (SIP, IAX2, LOCAL etc) is used, only\n" "to a given destination. If TECH (SIP, IAX2, LOCAL etc) is used, only\n"
"an incoming call with the same channel technology will be transfered.\n" "an incoming call with the same channel technology will be transfered.\n"
"Note that for SIP, if you transfer before call is setup, a 302 redirect\n" "Note that for SIP, if you transfer before call is setup, a 302 redirect\n"
@ -77,7 +77,7 @@ static int transfer_exec(struct ast_channel *chan, void *data)
); );
if (ast_strlen_zero((char *)data)) { if (ast_strlen_zero((char *)data)) {
ast_log(LOG_WARNING, "Transfer requires an argument ([Tech/]destination[|options])\n"); ast_log(LOG_WARNING, "Transfer requires an argument ([Tech/]destination[,options])\n");
pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "FAILURE"); pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "FAILURE");
return 0; return 0;
} else } else

@ -49,7 +49,7 @@ static char *app = "SendURL";
static char *synopsis = "Send a URL"; static char *synopsis = "Send a URL";
static char *descrip = static char *descrip =
" SendURL(URL[|option]): Requests client go to URL (IAX2) or sends the \n" " SendURL(URL[,option]): Requests client go to URL (IAX2) or sends the \n"
"URL to the client (other channels).\n" "URL to the client (other channels).\n"
"Result is returned in the SENDURLSTATUS channel variable:\n" "Result is returned in the SENDURLSTATUS channel variable:\n"
" SUCCESS URL successfully sent to client\n" " SUCCESS URL successfully sent to client\n"

@ -44,7 +44,7 @@ static char *app = "UserEvent";
static char *synopsis = "Send an arbitrary event to the manager interface"; static char *synopsis = "Send an arbitrary event to the manager interface";
static char *descrip = static char *descrip =
" UserEvent(eventname[|body]): Sends an arbitrary event to the manager\n" " UserEvent(eventname[,body]): Sends an arbitrary event to the manager\n"
"interface, with an optional body representing additional arguments. The\n" "interface, with an optional body representing additional arguments. The\n"
"body may be specified as a | delimeted list of headers. Each additional\n" "body may be specified as a | delimeted list of headers. Each additional\n"
"argument will be placed on a new line in the event. The format of the\n" "argument will be placed on a new line in the event. The format of the\n"
@ -65,7 +65,7 @@ static int userevent_exec(struct ast_channel *chan, void *data)
); );
if (ast_strlen_zero(data)) { if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "UserEvent requires an argument (eventname|optional event body)\n"); ast_log(LOG_WARNING, "UserEvent requires an argument (eventname,optional event body)\n");
return -1; return -1;
} }

@ -478,7 +478,7 @@ static char *addesc = "Comedian Mail";
static char *synopsis_vm = "Leave a Voicemail message"; static char *synopsis_vm = "Leave a Voicemail message";
static char *descrip_vm = static char *descrip_vm =
" VoiceMail(mailbox[@context][&mailbox[@context]][...][|options]): This\n" " VoiceMail(mailbox[@context][&mailbox[@context]][...][,options]): This\n"
"application allows the calling party to leave a message for the specified\n" "application allows the calling party to leave a message for the specified\n"
"list of mailboxes. When multiple mailboxes are specified, the greeting will\n" "list of mailboxes. When multiple mailboxes are specified, the greeting will\n"
"be taken from the first mailbox specified. Dialplan execution will stop if the\n" "be taken from the first mailbox specified. Dialplan execution will stop if the\n"
@ -502,7 +502,7 @@ static char *descrip_vm =
static char *synopsis_vmain = "Check Voicemail messages"; static char *synopsis_vmain = "Check Voicemail messages";
static char *descrip_vmain = static char *descrip_vmain =
" VoiceMailMain([mailbox][@context][|options]): This application allows the\n" " VoiceMailMain([mailbox][@context][,options]): This application allows the\n"
"calling party to check voicemail messages. A specific mailbox, and optional\n" "calling party to check voicemail messages. A specific mailbox, and optional\n"
"corresponding context, may be specified. If a mailbox is not provided, the\n" "corresponding context, may be specified. If a mailbox is not provided, the\n"
"calling party will be prompted to enter one. If a context is not specified,\n" "calling party will be prompted to enter one. If a context is not specified,\n"
@ -520,7 +520,7 @@ static char *synopsis_vm_box_exists =
"Check to see if Voicemail mailbox exists"; "Check to see if Voicemail mailbox exists";
static char *descrip_vm_box_exists = static char *descrip_vm_box_exists =
" MailboxExists(mailbox[@context][|options]): Check to see if the specified\n" " MailboxExists(mailbox[@context][,options]): Check to see if the specified\n"
"mailbox exists. If no voicemail context is specified, the 'default' context\n" "mailbox exists. If no voicemail context is specified, the 'default' context\n"
"will be used.\n" "will be used.\n"
" This application will set the following channel variable upon completion:\n" " This application will set the following channel variable upon completion:\n"
@ -532,7 +532,7 @@ static char *descrip_vm_box_exists =
static char *synopsis_vmauthenticate = "Authenticate with Voicemail passwords"; static char *synopsis_vmauthenticate = "Authenticate with Voicemail passwords";
static char *descrip_vmauthenticate = static char *descrip_vmauthenticate =
" VMAuthenticate([mailbox][@context][|options]): This application behaves the\n" " VMAuthenticate([mailbox][@context][,options]): This application behaves the\n"
"same way as the Authenticate application, but the passwords are taken from\n" "same way as the Authenticate application, but the passwords are taken from\n"
"voicemail.conf.\n" "voicemail.conf.\n"
" If the mailbox is specified, only that mailbox's password will be considered\n" " If the mailbox is specified, only that mailbox's password will be considered\n"

@ -52,7 +52,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
static char *app = "WaitForSilence"; static char *app = "WaitForSilence";
static char *synopsis = "Waits for a specified amount of silence"; static char *synopsis = "Waits for a specified amount of silence";
static char *descrip = static char *descrip =
" WaitForSilence(silencerequired[|iterations][|timeout]) \n" " WaitForSilence(silencerequired[,iterations][,timeout]) \n"
"Wait for Silence: Waits for up to 'silencerequired' \n" "Wait for Silence: Waits for up to 'silencerequired' \n"
"milliseconds of silence, 'iterations' times or once if omitted.\n" "milliseconds of silence, 'iterations' times or once if omitted.\n"
"An optional timeout specified the number of seconds to return\n" "An optional timeout specified the number of seconds to return\n"
@ -67,9 +67,9 @@ static char *descrip =
"include two or more calls to WaitForSilence when dealing with an answering\n" "include two or more calls to WaitForSilence when dealing with an answering\n"
"machine; first waiting for the spiel to finish, then waiting for the beep, etc.\n\n" "machine; first waiting for the spiel to finish, then waiting for the beep, etc.\n\n"
"Examples:\n" "Examples:\n"
" - WaitForSilence(500|2) will wait for 1/2 second of silence, twice\n" " - WaitForSilence(500,2) will wait for 1/2 second of silence, twice\n"
" - WaitForSilence(1000) will wait for 1 second of silence, once\n" " - WaitForSilence(1000) will wait for 1 second of silence, once\n"
" - WaitForSilence(300|3|10) will wait for 300ms silence, 3 times,\n" " - WaitForSilence(300,3,10) will wait for 300ms silence, 3 times,\n"
" and returns after 10 sec, even if silence is not detected\n\n" " and returns after 10 sec, even if silence is not detected\n\n"
"Sets the channel variable WAITSTATUS with to one of these values:\n" "Sets the channel variable WAITSTATUS with to one of these values:\n"
"SILENCE - if exited with silence detected\n" "SILENCE - if exited with silence detected\n"
@ -163,7 +163,7 @@ static int waitforsilence_exec(struct ast_channel *chan, void *data)
res = ast_answer(chan); /* Answer the channel */ res = ast_answer(chan); /* Answer the channel */
if (!data || ( (sscanf(data, "%d|%d|%d", &silencereqd, &iterations, &timeout) != 3) && if (!data || ( (sscanf(data, "%d,%d,%d", &silencereqd, &iterations, &timeout) != 3) &&
(sscanf(data, "%d|%d", &silencereqd, &iterations) != 2) && (sscanf(data, "%d|%d", &silencereqd, &iterations) != 2) &&
(sscanf(data, "%d", &silencereqd) != 1) ) ) { (sscanf(data, "%d", &silencereqd) != 1) ) ) {
ast_log(LOG_WARNING, "Using default value of 1000ms, 1 iteration, no timeout\n"); ast_log(LOG_WARNING, "Using default value of 1000ms, 1 iteration, no timeout\n");

@ -121,7 +121,7 @@ static int cdr_write(struct ast_channel *chan, const char *cmd, char *parse,
static struct ast_custom_function cdr_function = { static struct ast_custom_function cdr_function = {
.name = "CDR", .name = "CDR",
.synopsis = "Gets or sets a CDR variable", .synopsis = "Gets or sets a CDR variable",
.syntax = "CDR(<name>[|options])", .syntax = "CDR(<name>[,options])",
.read = cdr_read, .read = cdr_read,
.write = cdr_write, .write = cdr_write,
.desc = .desc =
@ -146,9 +146,9 @@ static struct ast_custom_function cdr_function = {
" and this variable will be stored on the cdr.\n" " and this variable will be stored on the cdr.\n"
" raw values for disposition:\n" " raw values for disposition:\n"
" 1 = NO ANSWER\n" " 1 = NO ANSWER\n"
" 2 = BUSY\n" " 2 = BUSY\n"
" 3 = FAILED\n" " 3 = FAILED\n"
" 4 = ANSWERED\n" " 4 = ANSWERED\n"
" raw values for amaflags:\n" " raw values for amaflags:\n"
" 1 = OMIT\n" " 1 = OMIT\n"
" 2 = BILLING\n" " 2 = BILLING\n"

@ -181,11 +181,11 @@ static struct ast_custom_function channel_function = {
" remote_count Number of transmitted packets\n" " remote_count Number of transmitted packets\n"
" rtt Round trip time\n" " rtt Round trip time\n"
" all All statistics (in a form suited to logging, but not for parsing)\n" " all All statistics (in a form suited to logging, but not for parsing)\n"
"R/O rtpdest Get remote RTP destination information\n" "R/O rtpdest Get remote RTP destination information\n"
" This option takes one additional argument:\n" " This option takes one additional argument:\n"
" Argument 1:\n" " Argument 1:\n"
" audio Get audio destination\n" " audio Get audio destination\n"
" video Get video destination\n" " video Get video destination\n"
"\n" "\n"
"chan_iax2 provides the following additional options:\n" "chan_iax2 provides the following additional options:\n"
"R/W osptoken Get or set the OSP token information for a call\n" "R/W osptoken Get or set the OSP token information for a call\n"

@ -167,7 +167,7 @@ static int acf_curl_exec(struct ast_channel *chan, const char *cmd, char *info,
struct ast_custom_function acf_curl = { struct ast_custom_function acf_curl = {
.name = "CURL", .name = "CURL",
.synopsis = "Retrieves the contents of a URL", .synopsis = "Retrieves the contents of a URL",
.syntax = "CURL(url[|post-data])", .syntax = "CURL(url[,post-data])",
.desc = .desc =
" url - URL to retrieve\n" " url - URL to retrieve\n"
" post-data - Optional data to send as a POST (GET is default action)\n", " post-data - Optional data to send as a POST (GET is default action)\n",

@ -52,7 +52,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/enum.h" #include "asterisk/enum.h"
#include "asterisk/app.h" #include "asterisk/app.h"
static char *synopsis = "Syntax: ENUMLOOKUP(number[|Method-type[|options[|record#[|zone-suffix]]]])\n"; static char *synopsis = "Syntax: ENUMLOOKUP(number[,Method-type[,options[,record#[,zone-suffix]]]])\n";
static int function_enum(struct ast_channel *chan, const char *cmd, char *data, static int function_enum(struct ast_channel *chan, const char *cmd, char *data,
char *buf, size_t len) char *buf, size_t len)
@ -293,7 +293,7 @@ finish:
static struct ast_custom_function enum_query_function = { static struct ast_custom_function enum_query_function = {
.name = "ENUMQUERY", .name = "ENUMQUERY",
.synopsis = "Initiate an ENUM query", .synopsis = "Initiate an ENUM query",
.syntax = "ENUMQUERY(number[|Method-type[|zone-suffix]])", .syntax = "ENUMQUERY(number[,Method-type[,zone-suffix]])",
.desc = "This will do a ENUM lookup of the given phone number.\n" .desc = "This will do a ENUM lookup of the given phone number.\n"
"If no method-tpye is given, the default will be sip. If no\n" "If no method-tpye is given, the default will be sip. If no\n"
"zone-suffix is given, the default will be \"e164.arpa\".\n" "zone-suffix is given, the default will be \"e164.arpa\".\n"
@ -305,7 +305,7 @@ static struct ast_custom_function enum_query_function = {
static struct ast_custom_function enum_result_function = { static struct ast_custom_function enum_result_function = {
.name = "ENUMRESULT", .name = "ENUMRESULT",
.synopsis = "Retrieve results from a ENUMQUERY", .synopsis = "Retrieve results from a ENUMQUERY",
.syntax = "ENUMRESULT(id|resultnum)", .syntax = "ENUMRESULT(id,resultnum)",
.desc = "This function will retrieve results from a previous use\n" .desc = "This function will retrieve results from a previous use\n"
"of the ENUMQUERY function.\n" "of the ENUMQUERY function.\n"
" id - This argument is the identifier returned by the ENUMQUERY function.\n" " id - This argument is the identifier returned by the ENUMQUERY function.\n"
@ -320,7 +320,7 @@ static struct ast_custom_function enum_function = {
.synopsis = .synopsis =
"General or specific querying of NAPTR records for ENUM or ENUM-like DNS pointers", "General or specific querying of NAPTR records for ENUM or ENUM-like DNS pointers",
.syntax = .syntax =
"ENUMLOOKUP(number[|Method-type[|options[|record#[|zone-suffix]]]])", "ENUMLOOKUP(number[,Method-type[,options[,record#[,zone-suffix]]]])",
.desc = .desc =
"Option 'c' returns an integer count of the number of NAPTRs of a certain RR type.\n" "Option 'c' returns an integer count of the number of NAPTRs of a certain RR type.\n"
"Combination of 'c' and Method-type of 'ALL' will return a count of all NAPTRs for the record.\n" "Combination of 'c' and Method-type of 'ALL' will return a count of all NAPTRs for the record.\n"

@ -595,11 +595,12 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
} }
} }
if ((tmp = ast_variable_retrieve(cfg, catg, "read"))) { if ((tmp = ast_variable_retrieve(cfg, catg, "readsql")))
ast_log(LOG_WARNING, "Parameter 'read' is deprecated for category %s. Please use 'readsql' instead.\n", catg);
ast_copy_string((*query)->sql_read, tmp, sizeof((*query)->sql_read)); ast_copy_string((*query)->sql_read, tmp, sizeof((*query)->sql_read));
} else if ((tmp = ast_variable_retrieve(cfg, catg, "readsql"))) else if ((tmp = ast_variable_retrieve(cfg, catg, "read"))) {
ast_log(LOG_WARNING, "Parameter 'read' is deprecated for category %s. Please use 'readsql' instead.\n", catg);
ast_copy_string((*query)->sql_read, tmp, sizeof((*query)->sql_read)); ast_copy_string((*query)->sql_read, tmp, sizeof((*query)->sql_read));
}
if (!ast_strlen_zero((*query)->sql_read) && ast_strlen_zero((*query)->readhandle[0])) { if (!ast_strlen_zero((*query)->sql_read) && ast_strlen_zero((*query)->readhandle[0])) {
ast_free(*query); ast_free(*query);
@ -608,11 +609,12 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
return EINVAL; return EINVAL;
} }
if ((tmp = ast_variable_retrieve(cfg, catg, "write"))) { if ((tmp = ast_variable_retrieve(cfg, catg, "writesql")))
ast_log(LOG_WARNING, "Parameter 'write' is deprecated for category %s. Please use 'writesql' instead.\n", catg);
ast_copy_string((*query)->sql_write, tmp, sizeof((*query)->sql_write)); ast_copy_string((*query)->sql_write, tmp, sizeof((*query)->sql_write));
} else if ((tmp = ast_variable_retrieve(cfg, catg, "writesql"))) else if ((tmp = ast_variable_retrieve(cfg, catg, "write"))) {
ast_log(LOG_WARNING, "Parameter 'write' is deprecated for category %s. Please use 'writesql' instead.\n", catg);
ast_copy_string((*query)->sql_write, tmp, sizeof((*query)->sql_write)); ast_copy_string((*query)->sql_write, tmp, sizeof((*query)->sql_write));
}
if (!ast_strlen_zero((*query)->sql_write) && ast_strlen_zero((*query)->writehandle[0])) { if (!ast_strlen_zero((*query)->sql_write) && ast_strlen_zero((*query)->writehandle[0])) {
ast_free(*query); ast_free(*query);

@ -153,7 +153,7 @@ static struct ast_custom_function timeout_function = {
"Gets or sets various channel timeouts. The timeouts that can be\n" "Gets or sets various channel timeouts. The timeouts that can be\n"
"manipulated are:\n" "\n" "manipulated are:\n" "\n"
"absolute: The absolute maximum amount of time permitted for a call. A\n" "absolute: The absolute maximum amount of time permitted for a call. A\n"
" setting of 0 disables the timeout.\n" "\n" " setting of 0 disables the timeout.\n" "\n"
"digit: The maximum amount of time permitted between digits when the\n" "digit: The maximum amount of time permitted between digits when the\n"
" user is typing in an extension. When this timeout expires,\n" " user is typing in an extension. When this timeout expires,\n"
" after the user has started to type in an extension, the\n" " after the user has started to type in an extension, the\n"
@ -165,11 +165,11 @@ static struct ast_custom_function timeout_function = {
" extension, or if it doesn't exist the call would be\n" " extension, or if it doesn't exist the call would be\n"
" terminated). The default timeout is 5 seconds.\n" "\n" " terminated). The default timeout is 5 seconds.\n" "\n"
"response: The maximum amount of time permitted after falling through a\n" "response: The maximum amount of time permitted after falling through a\n"
" series of priorities for a channel in which the user may\n" " series of priorities for a channel in which the user may\n"
" begin typing an extension. If the user does not type an\n" " begin typing an extension. If the user does not type an\n"
" extension in this amount of time, control will pass to the\n" " extension in this amount of time, control will pass to the\n"
" 't' extension if it exists, and if not the call would be\n" " 't' extension if it exists, and if not the call would be\n"
" terminated. The default timeout is 10 seconds.\n", " terminated. The default timeout is 10 seconds.\n",
.read = timeout_read, .read = timeout_read,
.write = timeout_write, .write = timeout_write,
}; };

@ -79,7 +79,7 @@ static char *esynopsis = "Executes an EAGI compliant application";
static char *deadsynopsis = "Executes AGI on a hungup channel"; static char *deadsynopsis = "Executes AGI on a hungup channel";
static char *descrip = static char *descrip =
" [E|Dead]AGI(command|args): Executes an Asterisk Gateway Interface compliant\n" " [E|Dead]AGI(command,args): Executes an Asterisk Gateway Interface compliant\n"
"program on a channel. AGI allows Asterisk to launch external programs\n" "program on a channel. AGI allows Asterisk to launch external programs\n"
"written in any language to control a telephony channel, play audio,\n" "written in any language to control a telephony channel, play audio,\n"
"read DTMF digits, etc. by communicating with the AGI protocol on stdin\n" "read DTMF digits, etc. by communicating with the AGI protocol on stdin\n"

@ -65,7 +65,7 @@ static unsigned long seq = 0;
static char *monitor_synopsis = "Monitor a channel"; static char *monitor_synopsis = "Monitor a channel";
static char *monitor_descrip = "Monitor([file_format[:urlbase]|[fname_base]|[options]]):\n" static char *monitor_descrip = "Monitor([file_format[:urlbase],[fname_base],[options]]):\n"
"Used to start monitoring a channel. The channel's input and output\n" "Used to start monitoring a channel. The channel's input and output\n"
"voice packets are logged to files until the channel hangs up or\n" "voice packets are logged to files until the channel hangs up or\n"
"monitoring is stopped by the StopMonitor application.\n" "monitoring is stopped by the StopMonitor application.\n"
@ -428,8 +428,6 @@ int ast_monitor_change_fname(struct ast_channel *chan, const char *fname_base, i
static int start_monitor_exec(struct ast_channel *chan, void *data) static int start_monitor_exec(struct ast_channel *chan, void *data)
{ {
char *arg = NULL; char *arg = NULL;
char *format = NULL;
char *fname_base = NULL;
char *options = NULL; char *options = NULL;
char *delay = NULL; char *delay = NULL;
char *urlprefix = NULL; char *urlprefix = NULL;
@ -438,37 +436,40 @@ static int start_monitor_exec(struct ast_channel *chan, void *data)
int joinfiles = 0; int joinfiles = 0;
int waitforbridge = 0; int waitforbridge = 0;
int res = 0; int res = 0;
char *parse;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(format);
AST_APP_ARG(fname_base);
AST_APP_ARG(options);
);
/* Parse arguments. */ /* Parse arguments. */
if (!ast_strlen_zero((char*)data)) { if (ast_strlen_zero((char*)data)) {
arg = ast_strdupa((char*)data); ast_log(LOG_ERROR, "Monitor requires an argument\n");
format = arg; return 0;
fname_base = strchr(arg, '|');
if (fname_base) {
*fname_base = 0;
fname_base++;
if ((options = strchr(fname_base, '|'))) {
*options = 0;
options++;
if (strchr(options, 'm'))
stream_action |= X_JOIN;
if (strchr(options, 'b'))
waitforbridge = 1;
if (strchr(options, 'i'))
stream_action &= ~X_REC_IN;
if (strchr(options, 'o'))
stream_action &= ~X_REC_OUT;
}
}
arg = strchr(format,':');
if (arg) {
*arg++ = 0;
urlprefix = arg;
}
} }
parse = ast_strdupa((char*)data);
AST_STANDARD_APP_ARGS(args, parse);
if (strchr(args.options, 'm'))
stream_action |= X_JOIN;
if (strchr(args.options, 'b'))
waitforbridge = 1;
if (strchr(args.options, 'i'))
stream_action &= ~X_REC_IN;
if (strchr(args.options, 'o'))
stream_action &= ~X_REC_OUT;
arg = strchr(args.format, ':');
if (arg) {
*arg++ = 0;
urlprefix = arg;
}
if (urlprefix) { if (urlprefix) {
snprintf(tmp,sizeof(tmp) - 1,"%s/%s.%s",urlprefix,fname_base, snprintf(tmp, sizeof(tmp), "%s/%s.%s", urlprefix, args.fname_base,
((strcmp(format,"gsm")) ? "wav" : "gsm")); ((strcmp(args.format, "gsm")) ? "wav" : "gsm"));
if (!chan->cdr && !(chan->cdr = ast_cdr_alloc())) if (!chan->cdr && !(chan->cdr = ast_cdr_alloc()))
return -1; return -1;
ast_cdr_setuserfield(chan, tmp); ast_cdr_setuserfield(chan, tmp);
@ -484,15 +485,15 @@ static int start_monitor_exec(struct ast_channel *chan, void *data)
arg = strchr(options, 'b'); arg = strchr(options, 'b');
if (arg) { if (arg) {
*arg = 'X'; *arg = 'X';
pbx_builtin_setvar_helper(chan,"AUTO_MONITOR",delay); pbx_builtin_setvar_helper(chan,"AUTO_MONITOR", delay);
} }
} }
return 0; return 0;
} }
res = ast_monitor_start(chan, format, fname_base, 1, stream_action); res = ast_monitor_start(chan, args.format, args.fname_base, 1, stream_action);
if (res < 0) if (res < 0)
res = ast_monitor_change_fname(chan, fname_base, 1); res = ast_monitor_change_fname(chan, args.fname_base, 1);
if (stream_action & X_JOIN) { if (stream_action & X_JOIN) {
if ((stream_action & X_REC_IN) && (stream_action & X_REC_OUT)) if ((stream_action & X_REC_IN) && (stream_action & X_REC_OUT))

Loading…
Cancel
Save