[asterisk-commits] murf: branch murf/bug8386-1.2 r48414 - in /team/murf/bug8386-1.2: ./ apps/ ch...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Dec 12 11:00:09 MST 2006


Author: murf
Date: Tue Dec 12 12:00:08 2006
New Revision: 48414

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48414
Log:
Merged revisions 48315,48319-48322,48356,48361,48371,48374,48394,48398,48403 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r48315 | oej | 2006-12-06 05:14:40 -0700 (Wed, 06 Dec 2006) | 3 lines

Don't add Contact header on BYE, CANCEL, MESSAGE requests
(Bye, Cancel backported from 1.4, MESSAGE bug reported to me by Gunnar at Omnitor)

........
r48319 | crichter | 2006-12-06 07:35:25 -0700 (Wed, 06 Dec 2006) | 1 line

changed a few debugs to higher debug levels
........
r48320 | oej | 2006-12-06 08:42:41 -0700 (Wed, 06 Dec 2006) | 4 lines

Issue #8528 - make sure we don't delete the dialog too quickly after receiving
a 487. Move 487 handling into handle_response_invite where it really
belongs and don't add an ALREADYGONE flag to the dialog.

........
r48321 | crichter | 2006-12-06 08:48:45 -0700 (Wed, 06 Dec 2006) | 1 line

added the export and import of the MISDN_ADDRESS_COMPLETE Variable to inidcate wether the extension is already completely dialed or if there might come additional digits by information elements. also added some docs for that.
........
r48322 | russell | 2006-12-06 09:05:54 -0700 (Wed, 06 Dec 2006) | 3 lines

