[asterisk-commits] branch oej/t38passthrough r18635 - in /team/oej/t38passthrough: ./ apps/ chan...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Apr 9 12:27:14 MST 2006


Author: oej
Date: Sun Apr  9 14:25:59 2006
New Revision: 18635

URL: http://svn.digium.com/view/asterisk?rev=18635&view=rev
Log:
Reset, resolve, go

Added:
    team/oej/t38passthrough/doc/ajam.txt
      - copied unchanged from r17791, trunk/doc/ajam.txt
    team/oej/t38passthrough/res/res_config_pgsql.c
      - copied unchanged from r17791, trunk/res/res_config_pgsql.c
    team/oej/t38passthrough/static-http/
      - copied from r17791, trunk/static-http/
    team/oej/t38passthrough/static-http/ajamdemo.html
      - copied unchanged from r17791, trunk/static-http/ajamdemo.html
    team/oej/t38passthrough/static-http/astman.css
      - copied unchanged from r17791, trunk/static-http/astman.css
    team/oej/t38passthrough/static-http/astman.js
      - copied unchanged from r17791, trunk/static-http/astman.js
    team/oej/t38passthrough/static-http/prototype.js
      - copied unchanged from r17791, trunk/static-http/prototype.js
Removed:
    team/oej/t38passthrough/formats/format_au.c
    team/oej/t38passthrough/formats/format_pcm_alaw.c
