[asterisk-commits] qwell: branch qwell/fun_with_transports r387480 - in /team/qwell/fun_with_tra...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 2 14:03:56 CDT 2013


Author: qwell
Date: Thu May  2 14:03:45 2013
New Revision: 387480

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=387480
Log:
Multiple revisions 387111,387139,387189,387219,387267,387302,387349,387394,387416,387427

........
  r387111 | root | 2013-05-01 12:17:57 -0500 (Wed, 01 May 2013) | 5 lines
  
  Move some annoying chan_dahdi debug messages to level 5.
  ........
  
  Merged revisions 387108 from file:///srv/subversion/repos/asterisk/trunk
........
  r387139 | root | 2013-05-01 14:17:57 -0500 (Wed, 01 May 2013) | 19 lines
  
  Prevent crash in 'sip show peers' when the number of peers on a system is large
  
  When you have lots of SIP peers (according to the issue reporter, around 3500),
  the 'sip show peers' CLI command or AMI action can crash due to a poorly placed
  string duplication that occurs on the stack. This patch refactors the command
  to not allocate the string on the stack, and handles the formatting of a single
  peer in a separate function call.
  
  (closes issue ASTERISK-21466)
  Reported by: Guillaume Knispel
  patches:
    fix_sip_show_peers_stack_overflow_asterisk_11.3.0-v2.patch uploaded by gknispel (License 6492)
  ........
  
  Merged revisions 387134 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 387135 from file:///srv/subversion/repos/asterisk/trunk
........
  r387189 | root | 2013-05-01 15:18:17 -0500 (Wed, 01 May 2013) | 26 lines
  
  Multiple revisions 387181-387185
  
  ........
    r387181 | rmudgett | 2013-05-01 15:00:31 -0500 (Wed, 01 May 2013) | 1 line
    
    Remove some unnecessary calls to ast_bridged_channel() in chan_dahdi.c/sig_analog.c
  ........
    r387182 | rmudgett | 2013-05-01 15:00:53 -0500 (Wed, 01 May 2013) | 1 line
    
    Remove some unnecessary calls to ast_bridged_channel() in chan_iax2.c
  ........
    r387183 | rmudgett | 2013-05-01 15:01:10 -0500 (Wed, 01 May 2013) | 1 line
    
    Remove some unnecessary calls to ast_bridged_channel() in chan_skinny.c
  ........
    r387184 | rmudgett | 2013-05-01 15:01:27 -0500 (Wed, 01 May 2013) | 1 line
    
    Remove some unnecessary calls to ast_bridged_channel() in chan_mgcp.c
  ........
    r387185 | rmudgett | 2013-05-01 15:01:43 -0500 (Wed, 01 May 2013) | 1 line
    
    Remove some unnecessary calls to ast_bridged_channel() in chan_unistim.c
  ........
  
  Merged revisions 387181-387185 from file:///srv/subversion/repos/asterisk/trunk
........
  r387219 | root | 2013-05-01 16:18:13 -0500 (Wed, 01 May 2013) | 28 lines
  
  Multiple revisions 387209-387212
  
  ........
    r387209 | rmudgett | 2013-05-01 15:35:25 -0500 (Wed, 01 May 2013) | 5 lines
    
    Make mod_load_cmp() not as klunky.
    
    There is a reason the heap comparison functions like qsort(), and other
    comparison functions specify <0, >0, and =0 for the return values.
  ........
    r387210 | rmudgett | 2013-05-01 15:53:30 -0500 (Wed, 01 May 2013) | 1 line
    
    Whitespace changes.
  ........
    r387211 | rmudgett | 2013-05-01 15:59:29 -0500 (Wed, 01 May 2013) | 5 lines
    
    Make chan_local locals container an explicit list container.
    
    Pretending that chan_local locals container can have more than one bucket
    is silly.  The container has no key to help search.
  ........
    r387212 | rmudgett | 2013-05-01 16:09:14 -0500 (Wed, 01 May 2013) | 1 line
    
    Trivial changes. Comments, parentheses, spelling, wording.
  ........
  
  Merged revisions 387209-387212 from file:///srv/subversion/repos/asterisk/trunk
........
  r387267 | root | 2013-05-01 17:18:09 -0500 (Wed, 01 May 2013) | 44 lines
  
  Multiple revisions 387220,387260-387261
  
  ........
    r387220 | mjordan | 2013-05-01 16:18:24 -0500 (Wed, 01 May 2013) | 20 lines
    
    Clear the DTMF sending digit tracking on off nominal paths
    
    In certain situations, when the RTP engine goes to send a DTMF end digit
    it may be in a situation where the remote address is no longer available,
    or the digit that was supposed to be sent is invalid. In such cases, we
    need to clear the RTP counters appropriately. Otherwise, when the RTP
    source is set again, we'll continue to think that we're in the middle of
    sending a DTMF digit, which can confuse the remote party (signficantly).
    
    (closes issue ASTERISK-21522)
    Reported by: Corey Farrell
    patches:
      rtp_dtmf_process_end.patch uploaded by Corey Farrell (License 5909)
    ........
    
    Merged revisions 387213 from http://svn.asterisk.org/svn/asterisk/branches/1.8
    ........
    
    Merged revisions 387216 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
    r387260 | rmudgett | 2013-05-01 16:35:53 -0500 (Wed, 01 May 2013) | 10 lines
    
    Cleanup chan_local.c:local_new().
    
    * Remove t and ama local variables.  There is no way they could be
    anything other than default because p->owner can only be NULL at this
    point.
    
    * Rename tmp and tmp2 to owner and chan respectively.
    
    * Remove redundant initialization of channel context, exten, priority.
  ........
    r387261 | rmudgett | 2013-05-01 16:55:53 -0500 (Wed, 01 May 2013) | 2 lines
    
    Simplify chan_local.c:manager_optimize_away() using ao2_find().
  ........
  
  Merged revisions 387220,387260-387261 from file:///srv/subversion/repos/asterisk/trunk