Fix the name of the rtignoreregexpire option in the sample configuration file.
(issue #8526, arkadia)

........
r48356 | russell | 2006-12-07 11:14:13 -0700 (Thu, 07 Dec 2006) | 3 lines

Ensure that the file position is not incremented beyond the total number of
files available for playback.  (issue #8539, ulogic)

........
r48361 | russell | 2006-12-09 08:45:37 -0700 (Sat, 09 Dec 2006) | 6 lines

Use locking when accessing the registrations list.  This list is not actually
used very often, so the likelihood of there being a problem is pretty small,
but still possible.  For example, if the CLI command to list the registrations
was called at the same time that a reload was occurring and the registrations
list was getting destroyed and rebuilt, a crash could occur.

........
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).
........
r48374 | tilghman | 2006-12-10 17:33:59 -0700 (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.

........
r48394 | mogorman | 2006-12-11 14:55:43 -0700 (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.

........
r48398 | mogorman | 2006-12-11 16:00:04 -0700 (Mon, 11 Dec 2006) | 2 lines

the english language can be a tricky beast

........
r48403 | kpfleming | 2006-12-11 22:11:13 -0700 (Mon, 11 Dec 2006) | 2 lines

add silence files

........

Added:
    team/murf/bug8386-1.2/sounds/silence/
      - copied from r48403, branches/1.2/sounds/silence/
    team/murf/bug8386-1.2/sounds/silence/1.gsm
      - copied unchanged from r48403, branches/1.2/sounds/silence/1.gsm
    team/murf/bug8386-1.2/sounds/silence/10.gsm
      - copied unchanged from r48403, branches/1.2/sounds/silence/10.gsm
    team/murf/bug8386-1.2/sounds/silence/2.gsm
      - copied unchanged from r48403, branches/1.2/sounds/silence/2.gsm
    team/murf/bug8386-1.2/sounds/silence/3.gsm
      - copied unchanged from r48403, branches/1.2/sounds/silence/3.gsm
    team/murf/bug8386-1.2/sounds/silence/4.gsm
      - copied unchanged from r48403, branches/1.2/sounds/silence/4.gsm
    team/murf/bug8386-1.2/sounds/silence/5.gsm
      - copied unchanged from r48403, branches/1.2/sounds/silence/5.gsm
    team/murf/bug8386-1.2/sounds/silence/6.gsm
      - copied unchanged from r48403, branches/1.2/sounds/silence/6.gsm
    team/murf/bug8386-1.2/sounds/silence/7.gsm
      - copied unchanged from r48403, branches/1.2/sounds/silence/7.gsm
    team/murf/bug8386-1.2/sounds/silence/8.gsm
      - copied unchanged from r48403, branches/1.2/sounds/silence/8.gsm
    team/murf/bug8386-1.2/sounds/silence/9.gsm
      - copied unchanged from r48403, branches/1.2/sounds/silence/9.gsm
Modified:
    team/murf/bug8386-1.2/   (props changed)
    team/murf/bug8386-1.2/Makefile
    team/murf/bug8386-1.2/apps/app_externalivr.c
    team/murf/bug8386-1.2/apps/app_festival.c
    team/murf/bug8386-1.2/apps/app_ices.c
    team/murf/bug8386-1.2/apps/app_mp3.c
    team/murf/bug8386-1.2/apps/app_nbscat.c
    team/murf/bug8386-1.2/apps/app_zapras.c
    team/murf/bug8386-1.2/channels/chan_iax2.c
    team/murf/bug8386-1.2/channels/chan_misdn.c
    team/murf/bug8386-1.2/channels/chan_sip.c
    team/murf/bug8386-1.2/channels/chan_zap.c
    team/murf/bug8386-1.2/channels/misdn/isdn_msg_parser.c
    team/murf/bug8386-1.2/configs/iax.conf.sample
    team/murf/bug8386-1.2/doc/README.misdn
    team/murf/bug8386-1.2/res/res_agi.c
    team/murf/bug8386-1.2/res/res_musiconhold.c
    team/murf/bug8386-1.2/sounds.txt

Propchange: team/murf/bug8386-1.2/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Dec 12 12:00:08 2006
@@ -1,1 +1,1 @@
-/branches/1.2:1-48302
+/branches/1.2:1-48413

Modified: team/murf/bug8386-1.2/Makefile
URL: http://svn.digium.com/view/asterisk/team/murf/bug8386-1.2/Makefile?view=diff&rev=48414&r1=48413&r2=48414
==============================================================================
--- team/murf/bug8386-1.2/Makefile (original)
+++ team/murf/bug8386-1.2/Makefile Tue Dec 12 12:00:08 2006
@@ -553,10 +553,19 @@
 datafiles: all
 	if [ x`$(ID) -un` = xroot ]; then sh mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
 	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits
+	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/silence
 	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/priv-callerintros
 	for x in sounds/digits/*.gsm; do \
 		if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
 			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits ; \
+		else \
+			echo "No description for $$x"; \
+			exit 1; \
+		fi; \
+	done
+	for x in sounds/silence/*.gsm; do \
+		if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
+			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/silence ; \
 		else \
 			echo "No description for $$x"; \
 			exit 1; \

Modified: team/murf/bug8386-1.2/apps/app_externalivr.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8386-1.2/apps/app_externalivr.c?view=diff&rev=48414&r1=48413&r2=48414
==============================================================================
--- team/murf/bug8386-1.2/apps/app_externalivr.c (original)
+++ team/murf/bug8386-1.2/apps/app_externalivr.c Tue Dec 12 12:00:08 2006
@@ -31,6 +31,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <errno.h>
+#include <signal.h>
 
 #include "asterisk.h"
 
@@ -152,7 +153,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;
 		}
 
@@ -258,9 +259,13 @@
 	FILE *child_commands = NULL;
 	FILE *child_errors = NULL;
 	FILE *child_events = NULL;
+	sigset_t fullset, oldset;
 
 	LOCAL_USER_ADD(u);
-	
+
+	sigfillset(&fullset);
+	pthread_sigmask(SIG_BLOCK, &fullset, &oldset);
+
 	AST_LIST_HEAD_INIT(&u->playlist);
 	AST_LIST_HEAD_INIT(&u->finishlist);
 	u->abort_current_sound = 0;
@@ -313,6 +318,9 @@
 	if (!pid) {
 		/* child process */
 		int i;
+
+		signal(SIGPIPE, SIG_DFL);
+		pthread_sigmask(SIG_UNBLOCK, &fullset, NULL);
 
 		if (option_highpriority)
 			ast_set_priority(0);
@@ -336,6 +344,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/bug8386-1.2/apps/app_festival.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8386-1.2/apps/app_festival.c?view=diff&rev=48414&r1=48413&r2=48414
==============================================================================
--- team/murf/bug8386-1.2/apps/app_festival.c (original)
+++ team/murf/bug8386-1.2/apps/app_festival.c Tue Dec 12 12:00:08 2006
@@ -127,19 +127,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 (option_highpriority)
 		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/bug8386-1.2/apps/app_ices.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8386-1.2/apps/app_ices.c?view=diff&rev=48414&r1=48413&r2=48414
==============================================================================
--- team/murf/bug8386-1.2/apps/app_ices.c (original)
+++ team/murf/bug8386-1.2/apps/app_ices.c Tue Dec 12 12:00:08 2006
@@ -68,15 +68,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 (option_highpriority)
 		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);
 	}
@@ -87,7 +99,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/bug8386-1.2/apps/app_mp3.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8386-1.2/apps/app_mp3.c?view=diff&rev=48414&r1=48413&r2=48414
==============================================================================
--- team/murf/bug8386-1.2/apps/app_mp3.c (original)
+++ team/murf/bug8386-1.2/apps/app_mp3.c Tue Dec 12 12:00:08 2006
@@ -67,15 +67,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 (option_highpriority)
 		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);
 	}
