[asterisk-commits] dvossel: branch 1.6.2 r247916 - in /branches/1.6.2: ./ channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Feb 19 11:41:33 CST 2010


Author: dvossel
Date: Fri Feb 19 11:41:28 2010
New Revision: 247916

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=247916
Log:
Merged revisions 247915 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r247915 | dvossel | 2010-02-19 11:40:26 -0600 (Fri, 19 Feb 2010) | 7 lines
  
  handle_request_invite revise comment, fix coding guideline issues
  
  I'm working with this code right now trying to analyze a deadlock.
  This change is just to clean up a few things before I make a more
  complex patch.
........

Modified:
    branches/1.6.2/   (props changed)
    branches/1.6.2/channels/chan_sip.c

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.2/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/channels/chan_sip.c?view=diff&rev=247916&r1=247915&r2=247916
==============================================================================
--- branches/1.6.2/channels/chan_sip.c (original)
+++ branches/1.6.2/channels/chan_sip.c Fri Feb 19 11:41:28 2010
@@ -19659,7 +19659,7 @@
 		char exten[AST_MAX_EXTENSION];
 		char context[AST_MAX_CONTEXT];
 	} pickup = {
-		.exten = "",	
+		.exten = "",
 	};
 	st_ref = SESSION_TIMER_REFRESHER_AUTO;
 
@@ -19813,7 +19813,7 @@
 
 			If it's not in early mode, 486 Busy.
 		*/
-		
+
 		/* Skip leading whitespace */
 		replace_id = ast_skip_blanks(replace_id);
 
@@ -19857,13 +19857,12 @@
 			}
 		}
 
+		/* This locks both refer_call pvt and refer_call pvt's owner!!!*/
 		if (!error && ast_strlen_zero(pickup.exten) && (p->refer->refer_call = get_sip_pvt_byid_locked(replace_id, totag, fromtag)) == NULL) {
 			ast_log(LOG_NOTICE, "Supervised transfer attempted to replace non-existent call id (%s)!\n", replace_id);
 			transmit_response_reliable(p, "481 Call Leg Does Not Exist (Replaces)", req);
 			error = 1;
 		}
-
-		/* At this point, bot the pvt and the owner of the call to be replaced is locked */
 
 		/* The matched call is the call from the transferer to Asterisk .
 			We want to bridge the bridged part of the call to the 
@@ -19947,7 +19946,6 @@
 	} else if (debug)
 		ast_verbose("Ignoring this INVITE request\n");
 
-	
 	if (!p->lastinvite && !req->ignore && !p->owner) {
 		/* This is a new invite */
 		/* Handle authentication if this is our first invite */
@@ -19964,7 +19962,7 @@
 				ast_log(LOG_NOTICE, "Failed to authenticate device %s\n", get_header(req, "From"));
 				transmit_response_reliable(p, "403 Forbidden", req);
 			}
-			p->invitestate = INV_COMPLETED;	
+			p->invitestate = INV_COMPLETED;
 			sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
 			ast_string_field_set(p, theirtag, NULL);
 			return 0;
@@ -19981,7 +19979,7 @@
 			if (process_sdp(p, req, SDP_T38_INITIATE)) {
 				/* Unacceptable codecs */
 				transmit_response_reliable(p, "488 Not acceptable here", req);
-				p->invitestate = INV_COMPLETED;	
+				p->invitestate = INV_COMPLETED;
 				sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
 				ast_debug(1, "No compatible codecs for this SIP call.\n");
 				return -1;
@@ -20017,7 +20015,7 @@
 				ast_log(LOG_NOTICE, "Failed to place call for device %s, too many calls\n", p->username);
 				transmit_response_reliable(p, "480 Temporarily Unavailable (Call limit) ", req);
 				sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
-				p->invitestate = INV_COMPLETED;	
+				p->invitestate = INV_COMPLETED;
 			}
 			return 0;
 		}
@@ -20036,14 +20034,14 @@
 				transmit_response_reliable(p, "484 Address Incomplete", req);
 			else {
 				char *decoded_exten = ast_strdupa(p->exten);
-				
+
 				transmit_response_reliable(p, "404 Not Found", req);
 				ast_uri_decode(decoded_exten);
 				ast_log(LOG_NOTICE, "Call from '%s' to extension"
 					" '%s' rejected because extension not found.\n",
 					S_OR(p->username, p->peername), decoded_exten);
 			}
