[asterisk-commits] tilghman: trunk r77808 - in /trunk: apps/ funcs/ res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 30 20:10:48 CDT 2007


Author: tilghman
Date: Mon Jul 30 20:10:47 2007
New Revision: 77808

URL: http://svn.digium.com/view/asterisk?view=rev&rev=77808
Log:
Mostly cleanup of documentation to substitute the pipe with the comma, but a few other formatting cleanups, too.

Modified:
    trunk/apps/app_amd.c
    trunk/apps/app_authenticate.c
    trunk/apps/app_chanisavail.c
    trunk/apps/app_chanspy.c
    trunk/apps/app_controlplayback.c
    trunk/apps/app_dictate.c
    trunk/apps/app_directory.c
    trunk/apps/app_disa.c
    trunk/apps/app_festival.c
    trunk/apps/app_followme.c
    trunk/apps/app_image.c
    trunk/apps/app_macro.c
    trunk/apps/app_meetme.c
    trunk/apps/app_minivm.c
    trunk/apps/app_mixmonitor.c
    trunk/apps/app_page.c
    trunk/apps/app_parkandannounce.c
    trunk/apps/app_playback.c
    trunk/apps/app_privacy.c
    trunk/apps/app_queue.c
    trunk/apps/app_read.c
    trunk/apps/app_record.c
    trunk/apps/app_rpt.c
    trunk/apps/app_sayunixtime.c
    trunk/apps/app_senddtmf.c
    trunk/apps/app_sendtext.c
    trunk/apps/app_sms.c
    trunk/apps/app_speech_utils.c
    trunk/apps/app_stack.c
    trunk/apps/app_talkdetect.c
    trunk/apps/app_transfer.c
    trunk/apps/app_url.c
    trunk/apps/app_userevent.c
    trunk/apps/app_voicemail.c
    trunk/apps/app_waitforsilence.c
    trunk/funcs/func_cdr.c
    trunk/funcs/func_channel.c
    trunk/funcs/func_curl.c
    trunk/funcs/func_enum.c
    trunk/funcs/func_odbc.c
    trunk/funcs/func_timeout.c
    trunk/res/res_agi.c
    trunk/res/res_monitor.c

Modified: trunk/apps/app_amd.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_amd.c?view=diff&rev=77808&r1=77807&r2=77808
==============================================================================
--- trunk/apps/app_amd.c (original)
+++ trunk/apps/app_amd.c Mon Jul 30 20:10:47 2007
@@ -47,9 +47,9 @@
 static char *app = "AMD";
 static char *synopsis = "Attempts to detect answering machines";
 static char *descrip =
-"  AMD([initialSilence][|greeting][|afterGreetingSilence][|totalAnalysisTime]\n"
-"      [|minimumWordLength][|betweenWordsSilence][|maximumNumberOfWords]\n"
-"      [|silenceThreshold])\n"
+"  AMD([initialSilence],[greeting],[afterGreetingSilence],[totalAnalysisTime]\n"
+"      ,[minimumWordLength],[betweenWordsSilence],[maximumNumberOfWords]\n"
+"      ,[silenceThreshold])\n"
 "  This application attempts to detect answering machines at the beginning\n"
 "  of outbound calls.  Simply call this application after the call\n"
 "  has been answered (outbound only, of course).\n"

Modified: trunk/apps/app_authenticate.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_authenticate.c?view=diff&rev=77808&r1=77807&r2=77808
==============================================================================
--- trunk/apps/app_authenticate.c (original)
+++ trunk/apps/app_authenticate.c Mon Jul 30 20:10:47 2007
@@ -66,7 +66,7 @@
 static char *synopsis = "Authenticate a user";
 
 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"
 "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"

Modified: trunk/apps/app_chanisavail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_chanisavail.c?view=diff&rev=77808&r1=77807&r2=77808
==============================================================================
--- trunk/apps/app_chanisavail.c (original)
+++ trunk/apps/app_chanisavail.c Mon Jul 30 20:10:47 2007
@@ -53,7 +53,7 @@
 static char *synopsis = "Check channel availability";
 
 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"
 "available. The following variables will be set by this application:\n"
 "  ${AVAILCHAN}     - the name of the available channel, if one exists\n"

Modified: trunk/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_chanspy.c?view=diff&rev=77808&r1=77807&r2=77808
==============================================================================
--- trunk/apps/app_chanspy.c (original)
+++ trunk/apps/app_chanspy.c Mon Jul 30 20:10:47 2007
@@ -56,7 +56,7 @@
 static const char *tdesc = "Listen to a channel, and optionally whisper into it";
 static const char *app_chan = "ChanSpy";
 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"
 "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"