@@ -97,7 +107,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/bug8386-1.2/apps/app_nbscat.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8386-1.2/apps/app_nbscat.c?view=diff&rev=48414&r1=48413&r2=48414
==============================================================================
--- team/murf/bug8386-1.2/apps/app_nbscat.c (original)
+++ team/murf/bug8386-1.2/apps/app_nbscat.c Tue Dec 12 12:00:08 2006
@@ -71,16 +71,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 (option_highpriority)
 		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);
 	}
@@ -88,7 +98,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/bug8386-1.2/apps/app_zapras.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8386-1.2/apps/app_zapras.c?view=diff&rev=48414&r1=48413&r2=48414
==============================================================================
--- team/murf/bug8386-1.2/apps/app_zapras.c (original)
+++ team/murf/bug8386-1.2/apps/app_zapras.c Tue Dec 12 12:00:08 2006
@@ -87,11 +87,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);
@@ -103,10 +115,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/bug8386-1.2/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8386-1.2/channels/chan_iax2.c?view=diff&rev=48414&r1=48413&r2=48414
==============================================================================
--- team/murf/bug8386-1.2/channels/chan_iax2.c (original)
+++ team/murf/bug8386-1.2/channels/chan_iax2.c Tue Dec 12 12:00:08 2006
@@ -410,6 +410,7 @@
 };
 
 static struct iax2_registry *registrations;
+AST_MUTEX_DEFINE_STATIC(reg_lock);
 
 /* Don't retry more frequently than every 10 ms, or less frequently than every 5 seconds */
 #define MIN_RETRY_TIME		100
@@ -4399,8 +4400,8 @@
 	char iabuf[INET_ADDRSTRLEN];
 	if (argc != 3)
 		return RESULT_SHOWUSAGE;
-	ast_mutex_lock(&peerl.lock);
 	ast_cli(fd, FORMAT2, "Host", "Username", "Perceived", "Refresh", "State");
