[asterisk-commits] branch bweschke/polycom_acd_functions - r8029 in /team/bweschke/polycom_acd_f...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jan 12 13:45:24 CST 2006


Author: bweschke
Date: Thu Jan 12 13:45:01 2006
New Revision: 8029

URL: http://svn.digium.com/view/asterisk?rev=8029&view=rev
Log:
SVNMerge: Bringing this branch up to date with /trunk


Added:
    team/bweschke/polycom_acd_functions/apps/app_morsecode.c
      - copied unchanged from r8027, trunk/apps/app_morsecode.c
    team/bweschke/polycom_acd_functions/contrib/init.d/rc.suse.asterisk
      - copied unchanged from r8027, trunk/contrib/init.d/rc.suse.asterisk
    team/bweschke/polycom_acd_functions/contrib/scripts/safe_asterisk_restart
      - copied unchanged from r8027, trunk/contrib/scripts/safe_asterisk_restart
    team/bweschke/polycom_acd_functions/formats/format_h264.c
      - copied unchanged from r8027, trunk/formats/format_h264.c
    team/bweschke/polycom_acd_functions/funcs/func_base64.c
      - copied unchanged from r8027, trunk/funcs/func_base64.c
    team/bweschke/polycom_acd_functions/funcs/func_rand.c
      - copied unchanged from r8027, trunk/funcs/func_rand.c
    team/bweschke/polycom_acd_functions/include/asterisk/stringfields.h
      - copied unchanged from r8027, trunk/include/asterisk/stringfields.h
    team/bweschke/polycom_acd_functions/include/asterisk/udptl.h
      - copied unchanged from r8027, trunk/include/asterisk/udptl.h
    team/bweschke/polycom_acd_functions/udptl.c
      - copied unchanged from r8027, trunk/udptl.c
Removed:
    team/bweschke/polycom_acd_functions/ast_expr.y
    team/bweschke/polycom_acd_functions/channels/chan_modem.c
    team/bweschke/polycom_acd_functions/channels/chan_modem_aopen.c
    team/bweschke/polycom_acd_functions/channels/chan_modem_bestdata.c
    team/bweschke/polycom_acd_functions/channels/chan_modem_i4l.c
    team/bweschke/polycom_acd_functions/include/asterisk/vmodem.h