@@ -97,7 +97,7 @@
 
 static const char *app_ext = "ExtenSpy";
 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"
 "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"

Modified: trunk/apps/app_controlplayback.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_controlplayback.c?view=diff&rev=77808&r1=77807&r2=77808
==============================================================================
--- trunk/apps/app_controlplayback.c (original)
+++ trunk/apps/app_controlplayback.c Mon Jul 30 20:10:47 2007
@@ -49,7 +49,7 @@
 static const char *synopsis = "Play a file with fast forward and rewind";
 
 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"
 "can be used to rewind, and the '#' key can be used to fast-forward.\n"
 "Parameters:\n"

Modified: trunk/apps/app_dictate.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_dictate.c?view=diff&rev=77808&r1=77807&r2=77808
==============================================================================
--- trunk/apps/app_dictate.c (original)
+++ trunk/apps/app_dictate.c Mon Jul 30 20:10:47 2007
@@ -48,7 +48,7 @@
 
 static char *app = "Dictate";
 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";
 
 

Modified: trunk/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_directory.c?view=diff&rev=77808&r1=77807&r2=77808
==============================================================================
--- trunk/apps/app_directory.c (original)
+++ trunk/apps/app_directory.c Mon Jul 30 20:10:47 2007
@@ -59,7 +59,7 @@
 
 static char *synopsis = "Provide directory of voicemail extensions";
 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"
 "by name. The list of names and corresponding extensions is retrieved from the\n"
 "voicemail configuration file, voicemail.conf.\n"

Modified: trunk/apps/app_disa.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_disa.c?view=diff&rev=77808&r1=77807&r2=77808
==============================================================================
--- trunk/apps/app_disa.c (original)
+++ trunk/apps/app_disa.c Mon Jul 30 20:10:47 2007
@@ -55,8 +55,8 @@
 static char *synopsis = "DISA (Direct Inward System Access)";
 
 static char *descrip = 
-"DISA(<numeric passcode>[|<context>[|<cid>[|mailbox[|options]]]]) or\n"
-"DISA(<filename>[||||options])\n"
+"DISA(<numeric passcode>[,<context>[,<cid>[,mailbox[,options]]]]) or\n"
+"DISA(<filename>[,,,,options])\n"
 "The DISA, Direct Inward System Access, application allows someone from \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"

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

Modified: trunk/apps/app_followme.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_followme.c?view=diff&rev=77808&r1=77807&r2=77808
==============================================================================
--- trunk/apps/app_followme.c (original)
+++ trunk/apps/app_followme.c Mon Jul 30 20:10:47 2007
@@ -61,7 +61,7 @@
 static char *app = "FollowMe";
 static char *synopsis = "Find-Me/Follow-Me application";
 static char *descrip = 
-"  FollowMe(followmeid|options):\n"
+"  FollowMe(followmeid,options):\n"
 "This application performs Find-Me/Follow-Me functionality for the caller\n"
 "as defined in the profile matching the <followmeid> parameter in\n"
 "followme.conf. If the specified <followmeid> profile doesn't exist in\n"

Modified: trunk/apps/app_image.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_image.c?view=diff&rev=77808&r1=77807&r2=77808
==============================================================================
--- trunk/apps/app_image.c (original)
+++ trunk/apps/app_image.c Mon Jul 30 20:10:47 2007
@@ -49,34 +49,21 @@
 static char *synopsis = "Send an image file";
 
 static char *descrip = 
-"  SendImage(filename): Sends an image on a channel. \n"
-"If the channel supports image transport but the image send\n"
-"fails, the channel will be hung up. Otherwise, the dialplan\n"
-"continues execution.\n"
-"This application sets the following channel variable upon completion:\n"
-"	SENDIMAGESTATUS		The status is the result of the attempt as a text string, one of\n"
-"		OK | NOSUPPORT \n";			
+"  SendImage(filename): Sends an image on a channel.\n"
+"If the channel supports image transport but the image send fails, the channel\n"
+"will be hung up.  Otherwise, the dialplan continues execution.  This\n"
+"application sets the following channel variable upon completion:\n"
+"   SENDIMAGESTATUS  The status is the result of the attempt, one of:\n"
+"                    OK | NOSUPPORT \n";			
 
 
 static int sendimage_exec(struct ast_channel *chan, void *data)
 {
 	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(args.filename)) {
-		ast_log(LOG_WARNING, "SendImage requires an argument (filename[|options])\n");
+	if (ast_strlen_zero(data)) {
+		ast_log(LOG_WARNING, "SendImage requires an argument (filename)\n");
 		return -1;
-	}
-
-	if (args.options) {
 	}
 
 	if (!ast_supports_images(chan)) {
@@ -85,7 +72,7 @@
 		return 0;
 	}
 
-	if (!(res = ast_send_image(chan, args.filename)))
+	if (!(res = ast_send_image(chan, data)))
 		pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "OK");
 		
 	return res;

