[asterisk-commits] branch oej/codecnegotiation r15323 - in /team/oej/codecnegotiation: ./ agi/ a...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Mar 27 14:42:27 MST 2006


Author: oej
Date: Mon Mar 27 15:42:13 2006
New Revision: 15323

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

Added:
    team/oej/codecnegotiation/apps/app_channelredirect.c
      - copied unchanged from r15319, trunk/apps/app_channelredirect.c
    team/oej/codecnegotiation/configs/http.conf.sample
      - copied unchanged from r15319, trunk/configs/http.conf.sample
    team/oej/codecnegotiation/http.c
      - copied unchanged from r15319, trunk/http.c
    team/oej/codecnegotiation/include/asterisk/http.h
      - copied unchanged from r15319, trunk/include/asterisk/http.h
Modified:
    team/oej/codecnegotiation/   (props changed)
    team/oej/codecnegotiation/Makefile
    team/oej/codecnegotiation/UPGRADE.txt
    team/oej/codecnegotiation/agi/Makefile
    team/oej/codecnegotiation/app.c
    team/oej/codecnegotiation/apps/app_amd.c
    team/oej/codecnegotiation/apps/app_dial.c
    team/oej/codecnegotiation/apps/app_directory.c
    team/oej/codecnegotiation/apps/app_dumpchan.c
    team/oej/codecnegotiation/apps/app_meetme.c
    team/oej/codecnegotiation/apps/app_queue.c
    team/oej/codecnegotiation/apps/app_readfile.c
    team/oej/codecnegotiation/apps/app_stack.c
    team/oej/codecnegotiation/apps/app_voicemail.c
    team/oej/codecnegotiation/asterisk.c
    team/oej/codecnegotiation/astmm.c
    team/oej/codecnegotiation/cdr.c
    team/oej/codecnegotiation/cdr/Makefile
    team/oej/codecnegotiation/channel.c
    team/oej/codecnegotiation/channels/chan_agent.c
    team/oej/codecnegotiation/channels/chan_iax2.c
    team/oej/codecnegotiation/channels/chan_misdn.c
    team/oej/codecnegotiation/channels/chan_sip.c
    team/oej/codecnegotiation/channels/chan_skinny.c
    team/oej/codecnegotiation/channels/chan_vpb.c
    team/oej/codecnegotiation/channels/chan_zap.c
    team/oej/codecnegotiation/channels/misdn/chan_misdn_config.h
    team/oej/codecnegotiation/channels/misdn/isdn_lib.c
    team/oej/codecnegotiation/channels/misdn_config.c
    team/oej/codecnegotiation/cli.c
    team/oej/codecnegotiation/codecs/Makefile
    team/oej/codecnegotiation/codecs/gsm/libgsm.vcproj   (props changed)
    team/oej/codecnegotiation/codecs/ilbc/libilbc.vcproj   (props changed)
    team/oej/codecnegotiation/codecs/lpc10/liblpc10.vcproj   (props changed)
    team/oej/codecnegotiation/configs/features.conf.sample
    team/oej/codecnegotiation/configs/indications.conf.sample
    team/oej/codecnegotiation/configs/misdn.conf.sample
    team/oej/codecnegotiation/configs/sip.conf.sample
    team/oej/codecnegotiation/configs/zapata.conf.sample
    team/oej/codecnegotiation/contrib/init.d/rc.redhat.asterisk
    team/oej/codecnegotiation/db.c
    team/oej/codecnegotiation/doc/enum.txt
    team/oej/codecnegotiation/editline/term.c
    team/oej/codecnegotiation/funcs/func_channel.c
    team/oej/codecnegotiation/funcs/func_enum.c
    team/oej/codecnegotiation/image.c
    team/oej/codecnegotiation/include/asterisk/cdr.h
    team/oej/codecnegotiation/include/asterisk/channel.h
    team/oej/codecnegotiation/include/asterisk/compat.h
    team/oej/codecnegotiation/include/asterisk/lock.h
    team/oej/codecnegotiation/include/asterisk/manager.h
    team/oej/codecnegotiation/include/asterisk/module.h
    team/oej/codecnegotiation/include/asterisk/say.h
    team/oej/codecnegotiation/include/asterisk/sched.h
    team/oej/codecnegotiation/include/asterisk/strings.h
    team/oej/codecnegotiation/include/solaris-compat/compat.h
    team/oej/codecnegotiation/loader.c
    team/oej/codecnegotiation/manager.c
    team/oej/codecnegotiation/pbx.c
    team/oej/codecnegotiation/res/res_features.c
    team/oej/codecnegotiation/res/res_musiconhold.c
    team/oej/codecnegotiation/res/res_snmp.c
    team/oej/codecnegotiation/sample.call
    team/oej/codecnegotiation/say.c
    team/oej/codecnegotiation/sounds.txt
    team/oej/codecnegotiation/stdtime/localtime.c
    team/oej/codecnegotiation/strcompat.c
    team/oej/codecnegotiation/utils.c

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

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

Propchange: team/oej/codecnegotiation/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Mar 27 15:42:13 2006
@@ -1,1 +1,1 @@
-/trunk:1-13617
+/trunk:1-15322

Modified: team/oej/codecnegotiation/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/Makefile?rev=15323&r1=15322&r2=15323&view=diff
==============================================================================
--- team/oej/codecnegotiation/Makefile (original)
+++ team/oej/codecnegotiation/Makefile Mon Mar 27 15:42:13 2006
@@ -357,14 +357,23 @@
 SUBDIRS=res channels pbx apps codecs formats agi cdr funcs utils stdtime
 
 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 \
