[asterisk-commits] branch oej/peermatch r16826 - in /team/oej/peermatch: ./ apps/ channels/ chan...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Mar 31 17:31:36 MST 2006


Author: oej
Date: Fri Mar 31 18:31:21 2006
New Revision: 16826

URL: http://svn.digium.com/view/asterisk?rev=16826&view=rev
Log:
Update

Added:
    team/oej/peermatch/doc/ip-tos.txt
      - copied unchanged from r16703, trunk/doc/ip-tos.txt
Modified:
    team/oej/peermatch/   (props changed)
    team/oej/peermatch/.cleancount
    team/oej/peermatch/CREDITS
    team/oej/peermatch/Makefile
    team/oej/peermatch/acl.c
    team/oej/peermatch/app.c
    team/oej/peermatch/apps/app_channelredirect.c
    team/oej/peermatch/apps/app_dial.c
    team/oej/peermatch/apps/app_directory.c
    team/oej/peermatch/apps/app_dumpchan.c
    team/oej/peermatch/apps/app_echo.c
    team/oej/peermatch/apps/app_exec.c
    team/oej/peermatch/apps/app_macro.c
    team/oej/peermatch/apps/app_meetme.c
    team/oej/peermatch/apps/app_milliwatt.c
    team/oej/peermatch/apps/app_page.c
    team/oej/peermatch/apps/app_queue.c
    team/oej/peermatch/apps/app_rpt.c
    team/oej/peermatch/apps/app_sms.c
    team/oej/peermatch/apps/app_stack.c
    team/oej/peermatch/apps/app_voicemail.c
    team/oej/peermatch/apps/app_while.c
    team/oej/peermatch/asterisk.8
    team/oej/peermatch/asterisk.c
    team/oej/peermatch/asterisk.sgml
    team/oej/peermatch/callerid.c
    team/oej/peermatch/channel.c
    team/oej/peermatch/channels/chan_agent.c
    team/oej/peermatch/channels/chan_iax2.c
    team/oej/peermatch/channels/chan_local.c
    team/oej/peermatch/channels/chan_misdn.c
    team/oej/peermatch/channels/chan_oss.c
    team/oej/peermatch/channels/chan_sip.c
    team/oej/peermatch/channels/chan_skinny.c
    team/oej/peermatch/channels/chan_vpb.c
    team/oej/peermatch/channels/chan_zap.c
    team/oej/peermatch/channels/iax2-provision.c
    team/oej/peermatch/channels/iax2-provision.h
    team/oej/peermatch/channels/misdn/isdn_lib.c
    team/oej/peermatch/cli.c
    team/oej/peermatch/codecs/codec_a_mu.c
    team/oej/peermatch/codecs/codec_adpcm.c
    team/oej/peermatch/codecs/codec_alaw.c
    team/oej/peermatch/codecs/codec_g723_1.c
    team/oej/peermatch/codecs/codec_g726.c
    team/oej/peermatch/codecs/codec_gsm.c
    team/oej/peermatch/codecs/codec_ilbc.c
    team/oej/peermatch/codecs/codec_lpc10.c
    team/oej/peermatch/codecs/codec_speex.c
    team/oej/peermatch/codecs/codec_ulaw.c
    team/oej/peermatch/codecs/gsm/Makefile
    team/oej/peermatch/configs/extensions.conf.sample
    team/oej/peermatch/configs/http.conf.sample
    team/oej/peermatch/configs/iax.conf.sample
    team/oej/peermatch/configs/iaxprov.conf.sample
    team/oej/peermatch/configs/oss.conf.sample
    team/oej/peermatch/configs/queues.conf.sample
    team/oej/peermatch/configs/sip.conf.sample
    team/oej/peermatch/configs/skinny.conf.sample
    team/oej/peermatch/contrib/init.d/rc.redhat.asterisk
    team/oej/peermatch/doc/asterisk-conf.txt
    team/oej/peermatch/include/asterisk.h
    team/oej/peermatch/include/asterisk/acl.h
    team/oej/peermatch/include/asterisk/adsi.h
    team/oej/peermatch/include/asterisk/app.h
    team/oej/peermatch/include/asterisk/callerid.h
    team/oej/peermatch/include/asterisk/channel.h
    team/oej/peermatch/include/asterisk/cli.h
    team/oej/peermatch/include/asterisk/crypto.h
    team/oej/peermatch/include/asterisk/dns.h
    team/oej/peermatch/include/asterisk/enum.h
    team/oej/peermatch/include/asterisk/features.h
    team/oej/peermatch/include/asterisk/frame.h
    team/oej/peermatch/include/asterisk/fskmodem.h
    team/oej/peermatch/include/asterisk/image.h
    team/oej/peermatch/include/asterisk/indications.h
    team/oej/peermatch/include/asterisk/io.h
    team/oej/peermatch/include/asterisk/linkedlists.h
    team/oej/peermatch/include/asterisk/localtime.h
    team/oej/peermatch/include/asterisk/lock.h
    team/oej/peermatch/include/asterisk/logger.h
    team/oej/peermatch/include/asterisk/manager.h
    team/oej/peermatch/include/asterisk/module.h
    team/oej/peermatch/include/asterisk/musiconhold.h
    team/oej/peermatch/include/asterisk/options.h
    team/oej/peermatch/include/asterisk/pbx.h
    team/oej/peermatch/include/asterisk/plc.h
    team/oej/peermatch/include/asterisk/rtp.h
    team/oej/peermatch/include/asterisk/sched.h
    team/oej/peermatch/include/asterisk/tdd.h
    team/oej/peermatch/include/asterisk/term.h
    team/oej/peermatch/include/solaris-compat/compat.h
    team/oej/peermatch/indications.c
    team/oej/peermatch/loader.c
    team/oej/peermatch/manager.c
    team/oej/peermatch/pbx.c
    team/oej/peermatch/pbx/pbx_ael.c
    team/oej/peermatch/pbx/pbx_config.c
    team/oej/peermatch/pbx/pbx_dundi.c
    team/oej/peermatch/pbx/pbx_loopback.c
    team/oej/peermatch/pbx/pbx_realtime.c
    team/oej/peermatch/plc.c
    team/oej/peermatch/res/res_agi.c
    team/oej/peermatch/res/res_clioriginate.c
    team/oej/peermatch/res/res_features.c
    team/oej/peermatch/res/res_indications.c
    team/oej/peermatch/res/res_musiconhold.c
    team/oej/peermatch/res/res_smdi.c
    team/oej/peermatch/res/snmp/agent.c
    team/oej/peermatch/slinfactory.c
    team/oej/peermatch/strcompat.c
    team/oej/peermatch/translate.c
    team/oej/peermatch/utils.c
    team/oej/peermatch/utils/astman.c

