[asterisk-commits] mjordan: branch 12 r408069 - /branches/12/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Feb 14 06:39:17 CST 2014


Author: mjordan
Date: Fri Feb 14 06:39:11 2014
New Revision: 408069

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=408069
Log:
chnan_sip: Set SIP_DEFER_BYE_ON_TRANSFER prior to calling bridge blind transfer

This patch moves setting SIP_DEFER_BY_ON_TRANSFER prior to calling
ast_bridge_transfer_blind. This prevents a BYE from being sent prior to the
NOTIFY request that informs the transferor if the transfer succeeded or failed.

This patch also clears said flag from the off nominal NOTIFY paths in the
local_attended_transfer code, as once we've sent the NOTIFY request it is safe
to send by the BYE request.

This was caught by the blind-transfer-accountcode test in the Asterisk Test
Suite.

(closes issue ASTERISK-23290)
Reported by: Matt Jordan

Review: https://reviewboard.asterisk.org/r/3214/

Modified:
    branches/12/channels/chan_sip.c

Modified: branches/12/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/chan_sip.c?view=diff&rev=408069&r1=408068&r2=408069
==============================================================================
--- branches/12/channels/chan_sip.c (original)
+++ branches/12/channels/chan_sip.c Fri Feb 14 06:39:11 2014
@@ -26180,16 +26180,19 @@
 		transferer->refer->status = REFER_FAILED;
 		transmit_notify_with_sipfrag(transferer, seqno, "500 Internal Server Error", TRUE);
 		append_history(transferer, "Xfer", "Refer failed (internal error)");
+		ast_clear_flag(&transferer->flags[0], SIP_DEFER_BYE_ON_TRANSFER);
 		return -1;
 	case AST_BRIDGE_TRANSFER_INVALID:
 		transferer->refer->status = REFER_FAILED;
 		transmit_notify_with_sipfrag(transferer, seqno, "503 Service Unavailable", TRUE);
 		append_history(transferer, "Xfer", "Refer failed (invalid bridge state)");
+		ast_clear_flag(&transferer->flags[0], SIP_DEFER_BYE_ON_TRANSFER);
 		return -1;
 	case AST_BRIDGE_TRANSFER_NOT_PERMITTED:
 		transferer->refer->status = REFER_FAILED;
 		transmit_notify_with_sipfrag(transferer, seqno, "403 Forbidden", TRUE);
 		append_history(transferer, "Xfer", "Refer failed (operation not permitted)");
+		ast_clear_flag(&transferer->flags[0], SIP_DEFER_BYE_ON_TRANSFER);
 		return -1;
 	default:
 		break;
@@ -26473,6 +26476,7 @@
 		*nounlock = 1;
 	}
 
+	ast_set_flag(&p->flags[0], SIP_DEFER_BYE_ON_TRANSFER);
 	sip_pvt_unlock(p);
 	transfer_res = ast_bridge_transfer_blind(1, transferer, refer_to, refer_to_context, blind_transfer_cb, &cb_data);
 	sip_pvt_lock(p);
@@ -26483,24 +26487,26 @@
 		p->refer->status = REFER_FAILED;
 		transmit_notify_with_sipfrag(p, seqno, "503 Service Unavailable (can't handle one-legged xfers)", TRUE);
 		append_history(p, "Xfer", "Refer failed (only bridged calls).");
+		ast_clear_flag(&p->flags[0], SIP_DEFER_BYE_ON_TRANSFER);
 		break;
 	case AST_BRIDGE_TRANSFER_NOT_PERMITTED:
 		res = -1;
 		p->refer->status = REFER_FAILED;
 		transmit_notify_with_sipfrag(p, seqno, "403 Forbidden", TRUE);
 		append_history(p, "Xfer", "Refer failed (bridge does not permit transfers)");
+		ast_clear_flag(&p->flags[0], SIP_DEFER_BYE_ON_TRANSFER);
 		break;
 	case AST_BRIDGE_TRANSFER_FAIL:
 		res = -1;
 		p->refer->status = REFER_FAILED;
 		transmit_notify_with_sipfrag(p, seqno, "500 Internal Server Error", TRUE);
 		append_history(p, "Xfer", "Refer failed (internal error)");
+		ast_clear_flag(&p->flags[0], SIP_DEFER_BYE_ON_TRANSFER);
 		break;
 	case AST_BRIDGE_TRANSFER_SUCCESS:
 		res = 0;
 		p->refer->status = REFER_200OK;
 		transmit_notify_with_sipfrag(p, seqno, "200 OK", TRUE);
-		ast_set_flag(&p->flags[0], SIP_DEFER_BYE_ON_TRANSFER);
 		append_history(p, "Xfer", "Refer succeeded.");
 		break;
 	default:




More information about the asterisk-commits mailing list