[asterisk-commits] seanbright: branch seanbright/resolve-shadow-warnings r114643 - in /team/sean...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 25 07:17:04 CDT 2008


Author: seanbright
Date: Fri Apr 25 07:17:01 2008
New Revision: 114643

URL: http://svn.digium.com/view/asterisk?view=rev&rev=114643
Log:
Merged revisions 114585,114588,114592,114595,114598,114601,114604,114606,114609,114612,114617,114622,114625,114629,114633,114635,114637 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r114585 | oej | 2008-04-23 12:53:34 -0400 (Wed, 23 Apr 2008) | 10 lines

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

........
r114584 | oej | 2008-04-23 18:51:41 +0200 (Ons, 23 Apr 2008) | 2 lines

Add 502 support for both directions, not only one...  (see r114571)

........

................
r114588 | russell | 2008-04-23 13:18:29 -0400 (Wed, 23 Apr 2008) | 10 lines

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

........
r114587 | russell | 2008-04-23 12:16:32 -0500 (Wed, 23 Apr 2008) | 2 lines

Fix find_callno_locked() to actually return the callno locked in some more cases.

........

................
r114592 | russell | 2008-04-23 14:01:00 -0400 (Wed, 23 Apr 2008) | 13 lines

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

........
r114591 | russell | 2008-04-23 12:55:31 -0500 (Wed, 23 Apr 2008) | 5 lines

Store the manager session ID explicitly as 4 byte ID instead of a ulong.  The
mansession_id cookie is coded to be limited to 8 characters of hex, and this
could break logins from 64-bit machines in some cases.
(inspired by AST-20)

........

................
r114595 | qwell | 2008-04-23 14:33:28 -0400 (Wed, 23 Apr 2008) | 16 lines

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

........
r114594 | qwell | 2008-04-23 13:28:44 -0500 (Wed, 23 Apr 2008) | 8 lines

Fix reload/unload for res_musiconhold module.

