[svn-commits] mnicholson: branch 1.6.2 r299242 - in /branches/1.6.2: ./ channels/chan_sip.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Dec 20 21:25:43 UTC 2010


Author: mnicholson
Date: Mon Dec 20 15:25:35 2010
New Revision: 299242

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=299242
Log:
Merged revisions 299194,299198,299220 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r299194 | mnicholson | 2010-12-20 14:45:38 -0600 (Mon, 20 Dec 2010) | 6 lines
  
  Respond as soon as possible with a 202 Accepted to refer requests.
  
  This change also plugs a few memory leaks that can occur when parking sip calls.
  
  ABE-2656
........
  r299198 | mnicholson | 2010-12-20 15:00:44 -0600 (Mon, 20 Dec 2010) | 2 lines
  
  Remove changes to via processing that were not supposed to go into the last commit.
........
  r299220 | mnicholson | 2010-12-20 15:21:39 -0600 (Mon, 20 Dec 2010) | 4 lines
  
  Use ast_free() instead of free()
  
  ABE-2656
........

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

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'branch-1.4-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=299242&r1=299241&r2=299242
==============================================================================
--- branches/1.6.2/channels/chan_sip.c (original)
+++ branches/1.6.2/channels/chan_sip.c Mon Dec 20 15:25:35 2010
@@ -18976,7 +18976,7 @@
 	if (!transferee || !transferer) {
 		ast_log(LOG_ERROR, "Missing channels for parking! Transferer %s Transferee %s\n", transferer ? "<available>" : "<missing>", transferee ? "<available>" : "<missing>" );
 		deinit_req(&d->req);
-		free(d);
+		ast_free(d);
 		return NULL;
 	}
 	ast_debug(4, "SIP Park: Transferer channel %s, Transferee %s\n", transferer->name, transferee->name);
@@ -18987,7 +18987,7 @@
 		transmit_response(transferer->tech_pvt, "503 Internal error", &req);
 		ast_channel_unlock(transferee);
 		deinit_req(&d->req);
-		free(d);
+		ast_free(d);
 		return NULL;
 	} 
 	ast_channel_unlock(transferee);
@@ -19007,7 +19007,6 @@
 
 	/* Any way back to the current call??? */
 	/* Transmit response to the REFER request */
-	transmit_response(transferer->tech_pvt, "202 Accepted", &req);
 	if (!res)	{
 		/* Transfer succeeded */
 		append_history(transferer->tech_pvt, "SIPpark", "Parked call on %d", ext);
@@ -19022,7 +19021,7 @@
 		/* Do not hangup call */
 	}
 	deinit_req(&d->req);
-	free(d);
+	ast_free(d);
 	return NULL;
 }
 
@@ -19106,22 +19105,23 @@
 		}
 		return -1;
 	}
-	if ((d = ast_calloc(1, sizeof(*d)))) {
-
-		/* Save original request for followup */
-		copy_request(&d->req, req);
-		d->chan1 = transferee;	/* Transferee */
-		d->chan2 = transferer;	/* Transferer */
-		d->seqno = seqno;
-		if (ast_pthread_create_detached_background(&th, NULL, sip_park_thread, d) < 0) {
-			/* Could not start thread */
-			deinit_req(&d->req);
-			ast_free(d);	/* We don't need it anymore. If thread is created, d will be free'd
-					   by sip_park_thread() */
-			return 0;
-		}
-	} 
-	return -1;
+	if (!(d = ast_calloc(1, sizeof(*d)))) {
+		return -1;
+	}
+
+	/* Save original request for followup */
+	copy_request(&d->req, req);
+	d->chan1 = transferee;	/* Transferee */
+	d->chan2 = transferer;	/* Transferer */
+	d->seqno = seqno;
+	if (ast_pthread_create_detached_background(&th, NULL, sip_park_thread, d) < 0) {
+		/* Could not start thread */
+		deinit_req(&d->req);
+		ast_free(d);	/* We don't need it anymore. If thread is created, d will be free'd
+				   by sip_park_thread() */
+		return -1;
+	}
+	return 0;
 }
 
 /*! \brief Turn off generator data 
@@ -20669,7 +20669,6 @@
 		transferer->refer->replaces_callid_fromtag))) {
 		if (transferer->refer->localtransfer) {
 			/* We did not find the refered call. Sorry, can't accept then */
-			transmit_response(transferer, "202 Accepted", req);
 			/* Let's fake a response from someone else in order
 		   	to follow the standard */
 			transmit_notify_with_sipfrag(transferer, seqno, "481 Call leg/transaction does not exist", TRUE);
@@ -20684,7 +20683,6 @@
 	}
 
 	/* Ok, we can accept this transfer */
-	transmit_response(transferer, "202 Accepted", req);
 	append_history(transferer, "Xfer", "Refer accepted");
 	if (!targetcall_pvt->owner) {	/* No active channel */
 		ast_debug(4, "SIP attended transfer: Error: No owner of target call\n");
@@ -20976,6 +20974,9 @@
 
 	ast_set_flag(&p->flags[0], SIP_GOTREFER);
 
+	/* From here on failures will be indicated with NOTIFY requests */
+	transmit_response(p, "202 Accepted", req);
+
 	/* Attended transfer: Find all call legs and bridge transferee with target*/
 	if (p->refer->attendedtransfer) {
 		if ((res = local_attended_transfer(p, &current, req, seqno)))
@@ -21005,13 +21006,13 @@
 			p->refer->refer_to);
 		if (sipdebug)
 			ast_debug(4, "SIP transfer to parking: trying to park %s. Parked by %s\n", current.chan2->name, current.chan1->name);
-		sip_park(current.chan2, current.chan1, req, seqno);
+		if ((res = sip_park(current.chan2, current.chan1, req, seqno))) {
+			transmit_notify_with_sipfrag(p, seqno, "500 Internal Server Error", TRUE);
+		}
 		return res;
 	} 
 
 	/* Blind transfers and remote attended xfers */
-	transmit_response(p, "202 Accepted", req);
-
 	if (current.chan1 && current.chan2) {
 		ast_debug(3, "chan1->name: %s\n", current.chan1->name);
 		pbx_builtin_setvar_helper(current.chan1, "BLINDTRANSFER", current.chan2->name);




More information about the svn-commits mailing list