Modified:
    team/oej/t38passthrough/   (props changed)
    team/oej/t38passthrough/.cleancount
    team/oej/t38passthrough/CREDITS
    team/oej/t38passthrough/Makefile
    team/oej/t38passthrough/README
    team/oej/t38passthrough/acl.c
    team/oej/t38passthrough/app.c
    team/oej/t38passthrough/apps/app_alarmreceiver.c
    team/oej/t38passthrough/apps/app_channelredirect.c
    team/oej/t38passthrough/apps/app_dial.c
    team/oej/t38passthrough/apps/app_echo.c
    team/oej/t38passthrough/apps/app_exec.c
    team/oej/t38passthrough/apps/app_macro.c
    team/oej/t38passthrough/apps/app_meetme.c
    team/oej/t38passthrough/apps/app_milliwatt.c
    team/oej/t38passthrough/apps/app_page.c
    team/oej/t38passthrough/apps/app_queue.c
    team/oej/t38passthrough/apps/app_record.c
    team/oej/t38passthrough/apps/app_rpt.c
    team/oej/t38passthrough/apps/app_senddtmf.c
    team/oej/t38passthrough/apps/app_sms.c
    team/oej/t38passthrough/apps/app_stack.c
    team/oej/t38passthrough/apps/app_voicemail.c
    team/oej/t38passthrough/apps/app_while.c
    team/oej/t38passthrough/asterisk.8
    team/oej/t38passthrough/asterisk.c
    team/oej/t38passthrough/asterisk.sgml
    team/oej/t38passthrough/callerid.c
    team/oej/t38passthrough/channel.c
    team/oej/t38passthrough/channels/chan_agent.c
    team/oej/t38passthrough/channels/chan_h323.c
    team/oej/t38passthrough/channels/chan_iax2.c
    team/oej/t38passthrough/channels/chan_local.c
    team/oej/t38passthrough/channels/chan_mgcp.c
    team/oej/t38passthrough/channels/chan_misdn.c
    team/oej/t38passthrough/channels/chan_oss.c
    team/oej/t38passthrough/channels/chan_sip.c
    team/oej/t38passthrough/channels/chan_zap.c
    team/oej/t38passthrough/channels/h323/ast_h323.cpp
    team/oej/t38passthrough/channels/iax2-provision.c
    team/oej/t38passthrough/channels/iax2-provision.h
    team/oej/t38passthrough/channels/misdn/Makefile
    team/oej/t38passthrough/channels/misdn/isdn_lib.c
    team/oej/t38passthrough/channels/misdn/isdn_lib.h
    team/oej/t38passthrough/channels/misdn/isdn_msg_parser.c
    team/oej/t38passthrough/channels/misdn/portinfo.c
    team/oej/t38passthrough/cli.c
    team/oej/t38passthrough/codecs/codec_a_mu.c
    team/oej/t38passthrough/codecs/codec_adpcm.c
    team/oej/t38passthrough/codecs/codec_alaw.c
    team/oej/t38passthrough/codecs/codec_g723_1.c
    team/oej/t38passthrough/codecs/codec_g726.c
    team/oej/t38passthrough/codecs/codec_gsm.c
    team/oej/t38passthrough/codecs/codec_ilbc.c
    team/oej/t38passthrough/codecs/codec_lpc10.c
    team/oej/t38passthrough/codecs/codec_speex.c
    team/oej/t38passthrough/codecs/codec_ulaw.c
    team/oej/t38passthrough/codecs/gsm/Makefile
    team/oej/t38passthrough/configs/extensions.conf.sample
    team/oej/t38passthrough/configs/features.conf.sample
    team/oej/t38passthrough/configs/http.conf.sample
    team/oej/t38passthrough/configs/manager.conf.sample
    team/oej/t38passthrough/configs/oss.conf.sample
    team/oej/t38passthrough/configs/queues.conf.sample
    team/oej/t38passthrough/configs/sip.conf.sample
    team/oej/t38passthrough/configs/skinny.conf.sample
    team/oej/t38passthrough/contrib/init.d/rc.redhat.asterisk
    team/oej/t38passthrough/devicestate.c
    team/oej/t38passthrough/dns.c
    team/oej/t38passthrough/doc/00README.1st
    team/oej/t38passthrough/doc/CODING-GUIDELINES
    team/oej/t38passthrough/doc/asterisk-conf.txt
    team/oej/t38passthrough/doc/ip-tos.txt
    team/oej/t38passthrough/doc/manager.txt
    team/oej/t38passthrough/enum.c
    team/oej/t38passthrough/file.c
    team/oej/t38passthrough/formats/Makefile
    team/oej/t38passthrough/formats/format_g723.c
    team/oej/t38passthrough/formats/format_g726.c
    team/oej/t38passthrough/formats/format_g729.c
    team/oej/t38passthrough/formats/format_gsm.c
    team/oej/t38passthrough/formats/format_h263.c
    team/oej/t38passthrough/formats/format_h264.c
    team/oej/t38passthrough/formats/format_ilbc.c
    team/oej/t38passthrough/formats/format_ogg_vorbis.c
    team/oej/t38passthrough/formats/format_pcm.c
    team/oej/t38passthrough/formats/format_sln.c
    team/oej/t38passthrough/formats/format_vox.c
    team/oej/t38passthrough/formats/format_wav.c
    team/oej/t38passthrough/formats/format_wav_gsm.c
    team/oej/t38passthrough/http.c
    team/oej/t38passthrough/include/asterisk.h
    team/oej/t38passthrough/include/asterisk/adsi.h
    team/oej/t38passthrough/include/asterisk/app.h
    team/oej/t38passthrough/include/asterisk/callerid.h
    team/oej/t38passthrough/include/asterisk/channel.h
    team/oej/t38passthrough/include/asterisk/cli.h
    team/oej/t38passthrough/include/asterisk/crypto.h
    team/oej/t38passthrough/include/asterisk/dns.h
    team/oej/t38passthrough/include/asterisk/doxyref.h
    team/oej/t38passthrough/include/asterisk/enum.h
    team/oej/t38passthrough/include/asterisk/features.h
    team/oej/t38passthrough/include/asterisk/file.h
    team/oej/t38passthrough/include/asterisk/frame.h
    team/oej/t38passthrough/include/asterisk/fskmodem.h
    team/oej/t38passthrough/include/asterisk/http.h
    team/oej/t38passthrough/include/asterisk/image.h
    team/oej/t38passthrough/include/asterisk/indications.h
    team/oej/t38passthrough/include/asterisk/io.h
    team/oej/t38passthrough/include/asterisk/linkedlists.h
    team/oej/t38passthrough/include/asterisk/localtime.h
    team/oej/t38passthrough/include/asterisk/lock.h
    team/oej/t38passthrough/include/asterisk/logger.h
    team/oej/t38passthrough/include/asterisk/manager.h
    team/oej/t38passthrough/include/asterisk/module.h
    team/oej/t38passthrough/include/asterisk/musiconhold.h
    team/oej/t38passthrough/include/asterisk/options.h
    team/oej/t38passthrough/include/asterisk/pbx.h
    team/oej/t38passthrough/include/asterisk/plc.h
    team/oej/t38passthrough/include/asterisk/rtp.h
    team/oej/t38passthrough/include/asterisk/sched.h
    team/oej/t38passthrough/include/asterisk/tdd.h
    team/oej/t38passthrough/include/asterisk/term.h
    team/oej/t38passthrough/include/solaris-compat/compat.h
    team/oej/t38passthrough/indications.c
    team/oej/t38passthrough/loader.c
    team/oej/t38passthrough/manager.c
    team/oej/t38passthrough/pbx.c
    team/oej/t38passthrough/pbx/pbx_ael.c
    team/oej/t38passthrough/pbx/pbx_config.c
    team/oej/t38passthrough/pbx/pbx_dundi.c
    team/oej/t38passthrough/pbx/pbx_loopback.c
    team/oej/t38passthrough/pbx/pbx_realtime.c
    team/oej/t38passthrough/plc.c
    team/oej/t38passthrough/res/Makefile
    team/oej/t38passthrough/res/res_agi.c
    team/oej/t38passthrough/res/res_clioriginate.c
    team/oej/t38passthrough/res/res_features.c
    team/oej/t38passthrough/res/res_indications.c
    team/oej/t38passthrough/res/res_musiconhold.c
    team/oej/t38passthrough/res/res_smdi.c
    team/oej/t38passthrough/res/snmp/agent.c
    team/oej/t38passthrough/rtp.c
    team/oej/t38passthrough/slinfactory.c
    team/oej/t38passthrough/strcompat.c
    team/oej/t38passthrough/translate.c
    team/oej/t38passthrough/udptl.c
    team/oej/t38passthrough/utils.c
    team/oej/t38passthrough/utils/astman.c