(closes issue #11575)
Reported by: sunder
Patches:
      M11575_14_rev3.diff uploaded by junky (license 177)
      bug11575_trunk.diff.txt uploaded by jamesgolovich (license 176)

........

................
r114598 | russell | 2008-04-23 16:53:05 -0400 (Wed, 23 Apr 2008) | 18 lines

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

........
r114597 | russell | 2008-04-23 15:49:18 -0500 (Wed, 23 Apr 2008) | 10 lines

Fix an issue that caused getting the correct next channel to not always work.
Also, remove setting the amount of time to wait for a digit from 5 seconds back
down to 1/10 of a second.  I believe this was so the beep didn't get played over
and over really fast, but a while back I put in another fix for that issue.

(closes issue #12498)
Reported by: jsmith
Patches:
      app_chanspy_channel_walk.trunk.patch uploaded by jsmith (license 15)

........

................
r114601 | russell | 2008-04-23 18:53:20 -0400 (Wed, 23 Apr 2008) | 14 lines

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

........
r114600 | russell | 2008-04-23 17:18:12 -0500 (Wed, 23 Apr 2008) | 6 lines

Improve some broken cookie parsing code.  Previously, manager login over HTTP
would only work if the mansession_id cookie was first.  Now, the code builds
a list of all of the cookies in the Cookie header.  This fixes a problem
observed by users of the Asterisk GUI.
(closes AST-20)

........

................
r114604 | russell | 2008-04-24 10:55:21 -0400 (Thu, 24 Apr 2008) | 3 lines

Change a verbose message to debug.
(closes issue #12514)

................
r114606 | oej | 2008-04-24 10:59:05 -0400 (Thu, 24 Apr 2008) | 11 lines

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

........
r114603 | oej | 2008-04-24 16:55:18 +0200 (Tor, 24 Apr 2008) | 3 lines

Only have one max-forwards header in outbound REFERs.
Discovered in the Asterisk SIP Masterclass in Orlando. Thanks Joe!

........

................
r114609 | russell | 2008-04-24 11:56:55 -0400 (Thu, 24 Apr 2008) | 12 lines

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

........
r114608 | russell | 2008-04-24 10:55:21 -0500 (Thu, 24 Apr 2008) | 4 lines

Fix a silly mistake in a change I made yesterday that caused chan_iax2 to blow
up very quickly.
(issue #12515)

........

................
r114612 | qwell | 2008-04-24 12:47:01 -0400 (Thu, 24 Apr 2008) | 17 lines

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

(closes issue #12496)
Reported by: daniele
Patches:
      misdn-moh-1.6.0-beta7.1.patch uploaded by daniele (license 471)
Tested by: daniele

Technically, I didn't use the patch above except to find out what revision to merge - but it's the same thing as this revision.

........
r51989 | crichter | 2007-01-24 06:57:22 -0600 (Wed, 24 Jan 2007) | 1 line

added fix from #8899
........

................
r114617 | tilghman | 2008-04-24 15:24:31 -0400 (Thu, 24 Apr 2008) | 6 lines

Fix DST calculation, and fix bug in calculation of whether conf has started yet or not
(Closes issue #12292)
 Reported by: DEA
 Patches: 
       app_meetme-rt-dst-sched-fix.txt uploaded by DEA (license 3)

................
r114622 | tilghman | 2008-04-24 15:54:57 -0400 (Thu, 24 Apr 2008) | 12 lines

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

........
r114621 | tilghman | 2008-04-24 14:53:36 -0500 (Thu, 24 Apr 2008) | 4 lines

Ensure that when we set the accountcode, it actually shows up in the CDR.
(Fix for AMI Originate)
(Closes issue #12007)

........

................
r114625 | mmichelson | 2008-04-24 16:06:06 -0400 (Thu, 24 Apr 2008) | 18 lines

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

........
r114624 | mmichelson | 2008-04-24 15:04:24 -0500 (Thu, 24 Apr 2008) | 10 lines

Resolve a deadlock in chan_local by releasing the channel lock
temporarily.

(closes issue #11712)
Reported by: callguy
Patches:
      11712.patch uploaded by putnopvut (license 60)
Tested by: acunningham


........

................
r114629 | mmichelson | 2008-04-24 16:43:52 -0400 (Thu, 24 Apr 2008) | 16 lines

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

........
r114628 | mmichelson | 2008-04-24 15:43:03 -0500 (Thu, 24 Apr 2008) | 8 lines

Output of channel variables when eventwhencalled=vars was set
was being truncated two characters. This patch corrects the
problem.

(closes issue #12493)
Reported by: davidw


........

................
r114633 | mmichelson | 2008-04-24 17:35:39 -0400 (Thu, 24 Apr 2008) | 19 lines

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

........
r114632 | mmichelson | 2008-04-24 16:35:08 -0500 (Thu, 24 Apr 2008) | 11 lines

Re-invite RTP during a masquerade so that, for instance, an AMI
redirect of two channels which are natively bridged will preserve audio
on both channels. This prevents a problem with Asterisk not re-inviting
due to one of the channels having being a zombie.

(closes issue #12513)
Reported by: mneuhauser
Patches:
      asterisk-1.4-114602_restore-RTP-on-fixup.patch uploaded by mneuhauser (license 425)


........

................
r114635 | file | 2008-04-24 18:11:46 -0400 (Thu, 24 Apr 2008) | 4 lines

Hey look, it builds.
(closes issue #12519)
Reported by: falves11

................
r114637 | mvanbaak | 2008-04-24 18:16:48 -0400 (Thu, 24 Apr 2008) | 8 lines

Pass the hangup cause all the way to the calling app/channel.

(closes issue #11328)
Reported by: rain
Patches:
      20071207__pass_cause_in_hangup_control_frame.diff.txt uploaded by Corydon76 (license 14)
brought up-to-date to trunk by me

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

Modified:
    team/seanbright/resolve-shadow-warnings/   (props changed)
    team/seanbright/resolve-shadow-warnings/apps/app_alarmreceiver.c
    team/seanbright/resolve-shadow-warnings/apps/app_chanspy.c
    team/seanbright/resolve-shadow-warnings/apps/app_dial.c
    team/seanbright/resolve-shadow-warnings/apps/app_disa.c
    team/seanbright/resolve-shadow-warnings/apps/app_externalivr.c
    team/seanbright/resolve-shadow-warnings/apps/app_followme.c
    team/seanbright/resolve-shadow-warnings/apps/app_meetme.c
    team/seanbright/resolve-shadow-warnings/apps/app_queue.c
    team/seanbright/resolve-shadow-warnings/channels/chan_alsa.c
    team/seanbright/resolve-shadow-warnings/channels/chan_gtalk.c
    team/seanbright/resolve-shadow-warnings/channels/chan_h323.c
    team/seanbright/resolve-shadow-warnings/channels/chan_iax2.c
    team/seanbright/resolve-shadow-warnings/channels/chan_jingle.c
    team/seanbright/resolve-shadow-warnings/channels/chan_local.c
    team/seanbright/resolve-shadow-warnings/channels/chan_mgcp.c
    team/seanbright/resolve-shadow-warnings/channels/chan_misdn.c
    team/seanbright/resolve-shadow-warnings/channels/chan_oss.c
    team/seanbright/resolve-shadow-warnings/channels/chan_sip.c
    team/seanbright/resolve-shadow-warnings/channels/chan_skinny.c
    team/seanbright/resolve-shadow-warnings/channels/chan_unistim.c
    team/seanbright/resolve-shadow-warnings/channels/chan_zap.c
    team/seanbright/resolve-shadow-warnings/include/asterisk/channel.h
    team/seanbright/resolve-shadow-warnings/include/asterisk/manager.h
    team/seanbright/resolve-shadow-warnings/main/channel.c
    team/seanbright/resolve-shadow-warnings/main/http.c
    team/seanbright/resolve-shadow-warnings/main/manager.c
    team/seanbright/resolve-shadow-warnings/res/res_musiconhold.c

Propchange: team/seanbright/resolve-shadow-warnings/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/seanbright/resolve-shadow-warnings/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Apr 25 07:17:01 2008
@@ -1,1 +1,1 @@
-/trunk:1-114582
+/trunk:1-114642

Modified: team/seanbright/resolve-shadow-warnings/apps/app_alarmreceiver.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_alarmreceiver.c?view=diff&rev=114643&r1=114642&r2=114643
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_alarmreceiver.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_alarmreceiver.c Fri Apr 25 07:17:01 2008
@@ -252,6 +252,9 @@
 
 		/* If they hung up, leave */
 		if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
+			if (f->seqno) {
+				chan->hangupcause = f->seqno;
+			}
 			ast_frfree(f);
 			res = -1;
 			break;

Modified: team/seanbright/resolve-shadow-warnings/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_chanspy.c?view=diff&rev=114643&r1=114642&r2=114643
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_chanspy.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_chanspy.c Fri Apr 25 07:17:01 2008
@@ -705,12 +705,11 @@
 
 			for (s = peer_name; s < ptr; s++)
 				*s = tolower(*s);
-		
 			/* We have to unlock the peer channel here to avoid a deadlock.
-			 * So, when we need it again, we have to lock the datastore and get
-			 * the pointer from there to see if the channel is still valid. */
+			 * So, when we need to dereference it again, we have to lock the 
+			 * datastore and get the pointer from there to see if the channel 
+			 * is still valid. */
 			ast_channel_unlock(peer);
-			peer = NULL;
 
 			if (!ast_test_flag(flags, OPTION_QUIET)) {
 				if (!ast_test_flag(flags, OPTION_NOTECH)) {
@@ -731,7 +730,6 @@
 					ast_say_digits(chan, atoi(ptr), "", chan->language);
 			}
 
-			waitms = 5000;
 			res = channel_spy(chan, peer_chanspy_ds, &volfactor, fd, flags, exitcontext);
 			num_spyed_upon++;	
 

Modified: team/seanbright/resolve-shadow-warnings/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_dial.c?view=diff&rev=114643&r1=114642&r2=114643
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_dial.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_dial.c Fri Apr 25 07:17:01 2008
@@ -788,8 +788,11 @@
 				*to = -1;
 				strcpy(pa->status, "CANCEL");
 				ast_cdr_noanswer(in->cdr);
-				if (f)
+				if (f) {
+					if (f->seqno)
+						in->hangupcause = f->seqno;
 					ast_frfree(f);
+				}
 				return NULL;
 			}
 

Modified: team/seanbright/resolve-shadow-warnings/apps/app_disa.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_disa.c?view=diff&rev=114643&r1=114642&r2=114643
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_disa.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_disa.c Fri Apr 25 07:17:01 2008
@@ -195,6 +195,8 @@
 		}
 
 		if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
+			if (f->seqno)
+				chan->hangupcause = f->seqno;
 			ast_frfree(f);
 			ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY);
 			return -1;

Modified: team/seanbright/resolve-shadow-warnings/apps/app_externalivr.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_externalivr.c?view=diff&rev=114643&r1=114642&r2=114643
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_externalivr.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_externalivr.c Fri Apr 25 07:17:01 2008
@@ -560,6 +560,9 @@
  			} else if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
  				ast_chan_log(LOG_NOTICE, chan, "Got AST_CONTROL_HANGUP\n");
  				send_eivr_event(eivr_events, 'H', NULL, chan);
+				if (f->seqno) {
+					chan->hangupcause = f->seqno;
+				}
  				ast_frfree(f);
  				res = -1;
  				break;

Modified: team/seanbright/resolve-shadow-warnings/apps/app_followme.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_followme.c?view=diff&rev=114643&r1=114642&r2=114643
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_followme.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_followme.c Fri Apr 25 07:17:01 2008
@@ -607,6 +607,9 @@
 					switch(f->subclass) {
 					case AST_CONTROL_HANGUP:
 						ast_verb(3, "%s received a hangup frame.\n", winner->name);
+						if (f->seqno) {
+							winner->hangupcause = f->seqno;
+						}
 						if (dg == 0) {
 							ast_verb(3, "The calling channel hungup. Need to drop everyone else.\n");
 							clear_calling_tree(findme_user_list);

Modified: team/seanbright/resolve-shadow-warnings/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_meetme.c?view=diff&rev=114643&r1=114642&r2=114643
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_meetme.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_meetme.c Fri Apr 25 07:17:01 2008
@@ -2706,35 +2706,56 @@
 		char useropts[32] = "";
 		char adminopts[32] = "";
 		struct ast_tm tm, etm;
-		struct timeval starttime = { .tv_sec = 0 }, endtime = { .tv_sec = 0 };
+		struct timeval endtime = { .tv_sec = 0 };
 
 		if (rt_schedule) {
 			now = ast_tvnow();
 
-			if (fuzzystart)
-				now.tv_sec += fuzzystart;
-
 			ast_localtime(&now, &tm, NULL);
 			ast_strftime(currenttime, sizeof(currenttime), DATE_FORMAT, &tm);
 
-			if (earlyalert) {
+			ast_debug(1, "Looking for conference %s that starts after %s\n", confno, eatime);
+
+			var = ast_load_realtime("meetme", "confno",
+				confno, "starttime <= ", currenttime, "endtime >= ",
+				currenttime, NULL);
+
+			if (!var && fuzzystart) {
+				now = ast_tvnow();
+				now.tv_sec += fuzzystart;
+
+				ast_localtime(&now, &tm, NULL);
+				ast_strftime(currenttime, sizeof(currenttime), DATE_FORMAT, &tm);
+				var = ast_load_realtime("meetme", "confno",
+					confno, "starttime <= ", currenttime, "endtime >= ",
+					currenttime, NULL);
+			}
+
+			if (!var && earlyalert) {
+				now = ast_tvnow();
 				now.tv_sec += earlyalert;
 				ast_localtime(&now, &etm, NULL);
 				ast_strftime(eatime, sizeof(eatime), DATE_FORMAT, &etm);
-			} else {
-				ast_copy_string(eatime, currenttime, sizeof(eatime));
+				var = ast_load_realtime("meetme", "confno",
+					confno, "starttime <= ", eatime, "endtime >= ",
+					currenttime, NULL);
+				if (var)
+					*too_early = 1;
 			}
 
-			ast_debug(1, "Looking for conference %s that starts after %s\n", confno, eatime);
-
-			var = ast_load_realtime("meetme", "confno",
-				confno, "starttime <= ", eatime, "endtime >= ",
-				currenttime, NULL);
 		} else
 			 var = ast_load_realtime("meetme", "confno", confno, NULL);
 
 		if (!var)
 			return NULL;
+
+		if (rt_schedule && *too_early) {
+			/* Announce that the caller is early and exit */
+			if (!ast_streamfile(chan, "conf-has-not-started", chan->language))
+				ast_waitstream(chan, "");
+			ast_variables_destroy(var);
+			return NULL;
+		}
 
 		while (var) {
 			if (!strcasecmp(var->name, "pin")) {
@@ -2753,31 +2774,18 @@
 					struct tm tm;
 				} t = { { 0, }, };
 				strptime(var->value, "%Y-%m-%d %H:%M:%S", &t.tm);
+				/* strptime does not determine if a time is
+				 * in DST or not.  Set tm_isdst to -1 to 
+				 * allow ast_mktime to adjust for DST 
+				 * if needed */
+				t.tm.tm_isdst = -1; 
 				endtime = ast_mktime(&t.atm, NULL);
-			} else if (!strcasecmp(var->name, "starttime")) {
-				union {
-					struct ast_tm atm;
-					struct tm tm;
-				} t = { { 0, }, };
-				strptime(var->value, "%Y-%m-%d %H:%M:%S", &t.tm);
-				starttime = ast_mktime(&t.atm, NULL);
 			}
 
 			var = var->next;
 		}
+
 		ast_variables_destroy(var);
-
-		if (earlyalert) {
-			now = ast_tvnow();
-
-			if (now.tv_sec + fuzzystart < starttime.tv_sec) {
-				/* Announce that the caller is early and exit */
-				if (!ast_streamfile(chan, "conf-has-not-started", chan->language))
-					 ast_waitstream(chan, "");
-				*too_early = 1;
-				return NULL;
-			}
-		}
 
 		cnf = build_conf(confno, pin ? pin : "", pinadmin ? pinadmin : "", make, dynamic, refcount, chan);
 

Modified: team/seanbright/resolve-shadow-warnings/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_queue.c?view=diff&rev=114643&r1=114642&r2=114643
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_queue.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_queue.c Fri Apr 25 07:17:01 2008
@@ -2077,10 +2077,10 @@
 				j += 9;
 			}
 		}
-		if (j > len - 1)
-			j = len - 1;
-		vars[j - 2] = '\r';
-		vars[j - 1] = '\n';
+		if (j > len - 3)
+			j = len - 3;
+		vars[j++] = '\r';
+		vars[j++] = '\n';
 		vars[j] = '\0';
 	} else {
 		/* there are no channel variables; leave it blank */
@@ -2644,6 +2644,8 @@
 				/* Got hung up */
 				*to = -1;
 				if (f) {
+					if (f->seqno)
+						in->hangupcause = f->seqno;
 					ast_frfree(f);
 				}
 				return NULL;

Modified: team/seanbright/resolve-shadow-warnings/channels/chan_alsa.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/chan_alsa.c?view=diff&rev=114643&r1=114642&r2=114643
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/chan_alsa.c (original)
+++ team/seanbright/resolve-shadow-warnings/channels/chan_alsa.c Fri Apr 25 07:17:01 2008
@@ -766,7 +766,7 @@
 		hookstate = 0;
 		grab_owner();
 		if (alsa.owner) {
-			ast_queue_hangup(alsa.owner);
+			ast_queue_hangup(alsa.owner, AST_CAUSE_NORMAL_CLEARING);
 			ast_channel_unlock(alsa.owner);
 		}
 	}

Modified: team/seanbright/resolve-shadow-warnings/channels/chan_gtalk.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/chan_gtalk.c?view=diff&rev=114643&r1=114642&r2=114643
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/chan_gtalk.c (original)
+++ team/seanbright/resolve-shadow-warnings/channels/chan_gtalk.c Fri Apr 25 07:17:01 2008
@@ -620,7 +620,7 @@
 			ast_getformatname_multiple(s2, BUFSIZ, tmp->peercapability),
 			ast_getformatname_multiple(s3, BUFSIZ, tmp->jointcapability));
 		/* close session if capabilities don't match */
-		ast_queue_hangup(tmp->owner);
+		ast_queue_hangup(tmp->owner, -1);
 
 		return -1;
 
@@ -749,7 +749,7 @@
 	if (tmp) {
 		tmp->alreadygone = 1;
 		if (tmp->owner)
-			ast_queue_hangup(tmp->owner);
+			ast_queue_hangup(tmp->owner, -1);
 	} else
 		ast_log(LOG_NOTICE, "Whoa, didn't find call!\n");
 	gtalk_response(client, from, pak, NULL, NULL);

Modified: team/seanbright/resolve-shadow-warnings/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/chan_h323.c?view=diff&rev=114643&r1=114642&r2=114643
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/chan_h323.c (original)
+++ team/seanbright/resolve-shadow-warnings/channels/chan_h323.c Fri Apr 25 07:17:01 2008
@@ -342,7 +342,7 @@
 			ast_debug(1, "Process pending hangup for %s\n", c->name);
 		c->_softhangup |= AST_SOFTHANGUP_DEV;
 		c->hangupcause = pvt->hangupcause;
-		ast_queue_hangup(c);
+		ast_queue_hangup(c, pvt->hangupcause);
 		pvt->needhangup = 0;
 		pvt->newstate = pvt->newcontrol = pvt->newdigit = pvt->DTMFsched = -1;
 	}
@@ -2379,7 +2379,7 @@
 	/* Send hangup */
 	if (pvt->owner) {
 		pvt->owner->_softhangup |= AST_SOFTHANGUP_DEV;
-		ast_queue_hangup(pvt->owner);
+		ast_queue_hangup(pvt->owner, -1);
 		ast_channel_unlock(pvt->owner);
 	}
 	ast_mutex_unlock(&pvt->lock);
@@ -2404,7 +2404,7 @@
 	if (pvt->owner && !ast_channel_trylock(pvt->owner)) {
 		pvt->owner->_softhangup |= AST_SOFTHANGUP_DEV;
 		pvt->owner->hangupcause = pvt->hangupcause = cause;
-		ast_queue_hangup(pvt->owner);
+		ast_queue_hangup(pvt->owner, cause);
 		ast_channel_unlock(pvt->owner);
 	}
 	else {

Modified: team/seanbright/resolve-shadow-warnings/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/chan_iax2.c?view=diff&rev=114643&r1=114642&r2=114643
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/chan_iax2.c (original)
+++ team/seanbright/resolve-shadow-warnings/channels/chan_iax2.c Fri Apr 25 07:17:01 2008
@@ -1509,7 +1509,8 @@
 					res = x;
 				}
 			}
-			ast_mutex_unlock(&iaxsl[x]);
+			if (!res || (res && !return_locked))
+				ast_mutex_unlock(&iaxsl[x]);
 		}
 		for (x=TRUNK_CALL_START;(res < 1) && (x<maxtrunkcall);x++) {
 			ast_mutex_lock(&iaxsl[x]);
@@ -1519,7 +1520,8 @@
 					res = x;
 				}
 			}
-			ast_mutex_unlock(&iaxsl[x]);
+			if (!res || (res && !return_locked))
+				ast_mutex_unlock(&iaxsl[x]);
 		}
 	}
 	if ((res < 1) && (new >= NEW_ALLOW)) {
@@ -1662,7 +1664,7 @@
 				usleep(1);
 				ast_mutex_lock(&iaxsl[callno]);
 			} else {
-				ast_queue_hangup(iaxs[callno]->owner);
+				ast_queue_hangup(iaxs[callno]->owner, -1);
 				ast_channel_unlock(iaxs[callno]->owner);
 				break;
 			}
@@ -2146,7 +2148,7 @@
 			/* If there's an owner, prod it to give up */
 			/* It is ok to use ast_queue_hangup() here instead of iax2_queue_hangup()
 			 * because we already hold the owner channel lock. */
-			ast_queue_hangup(owner);
+			ast_queue_hangup(owner, -1);
 		}
 
 		AST_LIST_LOCK(&frame_queue);