+	ast_mutex_lock(&reg_lock);
 	for (reg = registrations;reg;reg = reg->next) {
 		snprintf(host, sizeof(host), "%s:%d", ast_inet_ntoa(iabuf, sizeof(iabuf), reg->addr.sin_addr), ntohs(reg->addr.sin_port));
 		if (reg->us.sin_addr.s_addr) 
@@ -4410,7 +4411,7 @@
 		ast_cli(fd, FORMAT, host, 
 					reg->username, perceived, reg->refresh, regstate2str(reg->regstate));
 	}
-	ast_mutex_unlock(&peerl.lock);
+	ast_mutex_unlock(&reg_lock);
 	return RESULT_SUCCESS;
 #undef FORMAT
 #undef FORMAT2
@@ -5624,9 +5625,11 @@
 		reg->addr.sin_family = AF_INET;
 		memcpy(&reg->addr.sin_addr, hp->h_addr, sizeof(&reg->addr.sin_addr));
 		reg->addr.sin_port = porta ? htons(atoi(porta)) : htons(IAX_DEFAULT_PORTNO);
+		ast_mutex_lock(&reg_lock);
 		reg->next = registrations;
 		reg->callno = 0;
 		registrations = reg;
+		ast_mutex_unlock(&reg_lock);
 	} else {
 		ast_log(LOG_ERROR, "Out of memory\n");
 		return -1;
@@ -8582,6 +8585,7 @@
 		user = user->next;
 	}
 	ast_mutex_unlock(&userl.lock);
+	ast_mutex_lock(&reg_lock);
 	for (reg = registrations;reg;) {
 		regl = reg;
 		reg = reg->next;
@@ -8600,6 +8604,7 @@
 		free(regl);
 	}
 	registrations = NULL;
+	ast_mutex_unlock(&reg_lock);
 	ast_mutex_lock(&peerl.lock);
 	for (peer=peerl.peers;peer;) {
 		/* Assume all will be deleted, and we'll find out for sure later */
@@ -8976,8 +8981,10 @@
 	set_config(config,1);
 	prune_peers();
 	prune_users();
+	ast_mutex_lock(&reg_lock);
 	for (reg = registrations; reg; reg = reg->next)
 		iax2_do_register(reg);
+	ast_mutex_unlock(&reg_lock);
 	/* Qualify hosts, too */
 	ast_mutex_lock(&peerl.lock);
 	for (peer = peerl.peers; peer; peer = peer->next)
@@ -9742,8 +9749,10 @@
 		ast_netsock_release(netsock);
 	}
 
+	ast_mutex_lock(&reg_lock);
 	for (reg = registrations; reg; reg = reg->next)
 		iax2_do_register(reg);
+	ast_mutex_unlock(&reg_lock);
 	ast_mutex_lock(&peerl.lock);
 	for (peer = peerl.peers; peer; peer = peer->next) {
 		if (peer->sockfd < 0)

Modified: team/murf/bug8386-1.2/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8386-1.2/channels/chan_misdn.c?view=diff&rev=48414&r1=48413&r2=48414
==============================================================================
--- team/murf/bug8386-1.2/channels/chan_misdn.c (original)
+++ team/murf/bug8386-1.2/channels/chan_misdn.c Tue Dec 12 12:00:08 2006
@@ -1966,7 +1966,7 @@
 		chan_misdn_log(1, p->bc->port, " --> *\tUNHOLD pid:%d\n",p->bc?p->bc->pid:-1);
 		break;
 	default:
-		ast_log(LOG_NOTICE, " --> * Unknown Indication:%d pid:%d\n",cond,p->bc?p->bc->pid:-1);
+		chan_misdn_log(1, p->bc->port, " --> * Unknown Indication:%d pid:%d\n",cond,p->bc?p->bc->pid:-1);
 	}
   
 	return 0;
@@ -3183,6 +3183,11 @@
 			if (ch->other_ch) ch->other_ch->other_ch=ch;
 		}
 	}