+	translate.o file.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 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 \
 	netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
-	cryptostub.o sha1.o
+	cryptostub.o sha1.o http.o
+
+# we need to link in the objects statically, not as a library, because
+# otherwise modules will not have them available if none of the static
+# objects use it.
+OBJS+= stdtime/localtime.o
+
+# At the moment say.o is an optional component which can be overridden
+# by a module.
+OBJS+= say.o
 
 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/sys/poll.h),)
   OBJS+= poll.o

Modified: team/oej/codecnegotiation/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/UPGRADE.txt?rev=15323&r1=15322&r2=15323&view=diff
==============================================================================
--- team/oej/codecnegotiation/UPGRADE.txt (original)
+++ team/oej/codecnegotiation/UPGRADE.txt Mon Mar 27 15:42:13 2006
@@ -76,3 +76,10 @@
 	ASTBINDIR	/usr/local/bin/asterisk
 	ASTSBINDIR	/usr/local/sbin/asterisk
 
+Sounds:
+
+* The phonetic sounds directory has been removed from the asterisk-sounds package
+  because they are now included directly in Asterisk.  However, it is important to
+  note that the phonetic sounds that existed in asterisk-sounds used a different
+  naming convention than the sounds in Asterisk.  For example, instead of alpha.gsm
+  and bravo.gsm, Asterisk has a_p.gsm and b_p.gsm.

Modified: team/oej/codecnegotiation/agi/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/agi/Makefile?rev=15323&r1=15322&r2=15323&view=diff
==============================================================================
--- team/oej/codecnegotiation/agi/Makefile (original)
+++ team/oej/codecnegotiation/agi/Makefile Mon Mar 27 15:42:13 2006
@@ -13,15 +13,11 @@
 
 AGIS=agi-test.agi eagi-test eagi-sphinx-test jukebox.agi
 
-CFLAGS+=
+CFLAGS+=-DNO_AST_MM
 
 LIBS=
 ifeq ($(OSARCH),SunOS)
   LIBS=-lsocket -lnsl ../strcompat.o
-endif
-
-ifeq ($(findstring BSD,${OSARCH}),BSD)
-  CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
 endif
 
 all: depend $(AGIS)

Modified: team/oej/codecnegotiation/app.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/app.c?rev=15323&r1=15322&r2=15323&view=diff
==============================================================================
--- team/oej/codecnegotiation/app.c (original)
+++ team/oej/codecnegotiation/app.c Mon Mar 27 15:42:13 2006
@@ -1059,7 +1059,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 +1089,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;

Modified: team/oej/codecnegotiation/apps/app_amd.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/apps/app_amd.c?rev=15323&r1=15322&r2=15323&view=diff
==============================================================================
--- team/oej/codecnegotiation/apps/app_amd.c (original)
+++ team/oej/codecnegotiation/apps/app_amd.c Mon Mar 27 15:42:13 2006
@@ -20,6 +20,10 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+
+#include "asterisk.h"
+ 
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/module.h"
 #include "asterisk/lock.h"

Modified: team/oej/codecnegotiation/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/apps/app_dial.c?rev=15323&r1=15322&r2=15323&view=diff
==============================================================================
--- team/oej/codecnegotiation/apps/app_dial.c (original)
+++ team/oej/codecnegotiation/apps/app_dial.c Mon Mar 27 15:42:13 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

Modified: team/oej/codecnegotiation/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/apps/app_directory.c?rev=15323&r1=15322&r2=15323&view=diff
==============================================================================
--- team/oej/codecnegotiation/apps/app_directory.c (original)
+++ team/oej/codecnegotiation/apps/app_directory.c Mon Mar 27 15:42:13 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/codecnegotiation/apps/app_dumpchan.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/apps/app_dumpchan.c?rev=15323&r1=15322&r2=15323&view=diff
==============================================================================
--- team/oej/codecnegotiation/apps/app_dumpchan.c (original)
+++ team/oej/codecnegotiation/apps/app_dumpchan.c Mon Mar 27 15:42:13 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/codecnegotiation/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/apps/app_meetme.c?rev=15323&r1=15322&r2=15323&view=diff
==============================================================================
--- team/oej/codecnegotiation/apps/app_meetme.c (original)
+++ team/oej/codecnegotiation/apps/app_meetme.c Mon Mar 27 15:42:13 2006
@@ -779,6 +779,8 @@
 			f = ast_read(chan);
 			if (f)
 				ast_frfree(f);
+			else /* channel was hung up or something else happened */
+				break;
 		}
 	}
 
@@ -957,7 +959,9 @@
 		snprintf(user->namerecloc, sizeof(user->namerecloc),
 			 "%s/meetme/meetme-username-%s-%d", ast_config_AST_SPOOL_DIR,
 			 conf->confno, user->user_no);
-		ast_record_review(chan, "vm-rec-name", user->namerecloc, 10, "sln", &duration, NULL);
+		res = ast_record_review(chan, "vm-rec-name", user->namerecloc, 10, "sln", &duration, NULL);
+		if (res == -1)
+			goto outrun;
 	}
 
 	if ( !(confflags & (CONFFLAG_QUIET | CONFFLAG_NOONLYPERSON)) ) {
@@ -1830,28 +1834,20 @@
 				ast_log(LOG_WARNING, "No %s file :(\n", CONFIG_FILE_NAME);
 				return NULL;
 			}