@@ -2220,10 +2222,8 @@
 							ast_log(LOG_WARNING, "Max retries exceeded to host %s on %s (type = %d, subclass = %d, ts=%d, seqno=%d)\n", ast_inet_ntoa(iaxs[f->callno]->addr.sin_addr),iaxs[f->callno]->owner->name , f->af.frametype, f->af.subclass, f->ts, f->oseqno);
 						iaxs[callno]->error = ETIMEDOUT;
 						if (iaxs[callno]->owner) {
-							struct ast_frame fr = { 0, };
+							struct ast_frame fr = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP, .seqno = AST_CAUSE_DESTINATION_OUT_OF_ORDER };
 							/* Hangup the fd */
-							fr.frametype = AST_FRAME_CONTROL;
-							fr.subclass = AST_CONTROL_HANGUP;
 							iax2_queue_frame(callno, &fr); /* XXX */
 							/* Remember, owner could disappear */
 							if (iaxs[callno] && iaxs[callno]->owner)

Modified: team/seanbright/resolve-shadow-warnings/channels/chan_jingle.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/chan_jingle.c?view=diff&rev=114643&r1=114642&r2=114643
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/chan_jingle.c (original)
+++ team/seanbright/resolve-shadow-warnings/channels/chan_jingle.c Fri Apr 25 07:17:01 2008
@@ -573,7 +573,7 @@
 	if (tmp) {
 		tmp->alreadygone = 1;
 		if (tmp->owner)
-			ast_queue_hangup(tmp->owner);
+			ast_queue_hangup(tmp->owner, -1);
 	} else
 		ast_log(LOG_NOTICE, "Whoa, didn't find call!\n");
 	jingle_response(client, pak, NULL, NULL);