+
+	tmp=pbx_builtin_getvar_helper(chan,"MISDN_ADDRESS_COMPLETE");
+	if (tmp && (atoi(tmp) == 1)) {
+		bc->sending_complete=1;
+	}
 }
  
 void export_ch(struct ast_channel *chan, struct misdn_bchannel *bc, struct chan_list *ch)
@@ -3192,6 +3197,11 @@
 	chan_misdn_log(3,bc->port," --> EXPORT_PID: pid:%d\n",bc->pid);
 	sprintf(tmp,"%d",bc->pid);
 	pbx_builtin_setvar_helper(chan,"_MISDN_PID",tmp);
+
+	if (bc->sending_complete) {
+		sprintf(tmp,"%d",bc->sending_complete);
+		pbx_builtin_setvar_helper(chan,"MISDN_ADDRESS_COMPLETE",tmp);
+	}
 }
 
 
@@ -3936,7 +3946,11 @@
 				int ret=write(ch->pipe[1], bc->bframe, bc->bframe_len);
 				
 				if (ret<=0) {
-					chan_misdn_log(-1, bc->port, "Write returned <=0 (err=%s)\n",strerror(errno));
+					chan_misdn_log(-1, bc->port, "Write returned <=0 (err=%s) --> hanging up channel\n",strerror(errno));
+
+					stop_bc_tones(ch);
+					hangup_chan(ch);
+					release_chan(bc);
 				}
 			} else {
 				chan_misdn_log(1, bc->port, "Wripe Pipe full!\n");
@@ -4092,7 +4106,7 @@
 		break;
 				
 	default:
-		ast_log(LOG_NOTICE, "Got Unknown Event\n");
+		chan_misdn_log(1,0, "Got Unknown Event\n");
 		break;
 	}
 	
@@ -4350,7 +4364,7 @@
 		misdn_lib_send_facility(ch->bc, FACILITY_CALLDEFLECT, tok);
 		
 	} else {
-		ast_log(LOG_WARNING, "Unknown Facility: %s\n",tok);
+		chan_misdn_log(1, ch->bc->port, "Unknown Facility: %s\n",tok);
 	}
 	
 	return 0;

Modified: team/murf/bug8386-1.2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8386-1.2/channels/chan_sip.c?view=diff&rev=48414&r1=48413&r2=48414
==============================================================================
--- team/murf/bug8386-1.2/channels/chan_sip.c (original)
+++ team/murf/bug8386-1.2/channels/chan_sip.c Tue Dec 12 12:00:08 2006
@@ -4259,7 +4259,8 @@
 		add_header(req, "From", ot);
 		add_header(req, "To", of);
 	}
-	add_header(req, "Contact", p->our_contact);
+	if (sipmethod != SIP_BYE && sipmethod != SIP_CANCEL && sipmethod != SIP_MESSAGE)
+		add_header(req, "Contact", p->our_contact);
 	copy_header(req, orig, "Call-ID");
 	add_header(req, "CSeq", tmp);
 
@@ -9826,12 +9827,23 @@
 		ast_log(LOG_WARNING, "Re-invite to non-existing call leg on other UA. SIP dialog '%s'. Giving up.\n", p->callid);
 		transmit_request(p, SIP_ACK, seqno, 0, 0);
 		break;
+	case 487: /* Cancelled transaction */
+		/* We have sent CANCEL on an outbound INVITE 
+			This transaction is already scheduled to be killed by sip_hangup().
+		*/
+		transmit_request(p, SIP_ACK, seqno, 0, 0);
+		if (p->owner && !ignore)
+			ast_queue_hangup(p->owner);
+		else if (!ignore)
+			update_call_counter(p, DEC_CALL_LIMIT);
+		break;
 	case 491: /* Pending */
 		/* we have to wait a while, then retransmit */
 		/* Transmission is rescheduled, so everything should be taken care of.
 			We should support the retry-after at some point */
 		break;
 	case 501: /* Not implemented */
+		transmit_request(p, SIP_ACK, seqno, 0, 0);
 		if (p->owner)
 			ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
 		break;