Modified: trunk/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_macro.c?view=diff&rev=77808&r1=77807&r2=77808
==============================================================================
--- trunk/apps/app_macro.c (original)
+++ trunk/apps/app_macro.c Mon Jul 30 20:10:47 2007
@@ -51,7 +51,7 @@
 #define MACRO_EXIT_RESULT 1024
 
 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"
 "executing each step, then returning when the steps end. \n"
 "The calling extension, context, and priority are stored in ${MACRO_EXTEN}, \n"
@@ -76,13 +76,13 @@
 "         (now allows arguments like a Macro) with explict Return() calls instead.\n";
 
 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"
 "(otherwise <macroname_b> if provided)\n"
 "Arguments and return values as in application macro()\n";
 
 static char *exclusive_descrip =
-"  MacroExclusive(macroname|arg1|arg2...):\n"
+"  MacroExclusive(macroname,arg1,arg2...):\n"
 "Executes macro defined in the context 'macro-macroname'\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"
@@ -168,7 +168,7 @@
 	char *save_macro_offset;
  
 	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;
 	}
 

Modified: trunk/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_meetme.c?view=diff&rev=77808&r1=77807&r2=77808
==============================================================================
--- trunk/apps/app_meetme.c (original)
+++ trunk/apps/app_meetme.c Mon Jul 30 20:10:47 2007
@@ -263,7 +263,7 @@
 "      '1' -- do not play message when first person enters\n";
 
 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"
 "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"
@@ -294,7 +294,7 @@
 "";
 
 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"
 "      'k' -- Kick the specified user out of the conference he is in\n"
 "      'm' -- Unmute the specified user\n"
@@ -894,10 +894,10 @@
 	if (strstr(argv[1], "lock")) {	
 		if (strcmp(argv[1], "lock") == 0) {
 			/* Lock */
-			strncat(cmdline, "|L", sizeof(cmdline) - strlen(cmdline) - 1);
+			strncat(cmdline, ",L", sizeof(cmdline) - strlen(cmdline) - 1);
 		} else {
 			/* Unlock */
-			strncat(cmdline, "|l", sizeof(cmdline) - strlen(cmdline) - 1);
+			strncat(cmdline, ",l", sizeof(cmdline) - strlen(cmdline) - 1);
 		}
 	} else if (strstr(argv[1], "mute")) { 
 		if (argc < 4)
@@ -905,17 +905,17 @@
 		if (strcmp(argv[1], "mute") == 0) {
 			/* Mute */
 			if (strcmp(argv[3], "all") == 0) {
-				strncat(cmdline, "|N", sizeof(cmdline) - strlen(cmdline) - 1);
+				strncat(cmdline, ",N", sizeof(cmdline) - strlen(cmdline) - 1);
 			} 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);
 			}
 		} else {
 			/* Unmute */
 			if (strcmp(argv[3], "all") == 0) {
-				strncat(cmdline, "|n", sizeof(cmdline) - strlen(cmdline) - 1);
+				strncat(cmdline, ",n", sizeof(cmdline) - strlen(cmdline) - 1);
 			} 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);
 			}
 		}
@@ -924,12 +924,12 @@
 			return RESULT_SHOWUSAGE;
 		if (strcmp(argv[3], "all") == 0) {
 			/* Kick all */
-			strncat(cmdline, "|K", sizeof(cmdline) - strlen(cmdline) - 1);
+			strncat(cmdline, ",K", sizeof(cmdline) - strlen(cmdline) - 1);
 		} else {
 			/* 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);
-		}	
+		}
 	} else if(strcmp(argv[1], "list") == 0) {
 		int concise = ( 4 == argc && ( !strcasecmp(argv[3], "concise") ) );
 		/* List all the users in a conference */
@@ -2450,7 +2450,7 @@
 				if (!(parse = ast_strdupa(var->value)))
 					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);
 				if (!strcasecmp(args.confno, confno)) {
 					/* Bingo it's a valid conference */
@@ -3093,7 +3093,7 @@
 	}
 
 	ast_stopstream(cnf->lchan);