........
  r387302 | root | 2013-05-02 02:18:01 -0500 (Thu, 02 May 2013) | 50 lines
  
  Multiple revisions 387296,387299
  
  ........
    r387296 | alecdavis | 2013-05-02 01:47:16 -0500 (Thu, 02 May 2013) | 24 lines
    
    Add Asterisk Version to core show locks
    
    Assist with reporting 'core show locks' when submitting bug reports.
    
    Example below:
    
    ===========================
    == SVN-branch-1.8-...
    == Currently Held Locks
    ===========================
    
    
    (closes issue ASTERISK-21743)
    
    Reported by: alecdavis
    Tested by: alecdavis
    alecdavis (license 585)
    ........
    
    Merged revisions 387294 from http://svn.asterisk.org/svn/asterisk/branches/1.8
    ........
    
    Merged revisions 387295 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
    r387299 | alecdavis | 2013-05-02 01:57:04 -0500 (Thu, 02 May 2013) | 16 lines
    
    chan_dahdi: fix lower bound check with -ve integer conversion from a float 
    
    Lower bound of a 16bit signed int is -32768 not -32767
    
    (closes issue ASTERISK-21744)
    
    Reported by: alecdavis
    Tested by: alecdavis
    alecdavis (license 585)
    ........
    
    Merged revisions 387297 from http://svn.asterisk.org/svn/asterisk/branches/1.8
    ........
    
    Merged revisions 387298 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 387296,387299 from file:///srv/subversion/repos/asterisk/trunk
........
  r387349 | root | 2013-05-02 03:18:16 -0500 (Thu, 02 May 2013) | 39 lines
  
  chan_sip: Honor Session-Expires in 200OK response when it's a RE-INVITE when asterisk is the refresher.
  
  RFC 4028 Section 7.2
   "UACs MUST be prepared to receive a Session-Expires header field in a
   response, even if none were present in the request." 
  
  What changed
    After ASTERISK-20787, inbound calls to asterisk with no Session-Expires in the INVITE are now are offered
    a Session-Expires (1800 asterisk default) in the response, with asterisk as the refresher.
  
  Symptom:
    After 900 seconds (asterisk default refresher period 1800), asterisk RE-INVITEs the device, the device
     may respond with a much lower Session-Expires (180 in our case) value that it is now using.
  
    Asterisk ignores this response, as it's deemed both an INBOUND CALL, and a RE-INVITE.
  
    After 180 seconds the device times out and sends BYE (hangs up), asterisk is still working with the
    refresher period of 1800 as it ignored the 'Session Expires: 180' in the previous 200OK response.
   
  Fix:
  	handle_response_invite() when 200OK, remove check for outbound and reinvite.
    
  (closes issue ASTERISK-21664)
  
  Reported by: alecdavis
  Tested by: alecdavis
  alecdavis (license 585)
  
  Review https://reviewboard.asterisk.org/r/2463/
  ........
  
  Merged revisions 387312 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 387319 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 387327 from file:///srv/subversion/repos/asterisk/trunk
........
  r387394 | root | 2013-05-02 04:19:30 -0500 (Thu, 02 May 2013) | 31 lines
  
  chan_sip: Session-Expires: Set timer to correctly expire at (~2/3) of the interval when not the refresher
  
  RFC 4028 Section 10
  	if the side not performing refreshes does not receive a
  	session refresh request before the session expiration, it SHOULD send
  	a BYE to terminate the session, slightly before the session
  	expiration.  The minimum of 32 seconds and one third of the session
  	interval is RECOMMENDED.
  
  Prior to this asterisk would refresh at 1/2 the Session-Expires interval,
  or if the remote device was the refresher, asterisk would timeout at interval end.
  
  Now, when not refresher, timeout as per RFC noted above.
  
  (closes issue ASTERISK-21742)
  
  Reported by: alecdavis
  Tested by: alecdavis
  alecdavis (license 585)
  
  Review https://reviewboard.asterisk.org/r/2488/
  ........
  
  Merged revisions 387344 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 387345 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 387369 from file:///srv/subversion/repos/asterisk/trunk
........
  r387416 | qwell | 2013-05-02 10:58:39 -0500 (Thu, 02 May 2013) | 5 lines
  
  Send a 181 for forwarded calls.
  
  (closes issue ASTERISK-21435)
  Review: https://reviewboard.asterisk.org/r/2484/
........
  r387427 | root | 2013-05-02 12:18:13 -0500 (Thu, 02 May 2013) | 25 lines
  
  Multiple revisions 387420,387423
  
  ........
    r387420 | jrose | 2013-05-02 11:39:28 -0500 (Thu, 02 May 2013) | 2 lines
    
    Putting all event defs and names back for now due to res_corosync dependency
  ........
    r387423 | mjordan | 2013-05-02 12:15:46 -0500 (Thu, 02 May 2013) | 13 lines
    
    Update utils Makefile to handle r387294
    
    Alec's patch that added the Asterisk version to 'core show locks' angered the
    items in utils, as they exist somewhat outside of the Asterisk build system.
    Some day, this Makefile should get nuked from high orbit, but for now, include
    version.c in its list of stuff to pile in.
    ........
    
    Merged revisions 387421 from http://svn.asterisk.org/svn/asterisk/branches/1.8
    ........
    
    Merged revisions 387422 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 387420,387423 from file:///srv/subversion/repos/asterisk/trunk
........

Merged revisions 387111,387139,387189,387219,387267,387302,387349,387394,387416,387427 from http://svn.asterisk.org/svn/asterisk/team/group/pimp_my_sip