@@ -10139,6 +10151,10 @@
 				ast_set_flag(p, SIP_NEEDDESTROY);	
 
 			break;
+		case 487:
+			if (sipmethod == SIP_INVITE)
+				handle_response_invite(p, resp, rest, req, ignore, seqno);
+			break;
 		case 491: /* Pending */
 			if (sipmethod == SIP_INVITE) {
 				handle_response_invite(p, resp, rest, req, ignore, seqno);
@@ -10174,12 +10190,6 @@
 				case 603: /* Decline */
 					if (p->owner)
 						ast_queue_control(p->owner, AST_CONTROL_BUSY);
-					break;
-				case 487:
-					/* channel now destroyed - dec the inUse counter */
-					if (owner)
-						ast_queue_hangup(p->owner);
-					update_call_counter(p, DEC_CALL_LIMIT);
 					break;
 				case 482: /* SIP is incapable of performing a hairpin call, which
 				             is yet another failure of not having a layer 2 (again, YAY

Modified: team/murf/bug8386-1.2/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8386-1.2/channels/chan_zap.c?view=diff&rev=48414&r1=48413&r2=48414
==============================================================================
--- team/murf/bug8386-1.2/channels/chan_zap.c (original)
+++ team/murf/bug8386-1.2/channels/chan_zap.c Tue Dec 12 12:00:08 2006
@@ -3339,7 +3339,7 @@
 		   stop if now if appropriate */
 		if (ast_bridged_channel(p->subs[SUB_THREEWAY].owner))
 			ast_moh_stop(ast_bridged_channel(p->subs[SUB_THREEWAY].owner));
-		if (p->subs[SUB_THREEWAY].owner->_state == AST_STATE_RINGING) {
+		if (p->subs[SUB_REAL].owner->_state == AST_STATE_RINGING) {
 			ast_indicate(ast_bridged_channel(p->subs[SUB_REAL].owner), AST_CONTROL_RINGING);
 		}
 		if (p->subs[SUB_REAL].owner->cdr) {
@@ -3363,7 +3363,7 @@
 		ast_mutex_unlock(&p->subs[SUB_THREEWAY].owner->lock);
 		unalloc_sub(p, SUB_THREEWAY);
 	} else if (ast_bridged_channel(p->subs[SUB_THREEWAY].owner)) {
-		if (p->subs[SUB_REAL].owner->_state == AST_STATE_RINGING) {
+		if (p->subs[SUB_THREEWAY].owner->_state == AST_STATE_RINGING) {
 			ast_indicate(ast_bridged_channel(p->subs[SUB_THREEWAY].owner), AST_CONTROL_RINGING);
 		}
 		ast_moh_stop(ast_bridged_channel(p->subs[SUB_THREEWAY].owner));
@@ -4853,11 +4853,10 @@
 			}
 #endif
 			res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_RINGTONE);
-			if (chan->_state != AST_STATE_UP) {
-				if ((chan->_state != AST_STATE_RING) ||
-					((p->sig != SIG_FXSKS) &&
+			if (chan->_state != AST_STATE_UP && chan->_state != AST_STATE_RING) {
+				if ((p->sig != SIG_FXSKS) &&
 					 (p->sig != SIG_FXSLS) &&
-					 (p->sig != SIG_FXSGS)))
+					 (p->sig != SIG_FXSGS))
 					ast_setstate(chan, AST_STATE_RINGING);
 			}
 			break;

Modified: team/murf/bug8386-1.2/channels/misdn/isdn_msg_parser.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8386-1.2/channels/misdn/isdn_msg_parser.c?view=diff&rev=48414&r1=48413&r2=48414
==============================================================================
--- team/murf/bug8386-1.2/channels/misdn/isdn_msg_parser.c (original)
+++ team/murf/bug8386-1.2/channels/misdn/isdn_msg_parser.c Tue Dec 12 12:00:08 2006
@@ -322,6 +322,10 @@
 		
     
 		enc_ie_bearer(&setup->BEARER, msg, coding, capability, mode, rate, -1, user, nt,bc);
+	}
+
+	if (bc->sending_complete) {
+		enc_ie_complete(&setup->BEARER,msg, bc->sending_complete, nt, bc);
 	}
   
 #if DEBUG 

Modified: team/murf/bug8386-1.2/configs/iax.conf.sample
URL: http://svn.digium.com/view/asterisk/team/murf/bug8386-1.2/configs/iax.conf.sample?view=diff&rev=48414&r1=48413&r2=48414
==============================================================================
--- team/murf/bug8386-1.2/configs/iax.conf.sample (original)
+++ team/murf/bug8386-1.2/configs/iax.conf.sample Tue Dec 12 12:00:08 2006
@@ -272,7 +272,7 @@
 				; friends expire within this number of seconds instead of the
 				; registration interval.
 
-;rtignoreexpire=yes		; When reading a peer from Realtime, if the peer's registration
+;rtignoreregexpire=yes		; When reading a peer from Realtime, if the peer's registration
 				; has expired based on its registration interval, used the stored
 				; address information regardless. (yes|no)
 

Modified: team/murf/bug8386-1.2/doc/README.misdn
URL: http://svn.digium.com/view/asterisk/team/murf/bug8386-1.2/doc/README.misdn?view=diff&rev=48414&r1=48413&r2=48414
==============================================================================
--- team/murf/bug8386-1.2/doc/README.misdn (original)
+++ team/murf/bug8386-1.2/doc/README.misdn Tue Dec 12 12:00:08 2006
@@ -40,6 +40,7 @@
 - Configuration
 - Dial and Options String
 - misdn cli commands
+- mISDN Variables
 - Debugging and sending Bugreports
 - Examples
 - Known working Configurations
@@ -235,6 +236,14 @@
 msn (callerid) of the Phone to send the text to.
 
 
+mISDN Variables
+---------------
+
+mISDN Exports/Imports a few Variables: 
+
+- MISDN_ADDRESS_COMPLETE : 	Is either set to 1 from the Provider, or you 
+				can set it to 1 to force a sending complete.
+				
 
 Debugging and sending bug reports
 ---------------------------------

Modified: team/murf/bug8386-1.2/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8386-1.2/res/res_agi.c?view=diff&rev=48414&r1=48413&r2=48414
==============================================================================
--- team/murf/bug8386-1.2/res/res_agi.c (original)
+++ team/murf/bug8386-1.2/res/res_agi.c Tue Dec 12 12:00:08 2006
@@ -234,7 +234,7 @@
 	int audio[2];
 	int x;
 	int res;
-	sigset_t signal_set;
+	sigset_t signal_set, old_set;
 	
 	if (!strncasecmp(script, "agi://", 6))
 		return launch_netscript(script, argv, fds, efd, opid);
@@ -276,6 +276,10 @@
 			return -1;
 		}
 	}