-	flags = O_CREAT|O_TRUNC|O_WRONLY;
+	flags = O_CREAT | O_TRUNC | O_WRONLY;
 
 
 	cnf->recording = MEETME_RECORD_ACTIVE;
@@ -3356,7 +3356,7 @@
 	trunk_ref->chan = NULL;
 	if (ast_atomic_dec_and_test((int *) &trunk_ref->trunk->active_stations) &&
 		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);
 		trunk_ref->trunk->hold_stations = 0;
 		sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL);
@@ -3374,7 +3374,7 @@
 	char buf[80];
 	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);
 	sla_change_trunk_state(ringing_trunk->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL);
 
@@ -4374,7 +4374,7 @@
 	trunk_ref->chan = NULL;
 	if (ast_atomic_dec_and_test((int *) &trunk_ref->trunk->active_stations) &&
 		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);
 		trunk_ref->trunk->hold_stations = 0;
 		sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL);

Modified: trunk/apps/app_minivm.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_minivm.c?view=diff&rev=77808&r1=77807&r2=77808
==============================================================================
--- trunk/apps/app_minivm.c (original)
+++ trunk/apps/app_minivm.c Mon Jul 30 20:10:47 2007
@@ -686,8 +686,8 @@
 
 		if (n> 0) {
 			ogroup[0]= dtable[igroup[0]>>2];
-			ogroup[1]= dtable[((igroup[0]&3)<<4)|(igroup[1]>>4)];
-			ogroup[2]= dtable[((igroup[1]&0xF)<<2)|(igroup[2]>>6)];
+			ogroup[1]= dtable[((igroup[0]&3)<<4) | (igroup[1]>>4)];
+			ogroup[2]= dtable[((igroup[1]&0xF)<<2) | (igroup[2]>>6)];
 			ogroup[3]= dtable[igroup[2]&0x3F];
 
 			if (n<3) {
@@ -1650,7 +1650,7 @@
 		ast_log(LOG_ERROR, "Out of memory\n");
 		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]))
 		template = argv[1];
@@ -1720,7 +1720,7 @@
 		ast_log(LOG_ERROR, "Out of memory\n");
 		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 (ast_app_parse_options(minivm_app_options, &flags, opts, argv[1])) {
 			return -1;
@@ -1782,7 +1782,7 @@
 		ast_log(LOG_ERROR, "Out of memory\n");
 		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 (ast_app_parse_options(minivm_app_options, &flags, opts, argv[1]))
@@ -2001,7 +2001,7 @@
 			ast_log(LOG_ERROR, "Out of memory\n");
 			error = TRUE;
 		} 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) {

Modified: trunk/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_mixmonitor.c?view=diff&rev=77808&r1=77807&r2=77808
==============================================================================
--- trunk/apps/app_mixmonitor.c (original)
+++ trunk/apps/app_mixmonitor.c Mon Jul 30 20:10:47 2007
@@ -60,7 +60,7 @@
 static const char *app = "MixMonitor";
 static const char *synopsis = "Record a call and mix the audio during the recording";
 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"
 "If the filename is an absolute path, uses that path, otherwise\n"
 "creates the file in the configured monitoring directory from\n"

Modified: trunk/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_page.c?view=diff&rev=77808&r1=77807&r2=77808
==============================================================================
--- trunk/apps/app_page.c (original)
+++ trunk/apps/app_page.c Mon Jul 30 20:10:47 2007
@@ -57,7 +57,7 @@
 static const char *page_synopsis = "Pages phones";
 
 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"
 "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"
@@ -113,7 +113,7 @@
 	if (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" : "") );
 
 	/* Go through parsing/calling each device */
@@ -165,7 +165,7 @@
 	}
 
 	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" : "") );
 		pbx_exec(chan, app, meetmeopts);
 	}

Modified: trunk/apps/app_parkandannounce.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_parkandannounce.c?view=diff&rev=77808&r1=77807&r2=77808
==============================================================================
--- trunk/apps/app_parkandannounce.c (original)
+++ trunk/apps/app_parkandannounce.c Mon Jul 30 20:10:47 2007
@@ -57,7 +57,7 @@
 static char *synopsis = "Park and Announce";
 
 static char *descrip =
-"  ParkAndAnnounce(announce:template|timeout|dial|[return_context]):\n"
+"  ParkAndAnnounce(announce:template,timeout,dial[,return_context]):\n"

[... 1302 lines stripped ...]



More information about the asterisk-commits mailing list