[asterisk-commits] murf: branch murf/bug7836 r48441 - in /team/murf/bug7836: ./ apps/ build_tool...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Dec 13 00:43:59 MST 2006


Author: murf
Date: Wed Dec 13 01:43:58 2006
New Revision: 48441

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48441
Log:
Merged revisions 48373,48376,48378,48380,48383-48384,48388-48390,48392,48397,48400,48402,48408-48410,48415-48417,48432-48433 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r48373 | murf | 2006-12-09 20:14:27 -0700 (Sat, 09 Dec 2006) | 17 lines

Merged revisions 48372 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r48372 | murf | 2006-12-09 20:04:18 -0700 (Sat, 09 Dec 2006) | 9 lines

Merged revisions 48371 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r48371 | murf | 2006-12-09 19:14:13 -0700 (Sat, 09 Dec 2006) | 1 line

This version applies the patch suggested by stevens in bug 7836 (make inbound channel RINGING state consistent with other channels).
........

................

................
r48376 | tilghman | 2006-12-10 17:52:19 -0700 (Sun, 10 Dec 2006) | 21 lines

Merged revisions 48375 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r48375 | tilghman | 2006-12-10 18:47:21 -0600 (Sun, 10 Dec 2006) | 13 lines

Merged revisions 48374 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r48374 | tilghman | 2006-12-10 18:33:59 -0600 (Sun, 10 Dec 2006) | 5 lines

When doing a fork() and exec(), two problems existed (Issue 8086):
1) Ignored signals stayed ignored after the exec().
2) Signals could possibly fire between the fork() and exec(), causing Asterisk
signal handlers within the child to execute, which caused nasty race conditions.

........

................

................
r48378 | file | 2006-12-10 22:01:37 -0700 (Sun, 10 Dec 2006) | 10 lines

Merged revisions 48377 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r48377 | file | 2006-12-10 23:57:38 -0500 (Sun, 10 Dec 2006) | 2 lines

Don't access the conference structure after it has been freed.

........

................
r48380 | file | 2006-12-10 22:34:53 -0700 (Sun, 10 Dec 2006) | 10 lines

Merged revisions 48379 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r48379 | file | 2006-12-11 00:30:01 -0500 (Mon, 11 Dec 2006) | 2 lines