Modified:
    team/bweschke/polycom_acd_functions/   (props changed)
    team/bweschke/polycom_acd_functions/Makefile
    team/bweschke/polycom_acd_functions/UPGRADE.txt
    team/bweschke/polycom_acd_functions/app.c
    team/bweschke/polycom_acd_functions/apps/   (props changed)
    team/bweschke/polycom_acd_functions/apps/Makefile
    team/bweschke/polycom_acd_functions/apps/app_adsiprog.c
    team/bweschke/polycom_acd_functions/apps/app_alarmreceiver.c
    team/bweschke/polycom_acd_functions/apps/app_authenticate.c
    team/bweschke/polycom_acd_functions/apps/app_chanspy.c
    team/bweschke/polycom_acd_functions/apps/app_curl.c
    team/bweschke/polycom_acd_functions/apps/app_dial.c
    team/bweschke/polycom_acd_functions/apps/app_dictate.c
    team/bweschke/polycom_acd_functions/apps/app_directory.c
    team/bweschke/polycom_acd_functions/apps/app_disa.c
    team/bweschke/polycom_acd_functions/apps/app_externalivr.c
    team/bweschke/polycom_acd_functions/apps/app_meetme.c
    team/bweschke/polycom_acd_functions/apps/app_milliwatt.c
    team/bweschke/polycom_acd_functions/apps/app_mixmonitor.c
    team/bweschke/polycom_acd_functions/apps/app_page.c
    team/bweschke/polycom_acd_functions/apps/app_playback.c
    team/bweschke/polycom_acd_functions/apps/app_privacy.c
    team/bweschke/polycom_acd_functions/apps/app_queue.c
    team/bweschke/polycom_acd_functions/apps/app_read.c
    team/bweschke/polycom_acd_functions/apps/app_rpt.c
    team/bweschke/polycom_acd_functions/apps/app_stack.c
    team/bweschke/polycom_acd_functions/apps/app_voicemail.c
    team/bweschke/polycom_acd_functions/ast_expr2.fl
    team/bweschke/polycom_acd_functions/ast_expr2f.c
    team/bweschke/polycom_acd_functions/asterisk.c
    team/bweschke/polycom_acd_functions/astmm.c
    team/bweschke/polycom_acd_functions/autoservice.c
    team/bweschke/polycom_acd_functions/callerid.c
    team/bweschke/polycom_acd_functions/cdr/   (props changed)
    team/bweschke/polycom_acd_functions/cdr.c
    team/bweschke/polycom_acd_functions/channel.c
    team/bweschke/polycom_acd_functions/channels/   (props changed)
    team/bweschke/polycom_acd_functions/channels/Makefile
    team/bweschke/polycom_acd_functions/channels/chan_agent.c
    team/bweschke/polycom_acd_functions/channels/chan_alsa.c
    team/bweschke/polycom_acd_functions/channels/chan_iax2.c
    team/bweschke/polycom_acd_functions/channels/chan_local.c
    team/bweschke/polycom_acd_functions/channels/chan_oss.c
    team/bweschke/polycom_acd_functions/channels/chan_phone.c
    team/bweschke/polycom_acd_functions/channels/chan_sip.c
    team/bweschke/polycom_acd_functions/channels/chan_zap.c
    team/bweschke/polycom_acd_functions/cli.c
    team/bweschke/polycom_acd_functions/codecs/   (props changed)
    team/bweschke/polycom_acd_functions/codecs/ilbc/   (props changed)
    team/bweschke/polycom_acd_functions/codecs/lpc10/   (props changed)
    team/bweschke/polycom_acd_functions/config.c
    team/bweschke/polycom_acd_functions/configs/agents.conf.sample
    team/bweschke/polycom_acd_functions/configs/extensions.conf.sample
    team/bweschke/polycom_acd_functions/configs/features.conf.sample
    team/bweschke/polycom_acd_functions/configs/manager.conf.sample
    team/bweschke/polycom_acd_functions/configs/sip.conf.sample
    team/bweschke/polycom_acd_functions/configs/voicemail.conf.sample
    team/bweschke/polycom_acd_functions/configs/zapata.conf.sample
    team/bweschke/polycom_acd_functions/contrib/scripts/managerproxy.pl
    team/bweschke/polycom_acd_functions/db.c
    team/bweschke/polycom_acd_functions/db1-ast/   (props changed)
    team/bweschke/polycom_acd_functions/dns.c
    team/bweschke/polycom_acd_functions/doc/CODING-GUIDELINES
    team/bweschke/polycom_acd_functions/doc/README.cdr
    team/bweschke/polycom_acd_functions/doc/README.variables
    team/bweschke/polycom_acd_functions/editline/   (props changed)
    team/bweschke/polycom_acd_functions/file.c
    team/bweschke/polycom_acd_functions/formats/   (props changed)
    team/bweschke/polycom_acd_functions/formats/Makefile
    team/bweschke/polycom_acd_functions/formats/format_pcm.c
    team/bweschke/polycom_acd_functions/formats/format_pcm_alaw.c
    team/bweschke/polycom_acd_functions/frame.c
    team/bweschke/polycom_acd_functions/funcs/   (props changed)
    team/bweschke/polycom_acd_functions/funcs/Makefile
    team/bweschke/polycom_acd_functions/funcs/func_cdr.c
    team/bweschke/polycom_acd_functions/funcs/func_cut.c
    team/bweschke/polycom_acd_functions/funcs/func_math.c
    team/bweschke/polycom_acd_functions/funcs/func_md5.c
    team/bweschke/polycom_acd_functions/funcs/func_moh.c
    team/bweschke/polycom_acd_functions/image.c
    team/bweschke/polycom_acd_functions/include/asterisk/app.h
    team/bweschke/polycom_acd_functions/include/asterisk/astmm.h
    team/bweschke/polycom_acd_functions/include/asterisk/astobj.h
    team/bweschke/polycom_acd_functions/include/asterisk/callerid.h
    team/bweschke/polycom_acd_functions/include/asterisk/channel.h
    team/bweschke/polycom_acd_functions/include/asterisk/chanspy.h
    team/bweschke/polycom_acd_functions/include/asterisk/dns.h
    team/bweschke/polycom_acd_functions/include/asterisk/frame.h
    team/bweschke/polycom_acd_functions/include/asterisk/image.h
    team/bweschke/polycom_acd_functions/include/asterisk/linkedlists.h
    team/bweschke/polycom_acd_functions/include/asterisk/manager.h
    team/bweschke/polycom_acd_functions/include/asterisk/pbx.h
    team/bweschke/polycom_acd_functions/include/asterisk/rtp.h
    team/bweschke/polycom_acd_functions/include/asterisk/strings.h
    team/bweschke/polycom_acd_functions/include/asterisk/translate.h
    team/bweschke/polycom_acd_functions/include/asterisk/utils.h
    team/bweschke/polycom_acd_functions/manager.c
    team/bweschke/polycom_acd_functions/pbx/   (props changed)
    team/bweschke/polycom_acd_functions/pbx.c
    team/bweschke/polycom_acd_functions/pbx/pbx_config.c
    team/bweschke/polycom_acd_functions/pbx/pbx_spool.c
    team/bweschke/polycom_acd_functions/res/   (props changed)
    team/bweschke/polycom_acd_functions/res/res_features.c
    team/bweschke/polycom_acd_functions/res/res_osp.c
    team/bweschke/polycom_acd_functions/rtp.c
    team/bweschke/polycom_acd_functions/say.c
    team/bweschke/polycom_acd_functions/stdtime/   (props changed)
    team/bweschke/polycom_acd_functions/translate.c
    team/bweschke/polycom_acd_functions/utils.c

Propchange: team/bweschke/polycom_acd_functions/
------------------------------------------------------------------------------
--- svnmerge-blocked (original)
+++ svnmerge-blocked Thu Jan 12 13:45:01 2006
@@ -1,1 +1,1 @@
-/branches/1.2:7497
+/branches/1.2:7497,7915,7960,7965,7970,7976

Propchange: team/bweschke/polycom_acd_functions/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jan 12 13:45:01 2006
@@ -1,1 +1,1 @@
-/trunk:1-7700
+/trunk:1-8027

Modified: team/bweschke/polycom_acd_functions/Makefile
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/Makefile?rev=8029&r1=8028&r2=8029&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/Makefile (original)
+++ team/bweschke/polycom_acd_functions/Makefile Thu Jan 12 13:45:01 2006
@@ -346,7 +346,7 @@
 OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
 	translate.o file.o say.o pbx.o cli.o md5.o term.o \
 	ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
-	cdr.o tdd.o acl.o rtp.o manager.o asterisk.o \
+	cdr.o tdd.o acl.o rtp.o udptl.o manager.o asterisk.o \
 	dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
 	astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
 	utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
@@ -416,6 +416,8 @@
 LIBS+=-lssl
 
 INSTALL=install
+
+CFLAGS+=-DT38_SUPPORT
 
 _all: all
 	@echo " +--------- Asterisk Build Complete ---------+"  