Modified:
    team/qwell/fun_with_transports/   (props changed)
    team/qwell/fun_with_transports/channels/chan_dahdi.c
    team/qwell/fun_with_transports/channels/chan_gulp.c
    team/qwell/fun_with_transports/channels/chan_iax2.c
    team/qwell/fun_with_transports/channels/chan_local.c
    team/qwell/fun_with_transports/channels/chan_mgcp.c
    team/qwell/fun_with_transports/channels/chan_sip.c
    team/qwell/fun_with_transports/channels/chan_skinny.c
    team/qwell/fun_with_transports/channels/chan_unistim.c
    team/qwell/fun_with_transports/channels/sig_analog.c
    team/qwell/fun_with_transports/channels/sip/include/sip.h
    team/qwell/fun_with_transports/include/asterisk/event_defs.h
    team/qwell/fun_with_transports/main/event.c
    team/qwell/fun_with_transports/main/loader.c
    team/qwell/fun_with_transports/main/utils.c
    team/qwell/fun_with_transports/res/res_rtp_asterisk.c
    team/qwell/fun_with_transports/utils/Makefile

Propchange: team/qwell/fun_with_transports/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/qwell/fun_with_transports/
------------------------------------------------------------------------------
--- pimp_my_sip-integrated (original)
+++ pimp_my_sip-integrated Thu May  2 14:03:45 2013
@@ -1,1 +1,1 @@
-/team/group/pimp_my_sip:1-387077,386867,387097
+/team/group/pimp_my_sip:1-387479

Modified: team/qwell/fun_with_transports/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/channels/chan_dahdi.c?view=diff&rev=387480&r1=387479&r2=387480
==============================================================================
--- team/qwell/fun_with_transports/channels/chan_dahdi.c (original)
+++ team/qwell/fun_with_transports/channels/chan_dahdi.c Thu May  2 14:03:45 2013
@@ -5150,9 +5150,12 @@
 				if (drc) {
 					k = drc_sample(k, drc);
 				}