+
+	/* Block SIGHUP during the fork - prevents a race */
+	sigfillset(&signal_set);
+	pthread_sigmask(SIG_BLOCK, &signal_set, &old_set);
 	pid = fork();
 	if (pid < 0) {
 		ast_log(LOG_WARNING, "Failed to fork(): %s\n", strerror(errno));
@@ -293,9 +297,18 @@
 		} else {
 			close(STDERR_FILENO + 1);
 		}
-		
+
+		/* Before we unblock our signals, return our trapped signals back to the defaults */
+		signal(SIGHUP, SIG_DFL);
+		signal(SIGCHLD, SIG_DFL);
+		signal(SIGINT, SIG_DFL);
+		signal(SIGURG, SIG_DFL);
+		signal(SIGTERM, SIG_DFL);
+		signal(SIGPIPE, SIG_DFL);
+		signal(SIGXFSZ, SIG_DFL);
+
 		/* unblock important signal handlers */
-		if (sigfillset(&signal_set) || pthread_sigmask(SIG_UNBLOCK, &signal_set, NULL)) {
+		if (pthread_sigmask(SIG_UNBLOCK, &signal_set, NULL)) {
 			ast_log(LOG_WARNING, "unable to unblock signals for AGI script: %s\n", strerror(errno));
 			_exit(1);
 		}
@@ -310,6 +323,7 @@
 		fprintf(stderr, "Failed to execute '%s': %s\n", script, strerror(errno));
 		_exit(1);
 	}