Modified: team/seanbright/resolve-shadow-warnings/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/chan_local.c?view=diff&rev=114643&r1=114642&r2=114643
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/chan_local.c (original)
+++ team/seanbright/resolve-shadow-warnings/channels/chan_local.c Fri Apr 25 07:17:01 2008
@@ -505,6 +505,7 @@
 	p->chan->cid.cid_pres = p->owner->cid.cid_pres;
 	ast_string_field_set(p->chan, language, p->owner->language);
 	ast_string_field_set(p->chan, accountcode, p->owner->accountcode);
+	ast_cdr_update(p->chan);
 	p->chan->cdrflags = p->owner->cdrflags;
 
 	/* copy the channel variables from the incoming channel to the outgoing channel */
@@ -533,7 +534,7 @@
 {
 	struct local_pvt *p = ast->tech_pvt;
 	int isoutbound;
-	struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP };
+	struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP, .seqno = ast->hangupcause };
 	struct ast_channel *ochan = NULL;
 	int glaredetect = 0, res = 0;
 
@@ -550,7 +551,13 @@
 			/* Deadlock avoidance */
 			while (p->owner && ast_channel_trylock(p->owner)) {
 				ast_mutex_unlock(&p->lock);
+				if (ast) {
+					ast_channel_unlock(ast);
+				}
 				usleep(1);
+				if (ast) {
+					ast_channel_lock(ast);
+				}
 				ast_mutex_lock(&p->lock);
 			}
 			if (p->owner) {

Modified: team/seanbright/resolve-shadow-warnings/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/chan_mgcp.c?view=diff&rev=114643&r1=114642&r2=114643
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/chan_mgcp.c (original)
+++ team/seanbright/resolve-shadow-warnings/channels/chan_mgcp.c Fri Apr 25 07:17:01 2008
@@ -612,7 +612,7 @@
 	for(;;) {
 		if (sub->owner) {
 			if (!ast_channel_trylock(sub->owner)) {
-				ast_queue_hangup(sub->owner);
+				ast_queue_hangup(sub->owner, -1);
 				ast_channel_unlock(sub->owner);
 				break;
 			} else {

Modified: team/seanbright/resolve-shadow-warnings/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/chan_misdn.c?view=diff&rev=114643&r1=114642&r2=114643
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/chan_misdn.c (original)
+++ team/seanbright/resolve-shadow-warnings/channels/chan_misdn.c Fri Apr 25 07:17:01 2008
@@ -2320,13 +2320,13 @@
 	
 	if (!p) {
 		ast_log(LOG_WARNING, " --> Channel not connected ??\n");
-		ast_queue_hangup(ast);
+		ast_queue_hangup(ast, AST_CAUSE_NETWORK_OUT_OF_ORDER);
 	}
 
 	if (!p->bc) {
 		chan_misdn_log(1, 0, " --> Got Answer, but theres no bc obj ??\n");
 
-		ast_queue_hangup(ast);
+		ast_queue_hangup(ast, AST_CAUSE_PROTOCOL_ERROR);
 	}
 
 	tmp = pbx_builtin_getvar_helper(p->ast, "CRYPT_KEY");
@@ -2533,9 +2533,11 @@
 			start_bc_tones(p);
 		break;
 	case AST_CONTROL_HOLD:
+		ast_moh_start(ast,data,ast->musicclass); 
 		chan_misdn_log(1, p->bc->port, " --> *\tHOLD pid:%d\n", p->bc ? p->bc->pid : -1);
 		break;
 	case AST_CONTROL_UNHOLD:
+		ast_moh_stop(ast);
 		chan_misdn_log(1, p->bc->port, " --> *\tUNHOLD pid:%d\n", p->bc ? p->bc->pid : -1);
 		break;
 	default:
@@ -3663,7 +3665,7 @@
 		send_cause2ast(ch->ast, ch->bc, ch);
 
 		if (ch->ast)
-			ast_queue_hangup(ch->ast);
+			ast_queue_hangup(ch->ast, ch->bc->cause);
 		cb_log(2, port, " --> queue_hangup\n");
 	} else {
 		cb_log(1, port, "Cannot hangup chan, no ast\n");

Modified: team/seanbright/resolve-shadow-warnings/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/chan_oss.c?view=diff&rev=114643&r1=114642&r2=114643
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/chan_oss.c (original)
+++ team/seanbright/resolve-shadow-warnings/channels/chan_oss.c Fri Apr 25 07:17:01 2008
@@ -1040,7 +1040,7 @@
 	}
 	o->hookstate = 0;
 	if (o->owner)
-		ast_queue_hangup(o->owner);
+		ast_queue_hangup(o->owner, AST_CAUSE_NORMAL_CLEARING);
 	setformat(o, O_CLOSE);
 	return CLI_SUCCESS;
 }

Modified: team/seanbright/resolve-shadow-warnings/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/chan_sip.c?view=diff&rev=114643&r1=114642&r2=114643
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/chan_sip.c (original)
+++ team/seanbright/resolve-shadow-warnings/channels/chan_sip.c Fri Apr 25 07:17:01 2008
@@ -2970,7 +2970,7 @@
 		if (pkt->owner->owner) {
 			sip_alreadygone(pkt->owner);
 			ast_log(LOG_WARNING, "Hanging up call %s - no reply to our critical packet.\n", pkt->owner->callid);
-			ast_queue_hangup(pkt->owner->owner);
+			ast_queue_hangup(pkt->owner->owner, AST_CAUSE_PROTOCOL_ERROR);
 			ast_channel_unlock(pkt->owner->owner);
 		} else {
 			/* If no channel owner, destroy now */
@@ -3112,7 +3112,7 @@
 
 	if (p->owner) {
 		ast_log(LOG_WARNING, "Autodestruct on dialog '%s' with owner in place (Method: %s)\n", p->callid, sip_methods[p->method].text);
-		ast_queue_hangup(p->owner);
+		ast_queue_hangup(p->owner, AST_CAUSE_PROTOCOL_ERROR);
 	} else if (p->refer) {
 		ast_debug(3, "Finally hanging up channel after transfer: %s\n", p->callid);
 		transmit_request_with_auth(p, SIP_BYE, 0, XMIT_RELIABLE, 1);
@@ -5266,6 +5266,13 @@
 		ast_log(LOG_WARNING, "old channel wasn't %p but was %p\n", oldchan, p->owner);
 	else {
 		p->owner = newchan;
+		/* Re-invite RTP back to Asterisk. Needed if channel is masqueraded out of a native
+		   RTP bridge (i.e., RTP not going through Asterisk): RTP bridge code might not be
+		   able to do this if the masquerade happens before the bridge breaks (e.g., AMI
+		   redirect of both channels). Note that a channel can not be masqueraded *into*
+		   a native bridge. So there is no danger that this breaks a native bridge that
+		   should stay up. */
+		sip_set_rtp_peer(newchan, NULL, NULL, 0, 0, 0);
 		ret = 0;
 	}
 	ast_debug(3, "SIP Fixup: New owner for dialogue %s: %s (Old parent: %s)\n", p->callid, p->owner->name, oldchan->name);
@@ -9810,7 +9817,6 @@
 	p->refer->status = REFER_SENT;   /* Set refer status */
 
 	reqprep(&req, p, SIP_REFER, 0, 1);
-	add_header(&req, "Max-Forwards", DEFAULT_MAX_FORWARDS);
 
 	add_header(&req, "Refer-To", referto);
 	add_header(&req, "Allow", ALLOWED_METHODS);
@@ -12987,12 +12993,12 @@
 	
 	/* We absolutely cannot destroy the rtp struct while a bridge is active or we WILL crash */
 	if (dialog->rtp && ast_rtp_get_bridged(dialog->rtp)) {
-		ast_verbose("Bridge still active.  Delaying destroy of SIP dialog '%s' Method: %s\n", dialog->callid, sip_methods[dialog->method].text);
+		ast_debug(2, "Bridge still active.  Delaying destroy of SIP dialog '%s' Method: %s\n", dialog->callid, sip_methods[dialog->method].text);
 		return 0;
 	}
 
 	if (dialog->vrtp && ast_rtp_get_bridged(dialog->vrtp)) {
-		ast_verbose("Bridge still active.  Delaying destroy of SIP dialog '%s' Method: %s\n", dialog->callid, sip_methods[dialog->method].text);
+		ast_debug(2, "Bridge still active.  Delaying destroy of SIP dialog '%s' Method: %s\n", dialog->callid, sip_methods[dialog->method].text);
 		return 0;
 	}
 	/* Check RTP timeouts and kill calls if we have a timeout set and do not get RTP */
@@ -15688,7 +15694,7 @@
 		*/
 		xmitres = transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, FALSE);
 		if (p->owner && !req->ignore) {
-			ast_queue_hangup(p->owner);
+			ast_queue_hangup(p->owner, AST_CAUSE_NORMAL_CLEARING);
 			append_history(p, "Hangup", "Got 487 on CANCEL request from us. Queued AST hangup request");
  		} else if (!req->ignore) {
 			update_call_counter(p, DEC_CALL_LIMIT);
@@ -15769,7 +15775,7 @@
 		if (p->owner) {
 			if (!p->refer) {
 				ast_log(LOG_WARNING, "Notify answer on an owned channel? - %s\n", p->owner->name);
-				ast_queue_hangup(p->owner);
+				ast_queue_hangup(p->owner, AST_CAUSE_NORMAL_UNSPECIFIED);
 			} else {
 				ast_debug(4, "Got OK on REFER Notify message\n");
 			}
@@ -16331,7 +16337,7 @@
 				default:
 					/* Send hangup */	
 					if (owner && sipmethod != SIP_MESSAGE && sipmethod != SIP_INFO && sipmethod != SIP_BYE)
-						ast_queue_hangup(p->owner);
+						ast_queue_hangup(p->owner, AST_CAUSE_PROTOCOL_ERROR);
 					break;
 				}
 				/* ACK on invite */
@@ -16385,7 +16391,7 @@
 						ast_debug(1, "Got 200 OK on NOTIFY for transfer\n");
 					} else
 						ast_log(LOG_WARNING, "Notify answer on an owned channel?\n");
-					/* ast_queue_hangup(p->owner); Disabled */
+					/* ast_queue_hangup(p->owner, -1); Disabled */
 				} else {
 					if (!p->subscribed && !p->refer)
 						p->needdestroy = 1;
@@ -16458,6 +16464,7 @@
 				case 488: /* Not acceptable here - codec error */
 				case 603: /* Decline */
 				case 500: /* Server error */
+				case 502: /* Bad gateway */
 				case 503: /* Service Unavailable */
 				case 504: /* Server timeout */
 
@@ -18234,7 +18241,7 @@
 
 	stop_media_flows(p); /* Immediately stop RTP, VRTP and UDPTL as applicable */
 	if (p->owner)
-		ast_queue_hangup(p->owner);
+		ast_queue_hangup(p->owner, -1);
 	else
 		sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
 	if (p->initreq.len > 0) {
@@ -18393,15 +18400,15 @@
 					ast_queue_control(c, AST_CONTROL_UNHOLD);
 					ast_async_goto(bridged_to, p->context, p->refer->refer_to, 1);
 				} else
-					ast_queue_hangup(p->owner);
+					ast_queue_hangup(p->owner, -1);
 			}
 		} else {
 			ast_log(LOG_WARNING, "Invalid transfer information from '%s'\n", ast_inet_ntoa(p->recv.sin_addr));
 			if (p->owner)
-				ast_queue_hangup(p->owner);
+				ast_queue_hangup(p->owner, AST_CAUSE_PROTOCOL_ERROR);
 		}
 	} else if (p->owner) {
-		ast_queue_hangup(p->owner);
+		ast_queue_hangup(p->owner, -1);
 		ast_debug(3, "Received bye, issuing owner hangup\n");
 	} else {
 		sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);