-			p->invitestate = INV_COMPLETED;	
+			p->invitestate = INV_COMPLETED;
 			update_call_counter(p, DEC_CALL_LIMIT);
 			sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
 			return 0;
@@ -20053,7 +20051,7 @@
 			/* Basically for calling to IP/Host name only */
 			if (ast_strlen_zero(p->exten))
 				ast_string_field_set(p, exten, "s");
-			/* Initialize our tag */	
+			/* Initialize our tag */
 
 			make_our_tag(p->tag, sizeof(p->tag));
 			/* First invitation - create the channel */
@@ -20109,9 +20107,9 @@
 		if (!ast_strlen_zero(p_uac_min_se)) {
 			rtn = parse_minse(p_uac_min_se, &uac_min_se); 
 			if (rtn != 0) {
-        			transmit_response_reliable(p, "400 Min-SE Invalid Syntax", req);
-       	   			p->invitestate = INV_COMPLETED;
-       	   			if (!p->lastinvite) {
+				transmit_response_reliable(p, "400 Min-SE Invalid Syntax", req);
+				p->invitestate = INV_COMPLETED;
+				if (!p->lastinvite) {
 					sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
 				}
 				return -1;
@@ -20214,7 +20212,7 @@
 	if (!req->ignore && p)
 		p->lastinvite = seqno;
 
-	if (replace_id) { 	/* Attended transfer or call pickup - we're the target */
+	if (replace_id) {	/* Attended transfer or call pickup - we're the target */
 		if (!ast_strlen_zero(pickup.exten)) {
 			append_history(p, "Xfer", "INVITE/Replace received");
 
@@ -20556,7 +20554,7 @@
 			pvt_set_needdestroy(p, "outside of dialog");
 		}
 		return 0;
-	}	
+	}
 
 
 	/* Check if transfer is allowed from this device */
@@ -20569,7 +20567,7 @@
 	}
 
 	if (!req->ignore && ast_test_flag(&p->flags[0], SIP_GOTREFER)) {
-		/* Already have a pending REFER */	
+		/* Already have a pending REFER */
 		transmit_response(p, "491 Request pending", req);
 		append_history(p, "Xfer", "Refer failed. Request pending.");
 		return 0;
@@ -20625,7 +20623,7 @@
 		p->refer->localtransfer = 1;
 	} else if (sipdebug)
 			ast_debug(3, "This SIP transfer is to a remote SIP extension (remote domain %s)\n", p->refer->refer_to_domain);
-	
+
 	/* Is this a repeat of a current request? Ignore it */
 	/* Don't know what else to do right now. */
 	if (req->ignore) 
@@ -20684,7 +20682,7 @@
 		ast_queue_control(current.chan1, AST_CONTROL_UNHOLD);
 	}
 
-	ast_set_flag(&p->flags[0], SIP_GOTREFER);	
+	ast_set_flag(&p->flags[0], SIP_GOTREFER);
 
 	/* Attended transfer: Find all call legs and bridge transferee with target*/
 	if (p->refer->attendedtransfer) {
@@ -20703,7 +20701,7 @@
 		*nounlock = 1;
 		ast_channel_unlock(current.chan1);
 		copy_request(&current.req, req);
-		ast_clear_flag(&p->flags[0], SIP_GOTREFER);	
+		ast_clear_flag(&p->flags[0], SIP_GOTREFER);
 		p->refer->status = REFER_200OK;
 		append_history(p, "Xfer", "REFER to call parking.");
 		manager_event(EVENT_FLAG_CALL, "Transfer", "TransferMethod: SIP\r\nTransferType: Blind\r\nChannel: %s\r\nUniqueid: %s\r\nSIP-Callid: %s\r\nTargetChannel: %s\r\nTargetUniqueid: %s\r\nTransferExten: %s\r\nTransfer2Parking: Yes\r\n",
@@ -20757,7 +20755,7 @@
 	/* FAKE ringing if not attended transfer */
 	if (!p->refer->attendedtransfer)
 		transmit_notify_with_sipfrag(p, seqno, "183 Ringing", FALSE); 
-		
+
 	/* For blind transfer, this will lead to a new call */
 	/* For attended transfer to remote host, this will lead to
 	   a new SIP call with a replaces header, if the dial plan allows it 




More information about the asterisk-commits mailing list