-				k = (float)k*linear_gain;
-				if (k > 32767) k = 32767;
-				if (k < -32767) k = -32767;
+				k = (float)k * linear_gain;
+				if (k > 32767) {
+					k = 32767;
+				} else if (k < -32768) {
+					k = -32768;
+				}
 				g->txgain[j] = AST_LIN2A(k);
 			} else {
 				g->txgain[j] = j;
@@ -5166,9 +5169,12 @@
 				if (drc) {
 					k = drc_sample(k, drc);
 				}
-				k = (float)k*linear_gain;
-				if (k > 32767) k = 32767;
-				if (k < -32767) k = -32767;
+				k = (float)k * linear_gain;
+				if (k > 32767) {
+					k = 32767;
+				} else if (k < -32768) {
+					k = -32768;
+				}
 				g->txgain[j] = AST_LIN2MU(k);
 
 			} else {
@@ -5193,9 +5199,12 @@
 				if (drc) {
 					k = drc_sample(k, drc);
 				}
-				k = (float)k*linear_gain;
-				if (k > 32767) k = 32767;
-				if (k < -32767) k = -32767;
+				k = (float)k * linear_gain;
+				if (k > 32767) {
+					k = 32767;
+				} else if (k < -32768) {
+					k = -32768;
+				}
 				g->rxgain[j] = AST_LIN2A(k);
 			} else {
 				g->rxgain[j] = j;
@@ -5209,9 +5218,12 @@
 				if (drc) {
 					k = drc_sample(k, drc);
 				}
-				k = (float)k*linear_gain;
-				if (k > 32767) k = 32767;
-				if (k < -32767) k = -32767;
+				k = (float)k * linear_gain;
+				if (k > 32767) {
+					k = 32767;
+				} else if (k < -32768) {
+					k = -32768;
+				}
 				g->rxgain[j] = AST_LIN2MU(k);
 			} else {
 				g->rxgain[j] = j;
@@ -6547,8 +6559,7 @@
 				p->owner = p->subs[SUB_REAL].owner;
 				if (ast_channel_state(p->owner) != AST_STATE_UP)
 					p->subs[SUB_REAL].needanswer = 1;
-				if (ast_bridged_channel(p->subs[SUB_REAL].owner))
-					ast_queue_control(p->subs[SUB_REAL].owner, AST_CONTROL_UNHOLD);
+				ast_queue_control(p->subs[SUB_REAL].owner, AST_CONTROL_UNHOLD);
 			} else if (p->subs[SUB_THREEWAY].dfd > -1) {
 				swap_subs(p, SUB_THREEWAY, SUB_REAL);
 				unalloc_sub(p, SUB_THREEWAY);
@@ -6569,7 +6580,7 @@
 			if (p->subs[SUB_CALLWAIT].inthreeway) {
 				/* This is actually part of a three way, placed on hold.  Place the third part
 				   on music on hold now */
-				if (p->subs[SUB_THREEWAY].owner && ast_bridged_channel(p->subs[SUB_THREEWAY].owner)) {
+				if (p->subs[SUB_THREEWAY].owner) {
 					ast_queue_control_data(p->subs[SUB_THREEWAY].owner, AST_CONTROL_HOLD,
 						S_OR(p->mohsuggest, NULL),
 						!ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
@@ -6584,7 +6595,7 @@
 			if (p->subs[SUB_CALLWAIT].inthreeway) {
 				/* The other party of the three way call is currently in a call-wait state.
 				   Start music on hold for them, and take the main guy out of the third call */
-				if (p->subs[SUB_CALLWAIT].owner && ast_bridged_channel(p->subs[SUB_CALLWAIT].owner)) {
+				if (p->subs[SUB_CALLWAIT].owner) {
 					ast_queue_control_data(p->subs[SUB_CALLWAIT].owner, AST_CONTROL_HOLD,
 						S_OR(p->mohsuggest, NULL),
 						!ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
@@ -7838,11 +7849,10 @@
 	   together (but then, why would we want to?) */
 	if (ast_bridged_channel(p->subs[SUB_REAL].owner)) {
 		/* The three-way person we're about to transfer to could still be in MOH, so
-		   stop if now if appropriate */
-		if (ast_bridged_channel(p->subs[SUB_THREEWAY].owner))
-			ast_queue_control(p->subs[SUB_THREEWAY].owner, AST_CONTROL_UNHOLD);
+		   stop it now */
+		ast_queue_control(p->subs[SUB_THREEWAY].owner, AST_CONTROL_UNHOLD);
 		if (ast_channel_state(p->subs[SUB_REAL].owner) == AST_STATE_RINGING) {
-			ast_indicate(ast_bridged_channel(p->subs[SUB_REAL].owner), AST_CONTROL_RINGING);
+			ast_queue_control(p->subs[SUB_REAL].owner, AST_CONTROL_RINGING);
 		}
 		if (ast_channel_state(p->subs[SUB_THREEWAY].owner) == AST_STATE_RING) {
 			tone_zone_play_tone(p->subs[SUB_THREEWAY].dfd, DAHDI_TONE_RINGTONE);
@@ -7858,7 +7868,7 @@
 	} else if (ast_bridged_channel(p->subs[SUB_THREEWAY].owner)) {
 		ast_queue_control(p->subs[SUB_REAL].owner, AST_CONTROL_UNHOLD);
 		if (ast_channel_state(p->subs[SUB_THREEWAY].owner) == AST_STATE_RINGING) {
-			ast_indicate(ast_bridged_channel(p->subs[SUB_THREEWAY].owner), AST_CONTROL_RINGING);
+			ast_queue_control(p->subs[SUB_THREEWAY].owner, AST_CONTROL_RINGING);
 		}
 		if (ast_channel_state(p->subs[SUB_REAL].owner) == AST_STATE_RING) {
 			tone_zone_play_tone(p->subs[SUB_REAL].dfd, DAHDI_TONE_RINGTONE);
@@ -8524,8 +8534,7 @@
 				/* Make sure it stops ringing */
 				dahdi_set_hook(p->subs[idx].dfd, DAHDI_OFFHOOK);
 				/* Okay -- probably call waiting*/
-				if (ast_bridged_channel(p->owner))
-					ast_queue_control(p->owner, AST_CONTROL_UNHOLD);
+				ast_queue_control(p->owner, AST_CONTROL_UNHOLD);
 				p->subs[idx].needunhold = 1;
 				break;
 			case AST_STATE_RESERVED:
@@ -8679,17 +8688,15 @@
 				p->cidcwexpire = 0;
 				p->cid_suppress_expire = 0;
 				/* Start music on hold if appropriate */
-				if (!p->subs[SUB_CALLWAIT].inthreeway && ast_bridged_channel(p->subs[SUB_CALLWAIT].owner)) {
+				if (!p->subs[SUB_CALLWAIT].inthreeway) {
 					ast_queue_control_data(p->subs[SUB_CALLWAIT].owner, AST_CONTROL_HOLD,
 						S_OR(p->mohsuggest, NULL),
 						!ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
 				}
 				p->subs[SUB_CALLWAIT].needhold = 1;
-				if (ast_bridged_channel(p->subs[SUB_REAL].owner)) {
-					ast_queue_control_data(p->subs[SUB_REAL].owner, AST_CONTROL_HOLD,
-						S_OR(p->mohsuggest, NULL),
-						!ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
-				}
+				ast_queue_control_data(p->subs[SUB_REAL].owner, AST_CONTROL_HOLD,
+					S_OR(p->mohsuggest, NULL),
+					!ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
 				p->subs[SUB_REAL].needunhold = 1;
 			} else if (!p->subs[SUB_THREEWAY].owner) {
 				if (!p->threewaycalling) {
@@ -8766,12 +8773,10 @@
 					} else {
 						ast_verb(3, "Started three way call on channel %d\n", p->channel);
 
-						/* Start music on hold if appropriate */
-						if (ast_bridged_channel(p->subs[SUB_THREEWAY].owner)) {
-							ast_queue_control_data(p->subs[SUB_THREEWAY].owner, AST_CONTROL_HOLD,
-								S_OR(p->mohsuggest, NULL),
-								!ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
-						}
+						/* Start music on hold */
+						ast_queue_control_data(p->subs[SUB_THREEWAY].owner, AST_CONTROL_HOLD,
+							S_OR(p->mohsuggest, NULL),
+							!ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
 						p->subs[SUB_THREEWAY].needhold = 1;
 					}
 					ast_callid_threadstorage_auto_clean(callid, callid_created);
@@ -8808,7 +8813,7 @@
 							swap_subs(p, SUB_THREEWAY, SUB_REAL);
 							otherindex = SUB_REAL;
 						}
-						if (p->subs[otherindex].owner && ast_bridged_channel(p->subs[otherindex].owner))
+						if (p->subs[otherindex].owner)
 							ast_queue_control(p->subs[otherindex].owner, AST_CONTROL_UNHOLD);
 						p->subs[otherindex].needunhold = 1;
 						p->owner = p->subs[SUB_REAL].owner;
@@ -8817,7 +8822,7 @@
 						swap_subs(p, SUB_THREEWAY, SUB_REAL);
 						ast_channel_softhangup_internal_flag_add(p->subs[SUB_THREEWAY].owner, AST_SOFTHANGUP_DEV);
 						p->owner = p->subs[SUB_REAL].owner;
-						if (p->subs[SUB_REAL].owner && ast_bridged_channel(p->subs[SUB_REAL].owner))
+						if (p->subs[SUB_REAL].owner)
 							ast_queue_control(p->subs[SUB_REAL].owner, AST_CONTROL_UNHOLD);
 						p->subs[SUB_REAL].needunhold = 1;
 						dahdi_enable_ec(p);
@@ -9011,7 +9016,7 @@
 			(res != DAHDI_EVENT_HOOKCOMPLETE)) {
 			ast_debug(1, "Restoring owner of channel %d on event %d\n", p->channel, res);
 			p->owner = p->subs[SUB_REAL].owner;
-			if (p->owner && ast_bridged_channel(p->owner))
+			if (p->owner)
 				ast_queue_control(p->owner, AST_CONTROL_UNHOLD);
 			p->subs[SUB_REAL].needunhold = 1;
 		}
@@ -9056,8 +9061,7 @@
 				p->callwaitingrepeat = 0;
 				p->cidcwexpire = 0;
 				p->cid_suppress_expire = 0;
-				if (ast_bridged_channel(p->owner))
-					ast_queue_control(p->owner, AST_CONTROL_UNHOLD);
+				ast_queue_control(p->owner, AST_CONTROL_UNHOLD);
 				p->subs[SUB_REAL].needunhold = 1;
 			} else
 				ast_log(LOG_WARNING, "Absorbed on hook, but nobody is left!?!?\n");
@@ -9605,15 +9609,15 @@
 		return -1;
 	}
 	if (p->dialing) {
-		ast_debug(1, "Dropping frame since I'm still dialing on %s...\n",ast_channel_name(ast));
+		ast_debug(5, "Dropping frame since I'm still dialing on %s...\n",ast_channel_name(ast));
 		return 0;
 	}
 	if (!p->owner) {
-		ast_debug(1, "Dropping frame since there is no active owner on %s...\n",ast_channel_name(ast));
+		ast_debug(5, "Dropping frame since there is no active owner on %s...\n",ast_channel_name(ast));
 		return 0;
 	}
 	if (p->cidspill) {
-		ast_debug(1, "Dropping frame since I've still got a callerid spill on %s...\n",
+		ast_debug(5, "Dropping frame since I've still got a callerid spill on %s...\n",
 			ast_channel_name(ast));
 		return 0;
 	}
@@ -10694,8 +10698,7 @@
 					swap_subs(p, SUB_REAL, SUB_THREEWAY);
 					unalloc_sub(p, SUB_THREEWAY);
 					p->owner = p->subs[SUB_REAL].owner;
-					if (ast_bridged_channel(p->subs[SUB_REAL].owner))
-						ast_queue_control(p->subs[SUB_REAL].owner, AST_CONTROL_UNHOLD);
+					ast_queue_control(p->subs[SUB_REAL].owner, AST_CONTROL_UNHOLD);
 					ast_hangup(chan);
 					goto quit;
 				} else {

Modified: team/qwell/fun_with_transports/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/channels/chan_gulp.c?view=diff&rev=387480&r1=387479&r2=387480
==============================================================================
--- team/qwell/fun_with_transports/channels/chan_gulp.c (original)
+++ team/qwell/fun_with_transports/channels/chan_gulp.c Thu May  2 14:03:45 2013
@@ -770,6 +770,13 @@
 	case AST_CONTROL_SRCUPDATE:
 		break;
 	case AST_CONTROL_SRCCHANGE:
+		break;
+	case AST_CONTROL_REDIRECTING:
+		if (ast_channel_state(ast) != AST_STATE_UP) {
+			response_code = 181;
+		} else {
+			res = -1;
+		}
 		break;
 	case -1:
 		res = -1;

Modified: team/qwell/fun_with_transports/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/channels/chan_iax2.c?view=diff&rev=387480&r1=387479&r2=387480
==============================================================================
--- team/qwell/fun_with_transports/channels/chan_iax2.c (original)
+++ team/qwell/fun_with_transports/channels/chan_iax2.c Thu May  2 14:03:45 2013
@@ -10426,21 +10426,21 @@
 
 					ast_set_flag64(iaxs[fr->callno], IAX_QUELCH);
 					if (ies.musiconhold) {
+						const char *moh_suggest;
+
 						iax2_lock_owner(fr->callno);
 						if (!iaxs[fr->callno] || !iaxs[fr->callno]->owner) {
 							break;
 						}
-						if (ast_bridged_channel(iaxs[fr->callno]->owner)) {
-							const char *moh_suggest = iaxs[fr->callno]->mohsuggest;
-
-							/*
-							 * We already hold the owner lock so we do not
-							 * need to check iaxs[fr->callno] after it returns.
-							 */
-							iax2_queue_control_data(fr->callno, AST_CONTROL_HOLD, 
-								S_OR(moh_suggest, NULL),
-								!ast_strlen_zero(moh_suggest) ? strlen(moh_suggest) + 1 : 0);
-						}
+
+						/*
+						 * We already hold the owner lock so we do not
+						 * need to check iaxs[fr->callno] after it returns.
+						 */
+						moh_suggest = iaxs[fr->callno]->mohsuggest;
+						iax2_queue_control_data(fr->callno, AST_CONTROL_HOLD,
+							S_OR(moh_suggest, NULL),
+							!ast_strlen_zero(moh_suggest) ? strlen(moh_suggest) + 1 : 0);
 						ast_channel_unlock(iaxs[fr->callno]->owner);
 					}
 				}
@@ -10465,13 +10465,12 @@
 					if (!iaxs[fr->callno]->owner) {
 						break;
 					}
-					if (ast_bridged_channel(iaxs[fr->callno]->owner)) {
-						/*
-						 * We already hold the owner lock so we do not
-						 * need to check iaxs[fr->callno] after it returns.
-						 */
-						iax2_queue_control_data(fr->callno, AST_CONTROL_UNHOLD, NULL, 0);
-					}
+
+					/*
+					 * We already hold the owner lock so we do not
+					 * need to check iaxs[fr->callno] after it returns.
+					 */
+					iax2_queue_control_data(fr->callno, AST_CONTROL_UNHOLD, NULL, 0);
 					ast_channel_unlock(iaxs[fr->callno]->owner);
 				}
 				break;

Modified: team/qwell/fun_with_transports/channels/chan_local.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/channels/chan_local.c?view=diff&rev=387480&r1=387479&r2=387480
==============================================================================
--- team/qwell/fun_with_transports/channels/chan_local.c (original)
+++ team/qwell/fun_with_transports/channels/chan_local.c Thu May  2 14:03:45 2013
@@ -21,7 +21,7 @@
  * \author Mark Spencer <markster at digium.com>
  *
  * \brief Local Proxy Channel
- * 
+ *
  * \ingroup channel_drivers
  */
 
@@ -77,11 +77,6 @@
 static const char tdesc[] = "Local Proxy Channel Driver";
 
 #define IS_OUTBOUND(a,b) (a == b->chan ? 1 : 0)
-
-/* right now we are treating the locals astobj2 container as a
- * list.  If there is ever a reason to make this more efficient
- * increasing the bucket size would help. */
-static const int BUCKET_SIZE = 1;
 
 static struct ao2_container *locals;
 
@@ -136,21 +131,21 @@
 	.setoption = local_setoption,
 };
 
-/*! \brief the local pvt structure for all channels
-
-	The local channel pvt has two ast_chan objects - the "owner" and the "next channel", the outbound channel
-
-	ast_chan owner -> local_pvt -> ast_chan chan -> yet-another-pvt-depending-on-channel-type
-
-*/
+/*!
+ * \brief the local pvt structure for all channels
+ *
+ * The local channel pvt has two ast_chan objects - the "owner" and the "next channel", the outbound channel
+ *
+ * ast_chan owner -> local_pvt -> ast_chan chan -> yet-another-pvt-depending-on-channel-type
+ */
 struct local_pvt {
+	struct ast_channel *owner;      /*!< Master Channel - Bridging happens here */
+	struct ast_channel *chan;       /*!< Outbound channel - PBX is run here */
+	struct ast_format_cap *reqcap;  /*!< Requested format capabilities */
+	struct ast_jb_conf jb_conf;     /*!< jitterbuffer configuration for this local channel */
 	unsigned int flags;             /*!< Private flags */
 	char context[AST_MAX_CONTEXT];  /*!< Context to call */
 	char exten[AST_MAX_EXTENSION];  /*!< Extension to call */
-	struct ast_format_cap *reqcap;  /*!< Requested format capabilities */
-	struct ast_jb_conf jb_conf;     /*!< jitterbuffer configuration for this local channel */
-	struct ast_channel *owner;      /*!< Master Channel - Bridging happens here */
-	struct ast_channel *chan;       /*!< Outbound channel - PBX is run here */
 };
 
 #define LOCAL_ALREADY_MASQED  (1 << 0) /*!< Already masqueraded */
@@ -218,7 +213,7 @@
 }
 
 /* Called with ast locked */
-static int local_setoption(struct ast_channel *ast, int option, void * data, int datalen)
+static int local_setoption(struct ast_channel *ast, int option, void *data, int datalen)
 {
 	int res = 0;
 	struct local_pvt *p;
@@ -296,7 +291,7 @@
 	if (!context) {
 		ast_log(LOG_WARNING,
 			"Someone used Local/%s somewhere without a @context. This is bad.\n", data);
-		return AST_DEVICE_INVALID;	
+		return AST_DEVICE_INVALID;
 	}
 	*context++ = '\0';
 
@@ -409,7 +404,8 @@
 	return res;
 }
 
-/*! \brief queue a frame on a to either the p->owner or p->chan
+/*!
+ * \brief queue a frame onto either the p->owner or p->chan
  *
  * \note the local_pvt MUST have it's ref count bumped before entering this function and
  * decremented after this function is called.  This is a side effect of the deadlock
@@ -424,7 +420,6 @@
 
 	/* Recalculate outbound channel */
 	other = isoutbound ? p->owner : p->chan;
-
 	if (!other) {
 		return 0;
 	}
@@ -472,6 +467,7 @@
 	if (isoutbound) {
 		/* Pass along answer since somebody answered us */
 		struct ast_frame answer = { AST_FRAME_CONTROL, { AST_CONTROL_ANSWER } };
+
 		res = local_queue_frame(p, isoutbound, &answer, ast, 1);
 	} else {
 		ast_log(LOG_WARNING, "Huh?  Local is being asked to answer?\n");
@@ -685,7 +681,9 @@
 	}
 
 	/* Do not let a masquerade cause a Local channel to be bridged to itself! */
-	if (!ast_check_hangup(newchan) && ((p->owner && ast_channel_internal_bridged_channel(p->owner) == p->chan) || (p->chan && ast_channel_internal_bridged_channel(p->chan) == p->owner))) {
+	if (!ast_check_hangup(newchan)
+		&& ((p->owner && ast_channel_internal_bridged_channel(p->owner) == p->chan)
+			|| (p->chan && ast_channel_internal_bridged_channel(p->chan) == p->owner))) {
 		ast_log(LOG_WARNING, "You can not bridge a Local channel to itself!\n");
 		ao2_unlock(p);
 		ast_queue_hangup(newchan);
@@ -717,6 +715,7 @@
 	} else if (condition == AST_CONTROL_CONNECTED_LINE || condition == AST_CONTROL_REDIRECTING) {
 		struct ast_channel *this_channel;
 		struct ast_channel *the_other_channel;
+
 		/* A connected line update frame may only contain a partial amount of data, such
 		 * as just a source, or just a ton, and not the full amount of information. However,
 		 * the collected information is all stored in the outgoing channel's connectedline
@@ -735,6 +734,7 @@
 		}
 		if (the_other_channel) {
 			unsigned char frame_data[1024];
+
 			if (condition == AST_CONTROL_CONNECTED_LINE) {
 				if (isoutbound) {
 					ast_connected_line_copy_to_caller(ast_channel_caller(the_other_channel), ast_channel_connected(this_channel));
@@ -763,10 +763,10 @@
 			f.datalen = datalen;
 			res = local_queue_frame(p, isoutbound, &f, ast, 1);
 
-			if (!res && (condition == AST_CONTROL_T38_PARAMETERS) &&
-			    (datalen == sizeof(struct ast_control_t38_parameters))) {
+			if (!res && condition == AST_CONTROL_T38_PARAMETERS
+				&& datalen == sizeof(struct ast_control_t38_parameters)) {
 				const struct ast_control_t38_parameters *parameters = data;
-				
+
 				if (parameters->request_response == AST_T38_REQUEST_PARMS) {
 					res = AST_T38_REQUEST_PARMS;
 				}
@@ -967,7 +967,7 @@
 		S_COR(ast_channel_caller(owner)->id.number.valid, ast_channel_caller(owner)->id.number.str, NULL))) {
 		ast_log(LOG_NOTICE, "No such extension/context %s@%s while calling Local channel\n", exten, context);
 		res = -1;
-		chan = ast_channel_unref(chan); /* we already unlocked it, so clear it hear so the cleanup label won't touch it. */
+		chan = ast_channel_unref(chan); /* we already unlocked it, so clear it here so the cleanup label won't touch it. */
 		goto return_cleanup;
 	}
 
@@ -997,20 +997,22 @@
 		</managerEventInstance>
 	***/
 	manager_event(EVENT_FLAG_CALL, "LocalBridge",
-		      "Channel1: %s\r\n"
-		      "Channel2: %s\r\n"
-		      "Uniqueid1: %s\r\n"
-		      "Uniqueid2: %s\r\n"
-		      "Context: %s\r\n"
-		      "Exten: %s\r\n"
-		      "LocalOptimization: %s\r\n",
-			ast_channel_name(p->owner), ast_channel_name(p->chan), ast_channel_uniqueid(p->owner), ast_channel_uniqueid(p->chan),
-			p->context, p->exten,
-			ast_test_flag(p, LOCAL_NO_OPTIMIZATION) ? "Yes" : "No");
+		"Channel1: %s\r\n"
+		"Channel2: %s\r\n"
+		"Uniqueid1: %s\r\n"
+		"Uniqueid2: %s\r\n"
+		"Context: %s\r\n"
+		"Exten: %s\r\n"
+		"LocalOptimization: %s\r\n",
+		ast_channel_name(p->owner), ast_channel_name(p->chan),
+		ast_channel_uniqueid(p->owner), ast_channel_uniqueid(p->chan),
+		p->context, p->exten,
+		ast_test_flag(p, LOCAL_NO_OPTIMIZATION) ? "Yes" : "No");
 
 
 	/* Start switch on sub channel */
-	if (!(res = ast_pbx_start(chan))) {
+	res = ast_pbx_start(chan);
+	if (!res) {
 		ao2_lock(p);
 		ast_set_flag(p, LOCAL_LAUNCHED_PBX);
 		ao2_unlock(p);
@@ -1103,7 +1105,6 @@
 	if (!p->owner && !p->chan) {
 		ao2_unlock(p);
 
-		/* Remove from list */
 		ao2_unlink(locals, p);
 		ao2_ref(p, -1);
 		p = NULL;
@@ -1188,8 +1189,7 @@
 			if (ast_test_flag(tmp, LOCAL_NO_OPTIMIZATION))
 				ast_set_flag(&tmp->jb_conf, AST_JB_ENABLED);
 			else {
-				ast_log(LOG_ERROR, "You must use the 'n' option for chan_local "
-					"to use the 'j' option to enable the jitterbuffer\n");
+				ast_log(LOG_ERROR, "You must use the 'n' option with the 'j' option to enable the jitter buffer\n");
 			}
 		}
 		if (strchr(opts, 'b')) {
@@ -1208,7 +1208,6 @@
 	ast_copy_string(tmp->context, c ? c : "default", sizeof(tmp->context));
 	ast_copy_string(tmp->exten, parse, sizeof(tmp->exten));
 
-	/* Add to list */
 	ao2_link(locals, tmp);
 
 	return tmp; /* this is returned with a ref */
@@ -1217,75 +1216,64 @@
 /*! \brief Start new local channel */
 static struct ast_channel *local_new(struct local_pvt *p, int state, const char *linkedid, struct ast_callid *callid)
 {
-	struct ast_channel *tmp = NULL, *tmp2 = NULL;
+	struct ast_channel *owner;
+	struct ast_channel *chan;
 	struct ast_format fmt;
 	int generated_seqno = ast_atomic_fetchadd_int((int *)&name_sequence, +1);
-	const char *t;
-	int ama;
-
-	/* Allocate two new Asterisk channels */
-	/* safe accountcode */
-	if (p->owner && ast_channel_accountcode(p->owner))
-		t = ast_channel_accountcode(p->owner);
-	else
-		t = "";
-
-	if (p->owner)
-		ama = ast_channel_amaflags(p->owner);
-	else
-		ama = 0;
-
-	/* Make sure that the ;2 channel gets the same linkedid as ;1. You can't pass linkedid to both
-	 * allocations since if linkedid isn't set, then each channel will generate its own linkedid. */
-	if (!(tmp = ast_channel_alloc(1, state, 0, 0, t, p->exten, p->context, linkedid, ama, "Local/%s@%s-%08x;1", p->exten, p->context, generated_seqno))
-		|| !(tmp2 = ast_channel_alloc(1, AST_STATE_RING, 0, 0, t, p->exten, p->context, ast_channel_linkedid(tmp), ama, "Local/%s@%s-%08x;2", p->exten, p->context, generated_seqno))) {
-		if (tmp) {
-			tmp = ast_channel_release(tmp);
+
+	/*
+	 * Allocate two new Asterisk channels
+	 *
+	 * Make sure that the ;2 channel gets the same linkedid as ;1.
+	 * You can't pass linkedid to both allocations since if linkedid
+	 * isn't set, then each channel will generate its own linkedid.
+	 */
+	if (!(owner = ast_channel_alloc(1, state, NULL, NULL, NULL,
+			p->exten, p->context, linkedid, 0,
+			"Local/%s@%s-%08x;1", p->exten, p->context, generated_seqno))
+		|| !(chan = ast_channel_alloc(1, AST_STATE_RING, NULL, NULL, NULL,
+			p->exten, p->context, ast_channel_linkedid(owner), 0,
+			"Local/%s@%s-%08x;2", p->exten, p->context, generated_seqno))) {
+		if (owner) {
+			owner = ast_channel_release(owner);
 		}
 		ast_log(LOG_WARNING, "Unable to allocate channel structure(s)\n");
 		return NULL;
 	}
 
 	if (callid) {
-		ast_channel_callid_set(tmp, callid);
-		ast_channel_callid_set(tmp2, callid);
-	}
-
-	ast_channel_tech_set(tmp, &local_tech);
-	ast_channel_tech_set(tmp2, &local_tech);
-
-	ast_format_cap_copy(ast_channel_nativeformats(tmp), p->reqcap);
-	ast_format_cap_copy(ast_channel_nativeformats(tmp2), p->reqcap);
+		ast_channel_callid_set(owner, callid);
+		ast_channel_callid_set(chan, callid);
+	}
+
+	ast_channel_tech_set(owner, &local_tech);
+	ast_channel_tech_set(chan, &local_tech);
+	ast_channel_tech_pvt_set(owner, p);
+	ast_channel_tech_pvt_set(chan, p);
+
+	ast_format_cap_copy(ast_channel_nativeformats(owner), p->reqcap);
+	ast_format_cap_copy(ast_channel_nativeformats(chan), p->reqcap);
 
 	/* Determine our read/write format and set it on each channel */
 	ast_best_codec(p->reqcap, &fmt);
-	ast_format_copy(ast_channel_writeformat(tmp), &fmt);
-	ast_format_copy(ast_channel_writeformat(tmp2), &fmt);
-	ast_format_copy(ast_channel_rawwriteformat(tmp), &fmt);
-	ast_format_copy(ast_channel_rawwriteformat(tmp2), &fmt);
-	ast_format_copy(ast_channel_readformat(tmp), &fmt);
-	ast_format_copy(ast_channel_readformat(tmp2), &fmt);
-	ast_format_copy(ast_channel_rawreadformat(tmp), &fmt);
-	ast_format_copy(ast_channel_rawreadformat(tmp2), &fmt);
-
-	ast_channel_tech_pvt_set(tmp, p);
-	ast_channel_tech_pvt_set(tmp2, p);
-
-	ast_set_flag(ast_channel_flags(tmp), AST_FLAG_DISABLE_DEVSTATE_CACHE);
-	ast_set_flag(ast_channel_flags(tmp2), AST_FLAG_DISABLE_DEVSTATE_CACHE);
-
-	p->owner = tmp;
-	p->chan = tmp2;
-
-	ast_channel_context_set(tmp, p->context);
-	ast_channel_context_set(tmp2, p->context);
-	ast_channel_exten_set(tmp2, p->exten);
-	ast_channel_priority_set(tmp, 1);
-	ast_channel_priority_set(tmp2, 1);
-
-	ast_jb_configure(tmp, &p->jb_conf);
-
-	return tmp;
+	ast_format_copy(ast_channel_writeformat(owner), &fmt);
+	ast_format_copy(ast_channel_writeformat(chan), &fmt);
+	ast_format_copy(ast_channel_rawwriteformat(owner), &fmt);
+	ast_format_copy(ast_channel_rawwriteformat(chan), &fmt);
+	ast_format_copy(ast_channel_readformat(owner), &fmt);
+	ast_format_copy(ast_channel_readformat(chan), &fmt);
+	ast_format_copy(ast_channel_rawreadformat(owner), &fmt);
+	ast_format_copy(ast_channel_rawreadformat(chan), &fmt);
+
+	ast_set_flag(ast_channel_flags(owner), AST_FLAG_DISABLE_DEVSTATE_CACHE);
+	ast_set_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_DEVSTATE_CACHE);
+
+	p->owner = owner;
+	p->chan = chan;
+
+	ast_jb_configure(owner, &p->jb_conf);
+
+	return owner;
 }
 
 /*! \brief Part of PBX interface */
@@ -1366,43 +1354,31 @@
 static int manager_optimize_away(struct mansession *s, const struct message *m)
 {
 	const char *channel;
-	struct local_pvt *p, *tmp = NULL;
-	struct ast_channel *c;
-	int found = 0;
-	struct ao2_iterator it;
+	struct local_pvt *p;
+	struct local_pvt *found;
+	struct ast_channel *chan;
 
 	channel = astman_get_header(m, "Channel");
-
 	if (ast_strlen_zero(channel)) {
 		astman_send_error(s, m, "'Channel' not specified.");
 		return 0;
 	}
 
-	c = ast_channel_get_by_name(channel);
-	if (!c) {
+	chan = ast_channel_get_by_name(channel);
+	if (!chan) {
 		astman_send_error(s, m, "Channel does not exist.");
 		return 0;
 	}
 
-	p = ast_channel_tech_pvt(c);
-	ast_channel_unref(c);
-	c = NULL;
-
-	it = ao2_iterator_init(locals, 0);
-	while ((tmp = ao2_iterator_next(&it))) {
-		if (tmp == p) {
-			ao2_lock(tmp);
-			found = 1;
-			ast_clear_flag(tmp, LOCAL_NO_OPTIMIZATION);
-			ao2_unlock(tmp);
-			ao2_ref(tmp, -1);
-			break;
-		}
-		ao2_ref(tmp, -1);
-	}
-	ao2_iterator_destroy(&it);
-
+	p = ast_channel_tech_pvt(chan);
+	ast_channel_unref(chan);
+
+	found = p ? ao2_find(locals, p, 0) : NULL;
 	if (found) {
+		ao2_lock(found);
+		ast_clear_flag(found, LOCAL_NO_OPTIMIZATION);
+		ao2_unlock(found);
+		ao2_ref(found, -1);
 		astman_send_ack(s, m, "Queued channel to be optimized away");
 	} else {
 		astman_send_error(s, m, "Unable to find channel");
@@ -1425,7 +1401,8 @@
 	}
 	ast_format_cap_add_all(local_tech.capabilities);
 
-	if (!(locals = ao2_container_alloc(BUCKET_SIZE, NULL, locals_cmp_cb))) {
+	locals = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, locals_cmp_cb);
+	if (!locals) {
 		ast_format_cap_destroy(local_tech.capabilities);
 		return AST_MODULE_LOAD_FAILURE;
 	}

Modified: team/qwell/fun_with_transports/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/channels/chan_mgcp.c?view=diff&rev=387480&r1=387479&r2=387480
==============================================================================
--- team/qwell/fun_with_transports/channels/chan_mgcp.c (original)
+++ team/qwell/fun_with_transports/channels/chan_mgcp.c Thu May  2 14:03:45 2013
@@ -3226,11 +3226,10 @@
 	   together (but then, why would we want to?) */
 	if (ast_bridged_channel(p->sub->owner)) {

[... 2107 lines stripped ...]



More information about the asterisk-commits mailing list