Use the correct API call to say a device state changed. (Yes, I'm a nub.)

........

................
r48383 | file | 2006-12-10 22:38:57 -0700 (Sun, 10 Dec 2006) | 10 lines

Merged revisions 48381 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r48381 | file | 2006-12-11 00:36:45 -0500 (Mon, 11 Dec 2006) | 2 lines

Merge in my latest RTP changes. Break out RTP and RTCP callback functions so they no longer share a common one.

........

................
r48384 | tilghman | 2006-12-10 22:40:38 -0700 (Sun, 10 Dec 2006) | 10 lines

Merged revisions 48382 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r48382 | tilghman | 2006-12-10 23:37:09 -0600 (Sun, 10 Dec 2006) | 2 lines

STRFTIME() does not actually require an argument (issue 8540)

........

................
r48388 | murf | 2006-12-11 10:00:36 -0700 (Mon, 11 Dec 2006) | 1 line

This update fixes the problem reported in bug 8551; that ast_app_getdata() behaves differently in trunk for the case of a null prompt.
................
r48389 | rizzo | 2006-12-11 11:11:58 -0700 (Mon, 11 Dec 2006) | 13 lines

make sure the argument to ast_malloc() is > 0.

Long explaination:

The behaviour of the underlying malloc(0) differs depending on the
operating system.  Some return NULL (SysV behaviour); some still
allocate a small chunk of memory and return a valid pointer (e.g.
traditional BSD); some (e.g. FreeBSD 6.x) return a non-null pointer
that causes a memory fault if used, even just for reading.

Given the above variety, better never call malloc(0).


................
r48390 | mogorman | 2006-12-11 14:04:41 -0700 (Mon, 11 Dec 2006) | 3 lines

add support for dynamic channel creation and destruction, and
show transcoder to show number of channels in use.

................
r48392 | file | 2006-12-11 14:35:28 -0700 (Mon, 11 Dec 2006) | 10 lines

Merged revisions 48391 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r48391 | file | 2006-12-11 16:31:23 -0500 (Mon, 11 Dec 2006) | 2 lines

Return non-existant callerid handling to that which it was before. In 1.4 and trunk callerid can be allocated but not have any contents so we have to use ast_strlen_zero before passing it to the relevant functions. (issue #8567 reported by pabelanger)

........

................
r48397 | mogorman | 2006-12-11 15:31:20 -0700 (Mon, 11 Dec 2006) | 20 lines

Merged revisions 48396 via svnmerge from 
https://svn.digium.com/svn/asterisk/branches/1.4

................
r48396 | mogorman | 2006-12-11 16:11:35 -0600 (Mon, 11 Dec 2006) | 12 lines

Merged revisions 48394 via svnmerge from 
https://svn.digium.com/svn/asterisk/branches/1.2

........
r48394 | mogorman | 2006-12-11 15:55:43 -0600 (Mon, 11 Dec 2006) | 4 lines

app_externalivr needs a real silence file, and additional
changes to add silence files into core instead of extra
patch provided by bug 8177 with minor additions.

........

................

................
r48400 | mogorman | 2006-12-11 16:02:47 -0700 (Mon, 11 Dec 2006) | 10 lines

Merged revisions 48399 via svnmerge from 
https://svn.digium.com/svn/asterisk/branches/1.4

........
r48399 | mogorman | 2006-12-11 17:02:10 -0600 (Mon, 11 Dec 2006) | 2 lines

new sounds package with 100% more silence

........

................
r48402 | file | 2006-12-11 21:14:50 -0700 (Mon, 11 Dec 2006) | 10 lines

Merged revisions 48401 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r48401 | file | 2006-12-11 23:13:48 -0500 (Mon, 11 Dec 2006) | 2 lines

Use S_OR in my previous app_voicemail. This is the way it should have been done.

........

................
r48408 | rizzo | 2006-12-12 02:40:45 -0700 (Tue, 12 Dec 2006) | 10 lines

Make sure tab-completion works even when we have typed a fully
matching word (e.g. "sip<TAB>"); this is implemented by this one-line change

-               for (;; dst++, src += n) {
+               for (;src < argindex; dst++, src += n) {

However this code is not exactly trivial to understand, so
i am also adding some comments to help figuring out what it does.


................
r48409 | rizzo | 2006-12-12 03:35:10 -0700 (Tue, 12 Dec 2006) | 3 lines

normalize the scanning of "general" options in the config file.


................
r48410 | rizzo | 2006-12-12 03:36:15 -0700 (Tue, 12 Dec 2006) | 3 lines

properly initialize a malloc'ed buffer


................
r48415 | mogorman | 2006-12-12 12:55:39 -0700 (Tue, 12 Dec 2006) | 2 lines

fixed nubb error on my part, transcoder now unlocks and locks correctly, as well as counts in the correct direction.

................
r48416 | russell | 2006-12-12 15:27:22 -0700 (Tue, 12 Dec 2006) | 7 lines

Make chan_zap inform you that your version of zaptel is too old instead of
just failing to compile.

It seems like the proper way to do this would be in the configure script.
However, that wouldn't help existing checkouts unless we forced the configure
script to be executed after any code was changed.

................
r48417 | russell | 2006-12-12 15:32:20 -0700 (Tue, 12 Dec 2006) | 2 lines

Fix various spelling mistakes in comments.

................
r48432 | kpfleming | 2006-12-12 16:28:15 -0700 (Tue, 12 Dec 2006) | 10 lines

Merged revisions 48427 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r48427 | kpfleming | 2006-12-12 17:18:14 -0600 (Tue, 12 Dec 2006) | 2 lines

when making a release, we can always use wget and we can't run the configure script to find that out...

........

................
r48433 | russell | 2006-12-12 17:56:30 -0700 (Tue, 12 Dec 2006) | 3 lines

revert check for a zaptel transcoder related definition that was done in the
wrong module.

................

Modified:
    team/murf/bug7836/   (props changed)
    team/murf/bug7836/apps/app_externalivr.c
    team/murf/bug7836/apps/app_festival.c
    team/murf/bug7836/apps/app_ices.c
    team/murf/bug7836/apps/app_meetme.c
    team/murf/bug7836/apps/app_mp3.c
    team/murf/bug7836/apps/app_nbscat.c
    team/murf/bug7836/apps/app_voicemail.c
    team/murf/bug7836/apps/app_zapras.c
    team/murf/bug7836/build_tools/prep_tarball
    team/murf/bug7836/channels/chan_sip.c
    team/murf/bug7836/codecs/codec_zap.c
    team/murf/bug7836/funcs/func_strings.c
    team/murf/bug7836/include/asterisk/app.h
    team/murf/bug7836/include/asterisk/channel.h
    team/murf/bug7836/include/asterisk/pbx.h
    team/murf/bug7836/main/app.c
    team/murf/bug7836/main/cli.c
    team/murf/bug7836/main/manager.c
    team/murf/bug7836/main/rtp.c
    team/murf/bug7836/res/res_agi.c
    team/murf/bug7836/res/res_musiconhold.c
    team/murf/bug7836/sounds/Makefile

Propchange: team/murf/bug7836/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/murf/bug7836/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Dec 13 01:43:58 2006
@@ -1,1 +1,1 @@
-/trunk:1-48366
+/trunk:1-48440

Modified: team/murf/bug7836/apps/app_externalivr.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug7836/apps/app_externalivr.c?view=diff&rev=48441&r1=48440&r2=48441
==============================================================================
--- team/murf/bug7836/apps/app_externalivr.c (original)
+++ team/murf/bug7836/apps/app_externalivr.c Wed Dec 13 01:43:58 2006
@@ -40,6 +40,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <errno.h>
+#include <signal.h>
 
 #include "asterisk/lock.h"
 #include "asterisk/file.h"
@@ -153,7 +154,7 @@
 		if (state->current) {
 			file_to_stream = state->current->filename;
 		} else {
-			file_to_stream = "silence-10";
+			file_to_stream = "silence/10";
 			u->playing_silence = 1;
 		}
 
@@ -262,9 +263,13 @@
 		.finishlist = AST_LIST_HEAD_INIT_VALUE,
 	};
 	struct ivr_localuser *u = &foo;
+	sigset_t fullset, oldset;
 
 	lu = ast_module_user_add(chan);
-	
+
+	sigfillset(&fullset);
+	pthread_sigmask(SIG_BLOCK, &fullset, &oldset);
+
 	u->abort_current_sound = 0;
 	u->chan = chan;
 	
@@ -312,6 +317,9 @@
 	if (!pid) {
 		/* child process */
 		int i;
+
+		signal(SIGPIPE, SIG_DFL);
+		pthread_sigmask(SIG_UNBLOCK, &fullset, NULL);
 
 		if (ast_opt_high_priority)
 			ast_set_priority(0);
@@ -335,6 +343,8 @@
 		int ready_fd;
 		int waitfds[2] = { child_errors_fd, child_commands_fd };
 		struct ast_channel *rchan;
+
+		pthread_sigmask(SIG_SETMASK, &oldset, NULL);
 
 		close(child_stdin[0]);
 		child_stdin[0] = 0;

Modified: team/murf/bug7836/apps/app_festival.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug7836/apps/app_festival.c?view=diff&rev=48441&r1=48440&r2=48441
==============================================================================
--- team/murf/bug7836/apps/app_festival.c (original)
+++ team/murf/bug7836/apps/app_festival.c Wed Dec 13 01:43:58 2006
@@ -130,19 +130,26 @@
 #ifdef __PPC__ 
 	char c;
 #endif
+	sigset_t fullset, oldset;
+
+	sigfillset(&fullset);
+	pthread_sigmask(SIG_BLOCK, &fullset, &oldset);
 
         res = fork();
         if (res < 0)
                 ast_log(LOG_WARNING, "Fork failed\n");
-        if (res)
+        if (res) {
+		pthread_sigmask(SIG_SETMASK, &oldset, NULL);
                 return res;
+	}
         for (x=0;x<256;x++) {
                 if (x != fd)
                         close(x);
         }
 	if (ast_opt_high_priority)
 		ast_set_priority(0);
-
+	signal(SIGPIPE, SIG_DFL);
+	pthread_sigmask(SIG_UNBLOCK, &fullset, NULL);
 /*IAS */
 #ifdef __PPC__  
 	for( x=0; x<length; x+=2)

Modified: team/murf/bug7836/apps/app_ices.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug7836/apps/app_ices.c?view=diff&rev=48441&r1=48440&r2=48441
==============================================================================
--- team/murf/bug7836/apps/app_ices.c (original)
+++ team/murf/bug7836/apps/app_ices.c Wed Dec 13 01:43:58 2006
@@ -65,15 +65,27 @@
 {
 	int res;
 	int x;
+	sigset_t fullset, oldset;
+
+	sigfillset(&fullset);
+	pthread_sigmask(SIG_BLOCK, &fullset, &oldset);
+
 	res = fork();
 	if (res < 0) 
 		ast_log(LOG_WARNING, "Fork failed\n");
-	if (res)
+	if (res) {
+		pthread_sigmask(SIG_SETMASK, &oldset, NULL);
 		return res;
+	}
+
+	/* Stop ignoring PIPE */
+	signal(SIGPIPE, SIG_DFL);
+	pthread_sigmask(SIG_UNBLOCK, &fullset, NULL);
+
 	if (ast_opt_high_priority)
 		ast_set_priority(0);
 	dup2(fd, STDIN_FILENO);
-	for (x=STDERR_FILENO + 1;x<256;x++) {
+	for (x=STDERR_FILENO + 1;x<1024;x++) {
 		if ((x != STDIN_FILENO) && (x != STDOUT_FILENO))
 			close(x);
 	}
@@ -84,7 +96,7 @@
 	/* As a last-ditch effort, try to use PATH */
 	execlp("ices", "ices", filename, (char *)NULL);
 	ast_log(LOG_WARNING, "Execute of ices failed\n");
-	return -1;
+	_exit(0);
 }
 
 static int ices_exec(struct ast_channel *chan, void *data)

Modified: team/murf/bug7836/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug7836/apps/app_meetme.c?view=diff&rev=48441&r1=48440&r2=48441
==============================================================================
--- team/murf/bug7836/apps/app_meetme.c (original)
+++ team/murf/bug7836/apps/app_meetme.c Wed Dec 13 01:43:58 2006
@@ -1945,6 +1945,13 @@
 			conf->markedusers--;
 		/* Remove ourselves from the list */
 		AST_LIST_REMOVE(&conf->userlist, user, list);
+
+		/* Change any states */
+		if (!conf->users)
+			ast_device_state_changed("meetme:%s", conf->confno);
+		if (confflags & (CONFFLAG_SLA_STATION|CONFFLAG_SLA_TRUNK))
+			ast_device_state_changed("SLA:%s", conf->confno + 4);
+
 		if (AST_LIST_EMPTY(&conf->userlist)) {
 			/* close this one when no more users and no references*/
 			if (!conf->refcount)
@@ -1953,12 +1960,6 @@
 		/* Return the number of seconds the user was in the conf */
 		snprintf(meetmesecs, sizeof(meetmesecs), "%d", (int) (time(NULL) - user->jointime));
 		pbx_builtin_setvar_helper(chan, "MEETMESECS", meetmesecs);
-
-		/* This device changed state now */
-		if (!conf->users)	/* If there are no more members */
-			ast_device_state_changed("meetme:%s", conf->confno);
-		if (confflags & (CONFFLAG_SLA_STATION|CONFFLAG_SLA_TRUNK))
-			ast_device_state_changed("SLA:%s", conf->confno + 4);
 	}
 	free(user);
 	AST_LIST_UNLOCK(&confs);

Modified: team/murf/bug7836/apps/app_mp3.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug7836/apps/app_mp3.c?view=diff&rev=48441&r1=48440&r2=48441
==============================================================================
--- team/murf/bug7836/apps/app_mp3.c (original)
+++ team/murf/bug7836/apps/app_mp3.c Wed Dec 13 01:43:58 2006
@@ -64,15 +64,25 @@
 {
 	int res;
 	int x;
+	sigset_t fullset, oldset;
+
+	sigfillset(&fullset);
+	pthread_sigmask(SIG_BLOCK, &fullset, &oldset);
+
 	res = fork();
 	if (res < 0) 
 		ast_log(LOG_WARNING, "Fork failed\n");
-	if (res)
+	if (res) {
+		pthread_sigmask(SIG_SETMASK, &oldset, NULL);
 		return res;
+	}
 	if (ast_opt_high_priority)
 		ast_set_priority(0);
+	signal(SIGPIPE, SIG_DFL);
+	pthread_sigmask(SIG_UNBLOCK, &fullset, NULL);
+
 	dup2(fd, STDOUT_FILENO);
-	for (x=0;x<256;x++) {
+	for (x=STDERR_FILENO + 1;x<256;x++) {
 		if (x != STDOUT_FILENO)
 			close(x);
 	}
@@ -94,7 +104,7 @@
 	    execlp("mpg123", "mpg123", "-q", "-s", "-f", "8192", "--mono", "-r", "8000", filename, (char *)NULL);
 	}
 	ast_log(LOG_WARNING, "Execute of mpg123 failed\n");
-	return -1;
+	_exit(0);
 }
 
 static int timed_read(int fd, void *data, int datalen, int timeout)

Modified: team/murf/bug7836/apps/app_nbscat.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug7836/apps/app_nbscat.c?view=diff&rev=48441&r1=48440&r2=48441
==============================================================================
--- team/murf/bug7836/apps/app_nbscat.c (original)
+++ team/murf/bug7836/apps/app_nbscat.c Wed Dec 13 01:43:58 2006
@@ -68,16 +68,26 @@
 {
 	int res;
 	int x;
+	sigset_t fullset, oldset;
+
+	sigfillset(&fullset);
+	pthread_sigmask(SIG_BLOCK, &fullset, &oldset);
+
 	res = fork();
 	if (res < 0) 
 		ast_log(LOG_WARNING, "Fork failed\n");
-	if (res)
+	if (res) {
+		pthread_sigmask(SIG_SETMASK, &oldset, NULL);
 		return res;
+	}
+	signal(SIGPIPE, SIG_DFL);
+	pthread_sigmask(SIG_UNBLOCK, &fullset, NULL);
+
 	if (ast_opt_high_priority)
 		ast_set_priority(0);
 
 	dup2(fd, STDOUT_FILENO);
-	for (x=0;x<256;x++) {
+	for (x = STDERR_FILENO + 1; x < 1024; x++) {
 		if (x != STDOUT_FILENO)
 			close(x);
 	}
@@ -85,7 +95,7 @@
 	execl(NBSCAT, "nbscat8k", "-d", (char *)NULL);
 	execl(LOCAL_NBSCAT, "nbscat8k", "-d", (char *)NULL);
 	ast_log(LOG_WARNING, "Execute of nbscat8k failed\n");
-	return -1;
+	_exit(0);
 }
 
 static int timed_read(int fd, void *data, int datalen)

Modified: team/murf/bug7836/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug7836/apps/app_voicemail.c?view=diff&rev=48441&r1=48440&r2=48441
==============================================================================
--- team/murf/bug7836/apps/app_voicemail.c (original)
+++ team/murf/bug7836/apps/app_voicemail.c Wed Dec 13 01:43:58 2006
@@ -2428,7 +2428,7 @@
 		ast_log(LOG_WARNING, "Unable to store '%s' (can't create temporary file)\n", fn);
 		return -1;
 	} else {
-		make_email_file(p, myserveremail, vmu, msgnum, vmu->context, vmu->mailbox, chan->cid.cid_num, chan->cid.cid_name, fn, fmt, duration, 1, chan, NULL, 1);
+		make_email_file(p, myserveremail, vmu, msgnum, vmu->context, vmu->mailbox, S_OR(chan->cid.cid_num, NULL), S_OR(chan->cid.cid_name, NULL), fn, fmt, duration, 1, chan, NULL, 1);
 		/* read mail file to memory */		
 		len = ftell(p);
 		rewind(p);
@@ -2658,7 +2658,7 @@
 		ast_log(LOG_ERROR, "Recipient mailbox %s@%s is full\n", recip->mailbox, recip->context);
 	}
 	ast_unlock_path(todir);
-	notify_new_message(chan, recip, recipmsgnum, duration, fmt, chan->cid.cid_num, chan->cid.cid_name);
+	notify_new_message(chan, recip, recipmsgnum, duration, fmt, S_OR(chan->cid.cid_num, NULL), S_OR(chan->cid.cid_name, NULL));
 	
 	return 0;
 }
@@ -3080,7 +3080,7 @@
 				chan->exten,
 				chan->priority,
 				chan->name,
-				ast_callerid_merge(callerid, sizeof(callerid), chan->cid.cid_name, chan->cid.cid_num, "Unknown"),
+				ast_callerid_merge(callerid, sizeof(callerid), S_OR(chan->cid.cid_name, NULL), S_OR(chan->cid.cid_num, NULL), "Unknown"),
 				date, (long)time(NULL),
 				category ? category : ""); 
 		} else
@@ -3142,7 +3142,7 @@
 #endif
 					if (ast_fileexists(fn, NULL, NULL)) {
 						STORE(dir, vmu->mailbox, vmu->context, msgnum, chan, vmu, fmt, duration, vms);
-						notify_new_message(chan, vmu, msgnum, duration, fmt, chan->cid.cid_num, chan->cid.cid_name);
+						notify_new_message(chan, vmu, msgnum, duration, fmt, S_OR(chan->cid.cid_num, NULL), S_OR(chan->cid.cid_name, NULL));
 						DISPOSE(dir, msgnum);
 					}
 				}
@@ -4129,13 +4129,14 @@
  
 				STORE(todir, vmtmp->mailbox, vmtmp->context, vms->curmsg, chan, vmtmp, fmt, duration, vms);
 
- 				char *myserveremail = serveremail;
- 				if (!ast_strlen_zero(vmtmp->serveremail))
- 					myserveremail = vmtmp->serveremail;
- 				int attach_user_voicemail = ast_test_flag((&globalflags), VM_ATTACH);
- 				attach_user_voicemail = ast_test_flag(vmtmp, VM_ATTACH);
- 				/* NULL category for IMAP storage */
- 				sendmail(myserveremail, vmtmp, todircount, vmtmp->context, vmtmp->mailbox, chan->cid.cid_num, chan->cid.cid_name, vms->fn, fmt, duration, attach_user_voicemail, chan, NULL);
+				char *myserveremail = serveremail;
+				if (!ast_strlen_zero(vmtmp->serveremail))
+					myserveremail = vmtmp->serveremail;
+				int attach_user_voicemail = ast_test_flag((&globalflags), VM_ATTACH);
+				attach_user_voicemail = ast_test_flag(vmtmp, VM_ATTACH);
+				/* NULL category for IMAP storage */
+				sendmail(myserveremail, vmtmp, todircount, vmtmp->context, vmtmp->mailbox, S_OR(chan->cid.cid_num, NULL), S_OR(chan->cid.cid_name, NULL), vms->fn, fmt, duration, attach_user_voicemail, chan, NULL);
+
 #else
 				copy_message(chan, sender, 0, curmsg, duration, vmtmp, fmt);
 #endif

Modified: team/murf/bug7836/apps/app_zapras.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug7836/apps/app_zapras.c?view=diff&rev=48441&r1=48440&r2=48441
==============================================================================
--- team/murf/bug7836/apps/app_zapras.c (original)
+++ team/murf/bug7836/apps/app_zapras.c Wed Dec 13 01:43:58 2006
@@ -82,11 +82,23 @@
 	char *argv[PPP_MAX_ARGS];
 	int argc = 0;
 	char *stringp=NULL;
+	sigset_t fullset, oldset;
+
+	sigfillset(&fullset);
+	pthread_sigmask(SIG_BLOCK, &fullset, &oldset);
 
 	/* Start by forking */
 	pid = fork();
-	if (pid)
+	if (pid) {
+		pthread_sigmask(SIG_SETMASK, &oldset, NULL);
 		return pid;
+	}
+
+	/* Restore original signal handlers */
+	for (x=0;x<NSIG;x++)
+		signal(x, SIG_DFL);
+
+	pthread_sigmask(SIG_UNBLOCK, &fullset, NULL);
 
 	/* Execute RAS on File handles */
 	dup2(chan->fds[0], STDIN_FILENO);
@@ -98,10 +110,6 @@
 	/* Close other file descriptors */
 	for (x=STDERR_FILENO + 1;x<1024;x++) 
 		close(x);
-
-	/* Restore original signal handlers */
-	for (x=0;x<NSIG;x++)
-		signal(x, SIG_DFL);
 
 	/* Reset all arguments */
 	memset(argv, 0, sizeof(argv));

Modified: team/murf/bug7836/build_tools/prep_tarball
URL: http://svn.digium.com/view/asterisk/team/murf/bug7836/build_tools/prep_tarball?view=diff&rev=48441&r1=48440&r2=48441
==============================================================================
--- team/murf/bug7836/build_tools/prep_tarball (original)
+++ team/murf/bug7836/build_tools/prep_tarball Wed Dec 13 01:43:58 2006
@@ -5,4 +5,4 @@
 #
 # It will be executed from the top-level directory of the project.
 
-make -C sounds all MENUSELECT_CORE_SOUNDS=CORE-SOUNDS-EN-GSM MENUSELECT_MOH=MOH-FREEPLAY-WAV
+make -C sounds all MENUSELECT_CORE_SOUNDS=CORE-SOUNDS-EN-GSM MENUSELECT_MOH=MOH-FREEPLAY-WAV WGET=wget

Modified: team/murf/bug7836/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug7836/channels/chan_sip.c?view=diff&rev=48441&r1=48440&r2=48441
==============================================================================
--- team/murf/bug7836/channels/chan_sip.c (original)
+++ team/murf/bug7836/channels/chan_sip.c Wed Dec 13 01:43:58 2006
@@ -811,7 +811,7 @@
 #define T38FAX_RATE_12000			(1 << 12)	/*!< 12000 bps t38FaxRate */
 #define T38FAX_RATE_14400			(1 << 13)	/*!< 14400 bps t38FaxRate */
 
-/*!< This is default: NO MMR and JBIG trancoding, NO fill bit removal, transferredTCF TCF, UDP FEC, Version 0 and 9600 max fax rate */
+/*!< This is default: NO MMR and JBIG transcoding, NO fill bit removal, transferredTCF TCF, UDP FEC, Version 0 and 9600 max fax rate */
 static int global_t38_capability = T38FAX_VERSION_0 | T38FAX_RATE_2400 | T38FAX_RATE_4800 | T38FAX_RATE_7200 | T38FAX_RATE_9600;
 
 #define sipdebug		ast_test_flag(&global_flags[1], SIP_PAGE2_DEBUG)
@@ -841,7 +841,7 @@
 enum referstatus {
         REFER_IDLE,                    /*!< No REFER is in progress */
         REFER_SENT,                    /*!< Sent REFER to transferee */
-        REFER_RECEIVED,                /*!< Received REFER from transferer */
+        REFER_RECEIVED,                /*!< Received REFER from transferrer */
         REFER_CONFIRMED,               /*!< Refer confirmed with a 100 TRYING */
         REFER_ACCEPTED,                /*!< Accepted by transferee */
         REFER_RINGING,                 /*!< Target Ringing */
@@ -1159,7 +1159,7 @@
 	int refresh;			/*!< How often to refresh */
 	struct sip_pvt *call;		/*!< create a sip_pvt structure for each outbound "registration dialog" in progress */
 	enum sipregistrystate regstate;	/*!< Registration state (see above) */
-	time_t regtime;		/*!< Last succesful registration time */
+	time_t regtime;		/*!< Last successful registration time */
 	int callid_valid;		/*!< 0 means we haven't chosen callid for this registry yet. */
 	unsigned int ocseq;		/*!< Sequence number we got to for REGISTERs for this registry */
 	struct sockaddr_in us;		/*!< Who the server thinks we are */
@@ -1179,7 +1179,7 @@
 	ASTOBJ_CONTAINER_COMPONENTS(struct sip_peer);
 } peerl;
 
-/*! \brief  The register list: Other SIP proxys we register with and place calls to */
+/*! \brief  The register list: Other SIP proxies we register with and place calls to */
 static struct ast_register_list {
 	ASTOBJ_CONTAINER_COMPONENTS(struct sip_registry);
 	int recheck;
@@ -2872,7 +2872,7 @@
 	struct sip_pvt *p;
 	struct varshead *headp;
 	struct ast_var_t *current;
-	const char *referer = NULL;   /* SIP refererer */	
+	const char *referer = NULL;   /* SIP referrer */	
 
 	p = ast->tech_pvt;
 	if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) {
@@ -2895,7 +2895,7 @@
 			/* This is a transfered call */
 			p->options->transfer = 1;
 		} else if (!strcasecmp(ast_var_name(current), "SIPTRANSFER_REFERER")) {
-			/* This is the referer */
+			/* This is the referrer */
 			referer = ast_var_value(current);
 		} else if (!strcasecmp(ast_var_name(current), "SIPTRANSFER_REPLACES")) {
 			/* We're replacing a call. */
@@ -3082,9 +3082,9 @@
  * This will cause unexpected behaviour in subscriptions, since a "friend"
  * is *two* devices in Asterisk, not one.
  *
- * Thought: For realtime, we should propably update storage with inuse counter... 
+ * Thought: For realtime, we should probably update storage with inuse counter... 
  *
- * \return 0 if call is ok (no call limit, below treshold)
+ * \return 0 if call is ok (no call limit, below threshold)
  *	-1 on rejection of call
  *		
  */
@@ -3244,7 +3244,7 @@
 			return AST_CAUSE_NO_ANSWER;
 		case 484:	/* Address incomplete */
 			return AST_CAUSE_INVALID_NUMBER_FORMAT;
-		case 485:	/* Ambigous */
+		case 485:	/* Ambiguous */
 			return AST_CAUSE_UNALLOCATED;
 		case 486:	/* Busy everywhere */
 			return AST_CAUSE_BUSY;

Modified: team/murf/bug7836/codecs/codec_zap.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug7836/codecs/codec_zap.c?view=diff&rev=48441&r1=48440&r2=48441
==============================================================================
--- team/murf/bug7836/codecs/codec_zap.c (original)
+++ team/murf/bug7836/codecs/codec_zap.c Wed Dec 13 01:43:58 2006
@@ -50,6 +50,7 @@
 #include "asterisk/config.h"
 #include "asterisk/options.h"
 #include "asterisk/module.h"
+#include "asterisk/cli.h"
 #include "asterisk/logger.h"
 #include "asterisk/channel.h"
 #include "asterisk/utils.h"
@@ -59,6 +60,23 @@
 
 static unsigned int global_useplc = 0;
 static int cardsmode = 0;
+
+static int totalchannels = 0;
+static int channelsinuse = 0;
+AST_MUTEX_DEFINE_STATIC(channelcount);
+
+
+static const char show_transcoder_usage[] =
+"Usage: show transcoder\n"
+"       Displays transcoder utilization.\n";
+
+static int show_transcoder(int fd, int argc, char *argv[]);
+
+static struct ast_cli_entry transcoder_cli[] = {
+	{ { "show", "transcoder", NULL},
+	show_transcoder, "Displays transcoder utilization.",
+	show_transcoder_usage }
+};
 
 struct format_map {
 	unsigned int map[32][32];
@@ -84,6 +102,14 @@
 	struct ast_frame f;
 };
 
+static int show_transcoder(int fd, int argc, char *argv[])
+{
+	ast_mutex_lock(&channelcount);
+	ast_verbose("%d of %d channels are currently in use.\n",channelsinuse, totalchannels);
+	ast_mutex_unlock(&channelcount);
+	return RESULT_SUCCESS;
+}
+
 static int zap_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
 {
 	struct pvt *ztp = pvt->pvt;
@@ -128,7 +154,7 @@
 		ztp->fake = 1;
 		ztp->f.frametype = AST_FRAME_VOICE;
 		ztp->f.subclass = 0;
-		ztp->f.samples = (hdr->srcfmt == ZT_FORMAT_G729A || hdr->dstfmt == ZT_FORMAT_G729A) ? 160: 240;
+		ztp->f.samples = 240;
 		ztp->f.data = NULL;
 		ztp->f.offset = 0;
 		ztp->f.datalen = 0;
@@ -141,7 +167,7 @@
 #ifdef DEBUG_TRANSCODE
 			ztp->totalms += hdr->dstsamples;
 			if ((ztp->totalms - ztp->lasttotalms) > 8000) {
-				printf("Whee %p, %d (%d to %d)\n", ztp, hdr->dstlen, ztp->lasttotalms, ztp->totalms);
+				ast_verbose("Whee %p, %d (%d to %d)\n", ztp, hdr->dstlen, ztp->lasttotalms, ztp->totalms);
 				ztp->lasttotalms = ztp->totalms;
 			}
 #endif
@@ -172,8 +198,16 @@
 static void zap_destroy(struct ast_trans_pvt *pvt)
 {
 	struct pvt *ztp = pvt->pvt;
-
+	unsigned int x;
+
+	x = ZT_TCOP_RELEASE;
+	if (ioctl(ztp->fd, ZT_TRANSCODE_OP, &x))
+		ast_log(LOG_WARNING, "Failed to release transcoder channel: %s\n", strerror(errno));
+				
 	munmap(ztp->hdr, sizeof(*ztp->hdr));
+	ast_mutex_lock(&channelcount);
+	channelsinuse--; 
+	ast_mutex_unlock(&channelcount);
 	close(ztp->fd);
 }
 
@@ -229,22 +263,13 @@
 
 static int zap_new(struct ast_trans_pvt *pvt)
 {
+	ast_mutex_lock(&channelcount);
+	channelsinuse++; 
+	ast_mutex_unlock(&channelcount);
 	return zap_translate(pvt, pvt->t->dstfmt, pvt->t->srcfmt);
 }
 
-static struct ast_frame *g729_fakesrc_sample(void)
-{
-	/* Don't bother really trying to test hardware ones. */
-	static struct ast_frame f = {
-		.frametype = AST_FRAME_VOICE,
-		.samples = 160,
-		.src = __PRETTY_FUNCTION__
-	};
-
-	return &f;
-}
-
-static struct ast_frame *g723_fakesrc_sample(void)
+static struct ast_frame *fakesrc_sample(void)
 {
 	/* Don't bother really trying to test hardware ones. */
 	static struct ast_frame f = {
@@ -260,37 +285,34 @@
 {
 	struct translator *zt;
 	int res;
-	
-	if (!((cardsmode  == 1 && (dst == 8 || src == 8)) || (cardsmode == 2 && (dst == 0 || src == 0)) || (cardsmode == 0))) {
-		return -1;
-	}
-		if (!(zt = ast_calloc(1, sizeof(*zt))))
-			return -1;
-	
-		snprintf((char *) (zt->t.name), sizeof(zt->t.name), "zap%sto%s", 
-			 ast_getformatname((1 << src)), ast_getformatname((1 << dst)));
-		zt->t.srcfmt = (1 << src);
-		zt->t.dstfmt = (1 << dst);
-		zt->t.newpvt = zap_new;
-		zt->t.framein = zap_framein;
-		zt->t.frameout = zap_frameout;
-		zt->t.destroy = zap_destroy;
-		zt->t.sample = (dst == 8 || src == 8) ? g729_fakesrc_sample : g723_fakesrc_sample;
-		zt->t.useplc = global_useplc;
-		zt->t.buf_size = BUFFER_SAMPLES * 2;
-		zt->t.desc_size = sizeof(struct pvt);
-		if ((res = ast_register_translator(&zt->t))) {
-			free(zt);
-			return -1;
-		}
-	
-		AST_LIST_LOCK(&translators);
-		AST_LIST_INSERT_HEAD(&translators, zt, entry);
-		AST_LIST_UNLOCK(&translators);
-	
-		global_format_map.map[dst][src] = 1;
-	
-		return res;
+
+	if (!(zt = ast_calloc(1, sizeof(*zt))))
+		return -1;
+
+	snprintf((char *) (zt->t.name), sizeof(zt->t.name), "zap%sto%s", 
+		 ast_getformatname((1 << src)), ast_getformatname((1 << dst)));
+	zt->t.srcfmt = (1 << src);
+	zt->t.dstfmt = (1 << dst);
+	zt->t.newpvt = zap_new;
+	zt->t.framein = zap_framein;
+	zt->t.frameout = zap_frameout;
+	zt->t.destroy = zap_destroy;
+	zt->t.sample = fakesrc_sample;
+	zt->t.useplc = global_useplc;
+	zt->t.buf_size = BUFFER_SAMPLES * 2;
+	zt->t.desc_size = sizeof(struct pvt);
+	if ((res = ast_register_translator(&zt->t))) {
+		free(zt);
+		return -1;
+	}
+
+	AST_LIST_LOCK(&translators);
+	AST_LIST_INSERT_HEAD(&translators, zt, entry);
+	AST_LIST_UNLOCK(&translators);
+
+	global_format_map.map[dst][src] = 1;
+
+	return res;
 }
 
 static void drop_translator(int dst, int src)
@@ -394,6 +416,9 @@
 	for (info.tcnum = 0; !(res = ioctl(fd, ZT_TRANSCODE_OP, &info)); info.tcnum++) {
 		if (option_verbose > 1)
 			ast_verbose(VERBOSE_PREFIX_2 "Found transcoder '%s'.\n", info.name);
+		ast_mutex_lock(&channelcount);
+		totalchannels += info.numchannels;
+		ast_mutex_unlock(&channelcount);
 		build_translators(&map, info.dstfmts, info.srcfmts);
 	}
 	close(fd);
@@ -429,15 +454,17 @@
 static int unload_module(void)
 {
 	unregister_translators();
-
+	ast_cli_unregister_multiple(transcoder_cli, sizeof(transcoder_cli) / sizeof(struct ast_cli_entry));
 	return 0;
 }
 
 static int load_module(void)
 {
+	ast_mutex_init(&channelcount);
 	parse_config();
+
 	find_transcoders();
-
+	ast_cli_register_multiple(transcoder_cli, sizeof(transcoder_cli) / sizeof(struct ast_cli_entry));
 	return 0;
 }
 

Modified: team/murf/bug7836/funcs/func_strings.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug7836/funcs/func_strings.c?view=diff&rev=48441&r1=48440&r2=48441
==============================================================================
--- team/murf/bug7836/funcs/func_strings.c (original)
+++ team/murf/bug7836/funcs/func_strings.c Wed Dec 13 01:43:58 2006
@@ -425,12 +425,6 @@
 
 	buf[0] = '\0';
 
-	if (ast_strlen_zero(parse)) {
-		ast_log(LOG_ERROR,
-				"Asterisk function STRFTIME() requires an argument.\n");
-		return -1;
-	}
-
 	AST_STANDARD_APP_ARGS(args, parse);
 
 	ast_get_time_t(args.epoch, &epochi, time(NULL), NULL);

Modified: team/murf/bug7836/include/asterisk/app.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug7836/include/asterisk/app.h?view=diff&rev=48441&r1=48440&r2=48441
==============================================================================
--- team/murf/bug7836/include/asterisk/app.h (original)
+++ team/murf/bug7836/include/asterisk/app.h Wed Dec 13 01:43:58 2006
@@ -127,7 +127,7 @@
  * Normally, Asterisk has a SIGCHLD handler that is cleaning up all zombie
  * processes from forking elsewhere in Asterisk.  However, if you want to
  * wait*() on the process to retrieve information about it's exit status,
- * then this signal handler needs to be temporaraly replaced.
+ * then this signal handler needs to be temporarily replaced.
  *
  * Code that executes this function *must* call ast_unreplace_sigchld()
  * after it is finished doing the wait*().

Modified: team/murf/bug7836/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug7836/include/asterisk/channel.h?view=diff&rev=48441&r1=48440&r2=48441
==============================================================================
--- team/murf/bug7836/include/asterisk/channel.h (original)
+++ team/murf/bug7836/include/asterisk/channel.h Wed Dec 13 01:43:58 2006
@@ -91,7 +91,7 @@
 	The Core bridge handles two channels (a "phone call") and bridge
 	them together.
 	
-	The conference bridge (meetme) handles several channels simultaneosly
+	The conference bridge (meetme) handles several channels simultaneously
 	with the support of an external timer (zaptel timer). This is used
 	not only by the Conference application (meetme) but also by the
 	page application and the SLA system introduced in 1.4.
@@ -679,7 +679,7 @@
  * \param format requested channel format
  * \param data data to pass to the channel requester
  * \param timeout maximum amount of time to wait for an answer
- * \param reason why unsuccessful (if unsuceessful)
+ * \param reason why unsuccessful (if unsuccessful)
  * \param cidnum Caller-ID Number
  * \param cidname Caller-ID Name
  * \return Returns an ast_channel on success or no answer, NULL on failure.  Check the value of chan->_state
@@ -745,7 +745,7 @@
  * This function compares a offset from current time with the absolute time 
  * out on a channel (when to hang up). If the absolute time out on a channel
  * is earlier than current time plus the offset, it returns 1, if the two
- * time values are equal, it return 0, otherwise, it retturn -1.
+ * time values are equal, it return 0, otherwise, it return -1.
  */
 int ast_channel_cmpwhentohangup(struct ast_channel *chan, time_t offset);
 
@@ -802,7 +802,7 @@
   \return Returns < 0 on  failure, 0 if nothing ever arrived, and the # of ms remaining otherwise */
 int ast_waitfor(struct ast_channel *chan, int ms);
 
-/*! \brief Wait for a specied amount of time, looking for hangups 
+/*! \brief Wait for a specified amount of time, looking for hangups 
  * \param chan channel to wait for
  * \param ms length of time in milliseconds to sleep
  * Waits for a specified amount of time, servicing the channel as required.
@@ -810,7 +810,7 @@
  */
 int ast_safe_sleep(struct ast_channel *chan, int ms);
 
-/*! \brief Wait for a specied amount of time, looking for hangups and a condition argument 
+/*! \brief Wait for a specified amount of time, looking for hangups and a condition argument 
  * \param chan channel to wait for
  * \param ms length of time in milliseconds to sleep
  * \param cond a function pointer for testing continue condition
@@ -893,7 +893,7 @@
 int ast_set_read_format(struct ast_channel *chan, int format);
 
 /*! \brief Sets write format on channel chan
- * Set write format for channel to whichever compoent of "format" is best. 
+ * Set write format for channel to whichever component of "format" is best. 
  * \param chan channel to change
  * \param format new format for writing
  * \return Returns 0 on success, -1 on failure
@@ -1078,7 +1078,7 @@
  * \param transfercapability transfercapabilty to get the name of
  * Give a name to a transfercapbility
  * See above
- * Returns the text form of the binary transfer capbility
+ * Returns the text form of the binary transfer capbaility
  */
 char *ast_transfercapability2str(int transfercapability) attribute_const;
 
@@ -1129,7 +1129,6 @@
    being DTMF-deferred */
 int ast_channel_defer_dtmf(struct ast_channel *chan);
 
-/*! Undeos a defer */
 /*! Undo defer.  ast_read will return any dtmf characters that were queued */
 void ast_channel_undefer_dtmf(struct ast_channel *chan);
 
@@ -1150,7 +1149,7 @@
 /*! Activate a given generator */
 int ast_activate_generator(struct ast_channel *chan, struct ast_generator *gen, void *params);
 
-/*! Deactive an active generator */
+/*! Deactivate an active generator */
 void ast_deactivate_generator(struct ast_channel *chan);
 
 void ast_set_callerid(struct ast_channel *chan, const char *cidnum, const char *cidname, const char *ani);
@@ -1196,7 +1195,7 @@
 int ast_transfer(struct ast_channel *chan, char *dest);
 
 /*!	\brief  Start masquerading a channel
-	XXX This is a seriously wacked out operation.  We're essentially putting the guts of
+	XXX This is a seriously whacked out operation.  We're essentially putting the guts of
            the clone channel into the original channel.  Start by killing off the original
            channel's backend.   I'm not sure we're going to keep this function, because
            while the features are nice, the cost is very high in terms of pure nastiness. XXX

Modified: team/murf/bug7836/include/asterisk/pbx.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug7836/include/asterisk/pbx.h?view=diff&rev=48441&r1=48440&r2=48441
==============================================================================
--- team/murf/bug7836/include/asterisk/pbx.h (original)
+++ team/murf/bug7836/include/asterisk/pbx.h Wed Dec 13 01:43:58 2006
@@ -156,7 +156,7 @@
  * \param data the data passed into the app
  *
  * This application executes an application on a given channel.  It
- * saves the stack and executes the given appliation passing in
+ * saves the stack and executes the given application passing in
  * the given data.
  *
  * \return 0 on success, and -1 on failure

Modified: team/murf/bug7836/main/app.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug7836/main/app.c?view=diff&rev=48441&r1=48440&r2=48441
==============================================================================
--- team/murf/bug7836/main/app.c (original)
+++ team/murf/bug7836/main/app.c Wed Dec 13 01:43:58 2006
@@ -115,14 +115,16 @@
 	if (maxlen)
 		s[0] = '\0';
 
-	if (ast_strlen_zero(prompt))
-		return -1;
+	if (!prompt)
+		prompt="";
 
 	filename = ast_strdupa(prompt);
 	while ((front = strsep(&filename, "&"))) {
-		res = ast_streamfile(c, front, c->language);
-		if (res)
-			continue;
+		if (!ast_strlen_zero(front)) {
+			res = ast_streamfile(c, front, c->language);
+			if (res)
+				continue;
+		}
 		if (ast_strlen_zero(filename)) {
 			/* set timeouts for the last prompt */
 			fto = c->pbx ? c->pbx->rtimeout * 1000 : 6000;

Modified: team/murf/bug7836/main/cli.c

[... 511 lines stripped ...]


More information about the asterisk-commits mailing list