+	pthread_sigmask(SIG_SETMASK, &old_set, NULL);
 	if (option_verbose > 2) 
 		ast_verbose(VERBOSE_PREFIX_3 "Launched AGI Script %s\n", script);
 	fds[0] = toast[0];

Modified: team/murf/bug8386-1.2/res/res_musiconhold.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8386-1.2/res/res_musiconhold.c?view=diff&rev=48414&r1=48413&r2=48414
==============================================================================
--- team/murf/bug8386-1.2/res/res_musiconhold.c (original)
+++ team/murf/bug8386-1.2/res/res_musiconhold.c Tue Dec 12 12:00:08 2006
@@ -227,6 +227,7 @@
 	if (!ast_openstream_full(chan, state->class->filearray[state->pos], chan->language, 1)) {
 		ast_log(LOG_WARNING, "Unable to open file '%s': %s\n", state->class->filearray[state->pos], strerror(errno));
 		state->pos++;
+		state->pos %= state->class->total_files;
 		return -1;
 	}
 
@@ -325,6 +326,7 @@
 	int argc = 0;
 	DIR *dir = NULL;
 	struct dirent *de;
+	sigset_t signal_set, old_set;
 
 	
 	if (!strcasecmp(class->dir, "nodir")) {
@@ -425,6 +427,11 @@
 	if (time(NULL) - class->start < respawn_time) {
 		sleep(respawn_time - (time(NULL) - class->start));
 	}
+
+	/* Block signals during the fork() */
+	sigfillset(&signal_set);
+	pthread_sigmask(SIG_BLOCK, &signal_set, &old_set);
+
 	time(&class->start);
 	class->pid = fork();
 	if (class->pid < 0) {
@@ -438,6 +445,10 @@
 
 		if (option_highpriority)
 			ast_set_priority(0);
+
+		/* Reset ignored signals back to default */
+		signal(SIGPIPE, SIG_DFL);
+		pthread_sigmask(SIG_UNBLOCK, &signal_set, NULL);
 
 		close(fds[0]);
 		/* Stdout goes to pipe */
@@ -465,6 +476,7 @@
 		_exit(1);
 	} else {
 		/* Parent */
+		pthread_sigmask(SIG_SETMASK, &old_set, NULL);
 		close(fds[1]);
 	}
 	return fds[0];

Modified: team/murf/bug8386-1.2/sounds.txt
URL: http://svn.digium.com/view/asterisk/team/murf/bug8386-1.2/sounds.txt?view=diff&rev=48414&r1=48413&r2=48414
==============================================================================
--- team/murf/bug8386-1.2/sounds.txt (original)
+++ team/murf/bug8386-1.2/sounds.txt Tue Dec 12 12:00:08 2006
@@ -728,3 +728,25 @@
 
 %spy-zap.gsm%Zap
 
+; Silence directory
+
+%1.gsm%1 second of silence
+
+%2.gsm%2 seconds of silence
+
+%3.gsm%3 seconds of silence
+
+%4.gsm%4 seconds of silence
+
+%5.gsm%5 seconds of silence
+
+%6.gsm%6 seconds of silence
+
+%7.gsm%7 seconds of silence
+
+%8.gsm%8 seconds of silence
+
+%9.gsm%9 seconds of silence
+
+%10.gsm%10 seconds of silence
+



More information about the asterisk-commits mailing list