Propchange: team/oej/peermatch/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.

Propchange: team/oej/peermatch/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/oej/peermatch/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Mar 31 18:31:21 2006
@@ -1,1 +1,1 @@
-/trunk:1-15250
+/trunk:1-16722

Modified: team/oej/peermatch/.cleancount
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/.cleancount?rev=16826&r1=16825&r2=16826&view=diff
==============================================================================
--- team/oej/peermatch/.cleancount (original)
+++ team/oej/peermatch/.cleancount Fri Mar 31 18:31:21 2006
@@ -1,1 +1,1 @@
-11
+12

Modified: team/oej/peermatch/CREDITS
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/CREDITS?rev=16826&r1=16825&r2=16826&view=diff
==============================================================================
--- team/oej/peermatch/CREDITS (original)
+++ team/oej/peermatch/CREDITS Fri Mar 31 18:31:21 2006
@@ -90,6 +90,11 @@
 Music provided by www.freeplaymusic.com
 
 === OTHER SOURCE CODE IN ASTERISK ===
+Asterisk uses libedit, the lightweight readline replacement from
+NetBSD. It is BSD-licensed and requires the following statement:
+
+      This product includes software developed by the NetBSD
+      Foundation, Inc. and its contributors.
 
 Digium did not implement the codecs in Asterisk.  Here is the copyright on the
 GSM source:

Modified: team/oej/peermatch/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/Makefile?rev=16826&r1=16825&r2=16826&view=diff
==============================================================================
--- team/oej/peermatch/Makefile (original)
+++ team/oej/peermatch/Makefile Fri Mar 31 18:31:21 2006
@@ -788,6 +788,8 @@
 		echo ";astctlowner = root" ; \
 		echo ";astctlgroup = apache" ; \
 		echo ";astctl = asterisk.ctl" ; \
+		echo ";[options]" ; \
+		echo ";internal_timing = yes" ; \
 		) > $(DESTDIR)$(ASTCONFPATH) ; \
 	else \
 		echo "Skipping asterisk.conf creation"; \

Modified: team/oej/peermatch/acl.c
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/acl.c?rev=16826&r1=16825&r2=16826&view=diff
==============================================================================
--- team/oej/peermatch/acl.c (original)
+++ team/oej/peermatch/acl.c Fri Mar 31 18:31:21 2006
@@ -1,7 +1,7 @@
 /*
  * Asterisk -- An open source telephony toolkit.
  *
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2006, Digium, Inc.
  *
  * Mark Spencer <markster at digium.com>
  *
@@ -20,7 +20,7 @@
  *
  * \brief Various sorts of access control
  *
- * \author Mark Spencer <markster at digium.com> 
+ * \author Mark Spencer <markster at digium.com>
  */
 
 #include <stdio.h>
@@ -136,7 +136,7 @@
 		if (prev)
 			prev->next = link;		/* Link previous to this object */
 
-		if (!ret) 
+		if (!ret)
 			ret = link;		/* Save starting point */
 
 		start = start->next;		/* Go to next object */
@@ -153,7 +153,7 @@
 	struct ast_ha *prev = NULL;
 	struct ast_ha *ret;
 	int x, z;
-	unsigned int y;		
+	unsigned int y;
 
 	ret = path;
 	while (path) {
@@ -252,12 +252,55 @@
 	return 0;
 }
 
-int ast_str2tos(const char *value, int *tos)
+struct dscp_codepoint {
+	char *name;
+	unsigned int space;
+};
+
+/* IANA registered DSCP codepoints */
+
+static const struct dscp_codepoint dscp_pool1[] = {
+	{ "CS0", 0x00 },
+	{ "CS1", 0x08 },
+	{ "CS2", 0x10 },
+	{ "CS3", 0x18 },
+	{ "CS4", 0x20 },
+	{ "CS5", 0x28 },
+	{ "CS6", 0x30 },
+	{ "CS7", 0x38 },
+	{ "AF11", 0x0A },
+	{ "AF12", 0x0C },
+	{ "AF13", 0x0E },
+	{ "AF21", 0x12 },
+	{ "AF22", 0x14 },
+	{ "AF23", 0x16 },
+	{ "AF31", 0x1A },
+	{ "AF32", 0x1C },
+	{ "AF33", 0x1E },
+	{ "AF41", 0x22 },
+	{ "AF42", 0x24 },
+	{ "AF43", 0x26 },
+	{ "EF", 0x2E },
+};
+
+int ast_str2tos(const char *value, unsigned int *tos)
 {
 	int fval;
-	if (sscanf(value, "%i", &fval) == 1)
-		*tos = fval & 0xff;
-	else if (!strcasecmp(value, "lowdelay"))
+	unsigned int x;
+
+	if (sscanf(value, "%i", &fval) == 1) {
+		*tos = fval & 0xFF;
+		return 0;
+	}
+
+	for (x = 0; x < sizeof(dscp_pool1) / sizeof(dscp_pool1[0]); x++) {
+		if (!strcasecmp(value, dscp_pool1[x].name)) {
+			*tos = dscp_pool1[x].space << 2;
+			return 0;
+		}
+	}
+
+	if (!strcasecmp(value, "lowdelay"))
 		*tos = IPTOS_LOWDELAY;
 	else if (!strcasecmp(value, "throughput"))
 		*tos = IPTOS_THROUGHPUT;
@@ -269,16 +312,44 @@
 		*tos = 0;
 	else
 		return -1;
+
+	ast_log(LOG_WARNING, "TOS value %s is deprecated. Please see doc/ip-tos.txt for more information.\n", value);
+
 	return 0;
 }
 