Propchange: team/oej/t38passthrough/
------------------------------------------------------------------------------
    automerge = http://edvina.net/training/

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

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

Propchange: team/oej/t38passthrough/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sun Apr  9 14:25:59 2006
@@ -1,1 +1,1 @@
-/trunk:1-15469
+/trunk:1-17791

Modified: team/oej/t38passthrough/.cleancount
URL: http://svn.digium.com/view/asterisk/team/oej/t38passthrough/.cleancount?rev=18635&r1=18634&r2=18635&view=diff
==============================================================================
--- team/oej/t38passthrough/.cleancount (original)
+++ team/oej/t38passthrough/.cleancount Sun Apr  9 14:25:59 2006
@@ -1,1 +1,1 @@
-11
+13

Modified: team/oej/t38passthrough/CREDITS
URL: http://svn.digium.com/view/asterisk/team/oej/t38passthrough/CREDITS?rev=18635&r1=18634&r2=18635&view=diff
==============================================================================
--- team/oej/t38passthrough/CREDITS (original)
+++ team/oej/t38passthrough/CREDITS Sun Apr  9 14:25:59 2006
@@ -12,6 +12,8 @@
 Telesthetic - for supporting SIP development
 
 Christos Ricudis - for substantial code contributions
+
+nic.at - ENUM support in Asterisk
 
 Paul Bagyenda, Digital Solutions - for initial Voicetronix driver development
 
@@ -90,6 +92,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/t38passthrough/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/t38passthrough/Makefile?rev=18635&r1=18634&r2=18635&view=diff
==============================================================================
--- team/oej/t38passthrough/Makefile (original)
+++ team/oej/t38passthrough/Makefile Sun Apr  9 14:25:59 2006
@@ -28,6 +28,7 @@
 ifeq ($(CROSS_COMPILE),)
   OSARCH=$(shell uname -s)
   OSREV=$(shell uname -r)
+  MARCH=$(shell uname -m)
 else
   OSARCH=$(CROSS_ARCH)
   OSREV=$(CROSS_REV)
@@ -397,8 +398,11 @@
   AUDIO_LIBS=-framework CoreAudio
   ASTLINK=-Wl,-dynamic
   SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
-  OBJS+=poll.o
-  ASTCFLAGS+=-DPOLLCOMPAT
+  # Mac on Intel CoreDuo does not need poll compatibility layer
+  ifneq ($(MARCH),i386)
+    OBJS+=poll.o
+    ASTCFLAGS+=-DPOLLCOMPAT
+  endif
 else
 #These are used for all but Darwin
   ASTLINK=-Wl,-E 