Modified: team/bweschke/polycom_acd_functions/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/UPGRADE.txt?rev=8029&r1=8028&r2=8029&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/UPGRADE.txt (original)
+++ team/bweschke/polycom_acd_functions/UPGRADE.txt Thu Jan 12 13:45:01 2006
@@ -18,6 +18,9 @@
 * The application SetVar has been renamed to Set.  The syntax SetVar was marked
   deprecated in version 1.2 and is no longer recognized in this version.
 
+* app_read has been updated to use the newer options codes, using "skip" or
+  "noanswer" will not work.  Use s or n.  Also there is a new feature i, for
+  using indication tones, so typing in skip would give you unexpected results.
 Variables:
 
 * The builtin variables ${CALLERID}, ${CALLERIDNAME}, ${CALLERIDNUM},
@@ -26,3 +29,6 @@
   functions.  You are encouraged to move towards the associated dialplan
   function, as these variables will be removed in a future release.
 
+The SIP channel:
+
+* The "incominglimit" setting is replaced by the "call-limit" setting in sip.conf.

Modified: team/bweschke/polycom_acd_functions/app.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/app.c?rev=8029&r1=8028&r2=8029&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/app.c (original)
+++ team/bweschke/polycom_acd_functions/app.c Thu Jan 12 13:45:01 2006
@@ -279,47 +279,57 @@
 	return 0;
 }
 
-int ast_dtmf_stream(struct ast_channel *chan,struct ast_channel *peer,char *digits,int between) 
-{
-	char *ptr;
+int ast_dtmf_stream(struct ast_channel *chan, struct ast_channel *peer, const char *digits, int between) 
+{
+	const char *ptr;
 	int res = 0;
-	struct ast_frame f;
+	struct ast_frame f = {
+		.frametype = AST_FRAME_DTMF,
+		.src = "ast_dtmf_stream"
+	};
+
 	if (!between)
 		between = 100;
 
 	if (peer)
 		res = ast_autoservice_start(peer);
 
-	if (!res) {
-		res = ast_waitfor(chan,100);
-		if (res > -1) {
-			for (ptr=digits; *ptr; ptr++) {
-				if (*ptr == 'w') {
-					res = ast_safe_sleep(chan, 500);
-					if (res) 
-						break;
-					continue;
-				}
-				memset(&f, 0, sizeof(f));
-				f.frametype = AST_FRAME_DTMF;
+	if (!res)
+		res = ast_waitfor(chan, 100);
+
+	/* ast_waitfor will return the number of remaining ms on success */
+	if (res < 0)
+		return res;
+
+	for (ptr = digits; *ptr; ptr++) {
+		if (*ptr == 'w') {
+			/* 'w' -- wait half a second */
+			if ((res = ast_safe_sleep(chan, 500)))
+				break;
+		} else if (strchr("0123456789*#abcdfABCDF", *ptr)) {
+			/* Character represents valid DTMF */
+			if (*ptr == 'f' || *ptr == 'F') {
+				/* ignore return values if not supported by channel */
+				ast_indicate(chan, AST_CONTROL_FLASH);
+			} else {
 				f.subclass = *ptr;
-				f.src = "ast_dtmf_stream";
-				if (strchr("0123456789*#abcdABCD",*ptr)==NULL) {
-					ast_log(LOG_WARNING, "Illegal DTMF character '%c' in string. (0-9*#aAbBcCdD allowed)\n",*ptr);
-				} else {
-					res = ast_write(chan, &f);
-					if (res) 
-						break;
-					/* pause between digits */
-					res = ast_safe_sleep(chan,between);
-					if (res) 
-						break;
-				}
-			}
-		}
-		if (peer)
-			res = ast_autoservice_stop(peer);
-	}
+				if ((res = ast_write(chan, &f)))
+					break;
+			}
+			/* pause between digits */
+			if ((res = ast_safe_sleep(chan, between)))
+				break;
+		} else
+			ast_log(LOG_WARNING, "Illegal DTMF character '%c' in string. (0-9*#aAbBcCdD allowed)\n",*ptr);
+	}
+
+	if (peer) {
+		/* Stop autoservice on the peer channel, but don't overwrite any error condition 
+		   that has occurred previously while acting on the primary channel */
+		if (ast_autoservice_stop(peer) && !res)
+			res = -1;
+	}
+
 	return res;
 }
 

Propchange: team/bweschke/polycom_acd_functions/apps/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Jan 12 13:45:01 2006
@@ -1,1 +1,3 @@
 .depend
+*.a
+*.so

Modified: team/bweschke/polycom_acd_functions/apps/Makefile
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/apps/Makefile?rev=8029&r1=8028&r2=8029&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/apps/Makefile (original)
+++ team/bweschke/polycom_acd_functions/apps/Makefile Thu Jan 12 13:45:01 2006
@@ -24,7 +24,8 @@
      app_setcdruserfield.so app_settransfercapability.so app_softhangup.so     \
      app_stack.so app_system.so app_talkdetect.so app_test.so app_transfer.so  \
      app_userevent.so app_url.so app_verbose.so app_voicemail.so               \
-     app_waitforring.so app_waitforsilence.so app_while.so app_zapateller.so
+     app_waitforring.so app_waitforsilence.so app_while.so app_zapateller.so   \
+     app_morsecode.so
      
 #
 # Obsolete things...

Modified: team/bweschke/polycom_acd_functions/apps/app_adsiprog.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/apps/app_adsiprog.c?rev=8029&r1=8028&r2=8029&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/apps/app_adsiprog.c (original)
+++ team/bweschke/polycom_acd_functions/apps/app_adsiprog.c Thu Jan 12 13:45:01 2006
@@ -1359,13 +1359,10 @@
 		ast_log(LOG_WARNING, "Can't open file '%s'\n", fn);
 		return NULL;
 	}