+const char *ast_tos2str(unsigned int tos)
+{
+	unsigned int x;
+
+	switch (tos) {
+	case 0:
+		return "none";
+	case IPTOS_LOWDELAY:
+		return "lowdelay";
+	case IPTOS_THROUGHPUT:
+		return "throughput";
+	case IPTOS_RELIABILITY:
+		return "reliability";
+	case IPTOS_MINCOST:
+		return "mincost";
+	default:
+		for (x = 0; x < sizeof(dscp_pool1) / sizeof(dscp_pool1[0]); x++) {
+			if (dscp_pool1[x].space == (tos >> 2))
+				return dscp_pool1[x].name;
+		}
+	}
+
+	return "unknown";
+}
+
 int ast_get_ip(struct sockaddr_in *sin, const char *value)
 {
 	return ast_get_ip_or_srv(sin, value, NULL);
 }
 
 /* iface is the interface (e.g. eth0); address is the return value */
-int ast_lookup_iface(char *iface, struct in_addr *address) 
+int ast_lookup_iface(char *iface, struct in_addr *address)
 {
 	int mysock, res = 0;
 	struct my_ifreq ifreq;
@@ -357,4 +428,3 @@
 		return 0;
 	return -1;
 }
-

Modified: team/oej/peermatch/app.c
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/app.c?rev=16826&r1=16825&r2=16826&view=diff
==============================================================================
--- team/oej/peermatch/app.c (original)
+++ team/oej/peermatch/app.c Fri Mar 31 18:31:21 2006
@@ -79,7 +79,7 @@
 	else 
 		ast_log(LOG_NOTICE,"Huh....? no dial for indications?\n");
 	
-	for (x = strlen(collect); strlen(collect) < maxlen; ) {
+	for (x = strlen(collect); x < maxlen; ) {
 		res = ast_waitfordigit(chan, timeout);
 		if (!ast_ignore_pattern(context, collect))
 			ast_playtones_stop(chan);
@@ -94,12 +94,8 @@
 			break;
 		}
 	}
-	if (res >= 0) {
-		if (ast_exists_extension(chan, context, collect, 1, chan->cid.cid_num))
-			res = 1;
-		else
-			res = 0;
-	}
+	if (res >= 0)
+		res = ast_exists_extension(chan, context, collect, 1, chan->cid.cid_num) ? 1 : 0;
 	return res;
 }
 
@@ -1059,7 +1055,7 @@
 	if (ast_strlen_zero(group))
 		return 0;
 
- 	s = (!ast_strlen_zero(category)) ? category : GROUP_CATEGORY_PREFIX;
+ 	s = S_OR(category, GROUP_CATEGORY_PREFIX);
 	ast_copy_string(cat, s, sizeof(cat));
 
 	chan = NULL;
@@ -1089,7 +1085,7 @@
 	if (regcomp(&regexbuf, groupmatch, REG_EXTENDED | REG_NOSUB))
 		return 0;
 
-	s = (!ast_strlen_zero(category)) ? category : GROUP_CATEGORY_PREFIX;
+	s = S_OR(category, GROUP_CATEGORY_PREFIX);
 	ast_copy_string(cat, s, sizeof(cat));
 
 	chan = NULL;
@@ -1153,9 +1149,10 @@
 	char *fs;
 	int res;
 	int fd;
+	int lp = strlen(path);
 	time_t start;
 
