[asterisk-commits] mnicholson: trunk r299355 - in /trunk: ./ channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Dec 21 16:02:57 UTC 2010
Author: mnicholson
Date: Tue Dec 21 10:02:52 2010
New Revision: 299355
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=299355
Log:
Merged revisions 299353 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
................
r299353 | mnicholson | 2010-12-21 09:25:03 -0600 (Tue, 21 Dec 2010) | 30 lines
Merged revisions 299242 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2
................
r299242 | mnicholson | 2010-12-20 15:25:35 -0600 (Mon, 20 Dec 2010) | 23 lines
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:
trunk/ (props changed)
trunk/channels/chan_sip.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=299355&r1=299354&r2=299355
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Dec 21 10:02:52 2010
@@ -20293,7 +20293,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);
@@ -20302,7 +20302,7 @@
ast_log(LOG_WARNING, "Masquerade failed.\n");
transmit_response(transferer->tech_pvt, "503 Internal error", &req);
deinit_req(&d->req);
- free(d);
+ ast_free(d);
return NULL;
}
@@ -20321,7 +20321,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);
@@ -20336,7 +20335,7 @@
/* Do not hangup call */
}
deinit_req(&d->req);
- free(d);
+ ast_free(d);
return NULL;
}
@@ -20417,23 +20416,24 @@
}
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;
- d->parkexten = parkexten;
- 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;
+ d->parkexten = parkexten;
+ 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
@@ -21953,7 +21953,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);
@@ -21968,7 +21967,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");
@@ -22342,6 +22340,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, ¤t, req, seqno, nounlock)))
@@ -22379,13 +22380,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, p->refer->refer_to);
+ if (sip_park(current.chan2, current.chan1, req, seqno, p->refer->refer_to)) {
+ 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 asterisk-commits
mailing list