Modified: team/seanbright/resolve-shadow-warnings/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/chan_skinny.c?view=diff&rev=114643&r1=114642&r2=114643
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/chan_skinny.c (original)
+++ team/seanbright/resolve-shadow-warnings/channels/chan_skinny.c Fri Apr 25 07:17:01 2008
@@ -4515,7 +4515,7 @@
 		if ((res = attempt_transfer(p)) < 0) {
 			if (sub->next && sub->next->owner) {
 				sub->next->alreadygone = 1;
-				ast_queue_hangup(sub->next->owner,1);
+				ast_queue_hangup(sub->next->owner, -1);
 			}
 		} else if (res) {
 			ast_log(LOG_WARNING, "Transfer attempt failed\n");
@@ -4527,7 +4527,7 @@
 		/* If there is another active call, skinny_hangup will ring the phone with the other call */
 		if (sub->owner) {
 			sub->alreadygone = 1;
-			ast_queue_hangup(sub->owner);
+			ast_queue_hangup(sub->owner, -1);
 		} else {
 			ast_log(LOG_WARNING, "Skinny(%s@%s-%d) channel already destroyed\n",
 				l->name, d->name, sub->callid);
@@ -5224,7 +5224,7 @@
 				if ((res = attempt_transfer(p)) < 0) {
 					if (sub->next && sub->next->owner) {
 						sub->next->alreadygone = 1;
-						ast_queue_hangup(sub->next->owner, 1);
+						ast_queue_hangup(sub->next->owner, -1);
 					}
 				} else if (res) {
 					ast_log(LOG_WARNING, "Transfer attempt failed\n");
@@ -5236,7 +5236,7 @@
 				/* If there is another active call, skinny_hangup will ring the phone with the other call */
 				if (sub->owner) {
 					sub->alreadygone = 1;
-					ast_queue_hangup(sub->owner);
+					ast_queue_hangup(sub->owner, -1);
 				} else {
 					ast_log(LOG_WARNING, "Skinny(%s@%s-%d) channel already destroyed\n",
 						l->name, d->name, sub->callid);

Modified: team/seanbright/resolve-shadow-warnings/channels/chan_unistim.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/chan_unistim.c?view=diff&rev=114643&r1=114642&r2=114643
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/chan_unistim.c (original)
+++ team/seanbright/resolve-shadow-warnings/channels/chan_unistim.c Fri Apr 25 07:17:01 2008
@@ -1129,7 +1129,7 @@
 				if (sub->owner) {       /* Call in progress ? */
 					if (unistimdebug)
 						ast_verb(0, "Aborting call\n");
-					ast_queue_hangup(sub->owner);
+					ast_queue_hangup(sub->owner, AST_CAUSE_NETWORK_OUT_OF_ORDER);
 				}
 			} else
 				ast_log(LOG_WARNING, "Freeing a client with no subchannel !\n");
@@ -1978,11 +1978,11 @@
 			if (attempt_transfer(sub, l->subs[SUB_THREEWAY]) < 0)
 				ast_verb(0, "attempt_transfer failed.\n");
 		} else
-			ast_queue_hangup(sub->owner);
+			ast_queue_hangup(sub->owner, -1);
 	} else {
 		if (l->subs[SUB_THREEWAY]) {
 			if (l->subs[SUB_THREEWAY]->owner)
-				ast_queue_hangup(l->subs[SUB_THREEWAY]->owner);
+				ast_queue_hangup(l->subs[SUB_THREEWAY]->owner, AST_CAUSE_NORMAL_CLEARING);
 			else
 				ast_log(LOG_WARNING, "threeway sub without owner\n");
 		} else
@@ -2316,7 +2316,7 @@
 		if (unistimdebug)
 			ast_verb(0, "Transfer canceled, hangup our threeway channel\n");
 		if (p->subs[SUB_THREEWAY]->owner)
-			ast_queue_hangup(p->subs[SUB_THREEWAY]->owner);
+			ast_queue_hangup(p->subs[SUB_THREEWAY]->owner, AST_CAUSE_NORMAL_CLEARING);
 		else
 			ast_log(LOG_WARNING, "Canceling a threeway channel without owner\n");
 		return;
@@ -2372,7 +2372,7 @@
 			/* start switch */
 			if (ast_pthread_create(&t, NULL, unistim_ss, c)) {
 				display_last_error("Unable to create switch thread");
-				ast_queue_hangup(c);
+				ast_queue_hangup(c, AST_CAUSE_SWITCH_CONGESTION);
 			}
 		} else
 			ast_log(LOG_WARNING, "Unable to create channel for %s@%s\n",

Modified: team/seanbright/resolve-shadow-warnings/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/chan_zap.c?view=diff&rev=114643&r1=114642&r2=114643
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/chan_zap.c (original)
+++ team/seanbright/resolve-shadow-warnings/channels/chan_zap.c Fri Apr 25 07:17:01 2008

[... 401 lines stripped ...]



More information about the asterisk-commits mailing list