-	if (!(s = alloca(strlen(path) + 10)) || !(fs = alloca(strlen(path) + 20))) {
+	if (!(s = alloca(lp + 10)) || !(fs = alloca(lp + 20))) {
 		ast_log(LOG_WARNING, "Out of memory!\n");
 		return AST_LOCK_FAILURE;
 	}
@@ -1510,7 +1507,7 @@
 	if (fd < 0) {
 		ast_log(LOG_WARNING, "Cannot open file '%s' for reading: %s\n", filename, strerror(errno));
 		return NULL;
-	}	
+	}
 	if ((output = ast_malloc(count))) {
 		res = read(fd, output, count - 1);
 		if (res == count - 1) {
@@ -1540,14 +1537,13 @@
 
 	s = optstr;
 	while (*s) {
-		curarg = *s++ & 0x7f;
+		curarg = *s++ & 0x7f;	/* the array (in app.h) has 128 entries */
 		ast_set_flag(flags, options[curarg].flag);
 		argloc = options[curarg].arg_index;
 		if (*s == '(') {
 			/* Has argument */
 			arg = ++s;
-			while (*s && (*s != ')'))
-				s++;
+			s = strchr(s, ')');
 			if (*s) {
 				if (argloc)
 					args[argloc - 1] = arg;

Modified: team/oej/peermatch/apps/app_channelredirect.c
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/apps/app_channelredirect.c?rev=16826&r1=16825&r2=16826&view=diff
==============================================================================
--- team/oej/peermatch/apps/app_channelredirect.c (original)
+++ team/oej/peermatch/apps/app_channelredirect.c Fri Mar 31 18:31:21 2006
@@ -47,8 +47,6 @@
 static char *descrip = 
 "ChannelRedirect(channel|[[context|]extension|]priority):\n"
 "  Sends the specified channel to the specified extension priority\n";
-
-STANDARD_LOCAL_USER;
 
 LOCAL_USER_DECL;
 

Modified: team/oej/peermatch/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/apps/app_dial.c?rev=16826&r1=16825&r2=16826&view=diff
==============================================================================
--- team/oej/peermatch/apps/app_dial.c (original)
+++ team/oej/peermatch/apps/app_dial.c Fri Mar 31 18:31:21 2006
@@ -541,7 +541,7 @@
 							senddialevent(in, o->chan);
 							/* After calling, set callerid to extension */
 							if (!ast_test_flag(peerflags, OPT_ORIGINAL_CLID))
-								ast_set_callerid(o->chan, ast_strlen_zero(in->macroexten) ? in->exten : in->macroexten, get_cid_name(cidname, sizeof(cidname), in), NULL);
+								ast_set_callerid(o->chan, S_OR(in->macroexten, in->exten), get_cid_name(cidname, sizeof(cidname), in), NULL);
 						}
 					}
 					/* Hangup the original channel now, in case we needed it */
@@ -1135,7 +1135,7 @@
 			if (option_verbose > 2)
 				ast_verbose(VERBOSE_PREFIX_3 "Called %s\n", numsubst);
 			if (!ast_test_flag(peerflags, OPT_ORIGINAL_CLID))
-				ast_set_callerid(tmp->chan, ast_strlen_zero(chan->macroexten) ? chan->exten : chan->macroexten, get_cid_name(cidname, sizeof(cidname), chan), NULL);
+				ast_set_callerid(tmp->chan, S_OR(chan->macroexten, chan->exten), get_cid_name(cidname, sizeof(cidname), chan), NULL);
 		}
 		/* Put them in the list of outgoing thingies...  We're ready now. 
 		   XXX If we're forcibly removed, these outgoing calls won't get
@@ -1449,7 +1449,7 @@
 					if (*ch == '^')
 						*ch = '|';
 				}
-				res = pbx_exec(peer, app, opt_args[OPT_ARG_CALLEE_MACRO], 1);
+				res = pbx_exec(peer, app, opt_args[OPT_ARG_CALLEE_MACRO]);
 				ast_log(LOG_DEBUG, "Macro exited with status %d\n", res);
 				res = 0;
 			} else {

Modified: team/oej/peermatch/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/apps/app_directory.c?rev=16826&r1=16825&r2=16826&view=diff
==============================================================================
--- team/oej/peermatch/apps/app_directory.c (original)
+++ team/oej/peermatch/apps/app_directory.c Fri Mar 31 18:31:21 2006
@@ -179,7 +179,7 @@
 		}
 		ast_stopstream(chan);
 	} else {
-		res = ast_say_character_str(chan, !ast_strlen_zero(name) ? name : ext,
+		res = ast_say_character_str(chan, S_OR(name, ext),
 					AST_DIGIT_ANY, chan->language);
 	}
 

Modified: team/oej/peermatch/apps/app_dumpchan.c
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/apps/app_dumpchan.c?rev=16826&r1=16825&r2=16826&view=diff
==============================================================================
--- team/oej/peermatch/apps/app_dumpchan.c (original)
+++ team/oej/peermatch/apps/app_dumpchan.c Fri Mar 31 18:31:21 2006
@@ -126,7 +126,7 @@
 			 ast_print_group(cgrp, sizeof(cgrp), c->callgroup),
 			 ast_print_group(pgrp, sizeof(pgrp), c->pickupgroup),
 			 ( c->appl ? c->appl : "(N/A)" ),
-			 ( c-> data ? (!ast_strlen_zero(c->data) ? c->data : "(Empty)") : "(None)"),
+			 ( c-> data ? S_OR(c->data, "(Empty)") : "(None)"),
 			 (ast_test_flag(c, AST_FLAG_BLOCKING) ? c->blockproc : "(Not Blocking)"));
 
 	return 0;

Modified: team/oej/peermatch/apps/app_echo.c
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/apps/app_echo.c?rev=16826&r1=16825&r2=16826&view=diff
==============================================================================
--- team/oej/peermatch/apps/app_echo.c (original)
+++ team/oej/peermatch/apps/app_echo.c Fri Mar 31 18:31:21 2006
@@ -59,7 +59,6 @@
 	int res = -1;
 	int format;
 	struct localuser *u;
-	struct ast_frame *f;
 
 	LOCAL_USER_ADD(u);
 
@@ -68,7 +67,7 @@
 	ast_set_read_format(chan, format);
 
 	while (ast_waitfor(chan, -1) > -1) {
-		f = ast_read(chan);
+		struct ast_frame *f = ast_read(chan);
 		if (!f)
 			break;
 		f->delivery.tv_sec = 0;

Modified: team/oej/peermatch/apps/app_exec.c
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/apps/app_exec.c?rev=16826&r1=16825&r2=16826&view=diff
==============================================================================
--- team/oej/peermatch/apps/app_exec.c (original)
+++ team/oej/peermatch/apps/app_exec.c Fri Mar 31 18:31:21 2006
@@ -82,7 +82,7 @@
 			if (appname) {
 				app = pbx_findapp(appname);
 				if (app) {
-					res = pbx_exec(chan, app, args, 1);
+					res = pbx_exec(chan, app, args);
 				} else {
 					ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
 					res = -1;

Modified: team/oej/peermatch/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/apps/app_macro.c?rev=16826&r1=16825&r2=16826&view=diff
==============================================================================
--- team/oej/peermatch/apps/app_macro.c (original)
+++ team/oej/peermatch/apps/app_macro.c Fri Mar 31 18:31:21 2006
@@ -188,7 +188,7 @@
   		snprintf(varname, sizeof(varname), "ARG%d", argc);
 		s = pbx_builtin_getvar_helper(chan, varname);
 		if (s)
-			oldargs[argc] = strdup(s);
+			oldargs[argc] = ast_strdup(s);
 		pbx_builtin_setvar_helper(chan, varname, cur);
 		argc++;
 	}

Modified: team/oej/peermatch/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/apps/app_meetme.c?rev=16826&r1=16825&r2=16826&view=diff
==============================================================================
--- team/oej/peermatch/apps/app_meetme.c (original)
+++ team/oej/peermatch/apps/app_meetme.c Fri Mar 31 18:31:21 2006
@@ -685,42 +685,36 @@
 	return 0;
 }
 
-static char *complete_confcmd(const char *line, const char *word, int pos, int state) {
-#define CONF_COMMANDS 6
-	int which = 0, x = 0;
+static char *complete_confcmd(const char *line, const char *word, int pos, int state)
+{
+	static char *cmds[] = {"lock", "unlock", "mute", "unmute", "kick", "list", NULL};
+
+	int len = strlen(word);
+	int which = 0;
 	struct ast_conference *cnf = NULL;
 	struct ast_conf_user *usr = NULL;
 	char *confno = NULL;
 	char usrno[50] = "";
-	char cmds[CONF_COMMANDS][20] = {"lock", "unlock", "mute", "unmute", "kick", "list"};
-	char *myline;
+	char *myline, *ret = NULL;
 	
-	if (pos == 1) {
-		/* Command */
-		for (x = 0;x < CONF_COMMANDS; x++) {
-			if (!strncasecmp(cmds[x], word, strlen(word))) {
-				if (++which > state) {
-					return strdup(cmds[x]);
-				}
-			}
-		}
-	} else if (pos == 2) {
-		/* Conference Number */
+	if (pos == 1) {		/* Command */
+		return ast_cli_complete(word, cmds, state);
+	} else if (pos == 2) {	/* Conference Number */
 		AST_LIST_LOCK(&confs);
 		AST_LIST_TRAVERSE(&confs, cnf, list) {
-			if (!strncasecmp(word, cnf->confno, strlen(word))) {
-				if (++which > state)
-					break;
-			}
-		}
+			if (!strncasecmp(word, cnf->confno, len) && ++which > state) {
+				ret = cnf->confno;
+				break;
+			}
+		}
+		ret = ast_strdup(ret); /* dup before releasing the lock */
 		AST_LIST_UNLOCK(&confs);
-		return cnf ? strdup(cnf->confno) : NULL;
+		return ret;
 	} else if (pos == 3) {
 		/* User Number || Conf Command option*/
 		if (strstr(line, "mute") || strstr(line, "kick")) {
-			if ((state == 0) && (strstr(line, "kick") || strstr(line,"mute")) && !(strncasecmp(word, "all", strlen(word)))) {
+			if (state == 0 && (strstr(line, "kick") || strstr(line,"mute")) && !strncasecmp(word, "all", len))
 				return strdup("all");
-			}
 			which++;
 			AST_LIST_LOCK(&confs);
 
@@ -740,10 +734,8 @@
 				/* Search for the user */
 				for (usr = cnf->firstuser; usr; usr = usr->nextuser) {
 					snprintf(usrno, sizeof(usrno), "%d", usr->user_no);
-					if (!strncasecmp(word, usrno, strlen(word))) {
-						if (++which > state)
-							break;
-					}
+					if (!strncasecmp(word, usrno, len) && ++which > state)
+						break;
 				}
 			}
 			AST_LIST_UNLOCK(&confs);
@@ -1151,7 +1143,7 @@
 		app = pbx_findapp("agi");
 		if (app) {
 			char *s = ast_strdupa(agifile);
-			ret = pbx_exec(chan, app, s, 1);
+			ret = pbx_exec(chan, app, s);
 		} else {
 			ast_log(LOG_WARNING, "Could not find application (agi)\n");
 			ret = -2;
@@ -1845,8 +1837,8 @@
 				if (!strcasecmp(args.confno, confno)) {
 					/* Bingo it's a valid conference */
 					cnf = build_conf(args.confno,
-							ast_strlen_zero(args.pin) ? "" : args.pin,
-							ast_strlen_zero(args.pinadmin) ? "" : args.pinadmin,
+							S_OR(args.pin, ""),
+							S_OR(args.pinadmin, ""),
 							make, dynamic, refcount);
 					break;
 				}

Modified: team/oej/peermatch/apps/app_milliwatt.c
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/apps/app_milliwatt.c?rev=16826&r1=16825&r2=16826&view=diff
==============================================================================
--- team/oej/peermatch/apps/app_milliwatt.c (original)
+++ team/oej/peermatch/apps/app_milliwatt.c Fri Mar 31 18:31:21 2006
@@ -71,20 +71,27 @@
 {
 	struct ast_frame wf;
 	unsigned char buf[AST_FRIENDLY_OFFSET + 640];
-	int i,*indexp = (int *) data;
+	const int maxsamples = sizeof (buf) / sizeof (buf[0]);
+	int i, *indexp = (int *) data;
 
-	if (len + AST_FRIENDLY_OFFSET > sizeof(buf))
-	{
-		ast_log(LOG_WARNING,"Only doing %d bytes (%d bytes requested)\n",(int)(sizeof(buf) - AST_FRIENDLY_OFFSET),len);
-		len = sizeof(buf) - AST_FRIENDLY_OFFSET;
+	/* Instead of len, use samples, because channel.c generator_force
+	* generate(chan, tmp, 0, 160) ignores len. In any case, len is
+	* a multiple of samples, given by number of samples times bytes per
+	* sample. In the case of ulaw, len = samples. for signed linear
+	* len = 2 * samples */
+
+	if (samples > maxsamples) {
+		ast_log(LOG_WARNING, "Only doing %d samples (%d requested)\n", maxsamples, samples);
+		samples = maxsamples;
 	}
+	len = samples * sizeof (buf[0]);
 	wf.frametype = AST_FRAME_VOICE;
 	wf.subclass = AST_FORMAT_ULAW;
 	wf.offset = AST_FRIENDLY_OFFSET;
 	wf.mallocd = 0;
 	wf.data = buf + AST_FRIENDLY_OFFSET;
 	wf.datalen = len;
-	wf.samples = wf.datalen;
+	wf.samples = samples;
 	wf.src = "app_milliwatt";
 	wf.delivery.tv_sec = 0;
 	wf.delivery.tv_usec = 0;

Modified: team/oej/peermatch/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/apps/app_page.c?rev=16826&r1=16825&r2=16826&view=diff
==============================================================================
--- team/oej/peermatch/apps/app_page.c (original)
+++ team/oej/peermatch/apps/app_page.c Fri Mar 31 18:31:21 2006
@@ -186,7 +186,7 @@
 	}
 	if (!res) {
 		snprintf(meetmeopts, sizeof(meetmeopts), "%ud|A%sqxd", confid, ast_test_flag(&flags, PAGE_DUPLEX) ? "" : "t");
-		pbx_exec(chan, app, meetmeopts, 1);
+		pbx_exec(chan, app, meetmeopts);
 	}
 
 	LOCAL_USER_REMOVE(u);

Modified: team/oej/peermatch/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/apps/app_queue.c?rev=16826&r1=16825&r2=16826&view=diff
==============================================================================
--- team/oej/peermatch/apps/app_queue.c (original)
+++ team/oej/peermatch/apps/app_queue.c Fri Mar 31 18:31:21 2006
@@ -1440,12 +1440,9 @@
 	if (tmp->chan->cid.cid_ani)
 		free(tmp->chan->cid.cid_ani);
 	tmp->chan->cid.cid_ani = NULL;
-	if (qe->chan->cid.cid_num)
-		tmp->chan->cid.cid_num = strdup(qe->chan->cid.cid_num);
-	if (qe->chan->cid.cid_name)
-		tmp->chan->cid.cid_name = strdup(qe->chan->cid.cid_name);
-	if (qe->chan->cid.cid_ani)
-		tmp->chan->cid.cid_ani = strdup(qe->chan->cid.cid_ani);
+	tmp->chan->cid.cid_num = ast_strdup(qe->chan->cid.cid_num);
+	tmp->chan->cid.cid_name = ast_strdup(qe->chan->cid.cid_name);
+	tmp->chan->cid.cid_ani = ast_strdup(qe->chan->cid.cid_ani);
 
 	/* Inherit specially named variables from parent channel */
 	ast_channel_inherit_variables(qe->chan, tmp->chan);
@@ -1724,21 +1721,12 @@
 					} else {
 						if (o->chan->cid.cid_num)
 							free(o->chan->cid.cid_num);
-						o->chan->cid.cid_num = NULL;
+						o->chan->cid.cid_num = ast_strdup(in->cid.cid_num);
+
 						if (o->chan->cid.cid_name)
 							free(o->chan->cid.cid_name);
-						o->chan->cid.cid_name = NULL;
-
-						if (in->cid.cid_num) {
-							o->chan->cid.cid_num = strdup(in->cid.cid_num);
-							if (!o->chan->cid.cid_num)
-								ast_log(LOG_WARNING, "Out of memory\n");	
-						}
-						if (in->cid.cid_name) {
-							o->chan->cid.cid_name = strdup(in->cid.cid_name);
-							if (!o->chan->cid.cid_name)
-								ast_log(LOG_WARNING, "Out of memory\n");	
-						}
+						o->chan->cid.cid_name = ast_strdup(in->cid.cid_name);
+
 						ast_string_field_set(o->chan, accountcode, in->accountcode);
 						o->chan->cdrflags = in->cdrflags;
 
@@ -1749,10 +1737,8 @@
 						}
 						if (o->chan->cid.cid_rdnis) 
 							free(o->chan->cid.cid_rdnis);
-						if (!ast_strlen_zero(in->macroexten))
-							o->chan->cid.cid_rdnis = strdup(in->macroexten);
-						else
-							o->chan->cid.cid_rdnis = strdup(in->exten);
+						o->chan->cid.cid_rdnis =
+								ast_strdup(S_OR(in->macroexten, in->exten));
 						if (ast_call(o->chan, tmpchan, 0)) {
 							ast_log(LOG_NOTICE, "Failed to dial on local channel for call forward to '%s'\n", tmpchan);
 							do_hang(o);
@@ -2097,8 +2083,8 @@
 	if (!ast_strlen_zero(announceoverride))
 		announce = announceoverride;
 
- 	for (;cur; cur = cur->next) {
- 		struct callattempt *tmp = ast_calloc(1, sizeof(*tmp));
+	for (;cur; cur = cur->next) {
+		struct callattempt *tmp = ast_calloc(1, sizeof(*tmp));
 		if (!tmp) {
 			ast_mutex_unlock(&qe->parent->lock);
 			if (use_weight) 
@@ -2682,7 +2668,7 @@
 	}
 
 	if (!(parse = ast_strdupa(data))) 
-		return -1;	
+		return -1;
 
 	AST_STANDARD_APP_ARGS(args, parse);
 
@@ -3501,8 +3487,8 @@
 	
 	AST_LIST_LOCK(&queues);
 	AST_LIST_TRAVERSE(&queues, q, list) {
-		if (!strncasecmp(word, q->name, wordlen) &&  (++which > state)) {
-			ret = strdup(q->name);	
+		if (!strncasecmp(word, q->name, wordlen) && ++which > state) {
+			ret = ast_strdup(q->name);	
 			break;
 		}
 	}
@@ -3766,11 +3752,11 @@
 	case 3:	/* Don't attempt to complete name of member (infinite possibilities) */
 		return NULL;
 	case 4:	/* only one possible match, "to" */
-		return state == 0 ? strdup("to") : NULL;
+		return state == 0 ? ast_strdup("to") : NULL;
 	case 5:	/* <queue> */
 		return complete_queue(line, word, pos, state);
 	case 6: /* only one possible match, "penalty" */
-		return state == 0 ? strdup("penalty") : NULL;
+		return state == 0 ? ast_strdup("penalty") : NULL;
 	case 7:
 		if (state < 100) {	/* 0-99 */
 			char *num;
@@ -3823,23 +3809,23 @@
 	struct ast_call_queue *q;
 	struct member *m;
 
- 	/* 0 - add; 1 - queue; 2 - member; 3 - <member>; 4 - from; 5 - <queue> */
- 	if (pos > 5 || pos < 3)
-  		return NULL;
- 	if (pos == 4)	/* only one possible match, 'from' */
- 		return state == 0 ? strdup("from") : NULL;
-  
- 	if (pos == 5)	/* No need to duplicate code */
-  		return complete_queue(line, word, pos, state);
-  
- 	/* here is the case for 3, <member> */
-	if (!AST_LIST_EMPTY(&queues)) {
+	/* 0 - add; 1 - queue; 2 - member; 3 - <member>; 4 - from; 5 - <queue> */
+	if (pos > 5 || pos < 3)
+		return NULL;
+	if (pos == 4)	/* only one possible match, 'from' */
+		return state == 0 ? ast_strdup("from") : NULL;
+
+	if (pos == 5)	/* No need to duplicate code */
+		return complete_queue(line, word, pos, state);
+
+	/* here is the case for 3, <member> */
+	if (!AST_LIST_EMPTY(&queues)) { /* XXX unnecessary ? the traverse does that for us */
 		AST_LIST_TRAVERSE(&queues, q, list) {
 			ast_mutex_lock(&q->lock);
 			for (m = q->members ; m ; m = m->next) {
 				if (++which > state) {
 					ast_mutex_unlock(&q->lock);
-					return strdup(m->interface);
+					return ast_strdup(m->interface);
 				}
 			}
 			ast_mutex_unlock(&q->lock);

Modified: team/oej/peermatch/apps/app_rpt.c
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/apps/app_rpt.c?rev=16826&r1=16825&r2=16826&view=diff
==============================================================================
--- team/oej/peermatch/apps/app_rpt.c (original)
+++ team/oej/peermatch/apps/app_rpt.c Fri Mar 31 18:31:21 2006
@@ -260,7 +260,6 @@
 
 struct	ast_config *cfg;
 
-STANDARD_LOCAL_USER;
 LOCAL_USER_DECL;
 
 #define	MSWAIT 200

Modified: team/oej/peermatch/apps/app_sms.c
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/apps/app_sms.c?rev=16826&r1=16825&r2=16826&view=diff
==============================================================================
--- team/oej/peermatch/apps/app_sms.c (original)
+++ team/oej/peermatch/apps/app_sms.c Fri Mar 31 18:31:21 2006
@@ -1177,32 +1177,31 @@
 {
 	struct ast_frame f = { 0 };
 	unsigned char waste[AST_FRIENDLY_OFFSET];
+#define MAXSAMPLES (800)
 #ifdef OUTALAW
-	unsigned char buf[800];
+	unsigned char buf[MAXSAMPLES];
 #else
-	signed short buf[800];
+	signed short buf[MAXSAMPLES];
 #endif
+#define SAMPLE2LEN (sizeof (buf[0]))
 	sms_t *h = data;
 	int i;
 
-	if (len > sizeof (buf)) {
-		ast_log (LOG_WARNING, "Only doing %d bytes (%d bytes requested)\n", (int)(sizeof (buf) / sizeof (signed short)), len);
-		len = sizeof (buf);
-#ifdef OUTALAW
-		samples = len;
-#else
-		samples = len / 2;
-#endif
-	}
-	waste[0] = 0;					 /* make compiler happy */
+	if (samples > MAXSAMPLES) {
+		ast_log (LOG_WARNING, "Only doing %d samples (%d requested)\n",
+			 MAXSAMPLES, samples);
+		samples = MAXSAMPLES;
+	}
+	len = samples * SAMPLE2LEN;
+
+	waste[0] = 0;				 /* make compiler happy */
 	f.frametype = AST_FRAME_VOICE;
 #ifdef OUTALAW
 	f.subclass = AST_FORMAT_ALAW;
-	f.datalen = samples;
 #else
 	f.subclass = AST_FORMAT_SLINEAR;
-	f.datalen = samples * 2;
 #endif
+	f.datalen = len;
 	f.offset = AST_FRIENDLY_OFFSET;
 	f.mallocd = 0;
 	f.data = buf;
@@ -1254,6 +1253,8 @@
 		return -1;
 	}
 	return 0;
+#undef SAMPLE2LEN
+#undef MAXSAMPLES
 }
 
 static void sms_process (sms_t * h, int samples, signed short *data)

Modified: team/oej/peermatch/apps/app_stack.c
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/apps/app_stack.c?rev=16826&r1=16825&r2=16826&view=diff
==============================================================================
--- team/oej/peermatch/apps/app_stack.c (original)
+++ team/oej/peermatch/apps/app_stack.c Fri Mar 31 18:31:21 2006
@@ -140,7 +140,7 @@
 	label1 = strsep(&args, ":");
 	label2 = args;
 
-	if (ast_true(condition)) {
+	if (pbx_checkcondition(condition)) {
 		if (label1) {
 			res = gosub_exec(chan, label1);
 		}

Modified: team/oej/peermatch/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/apps/app_voicemail.c?rev=16826&r1=16825&r2=16826&view=diff
==============================================================================
--- team/oej/peermatch/apps/app_voicemail.c (original)
+++ team/oej/peermatch/apps/app_voicemail.c Fri Mar 31 18:31:21 2006
@@ -3422,7 +3422,7 @@
 				old_priority = chan->priority;
 				
 				/* call the the Directory, changes the channel */
-				res = pbx_exec(chan, app, context ? context : "default", 1);
+				res = pbx_exec(chan, app, context ? context : "default");
 				
 				ast_copy_string(username, chan->exten, sizeof(username));
 				

Modified: team/oej/peermatch/apps/app_while.c
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/apps/app_while.c?rev=16826&r1=16825&r2=16826&view=diff
==============================================================================
--- team/oej/peermatch/apps/app_while.c (original)
+++ team/oej/peermatch/apps/app_while.c Fri Mar 31 18:31:21 2006
@@ -101,7 +101,7 @@
 
 		if (ast_true(expr)) { 
 			if ((app = pbx_findapp(myapp))) {
-				res = pbx_exec(chan, app, mydata, 1);
+				res = pbx_exec(chan, app, mydata);
 			} else {
 				ast_log(LOG_WARNING, "Count not find application! (%s)\n", myapp);
 				res = -1;

Modified: team/oej/peermatch/asterisk.8
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/asterisk.8?rev=16826&r1=16825&r2=16826&view=diff
==============================================================================
--- team/oej/peermatch/asterisk.8 (original)
+++ team/oej/peermatch/asterisk.8 Fri Mar 31 18:31:21 2006
@@ -9,7 +9,7 @@
 asterisk \- All-purpose telephony server.
 .SH SYNOPSIS
 
-\fBasterisk\fR [ \fB-tThfdvVqpRgcin\fR ] [ \fB-C \fIfile\fB\fR ] [ \fB-U \fIuser\fB\fR ] [ \fB-G \fIgroup\fB\fR ] [ \fB-x \fIcommand\fB\fR ] [ \fB-M \fIvalue\fB\fR ]
+\fBasterisk\fR [ \fB-tThfdvVqpRgciIn\fR ] [ \fB-C \fIfile\fB\fR ] [ \fB-U \fIuser\fB\fR ] [ \fB-G \fIgroup\fB\fR ] [ \fB-x \fIcommand\fB\fR ] [ \fB-M \fIvalue\fB\fR ]
 
 
 \fBasterisk -r\fR [ \fB-v\fR ] [ \fB-x \fIcommand\fB\fR ]
@@ -114,6 +114,12 @@
 for controlling it. Additionally, if connection to the Asterisk 
 process is lost, attempt to reconnect for as long as 30 seconds.
 .TP
+\fB-I\fR
+Enable internal timing if Zaptel timer is available
+The default behaviour is that outbound packets are phase locked
+to inbound packets. Enabling this switch causes them to be
+locked to the internal Zaptel timer instead.
+.TP
 \fB-t\fR
 When recording files, write them first into a temporary holding directory, 
 then move them into the final location when done.

Modified: team/oej/peermatch/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/asterisk.c?rev=16826&r1=16825&r2=16826&view=diff
==============================================================================
--- team/oej/peermatch/asterisk.c (original)
+++ team/oej/peermatch/asterisk.c Fri Mar 31 18:31:21 2006
@@ -30,7 +30,7 @@
  *
  * \section copyright Copyright and author
  *
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2006, Digium, Inc.
  * Asterisk is a trade mark registered by Digium, Inc.
  *
  * \author Mark Spencer <markster at digium.com>
@@ -216,7 +216,7 @@
 char ast_config_AST_CTL_OWNER[AST_CONFIG_MAX_PATH] = "\0";
 char ast_config_AST_CTL_GROUP[AST_CONFIG_MAX_PATH] = "\0";
 char ast_config_AST_CTL[AST_CONFIG_MAX_PATH] = "asterisk.ctl";
-char ast_config_AST_SYSTEM_NAME[20]="";
+char ast_config_AST_SYSTEM_NAME[20] = "";
 
 static char *_argv[256];
 static int shuttingdown = 0;
@@ -462,7 +462,7 @@
 static void ast_network_puts(const char *string)
 {
 	int x;
-	for (x=0;x<AST_MAX_CONNECTS; x++) {
+	for (x=0; x < AST_MAX_CONNECTS; x++) {
 		if (consoles[x].fd > -1) 
 			fdprint(consoles[x].p[1], string);
 	}
@@ -503,7 +503,7 @@
 static void *netconsole(void *vconsole)
 {
 	struct console *con = vconsole;
-	char hostname[MAXHOSTNAMELEN]="";
+	char hostname[MAXHOSTNAMELEN] = "";
 	char tmp[512];
 	int res;
 	struct pollfd fds[2];
@@ -566,11 +566,11 @@
 	pthread_attr_t attr;
 	pthread_attr_init(&attr);
 	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-	for(;;) {
+	for (;;) {
 		if (ast_socket < 0)
 			return NULL;
 		fds[0].fd = ast_socket;
-		fds[0].events= POLLIN;
+		fds[0].events = POLLIN;
 		s = poll(fds, 1, -1);
 		if (s < 0) {
 			if (errno != EINTR)
@@ -583,7 +583,7 @@
 			if (errno != EINTR)
 				ast_log(LOG_WARNING, "Accept returned %d: %s\n", s, strerror(errno));
 		} else {
-			for (x=0;x<AST_MAX_CONNECTS;x++) {
+			for (x = 0; x < AST_MAX_CONNECTS; x++) {
 				if (consoles[x].fd < 0) {
 					if (socketpair(AF_LOCAL, SOCK_STREAM, 0, consoles[x].p)) {
 						ast_log(LOG_ERROR, "Unable to create pipe: %s\n", strerror(errno));
@@ -829,7 +829,7 @@
 			if (option_verbose && ast_opt_console)
 				ast_verbose("Beginning asterisk %s....\n", restart ? "restart" : "shutdown");
 			time(&s);
-			for(;;) {
+			for (;;) {
 				time(&e);
 				/* Wait up to 15 seconds for all channels to go away */
 				if ((e - s) > 15)
@@ -846,7 +846,7 @@
 				ast_begin_shutdown(0);
 			if (option_verbose && ast_opt_console)
 				ast_verbose("Waiting for inactivity to perform %s...\n", restart ? "restart" : "halt");
-			for(;;) {
+			for (;;) {
 				if (!ast_active_channels())
 					break;
 				if (!shuttingdown)
@@ -895,7 +895,7 @@
 		if (option_verbose || ast_opt_console)
 			ast_verbose("Preparing for Asterisk restart...\n");
 		/* Mark all FD's for closing on exec */
-		for (x=3;x<32768;x++) {
+		for (x=3; x < 32768; x++) {
 			fcntl(x, F_SETFD, FD_CLOEXEC);
 		}
 		if (option_verbose || ast_opt_console)
@@ -940,7 +940,7 @@
 static void console_verboser(const char *s, int pos, int replace, int complete)
 {
 	char tmp[80];
-	const char *c=NULL;
+	const char *c = NULL;
 	/* Return to the beginning of the line */
 	if (!pos) {
 		fprintf(stdout, "\r");
@@ -964,7 +964,7 @@
 
 static int ast_all_zeros(char *s)
 {
-	while(*s) {
+	while (*s) {
 		if (*s > 32)
 			return 0;
 		s++;  
@@ -1234,8 +1234,8 @@
 
 static int ast_el_read_char(EditLine *el, char *cp)
 {
-	int num_read=0;
-	int lastpos=0;
+	int num_read = 0;
+	int lastpos = 0;
 	struct pollfd fds[2];
 	int res;
 	int max;
@@ -1276,7 +1276,7 @@
 					int tries;
 					int reconnects_per_second = 20;
 					fprintf(stderr, "Attempting to reconnect for 30 seconds\n");
-					for (tries=0;tries<30 * reconnects_per_second;tries++) {
+					for (tries=0; tries < 30 * reconnects_per_second; tries++) {
 						if (ast_tryconnect()) {
 							fprintf(stderr, "Reconnect succeeded after %.3f seconds\n", 1.0 / reconnects_per_second * tries);
 							printf(term_quit());
@@ -1315,7 +1315,7 @@
 {
 	static char prompt[200];
 	char *pfmt;
-	int color_used=0;
+	int color_used = 0;
 	char term_code[20];
 
 	if ((pfmt = getenv("ASTERISK_PROMPT"))) {
@@ -1334,100 +1334,100 @@
 
 				t++;
 				switch (*t) {
-					case 'C': /* color */
-						t++;
-						if (sscanf(t, "%d;%d%n", &fgcolor, &bgcolor, &i) == 2) {
-							strncat(p, term_color_code(term_code, fgcolor, bgcolor, sizeof(term_code)),sizeof(prompt) - strlen(prompt) - 1);
-							t += i - 1;
-						} else if (sscanf(t, "%d%n", &fgcolor, &i) == 1) {
-							strncat(p, term_color_code(term_code, fgcolor, 0, sizeof(term_code)),sizeof(prompt) - strlen(prompt) - 1);
-							t += i - 1;
-						}
-
-						/* If the color has been reset correctly, then there's no need to reset it later */
-						if ((fgcolor == COLOR_WHITE) && (bgcolor == COLOR_BLACK)) {
-							color_used = 0;
-						} else {
-							color_used = 1;
-						}
-						break;
-					case 'd': /* date */
-						memset(&tm, 0, sizeof(tm));
-						time(&ts);
-						if (localtime_r(&ts, &tm)) {
-							strftime(p, sizeof(prompt) - strlen(prompt), "%Y-%m-%d", &tm);
-						}
-						break;
-					case 'h': /* hostname */

[... 10904 lines stripped ...]


More information about the asterisk-commits mailing list