-	scr = malloc(sizeof(struct adsi_script));
-	if (!scr) {
+	if (!(scr = ast_calloc(1, sizeof(*scr)))) {
 		fclose(f);
-		ast_log(LOG_WARNING, "Out of memory loading script '%s'\n", fn);
 		return NULL;
 	}
-	memset(scr, 0, sizeof(struct adsi_script));
 	/* Create "main" as first subroutine */
 	getsubbyname(scr, "main", NULL, 0);
 	while(!feof(f)) {

Modified: team/bweschke/polycom_acd_functions/apps/app_alarmreceiver.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/apps/app_alarmreceiver.c?rev=8029&r1=8028&r2=8029&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/apps/app_alarmreceiver.c (original)
+++ team/bweschke/polycom_acd_functions/apps/app_alarmreceiver.c Thu Jan 12 13:45:01 2006
@@ -56,6 +56,7 @@
 #include "asterisk/localtime.h"
 #include "asterisk/callerid.h"
 #include "asterisk/astdb.h"
+#include "asterisk/utils.h"
 
 #define ALMRCV_CONFIG "alarmreceiver.conf"
 #define ADEMCO_CONTACT_ID "ADEMCO_CONTACT_ID"
@@ -579,17 +580,11 @@
 
 		events_received++;
 		
-		/* Queue the Event */
-
-		if((enew = malloc(sizeof(event_node_t))) == NULL){
-			if(option_verbose >= 1)
-				ast_verbose(VERBOSE_PREFIX_1 "AlarmReceiver: Failed to allocate memory\n");
-			ast_log(LOG_WARNING, "AlarmReceiver Failed to allocate memory\n");
+		/* Queue the Event */		
+		if (!(enew = ast_calloc(1, sizeof(*enew)))) {
 			res = -1;
-                        break;
-		}
-
-		memset(enew, 0, sizeof(event_node_t));
+			break;
+		}
 		
 		enew->next = NULL;
 		ast_copy_string(enew->data, event, sizeof(enew->data));

Modified: team/bweschke/polycom_acd_functions/apps/app_authenticate.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/apps/app_authenticate.c?rev=8029&r1=8028&r2=8029&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/apps/app_authenticate.c (original)
+++ team/bweschke/polycom_acd_functions/apps/app_authenticate.c Thu Jan 12 13:45:01 2006
@@ -44,6 +44,23 @@
 #include "asterisk/app.h"
 #include "asterisk/astdb.h"
 #include "asterisk/utils.h"
+#include "asterisk/options.h"
+
+enum {
+	OPT_ACCOUNT = (1 << 0),
+	OPT_DATABASE = (1 << 1),
+	OPT_JUMP = (1 << 2),
+	OPT_MULTIPLE = (1 << 3),
+	OPT_REMOVE = (1 << 4),
+} auth_option_flags;
+
+AST_APP_OPTIONS(auth_app_options, {
+	AST_APP_OPTION('a', OPT_ACCOUNT),
+	AST_APP_OPTION('d', OPT_DATABASE),
+	AST_APP_OPTION('j', OPT_JUMP),
+	AST_APP_OPTION('m', OPT_MULTIPLE),
+	AST_APP_OPTION('r', OPT_REMOVE),
+});
 
 static char *tdesc = "Authentication Application";
 
@@ -52,9 +69,9 @@
 static char *synopsis = "Authenticate a user";
 
 static char *descrip =
-"  Authenticate(password[|options]): This application asks the caller to enter a\n"
-"given password in order to continue dialplan execution. If the password begins\n"
-"with the '/' character, it is interpreted as a file which contains a list of\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"
 "  When using a database key, the value associated with the key can be anything.\n"
 "Users have three attempts to authenticate before the channel is hung up. If the\n"
@@ -69,6 +86,10 @@
 "         the file. When one of the passwords is matched, the channel will have\n"
 "         its account code set to the corresponding account code in the file.\n"
 "     r - Remove the database key upon successful entry (valid with 'd' only)\n"
+"     maxdigits  - maximum acceptable number of digits. Stops reading after\n"
+"         maxdigits have been entered (without requiring the user to\n"
+"         press the '#' key).\n"
+"         Defaults to 0 - no limit - wait for the user press the '#' key.\n"
 ;
 
 STANDARD_LOCAL_USER;
@@ -78,13 +99,19 @@
 static int auth_exec(struct ast_channel *chan, void *data)
 {
 	int res=0;
-	int jump = 0;
 	int retries;
 	struct localuser *u;
-	char password[256]="";
 	char passwd[256];
-	char *opts;
 	char *prompt;
+	int maxdigits;
+	char *argcopy =NULL;
+	struct ast_flags flags = {0};
+
+	AST_DECLARE_APP_ARGS(arglist,
+		AST_APP_ARG(password);
+		AST_APP_ARG(options);
+		AST_APP_ARG(maxdigits);
+	);
 	
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "Authenticate requires an argument(password)\n");
@@ -101,37 +128,49 @@
 		}
 	}
 	