@@ -564,6 +568,13 @@
 
 datafiles: all
 	if [ x`$(ID) -un` = xroot ]; then sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
+	# Should static HTTP be installed during make samples or even with its own target ala
+	# webvoicemail?  There are portions here that *could* be customized but might also be
+	# improved a lot.  I'll put it here for now.
+	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/static-http
+	for x in static-http/*; do \
+		install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/static-http ; \
+	done
 	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits
 	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/priv-callerintros
 	for x in sounds/digits/*.gsm; do \
@@ -786,6 +797,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/t38passthrough/README
URL: http://svn.digium.com/view/asterisk/team/oej/t38passthrough/README?rev=18635&r1=18634&r2=18635&view=diff
==============================================================================
--- team/oej/t38passthrough/README (original)
+++ team/oej/t38passthrough/README Sun Apr  9 14:25:59 2006
@@ -2,14 +2,14 @@
 by Mark Spencer <markster at digium.com>
 and the Asterisk.org developer community
 
-Copyright (C) 2001-2005 Digium, Inc.
+Copyright (C) 2001-2006 Digium, Inc.
 and other copyright holders.
 ================================================================
 
 * SECURITY
   It is imperative that you read and fully understand the contents of
-the SECURITY file before you attempt to configure and run an Asterisk
-server.
+the security information file (doc/security.txt) before you attempt 
+to configure and run an Asterisk server.
 
 * WHAT IS ASTERISK ?
   Asterisk is an Open Source PBX and telephony toolkit.  It is, in a
@@ -84,11 +84,18 @@
 
   So let's proceed:
 
-1) Run "make"
+1) Read the README files.
+   There are more README files than this one in the doc/ directory.
+   Start with doc/00README.1st
+   You may also want to check the configuration files that contain
+   examples and reference guides. They are all in the configs/
+   directory.
+
+2) Run "make"
 
   Assuming the build completes successfully:
 
-2) Run "make install"
+3) Run "make install"
 
   Each time you update or checkout from the repository, you are strongly
 encouraged to ensure all previous object files are removed to avoid internal 
@@ -99,7 +106,7 @@
   If this is your first time working with Asterisk, you may wish to install
 the sample PBX, with demonstration extensions, etc.  If so, run:
 
-3) "make samples"
+4) "make samples"
 
   Doing so will overwrite any existing config files you have.
 

Modified: team/oej/t38passthrough/acl.c
URL: http://svn.digium.com/view/asterisk/team/oej/t38passthrough/acl.c?rev=18635&r1=18634&r2=18635&view=diff
==============================================================================
--- team/oej/t38passthrough/acl.c (original)
+++ team/oej/t38passthrough/acl.c Sun Apr  9 14:25:59 2006
@@ -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) {
@@ -313,7 +313,7 @@
 	else
 		return -1;
 
-	ast_log(LOG_WARNING, "tos value %s is deprecated.  See doc/ip-tos.txt for more information.", value);
+	ast_log(LOG_WARNING, "TOS value %s is deprecated. Please see doc/ip-tos.txt for more information.\n", value);
 
 	return 0;
 }
@@ -349,7 +349,7 @@
 }
 
 /* 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;
@@ -428,4 +428,3 @@
 		return 0;
 	return -1;
 }
-

Modified: team/oej/t38passthrough/app.c
URL: http://svn.digium.com/view/asterisk/team/oej/t38passthrough/app.c?rev=18635&r1=18634&r2=18635&view=diff
==============================================================================
--- team/oej/t38passthrough/app.c (original)
+++ team/oej/t38passthrough/app.c Sun Apr  9 14:25:59 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;
 }
 
@@ -1153,14 +1149,15 @@
 	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;
 	}
 
-	snprintf(fs, strlen(path) + 19, "%s/.lock-%08x", path, rand());
+	snprintf(fs, strlen(path) + 19, "%s/.lock-%08lx", path, ast_random());
 	fd = open(fs, O_WRONLY | O_CREAT | O_EXCL, 0600);
 	if (fd < 0) {
 		fprintf(stderr, "Unable to create lock file '%s': %s\n", path, strerror(errno));
@@ -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/t38passthrough/apps/app_alarmreceiver.c
URL: http://svn.digium.com/view/asterisk/team/oej/t38passthrough/apps/app_alarmreceiver.c?rev=18635&r1=18634&r2=18635&view=diff
==============================================================================
--- team/oej/t38passthrough/apps/app_alarmreceiver.c (original)
+++ team/oej/t38passthrough/apps/app_alarmreceiver.c Sun Apr  9 14:25:59 2006
@@ -551,13 +551,12 @@
 
 		checksum = checksum % 15;
 
-		if(checksum){
+		if (checksum) {
 			database_increment("checksum-errors");
-			if(option_verbose >= 2){
+			if (option_verbose >= 2)
 				ast_verbose(VERBOSE_PREFIX_2 "AlarmReceiver: Nonzero checksum\n");
 			ast_log(LOG_DEBUG, "AlarmReceiver: Nonzero checksum\n");
 			continue;
-			}
 		}
 
 		/* Check the message type for correctness */