-			var = ast_variable_browse(cfg, "rooms");
-			for (; var; var = var->next) {
+			for (var = ast_variable_browse(cfg, "rooms"); var; var = var->next) {
 				if (strcasecmp(var->name, "conf"))
 					continue;
 				
 				if (!(parse = ast_strdupa(var->value)))
 					return NULL;
 				
-				AST_STANDARD_APP_ARGS(args, parse);
+				AST_NONSTANDARD_APP_ARGS(args, parse, ',');
 				if (!strcasecmp(args.confno, confno)) {
 					/* Bingo it's a valid conference */
-					if (args.pin) {
-						if (args.pinadmin)
-							cnf = build_conf(args.confno, args.pin, args.pinadmin, make, dynamic, refcount);
-						else
-							cnf = build_conf(args.confno, args.pin, "", make, dynamic, refcount);
-					} else {
-						if (args.pinadmin)
-							cnf = build_conf(args.confno, "", args.pinadmin, make, dynamic, refcount);
-						else
-							cnf = build_conf(args.confno, "", "", make, dynamic, refcount);
-					}
+					cnf = build_conf(args.confno,
+							S_OR(args.pin, ""),
+							S_OR(args.pinadmin, ""),
+							make, dynamic, refcount);
 					break;
 				}
 			}
@@ -2026,7 +2022,7 @@
 									AST_LIST_UNLOCK(&confs);
 									if (!found) {
 										/* At this point, we have a confno_tmp (static conference) that is empty */
-										if ((empty_no_pin && ((!stringp) || (stringp && (stringp[0] == '\0')))) || (!empty_no_pin)) {
+										if ((empty_no_pin && ast_strlen_zero(stringp)) || (!empty_no_pin)) {
 											/* Case 1:  empty_no_pin and pin is nonexistent (NULL)
 											 * Case 2:  empty_no_pin and pin is blank (but not NULL)
 											 * Case 3:  not empty_no_pin

Modified: team/oej/codecnegotiation/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/apps/app_queue.c?rev=15323&r1=15322&r2=15323&view=diff
==============================================================================
--- team/oej/codecnegotiation/apps/app_queue.c (original)
+++ team/oej/codecnegotiation/apps/app_queue.c Mon Mar 27 15:42:13 2006
@@ -3357,7 +3357,7 @@
 	AST_LIST_UNLOCK(&queues);
 }
 
-static int __queues_show(int manager, int fd, int argc, char **argv, int queue_show)
+static int __queues_show(struct mansession *s, int manager, int fd, int argc, char **argv, int queue_show)
 {
 	struct ast_call_queue *q;
 	struct queue_ent *qe;
@@ -3381,10 +3381,17 @@
 	AST_LIST_LOCK(&queues);
 	if (AST_LIST_EMPTY(&queues)) {
 		AST_LIST_UNLOCK(&queues);
-		if (queue_show)
-			ast_cli(fd, "No such queue: %s.%s",argv[2], term);
-		else
-			ast_cli(fd, "No queues.%s", term);
+		if (queue_show) {
+			if (s)
+				astman_append(s, "No such queue: %s.%s",argv[2], term);
+			else
+				ast_cli(fd, "No such queue: %s.%s",argv[2], term);
+		} else {
+			if (s)
+				astman_append(s, "No queues.%s", term);
+			else
+				ast_cli(fd, "No queues.%s", term);
+		}
 		return RESULT_SUCCESS;
 	}
 	AST_LIST_TRAVERSE(&queues, q, list) {
@@ -3409,10 +3416,17 @@
 		sl = 0;
 		if(q->callscompleted > 0)
 			sl = 100*((float)q->callscompletedinsl/(float)q->callscompleted);
-		ast_cli(fd, "%-12.12s has %d calls (max %s) in '%s' strategy (%ds holdtime), W:%d, C:%d, A:%d, SL:%2.1f%% within %ds%s",
-			q->name, q->count, max_buf, int2strat(q->strategy), q->holdtime, q->weight, q->callscompleted, q->callsabandoned,sl,q->servicelevel, term);
+		if (s)
+			astman_append(s, "%-12.12s has %d calls (max %s) in '%s' strategy (%ds holdtime), W:%d, C:%d, A:%d, SL:%2.1f%% within %ds%s",
+				q->name, q->count, max_buf, int2strat(q->strategy), q->holdtime, q->weight, q->callscompleted, q->callsabandoned,sl,q->servicelevel, term);
+		else
+			ast_cli(fd, "%-12.12s has %d calls (max %s) in '%s' strategy (%ds holdtime), W:%d, C:%d, A:%d, SL:%2.1f%% within %ds%s",
+				q->name, q->count, max_buf, int2strat(q->strategy), q->holdtime, q->weight, q->callscompleted, q->callsabandoned,sl,q->servicelevel, term);
 		if (q->members) {
-			ast_cli(fd, "   Members: %s", term);
+			if (s)
+				astman_append(s, "   Members: %s", term);
+			else
+				ast_cli(fd, "   Members: %s", term);
 			for (mem = q->members; mem; mem = mem->next) {
 				max_buf[0] = '\0';
 				max = max_buf;
@@ -3429,19 +3443,37 @@
 							 mem->calls, (long)(time(NULL) - mem->lastcall));
 				} else
 					ast_build_string(&max, &max_left, " has taken no calls yet");
-				ast_cli(fd, "      %s%s%s", mem->interface, max_buf, term);
-			}
-		} else
+				if (s)
+					astman_append(s, "      %s%s%s", mem->interface, max_buf, term);
+				else
+					ast_cli(fd, "      %s%s%s", mem->interface, max_buf, term);
+			}
+		} else if (s)
+			astman_append(s, "   No Members%s", term);
+		else	
 			ast_cli(fd, "   No Members%s", term);
 		if (q->head) {
 			pos = 1;
-			ast_cli(fd, "   Callers: %s", term);
-			for (qe = q->head; qe; qe = qe->next) 
-				ast_cli(fd, "      %d. %s (wait: %ld:%2.2ld, prio: %d)%s", pos++, qe->chan->name,
-					(long)(now - qe->start) / 60, (long)(now - qe->start) % 60, qe->prio, term);
-		} else
+			if (s)
+				astman_append(s, "   Callers: %s", term);
+			else
+				ast_cli(fd, "   Callers: %s", term);
+			for (qe = q->head; qe; qe = qe->next) {
+				if (s)
+					astman_append(s, "      %d. %s (wait: %ld:%2.2ld, prio: %d)%s", pos++, qe->chan->name,
+						(long)(now - qe->start) / 60, (long)(now - qe->start) % 60, qe->prio, term);
+				else
+					ast_cli(fd, "      %d. %s (wait: %ld:%2.2ld, prio: %d)%s", pos++, qe->chan->name,
+						(long)(now - qe->start) / 60, (long)(now - qe->start) % 60, qe->prio, term);
+			}
+		} else if (s)
+			astman_append(s, "   No Callers%s", term);
+		else
 			ast_cli(fd, "   No Callers%s", term);
-		ast_cli(fd, "%s", term);
+		if (s)
+			astman_append(s, "%s", term);
+		else
+			ast_cli(fd, "%s", term);
 		ast_mutex_unlock(&q->lock);
 		if (queue_show)
 			break;
@@ -3452,12 +3484,12 @@
 
 static int queues_show(int fd, int argc, char **argv)
 {
-	return __queues_show(0, fd, argc, argv, 0);
+	return __queues_show(NULL, 0, fd, argc, argv, 0);
 }
 
 static int queue_show(int fd, int argc, char **argv)
 {
-	return __queues_show(0, fd, argc, argv, 1);
+	return __queues_show(NULL, 0, fd, argc, argv, 1);
 }
 
 static char *complete_queue(const char *line, const char *word, int pos, int state)
@@ -3485,8 +3517,8 @@
 static int manager_queues_show( struct mansession *s, struct message *m )
 {
 	char *a[] = { "show", "queues" };
-	__queues_show(1, s->fd, 2, a, 0);
-	ast_cli(s->fd, "\r\n\r\n");	/* Properly terminate Manager output */
+	__queues_show(s, 1, -1, 2, a, 0);
+	astman_append(s, "\r\n\r\n");	/* Properly terminate Manager output */
 
 	return RESULT_SUCCESS;
 } 
@@ -3518,7 +3550,7 @@
 		if (ast_strlen_zero(queuefilter) || !strcmp(q->name, queuefilter)) {
 			if(q->callscompleted > 0)
 				sl = 100*((float)q->callscompletedinsl/(float)q->callscompleted);
-			ast_cli(s->fd, "Event: QueueParams\r\n"
+			astman_append(s, "Event: QueueParams\r\n"
 						"Queue: %s\r\n"
 						"Max: %d\r\n"
 						"Calls: %d\r\n"
@@ -3535,7 +3567,7 @@
 			/* List Queue Members */
 			for (mem = q->members; mem; mem = mem->next) {
 				if (ast_strlen_zero(memberfilter) || !strcmp(mem->interface, memberfilter)) {
-					ast_cli(s->fd, "Event: QueueMember\r\n"
+					astman_append(s, "Event: QueueMember\r\n"
 						"Queue: %s\r\n"
 						"Location: %s\r\n"
 						"Membership: %s\r\n"
@@ -3553,7 +3585,7 @@
 			/* List Queue Entries */
 			pos = 1;
 			for (qe = q->head; qe; qe = qe->next) {
-				ast_cli(s->fd, "Event: QueueEntry\r\n"
+				astman_append(s, "Event: QueueEntry\r\n"
 					"Queue: %s\r\n"
 					"Position: %d\r\n"
 					"Channel: %s\r\n"
@@ -3572,7 +3604,7 @@
 	}
 	AST_LIST_UNLOCK(&queues);
 
-	ast_cli(s->fd,
+	astman_append(s,
 		"Event: QueueStatusComplete\r\n"
 		"%s"
 		"\r\n",idText);

Modified: team/oej/codecnegotiation/apps/app_readfile.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/apps/app_readfile.c?rev=15323&r1=15322&r2=15323&view=diff
==============================================================================
--- team/oej/codecnegotiation/apps/app_readfile.c (original)
+++ team/oej/codecnegotiation/apps/app_readfile.c Mon Mar 27 15:42:13 2006
@@ -92,15 +92,16 @@
 		}
 	}
 
-	returnvar = ast_read_textfile(file);
-	if(len > 0){
-		if(len < strlen(returnvar))
-			returnvar[len]='\0';
-		else
-			ast_log(LOG_WARNING,"%s is longer than %d, and %d \n", file, len, (int)strlen(returnvar));
+	if ((returnvar = ast_read_textfile(file))) {
+		if (len > 0) {
+			if (len < strlen(returnvar))
+				returnvar[len]='\0';
+			else
+				ast_log(LOG_WARNING, "%s is longer than %d, and %d \n", file, len, (int)strlen(returnvar));
+		}
+		pbx_builtin_setvar_helper(chan, varname, returnvar);
+		free(returnvar);
 	}
-	pbx_builtin_setvar_helper(chan, varname, returnvar);
-	free(returnvar);
 	LOCAL_USER_REMOVE(u);
 	return res;
 }

Modified: team/oej/codecnegotiation/apps/app_stack.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/apps/app_stack.c?rev=15323&r1=15322&r2=15323&view=diff
==============================================================================
--- team/oej/codecnegotiation/apps/app_stack.c (original)
+++ team/oej/codecnegotiation/apps/app_stack.c Mon Mar 27 15:42:13 2006
@@ -29,6 +29,10 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
+
+#include "asterisk.h"
+ 
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/options.h"
 #include "asterisk/logger.h"

Modified: team/oej/codecnegotiation/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/apps/app_voicemail.c?rev=15323&r1=15322&r2=15323&view=diff
==============================================================================
--- team/oej/codecnegotiation/apps/app_voicemail.c (original)
+++ team/oej/codecnegotiation/apps/app_voicemail.c Mon Mar 27 15:42:13 2006
@@ -328,7 +328,7 @@
 "           message. The units are whole-number decibels (dB).\n"
 "    s    - Skip the playback of instructions for leaving a message to the\n"
 "           calling party.\n"
-"    u    - Play the 'unavailble greeting.\n"
+"    u    - Play the 'unavailable greeting.\n"
 "    j    - Jump to priority n+101 if the mailbox is not found or some other\n"
 "           error occurs.\n";
 
@@ -2364,7 +2364,7 @@
 
 static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_options *options)
 {
-	char txtfile[256];
+	char tmptxtfile[256], txtfile[256];
 	char callerid[256];
 	FILE *txt;
 	int res = 0;
@@ -2561,7 +2561,8 @@
 				
 			/* Store information */
 			snprintf(txtfile, sizeof(txtfile), "%s.txt", fn);
-			txt = fopen(txtfile, "w+");
+			snprintf(tmptxtfile, sizeof(tmptxtfile), "%s.txt.tmp", fn);
+			txt = fopen(tmptxtfile, "w+");
 			if (txt) {
 				get_date(date, sizeof(date));
 				fprintf(txt, 
@@ -2601,6 +2602,7 @@
 			if (txt) {
 				fprintf(txt, "duration=%d\n", duration);
 				fclose(txt);
+				rename(tmptxtfile, txtfile);
 			}
 				
 			if (duration < vmminmessage) {
@@ -3471,11 +3473,13 @@
 		return res;
 	if (flag==1) {
 		struct leave_vm_options leave_options;
+		char mailbox[AST_MAX_EXTENSION * 2 + 2];
+		snprintf(mailbox, sizeof(mailbox), "%s@%s", username, context);
 
 		/* Send VoiceMail */
 		memset(&leave_options, 0, sizeof(leave_options));
 		leave_options.record_gain = record_gain;
-		cmd = leave_voicemail(chan, username, &leave_options);
+		cmd = leave_voicemail(chan, mailbox, &leave_options);
 	} else {
 
 		/* Forward VoiceMail */
@@ -3695,13 +3699,15 @@
 				if (!ast_strlen_zero(prefile)) {
 				/* See if we can find a recorded name for this person instead of their extension number */
 					if (ast_fileexists(prefile, NULL, NULL) > 0) {
-						ast_verbose(VERBOSE_PREFIX_3 "Playing envelope info: CID number '%s' matches mailbox number, playing recorded name\n", callerid);
+						if (option_verbose > 2)
+							ast_verbose(VERBOSE_PREFIX_3 "Playing envelope info: CID number '%s' matches mailbox number, playing recorded name\n", callerid);
 						if (!callback)
 							res = wait_file2(chan, vms, "vm-from");
 						res = ast_streamfile(chan, prefile, chan->language) > -1;
 						res = ast_waitstream(chan, "");
 					} else {
-						ast_verbose(VERBOSE_PREFIX_3 "Playing envelope info: message from '%s'\n", callerid);
+						if (option_verbose > 2)
+							ast_verbose(VERBOSE_PREFIX_3 "Playing envelope info: message from '%s'\n", callerid);
 						/* BB: Say "from extension" as one saying to sound smoother */
 						if (!callback)
 							res = wait_file2(chan, vms, "vm-from-extension");
@@ -3876,7 +3882,7 @@
 		return ERROR_LOCK_PATH;
 	
 	vms->curmsg = -1; 
-	for (x=0;x < vmu->maxmsg;x++) { 
+	for (x = 0; x < vmu->maxmsg; x++) { 
 		if (!vms->deleted[x] && (strcasecmp(vms->curbox, "INBOX") || !vms->heard[x])) { 
 			/* Save this message.  It's not in INBOX or hasn't been heard */ 
 			make_file(vms->fn, sizeof(vms->fn), vms->curdir, x); 
@@ -3910,9 +3916,9 @@
 
 done:
 	if (vms->deleted)
-		memset(vms->deleted, 0, sizeof(vms->deleted)); 
+		memset(vms->deleted, 0, vmu->maxmsg * sizeof(int)); 
 	if (vms->heard)
-		memset(vms->heard, 0, sizeof(vms->heard)); 
+		memset(vms->heard, 0, vmu->maxmsg * sizeof(int)); 
 
 	return 0;
 }
@@ -5354,7 +5360,8 @@
 					cmd = 't';
 					break;
 				case '2': /* Callback */
-					ast_verbose( VERBOSE_PREFIX_3 "Callback Requested\n");
+					if (option_verbose > 2)
+						ast_verbose( VERBOSE_PREFIX_3 "Callback Requested\n");
 					if (!ast_strlen_zero(vmu->callback) && vms.lastmsg > -1) {
 						cmd = advanced_options(chan, vmu, &vms, vms.curmsg, 2, record_gain);
 						if (cmd == 9) {
@@ -6441,7 +6448,8 @@
 	int retries = 0;
 
 	if (!num) {
-		ast_verbose( VERBOSE_PREFIX_3 "Destination number will be entered manually\n");
+		if (option_verbose > 2)
+			ast_verbose( VERBOSE_PREFIX_3 "Destination number will be entered manually\n");
 		while (retries < 3 && cmd != 't') {
 			destination[1] = '\0';
 			destination[0] = cmd = ast_play_and_wait(chan,"vm-enter-num-to-call");
@@ -6461,7 +6469,8 @@
 				if (cmd < 0)
 					return 0;
 				if (cmd == '*') {
-					ast_verbose( VERBOSE_PREFIX_3 "User hit '*' to cancel outgoing call\n");
+					if (option_verbose > 2)
+						ast_verbose( VERBOSE_PREFIX_3 "User hit '*' to cancel outgoing call\n");
 					return 0;
 				}
 				if ((cmd = ast_readstring(chan,destination + strlen(destination),sizeof(destination)-1,6000,10000,"#")) < 0) 
@@ -6475,14 +6484,16 @@
 		}
 		
 	} else {
-		ast_verbose( VERBOSE_PREFIX_3 "Destination number is CID number '%s'\n", num);
+		if (option_verbose > 2)
+			ast_verbose( VERBOSE_PREFIX_3 "Destination number is CID number '%s'\n", num);
 		ast_copy_string(destination, num, sizeof(destination));
 	}
 
 	if (!ast_strlen_zero(destination)) {
 		if (destination[strlen(destination) -1 ] == '*')
 			return 0; 
-		ast_verbose( VERBOSE_PREFIX_3 "Placing outgoing call to extension '%s' in context '%s' from context '%s'\n", destination, outgoing_context, chan->context);
+		if (option_verbose > 2)
+			ast_verbose( VERBOSE_PREFIX_3 "Placing outgoing call to extension '%s' in context '%s' from context '%s'\n", destination, outgoing_context, chan->context);
 		ast_copy_string(chan->exten, destination, sizeof(chan->exten));
 		ast_copy_string(chan->context, outgoing_context, sizeof(chan->context));
 		chan->priority = 0;
@@ -6553,7 +6564,8 @@
 							if (res)
 								return 9;
 						} else {
-							ast_verbose( VERBOSE_PREFIX_3 "Caller can not specify callback number - no dialout context available\n");
+							if (option_verbose > 2)
+								ast_verbose( VERBOSE_PREFIX_3 "Caller can not specify callback number - no dialout context available\n");
 							res = ast_play_and_wait(chan, "vm-sorry");
 						}
 						return res;
@@ -6574,7 +6586,8 @@
 						break;
 					default:
 						if (num) {
-							ast_verbose( VERBOSE_PREFIX_3 "Confirm CID number '%s' is number to use for callback\n", num);
+							if (option_verbose > 2)
+								ast_verbose( VERBOSE_PREFIX_3 "Confirm CID number '%s' is number to use for callback\n", num);
 							res = ast_play_and_wait(chan, "vm-num-i-have");
 							if (!res)
 								res = play_message_callerid(chan, vms, num, vmu->context, 1);
@@ -6616,25 +6629,30 @@
 		if (!ast_strlen_zero(cid)) {
 			ast_callerid_parse(cid, &name, &num);
 			if (!num) {
-				ast_verbose(VERBOSE_PREFIX_3 "No CID number available, no reply sent\n");
+				if (option_verbose > 2)
+					ast_verbose(VERBOSE_PREFIX_3 "No CID number available, no reply sent\n");
 				if (!res)
 					res = ast_play_and_wait(chan, "vm-nonumber");
 				return res;
 			} else {
 				if (find_user(NULL, vmu->context, num)) {
 					struct leave_vm_options leave_options;
-
-					ast_verbose(VERBOSE_PREFIX_3 "Leaving voicemail for '%s' in context '%s'\n", num, vmu->context);
+					char mailbox[AST_MAX_EXTENSION * 2 + 2];
+					snprintf(mailbox, sizeof(mailbox), "%s@%s", num, vmu->context);
+
+					if (option_verbose > 2)
+						ast_verbose(VERBOSE_PREFIX_3 "Leaving voicemail for '%s' in context '%s'\n", num, vmu->context);
 					
 					memset(&leave_options, 0, sizeof(leave_options));
 					leave_options.record_gain = record_gain;
-					res = leave_voicemail(chan, num, &leave_options);
+					res = leave_voicemail(chan, mailbox, &leave_options);
 					if (!res)
 						res = 't';
 					return res;
 				} else {
 					/* Sender has no mailbox, can't reply */
-					ast_verbose( VERBOSE_PREFIX_3 "No mailbox number '%s' in context '%s', no reply sent\n", num, vmu->context);
+					if (option_verbose > 2)
+						ast_verbose( VERBOSE_PREFIX_3 "No mailbox number '%s' in context '%s', no reply sent\n", num, vmu->context);
 					ast_play_and_wait(chan, "vm-nobox");
 					res = 't';
 					return res;
@@ -6685,7 +6703,8 @@
  				break;
  			} else {
  				/* Otherwise 1 is to save the existing message */
- 				ast_verbose(VERBOSE_PREFIX_3 "Saving message as is\n");
+ 				if (option_verbose > 2)
+					ast_verbose(VERBOSE_PREFIX_3 "Saving message as is\n");
  				ast_streamfile(chan, "vm-msgsaved", chan->language);
  				ast_waitstream(chan, "");
 				STORE(recordfile, vmu->mailbox, vmu->context, -1);
@@ -6695,17 +6714,21 @@
  			}
  		case '2':
  			/* Review */
- 			ast_verbose(VERBOSE_PREFIX_3 "Reviewing the message\n");
+ 			if (option_verbose > 2)
+				ast_verbose(VERBOSE_PREFIX_3 "Reviewing the message\n");
  			ast_streamfile(chan, recordfile, chan->language);
  			cmd = ast_waitstream(chan, AST_DIGIT_ANY);
  			break;
  		case '3':
  			message_exists = 0;
  			/* Record */
- 			if (recorded == 1)
-				ast_verbose(VERBOSE_PREFIX_3 "Re-recording the message\n");
- 			else	
-				ast_verbose(VERBOSE_PREFIX_3 "Recording the message\n");
+ 			if (recorded == 1) {
+				if (option_verbose > 2)
+					ast_verbose(VERBOSE_PREFIX_3 "Re-recording the message\n");
+ 			} else {	
+				if (option_verbose > 2)
+					ast_verbose(VERBOSE_PREFIX_3 "Recording the message\n");
+			}
 			if (recorded && outsidecaller) {
  				cmd = ast_play_and_wait(chan, INTRO);
  				cmd = ast_play_and_wait(chan, "beep");
@@ -6729,14 +6752,16 @@
 #if 0			
  			else if (vmu->review && (*duration < 5)) {
  				/* Message is too short */
- 				ast_verbose(VERBOSE_PREFIX_3 "Message too short\n");
+ 				if (option_verbose > 2)
+					ast_verbose(VERBOSE_PREFIX_3 "Message too short\n");
 				cmd = ast_play_and_wait(chan, "vm-tooshort");
  				cmd = vm_delete(recordfile);
  				break;
  			}
  			else if (vmu->review && (cmd == 2 && *duration < (maxsilence + 3))) {
  				/* Message is all silence */
- 				ast_verbose(VERBOSE_PREFIX_3 "Nothing recorded\n");
+ 				if (option_verbose > 2)
+					ast_verbose(VERBOSE_PREFIX_3 "Nothing recorded\n");
  				cmd = vm_delete(recordfile);
 				cmd = ast_play_and_wait(chan, "vm-nothingrecorded");
 				if (!cmd)

Modified: team/oej/codecnegotiation/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/asterisk.c?rev=15323&r1=15322&r2=15323&view=diff
==============================================================================
--- team/oej/codecnegotiation/asterisk.c (original)
+++ team/oej/codecnegotiation/asterisk.c Mon Mar 27 15:42:13 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>
  *
@@ -107,6 +107,7 @@
 #include "asterisk/pbx.h"
 #include "asterisk/enum.h"
 #include "asterisk/rtp.h"
+#include "asterisk/http.h"
 #if defined(T38_SUPPORT)
 #include "asterisk/udptl.h"
 #endif
@@ -882,11 +883,11 @@
 	if (ast_socket > -1) {
 		close(ast_socket);
 		ast_socket = -1;
+		unlink(ast_config_AST_SOCKET);
+		pthread_cancel(lthread);
 	}
 	if (ast_consock > -1)
 		close(ast_consock);
-	if (ast_socket > -1)
-		unlink(ast_config_AST_SOCKET);
 	if (!ast_opt_remote)
 		unlink(ast_config_AST_PID);
 	printf(term_quit());
@@ -1847,7 +1848,8 @@
 	return 0;
 }
 
-static void ast_readconfig(void) {
+static void ast_readconfig(void) 
+{
 	struct ast_config *cfg;
 	struct ast_variable *v;
 	char *config = AST_CONFIG_FILE;
@@ -2321,6 +2323,7 @@
 		printf(term_quit());
 		exit(1);
 	}
+	ast_http_init();
 	ast_channels_init();
 	if (init_manager()) {
 		printf(term_quit());

Modified: team/oej/codecnegotiation/astmm.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/astmm.c?rev=15323&r1=15322&r2=15323&view=diff
==============================================================================
--- team/oej/codecnegotiation/astmm.c (original)
+++ team/oej/codecnegotiation/astmm.c Mon Mar 27 15:42:13 2006
@@ -38,6 +38,7 @@
 #include "asterisk/options.h"
 #include "asterisk/lock.h"
 #include "asterisk/strings.h"
+#include "asterisk/unaligned.h"
 
 #define SOME_PRIME 563
 
@@ -104,7 +105,7 @@
 		regions[hash] = reg;
 		reg->fence = FENCE_MAGIC;
 		fence = (ptr + reg->len);
-		*fence = FENCE_MAGIC;
+		put_unaligned_uint32(fence, FENCE_MAGIC);
 	}
 	ast_mutex_unlock(&reglock);
 	if (!reg) {
@@ -166,7 +167,7 @@
 				fflush(mmlog);
 			}
 		}
-		if (*fence != FENCE_MAGIC) {
+		if (get_unaligned_uint32(fence) != FENCE_MAGIC) {
 			fprintf(stderr, "WARNING: High fence violation at %p, in %s of %s, line %d\n", reg->data, reg->func, reg->file, reg->lineno);
 			if (mmlog) {
 				fprintf(mmlog, "%ld - WARNING: High fence violation at %p, in %s of %s, line %d\n", time(NULL), reg->data, reg->func, reg->file, reg->lineno);
@@ -316,7 +317,7 @@
 						fflush(mmlog);
 					}
 				}
-				if (*fence != FENCE_MAGIC) {
+				if (get_unaligned_uint32(fence) != FENCE_MAGIC) {
 					fprintf(stderr, "WARNING: High fence violation at %p, in %s of %s, line %d\n", reg->data, reg->func, reg->file, reg->lineno);
 					if (mmlog) {
 						fprintf(mmlog, "%ld - WARNING: High fence violation at %p, in %s of %s, line %d\n", time(NULL), reg->data, reg->func, reg->file, reg->lineno);

Modified: team/oej/codecnegotiation/cdr.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/cdr.c?rev=15323&r1=15322&r2=15323&view=diff
==============================================================================
--- team/oej/codecnegotiation/cdr.c (original)
+++ team/oej/codecnegotiation/cdr.c Mon Mar 27 15:42:13 2006
@@ -439,7 +439,7 @@
 
 	while (cdr) {
 		next = cdr->next;
-		chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
+		chan = S_OR(cdr->channel, "<unknown>");
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_POSTED) && !ast_test_flag(cdr, AST_CDR_FLAG_POST_DISABLED))
 			ast_log(LOG_WARNING, "CDR on channel '%s' not posted\n", chan);
 		if (ast_tvzero(cdr->end))
@@ -464,7 +464,7 @@
 
 	while (cdr) {
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
-			chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
+			chan = S_OR(cdr->channel, "<unknown>");
 			if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
 				ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
 			if (!ast_tvzero(cdr->start))
@@ -480,7 +480,7 @@
 	char *chan; 
 
 	while (cdr) {
-		chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
+		chan = S_OR(cdr->channel, "<unknown>");
 		if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
 			ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
 		if (cdr->disposition < AST_CDR_ANSWERED)
@@ -497,7 +497,7 @@
 
 	while (cdr) {
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
-			chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
+			chan = S_OR(cdr->channel, "<unknown>");
 			if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
 				ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
 			if (cdr->disposition < AST_CDR_BUSY)
@@ -512,11 +512,13 @@
 	char *chan; 
 
 	while (cdr) {
-		chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
+		chan = S_OR(cdr->channel, "<unknown>");
 		if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
 			ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
-		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED))
-			cdr->disposition = AST_CDR_FAILED;
+		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
+			if (cdr->disposition < AST_CDR_FAILED)
+				cdr->disposition = AST_CDR_FAILED;
+		}
 		cdr = cdr->next;
 	}
 }
@@ -552,7 +554,7 @@
 	char *chan; 
 
 	while (cdr) {
-		chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
+		chan = S_OR(cdr->channel, "<unknown>");
 		if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
 			ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED))
@@ -567,7 +569,7 @@
 
 	while (cdr) {
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
-			chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
+			chan = S_OR(cdr->channel, "<unknown>");
 			if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
 				ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
 			if (!app)
@@ -615,7 +617,7 @@
 
 	while (cdr) {
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
-			chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
+			chan = S_OR(cdr->channel, "<unknown>");
 			if (!ast_strlen_zero(cdr->channel)) 
 				ast_log(LOG_WARNING, "CDR already initialized on '%s'\n", chan); 
 			ast_copy_string(cdr->channel, c->name, sizeof(cdr->channel));
@@ -650,7 +652,7 @@
 	char *chan;
 
 	while (cdr) {
-		chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
+		chan = S_OR(cdr->channel, "<unknown>");
 		if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
 			ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
 		if (ast_tvzero(cdr->end))
@@ -776,8 +778,8 @@
 			/* Copy account code et-al */	
 			ast_copy_string(cdr->accountcode, c->accountcode, sizeof(cdr->accountcode));
 			/* Destination information */
-			ast_copy_string(cdr->dst, (ast_strlen_zero(c->macroexten)) ? c->exten : c->macroexten, sizeof(cdr->dst));
-			ast_copy_string(cdr->dcontext, (ast_strlen_zero(c->macrocontext)) ? c->context : c->macrocontext, sizeof(cdr->dcontext));
+			ast_copy_string(cdr->dst, S_OR(c->macroexten, c->exten), sizeof(cdr->dst));

[... 8518 lines stripped ...]


More information about the asterisk-commits mailing list