-	strncpy(password, data, sizeof(password) - 1);
-	opts=strchr(password, '|');
-	if (opts) {
-		*opts = 0;
-		opts++;
-	} else
-		opts = "";
-	if (strchr(opts, 'j'))
-		jump = 1;
+	argcopy = ast_strdupa(data);
+	if (!argcopy) {
+		ast_log(LOG_ERROR, "Out of memory!\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
+
+	AST_STANDARD_APP_ARGS(arglist,argcopy);
+	
+	if (!ast_strlen_zero(arglist.options)) {
+		ast_app_parse_options(auth_app_options, &flags, NULL, arglist.options);
+	}
+
+	if (!ast_strlen_zero(arglist.maxdigits)) {
+		maxdigits = atoi(arglist.maxdigits);
+		if ((maxdigits<1) || (maxdigits>sizeof(passwd)-2))
+			maxdigits = sizeof(passwd) - 2;
+	} else {
+		maxdigits = sizeof(passwd) - 2;
+	}
+
 	/* Start asking for password */
 	prompt = "agent-pass";
 	for (retries = 0; retries < 3; retries++) {
-		res = ast_app_getdata(chan, prompt, passwd, sizeof(passwd) - 2, 0);
+		res = ast_app_getdata(chan, prompt, passwd, maxdigits, 0);
 		if (res < 0)
 			break;
 		res = 0;
-		if (password[0] == '/') {
-			if (strchr(opts, 'd')) {
+		if (arglist.password[0] == '/') {
+			if (ast_test_flag(&flags,OPT_DATABASE)) {
 				char tmp[256];
 				/* Compare against a database key */
-				if (!ast_db_get(password + 1, passwd, tmp, sizeof(tmp))) {
+				if (!ast_db_get(arglist.password + 1, passwd, tmp, sizeof(tmp))) {
 					/* It's a good password */
-					if (strchr(opts, 'r')) {
-						ast_db_del(password + 1, passwd);
+					if (ast_test_flag(&flags,OPT_REMOVE)) {
+						ast_db_del(arglist.password + 1, passwd);
 					}
 					break;
 				}
 			} else {
 				/* Compare against a file */
 				FILE *f;
-				f = fopen(password, "r");
+				f = fopen(arglist.password, "r");
 				if (f) {
 					char buf[256] = "";
 					char md5passwd[33] = "";
@@ -141,7 +180,7 @@
 						fgets(buf, sizeof(buf), f);
 						if (!feof(f) && !ast_strlen_zero(buf)) {
 							buf[strlen(buf) - 1] = '\0';
-							if (strchr(opts, 'm')) {
+							if (ast_test_flag(&flags,OPT_MULTIPLE)) {
 								md5secret = strchr(buf, ':');
 								if (md5secret == NULL)
 									continue;
@@ -149,13 +188,13 @@
 								md5secret++;
 								ast_md5_hash(md5passwd, passwd);
 								if (!strcmp(md5passwd, md5secret)) {
-									if (strchr(opts, 'a'))
+									if (ast_test_flag(&flags,OPT_ACCOUNT))
 										ast_cdr_setaccount(chan, buf);
 									break;
 								}
 							} else {
 								if (!strcmp(passwd, buf)) {
-									if (strchr(opts, 'a'))
+									if (ast_test_flag(&flags,OPT_ACCOUNT))
 										ast_cdr_setaccount(chan, buf);
 									break;
 								}
@@ -164,7 +203,7 @@
 					}
 					fclose(f);
 					if (!ast_strlen_zero(buf)) {
-						if (strchr(opts, 'm')) {
+						if (ast_test_flag(&flags,OPT_MULTIPLE)) {
 							if (md5secret && !strcmp(md5passwd, md5secret))
 								break;
 						} else {
@@ -173,23 +212,23 @@
 						}
 					}
 				} else 
-					ast_log(LOG_WARNING, "Unable to open file '%s' for authentication: %s\n", password, strerror(errno));
+					ast_log(LOG_WARNING, "Unable to open file '%s' for authentication: %s\n", arglist.password, strerror(errno));
 			}
 		} else {
 			/* Compare against a fixed password */
-			if (!strcmp(passwd, password)) 
+			if (!strcmp(passwd, arglist.password)) 
 				break;
 		}
 		prompt="auth-incorrect";
 	}
 	if ((retries < 3) && !res) {
-		if (strchr(opts, 'a') && !strchr(opts, 'm')) 
+		if (ast_test_flag(&flags,OPT_ACCOUNT) && !ast_test_flag(&flags,OPT_MULTIPLE)) 
 			ast_cdr_setaccount(chan, passwd);
 		res = ast_streamfile(chan, "auth-thankyou", chan->language);
 		if (!res)
 			res = ast_waitstream(chan, "");
 	} else {
-		if (jump && ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) {
+		if (ast_test_flag(&flags,OPT_JUMP) && ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) {
 			res = 0;
 		} else {
 			if (!ast_streamfile(chan, "vm-goodbye", chan->language))

Modified: team/bweschke/polycom_acd_functions/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/apps/app_chanspy.c?rev=8029&r1=8028&r2=8029&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/apps/app_chanspy.c (original)
+++ team/bweschke/polycom_acd_functions/apps/app_chanspy.c Thu Jan 12 13:45:01 2006
@@ -2,6 +2,7 @@
  * Asterisk -- An open source telephony toolkit.
  *
  * Copyright (C) 2005 Anthony Minessale II (anthmct at yahoo.com)
+ * Copyright (C) 2005 - 2006, Digium, Inc.
  *
  * Disclaimed to Digium
  *
@@ -211,9 +212,9 @@
 
 static void stop_spying(struct ast_channel *chan, struct ast_channel_spy *spy) 
 {
-	/* If our status has changed, then the channel we're spying on is gone....
+	/* If our status has changed to DONE, then the channel we're spying on is gone....
 	   DON'T TOUCH IT!!!  RUN AWAY!!! */
-	if (spy->status != CHANSPY_RUNNING)
+	if (spy->status == CHANSPY_DONE)
 		return;
 
 	if (!chan)

Modified: team/bweschke/polycom_acd_functions/apps/app_curl.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/apps/app_curl.c?rev=8029&r1=8028&r2=8029&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/apps/app_curl.c (original)
+++ team/bweschke/polycom_acd_functions/apps/app_curl.c Thu Jan 12 13:45:01 2006
@@ -46,6 +46,7 @@
 #include "asterisk/options.h"
 #include "asterisk/module.h"
 #include "asterisk/app.h"
+#include "asterisk/utils.h"
 
 static char *tdesc = "Load external URL";
 
@@ -63,9 +64,9 @@
 	/* There might be a realloc() out there that doesn't like reallocing
 	   NULL pointers, so we take care of it here */
 	if (ptr)
-		return realloc(ptr, size);
+		return ast_realloc(ptr, size);
 	else
-		return malloc(size);
+		return ast_malloc(size);
 }
 
 static size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)

Modified: team/bweschke/polycom_acd_functions/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/apps/app_dial.c?rev=8029&r1=8028&r2=8029&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/apps/app_dial.c (original)
+++ team/bweschke/polycom_acd_functions/apps/app_dial.c Thu Jan 12 13:45:01 2006
@@ -164,7 +164,7 @@
 "    S(x) - Hang up the call after 'x' seconds *after* the called party has\n"
 "           answered the call.\n"  	
 "    t    - Allow the called party to transfer the calling party by sending the\n"
-"           DTMF sequence defiend in features.conf.\n"
+"           DTMF sequence defined in features.conf.\n"
 "    T    - Allow the calling party to transfer the called party by sending the\n"
 "           DTMF sequence defined in features.conf.\n"
 "    w    - Allow the called party to enable recording of the call by sending\n"
@@ -984,13 +984,10 @@
 			goto out;
 		}
 		*number = '\0';
-		number++;
-		tmp = malloc(sizeof(struct localuser));
-		if (!tmp) {
-			ast_log(LOG_WARNING, "Out of memory\n");
+		number++;		
+		if (!(tmp = ast_calloc(1, sizeof(*tmp)))) {
 			goto out;
 		}
-		memset(tmp, 0, sizeof(struct localuser));
 		if (opts.flags) {
 			ast_copy_flags(tmp, &opts,
 				       OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER |

Modified: team/bweschke/polycom_acd_functions/apps/app_dictate.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/apps/app_dictate.c?rev=8029&r1=8028&r2=8029&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/apps/app_dictate.c (original)
+++ team/bweschke/polycom_acd_functions/apps/app_dictate.c Thu Jan 12 13:45:01 2006
@@ -82,7 +82,12 @@
 
 static int dictate_exec(struct ast_channel *chan, void *data)
 {
-	char *mydata, *argv[3], *path = NULL, filein[256], *filename = "";
+	char *path = NULL, filein[256], *filename = "";
+	char *parse;
+	AST_DECLARE_APP_ARGS(args,
+		AST_APP_ARG(base);
+		AST_APP_ARG(filename);
+	);
 	char dftbase[256];
 	char *base;
 	struct ast_flags flags = {0};
@@ -91,7 +96,6 @@
 	struct localuser *u;
 	int ffactor = 320 * 80,
 		res = 0,
-		argc = 0,
 		done = 0,
 		oldr = 0,
 		lastop = 0,
@@ -105,17 +109,23 @@
 	LOCAL_USER_ADD(u);
 	
 	snprintf(dftbase, sizeof(dftbase), "%s/dictate", ast_config_AST_SPOOL_DIR);
-	if (!ast_strlen_zero(data) && (mydata = ast_strdupa(data))) {
-		argc = ast_app_separate_args(mydata, '|', argv, sizeof(argv) / sizeof(argv[0]));
-	}
+	if (!ast_strlen_zero(data)) {
+		parse = ast_strdupa(data);
+		if (!parse) {
+			ast_log(LOG_ERROR, "Out of memory!\n");
+			return -1;
+		}
+		AST_STANDARD_APP_ARGS(args, parse);
+	} else
+		args.argc = 0;
 	
-	if (argc) {
-		base = argv[0];
+	if (args.argc && !ast_strlen_zero(args.base)) {
+		base = args.base;
 	} else {
 		base = dftbase;
 	}
-	if (argc && argv[1]) {
-		filename = argv[1];
+	if (args.argc > 1 && args.filename) {
+		filename = args.filename;
 	} 
 	oldr = chan->readformat;
 	if ((res = ast_set_read_format(chan, AST_FORMAT_SLINEAR)) < 0) {

Modified: team/bweschke/polycom_acd_functions/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/apps/app_directory.c?rev=8029&r1=8028&r2=8029&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/apps/app_directory.c (original)
+++ team/bweschke/polycom_acd_functions/apps/app_directory.c Thu Jan 12 13:45:01 2006
@@ -84,7 +84,7 @@
 {
 	char *tmp;
 	int lcount = 0;
-	tmp = malloc(NUMDIGITS + 1);
+	tmp = ast_malloc(NUMDIGITS + 1);
 	if (tmp) {
 		while((*lastname > 32) && lcount < NUMDIGITS) {
 			switch(toupper(*lastname)) {

Modified: team/bweschke/polycom_acd_functions/apps/app_disa.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/apps/app_disa.c?rev=8029&r1=8028&r2=8029&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/apps/app_disa.c (original)
+++ team/bweschke/polycom_acd_functions/apps/app_disa.c Thu Jan 12 13:45:01 2006
@@ -146,12 +146,12 @@
 	}
 	
 	if (ast_set_write_format(chan,AST_FORMAT_ULAW)) {
-		ast_log(LOG_WARNING, "Unable to set write format to Mu-law on %s\n",chan->name);
+		ast_log(LOG_WARNING, "Unable to set write format to Mu-law on %s\n", chan->name);
 		LOCAL_USER_REMOVE(u);
 		return -1;
 	}
 	if (ast_set_read_format(chan,AST_FORMAT_ULAW)) {
-		ast_log(LOG_WARNING, "Unable to set read format to Mu-law on %s\n",chan->name);
+		ast_log(LOG_WARNING, "Unable to set read format to Mu-law on %s\n", chan->name);
 		LOCAL_USER_REMOVE(u);
 		return -1;
 	}
@@ -198,8 +198,7 @@
 	for (;;) {
 		  /* if outa time, give em reorder */
 		if (ast_tvdiff_ms(ast_tvnow(), lastdigittime) > 
-		    ((k&2) ? digittimeout : firstdigittimeout))
-		{
+		    ((k&2) ? digittimeout : firstdigittimeout)) {
 			ast_log(LOG_DEBUG,"DISA %s entry timeout on chan %s\n",
 				((k&1) ? "extension" : "password"),chan->name);
 			break;
@@ -210,14 +209,12 @@
 		}
 			
 		f = ast_read(chan);
-		if (f == NULL) 
-		{
+		if (f == NULL) {
 			LOCAL_USER_REMOVE(u);
 			return -1;
 		}
 		if ((f->frametype == AST_FRAME_CONTROL) &&
-		    (f->subclass == AST_CONTROL_HANGUP))
-		{
+		    (f->subclass == AST_CONTROL_HANGUP)) {
 			ast_frfree(f);
 			LOCAL_USER_REMOVE(u);
 			return -1;
@@ -226,56 +223,54 @@
 			ast_frfree(f);
 			continue;
 		}
-		  /* if not DTMF, just do it again */
-		if (f->frametype != AST_FRAME_DTMF) 
-		{
+
+		/* if not DTMF, just do it again */
+		if (f->frametype != AST_FRAME_DTMF) {
 			ast_frfree(f);
 			continue;
 		}
 
 		j = f->subclass;  /* save digit */
 		ast_frfree(f);
-		if (i == 0) 
-		{
+		if (i == 0) {
 			k|=2; /* We have the first digit */ 
 			ast_playtones_stop(chan);
 		}
 		lastdigittime = ast_tvnow();
 		  /* got a DTMF tone */
-		if (i < AST_MAX_EXTENSION) /* if still valid number of digits */
-		{
-			if (!(k&1)) /* if in password state */
-			{
-				if (j == '#') /* end of password */
-				{
+		if (i < AST_MAX_EXTENSION) { /* if still valid number of digits */
+			if (!(k&1)) { /* if in password state */
+				if (j == '#') { /* end of password */
 					  /* see if this is an integer */
-					if (sscanf(args.passcode,"%d",&j) < 1)
-					   { /* nope, it must be a filename */
+					if (sscanf(args.passcode,"%d",&j) < 1) { /* nope, it must be a filename */
 						fp = fopen(args.passcode,"r");
-						if (!fp)
-						   {
+						if (!fp) {
 							ast_log(LOG_WARNING,"DISA password file %s not found on chan %s\n",args.passcode,chan->name);
 							LOCAL_USER_REMOVE(u);
 							return -1;
-						   }
+						}
 						pwline[0] = 0;
-						while(fgets(pwline,sizeof(pwline) - 1,fp))
-						   {
-							if (!pwline[0]) continue;
+						while(fgets(pwline,sizeof(pwline) - 1,fp)) {
+							if (!pwline[0])
+								continue;
 							if (pwline[strlen(pwline) - 1] == '\n') 
 								pwline[strlen(pwline) - 1] = 0;
-							if (!pwline[0]) continue;
-							  /* skip comments */
-							if (pwline[0] == '#') continue;
-							if (pwline[0] == ';') continue;
+							if (!pwline[0])
+								continue;
+							 /* skip comments */
+							if (pwline[0] == '#')
+								continue;
+							if (pwline[0] == ';')
+								continue;
 
 							AST_STANDARD_APP_ARGS(args, pwline);
 			
 							ast_log(LOG_DEBUG, "Mailbox: %s\n",args.mailbox);
 
-							  /* password must be in valid format (numeric) */
-							if (sscanf(args.passcode,"%d",&j) < 1) continue;
-							  /* if we got it */
+							/* password must be in valid format (numeric) */
+							if (sscanf(args.passcode,"%d", &j) < 1)
+								continue;
+							 /* if we got it */
 							if (!strcmp(exten,args.passcode)) {
 								if (ast_strlen_zero(args.context))
 									args.context = "disa";
@@ -283,12 +278,11 @@
 									args.mailbox = "";
 								break;
 							}
-						   }
+						}
 						fclose(fp);
-					   }
-					  /* compare the two */
-					if (strcmp(exten,args.passcode))
-					{
+					}
+					/* compare the two */
+					if (strcmp(exten,args.passcode)) {
 						ast_log(LOG_WARNING,"DISA on chan %s got bad password %s\n",chan->name,exten);
 						goto reorder;
 
@@ -302,15 +296,16 @@
 					exten[sizeof(acctcode)] = 0;
 					ast_copy_string(acctcode, exten, sizeof(acctcode));
 					exten[0] = 0;
-					ast_log(LOG_DEBUG,"Successful DISA log-in on chan %s\n",chan->name);
+					ast_log(LOG_DEBUG,"Successful DISA log-in on chan %s\n", chan->name);
 					continue;
 				}
 			}
 
 			exten[i++] = j;  /* save digit */
 			exten[i] = 0;
-			if (!(k&1)) continue; /* if getting password, continue doing it */
-			  /* if this exists */
+			if (!(k&1))
+				continue; /* if getting password, continue doing it */
+			/* if this exists */
 
 			if (ast_ignore_pattern(args.context, exten)) {
 				play_dialtone(chan, "");
@@ -321,7 +316,7 @@
 					did_ignore = 0;
 				}
 
-			  /* if can do some more, do it */
+			/* if can do some more, do it */
 			if (!ast_matchmore_extension(chan,args.context,exten,1, chan->cid.cid_num)) {
 				break;
 			}
@@ -341,8 +336,7 @@
 		if (!recheck || ast_exists_extension(chan, args.context, exten, 1, chan->cid.cid_num)) {
 			ast_playtones_stop(chan);
 			/* We're authenticated and have a target extension */
-			if (!ast_strlen_zero(args.cid))
-			{
+			if (!ast_strlen_zero(args.cid)) {
 				ast_callerid_split(args.cid, ourcidname, sizeof(ourcidname), ourcidnum, sizeof(ourcidnum));
 				ast_set_callerid(chan, ourcidnum, ourcidname, ourcidnum);
 			}
@@ -364,8 +358,7 @@
 	ast_indicate(chan,AST_CONTROL_CONGESTION);
 	/* something is invalid, give em reorder for several seconds */
 	time(&rstart);
-	while(time(NULL) < rstart + 10)
-	{
+	while(time(NULL) < rstart + 10) {
 		if (ast_waitfor(chan, -1) < 0)
 			break;
 		f = ast_read(chan);

Modified: team/bweschke/polycom_acd_functions/apps/app_externalivr.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/apps/app_externalivr.c?rev=8029&r1=8028&r2=8029&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/apps/app_externalivr.c (original)
+++ team/bweschke/polycom_acd_functions/apps/app_externalivr.c Thu Jan 12 13:45:01 2006
@@ -49,6 +49,7 @@
 #include "asterisk/module.h"
 #include "asterisk/linkedlists.h"
 #include "asterisk/app.h"
+#include "asterisk/utils.h"
 
 static const char *tdesc = "External IVR Interface Application";
 
@@ -112,10 +113,8 @@
 {
 	struct localuser *u = params;
 	struct gen_state *state;
-
-	state = calloc(1, sizeof(*state));
-
-	if (!state)
+	
+	if (!(state = ast_calloc(1, sizeof(*state))))
 		return NULL;
 
 	state->u = u;
@@ -234,10 +233,8 @@
 static struct playlist_entry *make_entry(const char *filename)
 {
 	struct playlist_entry *entry;
-
-	entry = calloc(1, sizeof(*entry) + strlen(filename) + 10);
-
-	if (!entry)
+	
+	if (!(entry = ast_calloc(1, sizeof(*entry) + strlen(filename) + 10)))
 		return NULL;
 
 	strcpy(entry->filename, filename);

Modified: team/bweschke/polycom_acd_functions/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/apps/app_meetme.c?rev=8029&r1=8028&r2=8029&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/apps/app_meetme.c (original)
+++ team/bweschke/polycom_acd_functions/apps/app_meetme.c Thu Jan 12 13:45:01 2006
@@ -662,8 +662,14 @@
 			}
 		}
 		/* Show all the users */
-		for (user = cnf->firstuser; user; user = user->nextuser)
-			ast_cli(fd, "User #: %-2.2d %12.12s %-20.20s Channel: %s %s %s %s %s\n",
+		for (user = cnf->firstuser; user; user = user->nextuser){
+			now = time(NULL);
+			hr = (now - user->jointime) / 3600;
+			min = ((now - user->jointime) % 3600) / 60;
+			sec = (now - user->jointime) % 60;
+
+
+			ast_cli(fd, "User #: %-2.2d %12.12s %-20.20s Channel: %s %s %s %s %s %02d:%02d:%02d\n",
 				user->user_no,
 				user->chan->cid.cid_num ? user->chan->cid.cid_num : "<unknown>",
 				user->chan->cid.cid_name ? user->chan->cid.cid_name : "<no name>",
@@ -671,7 +677,8 @@
 				user->userflags & CONFFLAG_ADMIN ? "(Admin)" : "",
 				user->userflags & CONFFLAG_MONITOR ? "(Listen only)" : "",
 				user->adminflags & ADMINFLAG_MUTED ? "(Admn Muted)" : "",
-				istalking(user->talking));
+				istalking(user->talking), hr, min, sec);
+		}
 		ast_cli(fd,"%d users in that conference.\n",cnf->users);
 
 		return RESULT_SUCCESS;
@@ -867,6 +874,8 @@
 	int menu_active = 0;
 	int using_pseudo = 0;
 	int duration=20;
+	int hr, min, sec;
+	time_t now;
 	struct ast_dsp *dsp=NULL;
 	struct ast_app *app;
 	const char *agifile;
@@ -1661,12 +1670,26 @@
 		ast_dsp_free(dsp);
 	
 	if (user->user_no) { /* Only cleanup users who really joined! */
-		manager_event(EVENT_FLAG_CALL, "MeetmeLeave", 
-			      "Channel: %s\r\n"
-			      "Uniqueid: %s\r\n"
-			      "Meetme: %s\r\n"
-			      "Usernum: %d\r\n",
-			      chan->name, chan->uniqueid, conf->confno, user->user_no);
+		now = time(NULL);
+		hr = (now - user->jointime) / 3600;
+		min = ((now - user->jointime) % 3600) / 60;
+		sec = (now - user->jointime) % 60;
+
+		manager_event(EVENT_FLAG_CALL, "MeetmeLeave",
+			"Channel: %s\r\n"
+			"Uniqueid: %s\r\n"
+			"Meetme: %s\r\n"
+			"Usernum: %d\r\n"
+		        "CIDnum: %s\r\n"
+			"CIDname: %s\r\n"
+		        "Duration: %02d:%02d:%02d\r\n",
+			 chan->name, chan->uniqueid, conf->confno, 
+			  user->user_no,
+			  user->chan->cid.cid_num ? user->chan->cid.cid_num :
+		         "<unknown>",
+		         user->chan->cid.cid_name ? user->chan->cid.cid_name :
+		          "<no name>", hr, min, sec);
+
 		conf->users--;
 		if (confflags & CONFFLAG_MARKEDUSER) 
 			conf->markedusers--;

Modified: team/bweschke/polycom_acd_functions/apps/app_milliwatt.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/apps/app_milliwatt.c?rev=8029&r1=8028&r2=8029&view=diff
==============================================================================

[... 11054 lines stripped ...]


More information about the asterisk-commits mailing list