Modified: team/oej/t38passthrough/apps/app_channelredirect.c
URL: http://svn.digium.com/view/asterisk/team/oej/t38passthrough/apps/app_channelredirect.c?rev=18635&r1=18634&r2=18635&view=diff
==============================================================================
--- team/oej/t38passthrough/apps/app_channelredirect.c (original)
+++ team/oej/t38passthrough/apps/app_channelredirect.c Sun Apr  9 14:25:59 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;
 
@@ -101,15 +99,16 @@
 		context = NULL;
 	}
 
-	if (!(prio = ast_findlabel_extension(chan2, S_OR(context, chan2->context), S_OR(exten, chan2->exten),
-					     priority, chan2->cid.cid_num))) {
+	/* ast_findlabel_extension does not convert numeric priorities; it only does a lookup */
+	if (!(prio = atoi(priority)) && !(prio = ast_findlabel_extension(chan2, S_OR(context, chan2->context),
+									S_OR(exten, chan2->exten), priority, chan2->cid.cid_num))) {
 		ast_log(LOG_WARNING, "'%s' is not a known priority or label\n", priority);
 		goto chanquit;
 	}
 
-	ast_log(LOG_DEBUG, "Attempting async goto (%s) to %s\n", args.channel, args.label);
+	ast_log(LOG_DEBUG, "Attempting async goto (%s) to %s|%s|%d\n", args.channel, S_OR(context, chan2->context), S_OR(exten, chan2->exten), prio);
 
-	if (ast_async_goto_if_exists(chan2, context ? context : chan2->context, exten ? exten : chan2->exten, prio))
+	if (ast_async_goto_if_exists(chan2, S_OR(context, chan2->context), S_OR(exten, chan2->exten), prio))
 		ast_log(LOG_WARNING, "%s failed for %s\n", app, args.channel);
 	else
 		res = 0;

Modified: team/oej/t38passthrough/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/t38passthrough/apps/app_dial.c?rev=18635&r1=18634&r2=18635&view=diff
==============================================================================
--- team/oej/t38passthrough/apps/app_dial.c (original)
+++ team/oej/t38passthrough/apps/app_dial.c Sun Apr  9 14:25:59 2006
@@ -35,6 +35,7 @@
 #include <sys/signal.h>
 #include <netinet/in.h>
 
+#define STATIC_MODULE
 #include "asterisk.h"
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
@@ -1449,7 +1450,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 {
@@ -1719,7 +1720,7 @@
 
 }
 
-int unload_module(void)
+STATIC_MODULE int unload_module(void)
 {
 	int res;
 
@@ -1731,7 +1732,7 @@
 	return res;
 }
 
-int load_module(void)
+STATIC_MODULE int load_module(void)
 {
 	int res;
 
@@ -1741,19 +1742,21 @@
 	return res;
 }
 
-char *description(void)
+STATIC_MODULE char *description(void)
 {
 	return tdesc;
 }
 
-int usecount(void)
+STATIC_MODULE int usecount(void)
 {
 	int res;
 	STANDARD_USECOUNT(res);
 	return res;
 }
 
-char *key()
+STATIC_MODULE char *key(void)
 {
 	return ASTERISK_GPL_KEY;
 }
+
+STD_MOD(MOD_1, NULL, NULL, NULL);

Modified: team/oej/t38passthrough/apps/app_echo.c
URL: http://svn.digium.com/view/asterisk/team/oej/t38passthrough/apps/app_echo.c?rev=18635&r1=18634&r2=18635&view=diff
==============================================================================
--- team/oej/t38passthrough/apps/app_echo.c (original)
+++ team/oej/t38passthrough/apps/app_echo.c Sun Apr  9 14:25:59 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/t38passthrough/apps/app_exec.c
URL: http://svn.digium.com/view/asterisk/team/oej/t38passthrough/apps/app_exec.c?rev=18635&r1=18634&r2=18635&view=diff
==============================================================================
--- team/oej/t38passthrough/apps/app_exec.c (original)
+++ team/oej/t38passthrough/apps/app_exec.c Sun Apr  9 14:25:59 2006
@@ -2,8 +2,9 @@
  * Asterisk -- An open source telephony toolkit.
  *
  * Copyright (c) 2004 - 2005, Tilghman Lesher.  All rights reserved.
+ * Portions copyright (c) 2006, Philipp Dunkel.
  *
- * Tilghman Lesher <app_exec__v001 at the-tilghman.com>
+ * Tilghman Lesher <app_exec__v002 at the-tilghman.com>
  *
  * This code is released by the author with no restrictions on usage.
  *
@@ -19,7 +20,8 @@
  *
  * \brief Exec application
  *
- * \author Tilghman Lesher <app_exec__v001 at the-tilghman.com>
+ * \author Tilghman Lesher <app_exec__v002 at the-tilghman.com>
+ * \author Philipp Dunkel <philipp.dunkel at ebox.at>
  *
  * \ingroup applications
  */
@@ -43,18 +45,43 @@
 /* Maximum length of any variable */
 #define MAXRESULT	1024
 
-static char *tdesc = "Executes applications";
+static char *tdesc = "Executes dialplan applications";
+
+/*! Note
+ *
+ * The key difference between these two apps is exit status.  In a
+ * nutshell, Exec tries to be transparent as possible, behaving
+ * in exactly the same way as if the application it calls was
+ * directly invoked from the dialplan.
+ *
+ * TryExec, on the other hand, provides a way to execute applications
+ * and catch any possible fatal error without actually fatally
+ * affecting the dialplan.
+ */
 
 static char *app_exec = "Exec";
-
-static char *exec_synopsis = "Executes internal application";
-
+static char *exec_synopsis = "Executes dialplan application";
 static char *exec_descrip =
 "Usage: Exec(appname(arguments))\n"
 "  Allows an arbitrary application to be invoked even when not\n"
+"hardcoded into the dialplan.  If the underlying application\n"
+"terminates the dialplan, or if the application cannot be found,\n"
+"Exec will terminate the dialplan.\n"
+"  To invoke external applications, see the application System.\n"
+"  If you would like to catch any error instead, see TryExec.\n";
+
+static char *app_tryexec = "TryExec";
+static char *tryexec_synopsis = "Executes dialplan application, always returning";
+static char *tryexec_descrip =
+"Usage: TryExec(appname(arguments))\n"
+"  Allows an arbitrary application to be invoked even when not\n"
 "hardcoded into the dialplan. To invoke external applications\n"
-"see the application System. Returns whatever value the\n"
-"app returns or a non-zero value if the app cannot be found.\n";
+"see the application System.  Always returns to the dialplan.\n"
+"The channel variable TRYSTATUS will be set to:\n"
+"    SUCCESS   if the application returned zero\n"
+"    FAILED    if the application returned non-zero\n"
+"    NOAPP     if the application was not found or was not specified\n"
+"    NOMEMORY  if there was not enough memory to execute.\n";
 
 LOCAL_USER_DECL;
 
@@ -62,12 +89,10 @@
 {
 	int res=0;
 	struct localuser *u;
-	char *s, *appname, *endargs, args[MAXRESULT];
+	char *s, *appname, *endargs, args[MAXRESULT] = "";
 	struct ast_app *app;
 
 	LOCAL_USER_ADD(u);
-
-	memset(args, 0, MAXRESULT);
 
 	/* Check and parse arguments */
 	if (data) {
@@ -82,7 +107,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;
@@ -96,11 +121,51 @@
 	return res;
 }
 
+static int tryexec_exec(struct ast_channel *chan, void *data)
+{
+	int res=0;
+	struct localuser *u;
+	char *s, *appname, *endargs, args[MAXRESULT] = "";
+	struct ast_app *app;
+
+	LOCAL_USER_ADD(u);
+
+	/* Check and parse arguments */
+	if (data) {
+		if ((s = ast_strdupa(data))) {
+			appname = strsep(&s, "(");
+			if (s) {
+				endargs = strrchr(s, ')');
+				if (endargs)
+					*endargs = '\0';
+				pbx_substitute_variables_helper(chan, s, args, MAXRESULT - 1);
+			}
+			if (appname) {
+				app = pbx_findapp(appname);
+				if (app) {
+					res = pbx_exec(chan, app, args);
+					pbx_builtin_setvar_helper(chan, "TRYSTATUS", res ? "FAILED" : "SUCCESS");
+				} else {
+					ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
+					pbx_builtin_setvar_helper(chan, "TRYSTATUS", "NOAPP");
+				}
+			}
+		} else {
+			ast_log(LOG_ERROR, "Out of memory\n");
+			pbx_builtin_setvar_helper(chan, "TRYSTATUS", "NOMEMORY");
+		}
+	}
+
+	LOCAL_USER_REMOVE(u);
+	return 0;
+}
+
 int unload_module(void)
 {
 	int res;
 
 	res = ast_unregister_application(app_exec);
+	res |= ast_unregister_application(app_tryexec);
 
 	STANDARD_HANGUP_LOCALUSERS;
 
@@ -109,7 +174,9 @@
 
 int load_module(void)
 {
-	return ast_register_application(app_exec, exec_exec, exec_synopsis, exec_descrip);
+	int res = ast_register_application(app_exec, exec_exec, exec_synopsis, exec_descrip);
+	res |= ast_register_application(app_tryexec, tryexec_exec, tryexec_synopsis, tryexec_descrip);
+	return res;
 }
 
 char *description(void)

Modified: team/oej/t38passthrough/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/team/oej/t38passthrough/apps/app_macro.c?rev=18635&r1=18634&r2=18635&view=diff
==============================================================================
--- team/oej/t38passthrough/apps/app_macro.c (original)
+++ team/oej/t38passthrough/apps/app_macro.c Sun Apr  9 14:25:59 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/t38passthrough/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/oej/t38passthrough/apps/app_meetme.c?rev=18635&r1=18634&r2=18635&view=diff
==============================================================================
--- team/oej/t38passthrough/apps/app_meetme.c (original)
+++ team/oej/t38passthrough/apps/app_meetme.c Sun Apr  9 14:25:59 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;

Modified: team/oej/t38passthrough/apps/app_milliwatt.c
URL: http://svn.digium.com/view/asterisk/team/oej/t38passthrough/apps/app_milliwatt.c?rev=18635&r1=18634&r2=18635&view=diff
==============================================================================
--- team/oej/t38passthrough/apps/app_milliwatt.c (original)
+++ team/oej/t38passthrough/apps/app_milliwatt.c Sun Apr  9 14:25:59 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/t38passthrough/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/team/oej/t38passthrough/apps/app_page.c?rev=18635&r1=18634&r2=18635&view=diff
==============================================================================
--- team/oej/t38passthrough/apps/app_page.c (original)
+++ team/oej/t38passthrough/apps/app_page.c Sun Apr  9 14:25:59 2006
@@ -143,7 +143,7 @@
 	char *tech, *resource;
 	char meetmeopts[80];
 	struct ast_flags flags = { 0 };
-	unsigned int confid = rand();
+	unsigned int confid = ast_random();
 	struct ast_app *app;
 	char *tmp;
 	int res=0;
@@ -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/t38passthrough/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/oej/t38passthrough/apps/app_queue.c?rev=18635&r1=18634&r2=18635&view=diff
==============================================================================
--- team/oej/t38passthrough/apps/app_queue.c (original)
+++ team/oej/t38passthrough/apps/app_queue.c Sun Apr  9 14:25:59 2006
@@ -1211,7 +1211,7 @@
 
 	ast_mutex_lock(&qe->parent->lock);
 	if (newvalue <= qe->parent->servicelevel)
-       		qe->parent->callscompletedinsl++;
+		qe->parent->callscompletedinsl++;
 	oldvalue = qe->parent->holdtime;
 	qe->parent->holdtime = (((oldvalue << 2) - oldvalue) + newvalue) >> 2;
 	ast_mutex_unlock(&qe->parent->lock);
@@ -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);
@@ -1767,7 +1753,7 @@
 				if (f) {
 					if (f->frametype == AST_FRAME_CONTROL) {
 						switch(f->subclass) {
-		    			case AST_CONTROL_ANSWER:
+						case AST_CONTROL_ANSWER:
 							/* This is our guy if someone answered. */
 							if (!peer) {
 								if (option_verbose > 2)
@@ -2006,7 +1992,7 @@
 		tmp->metric += mem->penalty * 1000000;
 		break;
 	case QUEUE_STRATEGY_RANDOM:
-		tmp->metric = rand() % 1000;
+		tmp->metric = ast_random() % 1000;
 		tmp->metric += mem->penalty * 1000000;
 		break;
 	case QUEUE_STRATEGY_FEWESTCALLS:
@@ -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) 
@@ -2207,7 +2193,7 @@
 				/* Agent must have hung up */
 				ast_log(LOG_WARNING, "Agent on %s hungup on the customer.  They're going to be pissed.\n", peer->name);
 				ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "AGENTDUMP", "%s", "");
-                                record_abandoned(qe);
+				record_abandoned(qe);
 				if (qe->parent->eventwhencalled) {
 					manager_event(EVENT_FLAG_AGENT, "AgentDump",
 						      "Queue: %s\r\n"
@@ -2237,7 +2223,7 @@
 		if (res < 0) {
 			ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "SYSCOMPAT", "%s", "");
 			ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", qe->chan->name, peer->name);
-                        record_abandoned(qe);
+		record_abandoned(qe);
 			ast_hangup(peer);
 			return -1;
 		}
@@ -2255,7 +2241,7 @@
 			else {
 				/* Last ditch effort -- no CDR, make up something */
 				char tmpid[256];
-				snprintf(tmpid, sizeof(tmpid), "chan-%x", rand());
+				snprintf(tmpid, sizeof(tmpid), "chan-%lx", ast_random());
 				ast_monitor_start(which, qe->parent->monfmt, tmpid, 1 );
 			}
 			if (qe->parent->monjoin)
@@ -2417,7 +2403,7 @@
 				free(last_member);
 
 				if (queue_persistent_members)
-				    dump_queue_members(q);
+					dump_queue_members(q);
 
 				res = RES_OKAY;
 			} else {
@@ -2454,17 +2440,17 @@
 				new_member->next = q->members;
 				q->members = new_member;
 				manager_event(EVENT_FLAG_AGENT, "QueueMemberAdded",
-					"Queue: %s\r\n"
-					"Location: %s\r\n"
-					"Membership: %s\r\n"
-					"Penalty: %d\r\n"
-					"CallsTaken: %d\r\n"
-					"LastCall: %d\r\n"
-					"Status: %d\r\n"
-					"Paused: %d\r\n",
-				q->name, new_member->interface, new_member->dynamic ? "dynamic" : "static",
-				new_member->penalty, new_member->calls, (int)new_member->lastcall, new_member->status, new_member->paused);
-					
+						"Queue: %s\r\n"
+						"Location: %s\r\n"
+						"Membership: %s\r\n"
+						"Penalty: %d\r\n"
+						"CallsTaken: %d\r\n"
+						"LastCall: %d\r\n"
+						"Status: %d\r\n"
+						"Paused: %d\r\n",
+						q->name, new_member->interface, new_member->dynamic ? "dynamic" : "static",
+						new_member->penalty, new_member->calls, (int)new_member->lastcall, new_member->status, new_member->paused);
+
 				if (dump)
 					dump_queue_members(q);
 
@@ -2503,7 +2489,7 @@
 				mem->paused = paused;
 
 				if (queue_persistent_members)
-				    dump_queue_members(q);
+					dump_queue_members(q);
 
 				ast_queue_log(q->name, "NONE", interface, (paused ? "PAUSE" : "UNPAUSE"), "%s", "");
 
@@ -2682,7 +2668,7 @@
 	}
 
 	if (!(parse = ast_strdupa(data))) 
-		return -1;	
+		return -1;
 

[... 22382 lines stripped ...]


More information about the asterisk-commits mailing list