[svn-commits] mnicholson: branch group/newcdr r203093 - /team/group/newcdr/channels/chan_sip.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jun 24 16:33:00 CDT 2009


Author: mnicholson
Date: Wed Jun 24 16:32:55 2009
New Revision: 203093

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=203093
Log:
Added deadlock avoidance for cel events generated by chan_sip

Modified:
    team/group/newcdr/channels/chan_sip.c

Modified: team/group/newcdr/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/newcdr/channels/chan_sip.c?view=diff&rev=203093&r1=203092&r2=203093
==============================================================================
--- team/group/newcdr/channels/chan_sip.c (original)
+++ team/group/newcdr/channels/chan_sip.c Wed Jun 24 16:32:55 2009
@@ -20717,7 +20717,13 @@
 		/* Transfer succeeded! */
 		const char *xfersound = pbx_builtin_getvar_helper(target.chan1, "ATTENDED_TRANSFER_COMPLETE_SOUND");
 
+		while (ast_channel_trylock(target.chan1)) {
+			sip_pvt_unlock(targetcall_pvt);
+			sched_yield();
+			sip_pvt_lock(targetcall_pvt);
+		}
 		ast_cel_report_event(target.chan1, AST_CEL_ATTENDEDTRANSFER, NULL, transferer_linkedid, target.chan2);
+		ast_channel_unlock(target.chan1);
 
 		/* Tell transferer that we're done. */
 		transmit_notify_with_sipfrag(transferer, seqno, "200 OK", TRUE);
@@ -21083,8 +21089,16 @@
 		/* Success  - we have a new channel */
 		ast_debug(3, "%s transfer succeeded. Telling transferer.\n", p->refer->attendedtransfer? "Attended" : "Blind");
 
+		while (ast_channel_trylock(current.chan1)) {
+			sip_pvt_unlock(p);
+			sched_yield();
+			sip_pvt_lock(p);
+		}
+
 		/* XXX - what to we put in CEL 'extra' for attended transfers to external systems? NULL for now */
 		ast_cel_report_event(current.chan1, p->refer->attendedtransfer? AST_CEL_ATTENDEDTRANSFER : AST_CEL_BLINDTRANSFER, NULL, p->refer->attendedtransfer ? NULL : p->refer->refer_to, current.chan2);
+		ast_channel_unlock(current.chan1);
+
 		transmit_notify_with_sipfrag(p, seqno, "200 Ok", TRUE);
 		if (p->refer->localtransfer)
 			p->refer->status = REFER_200OK;




More information about the svn-commits mailing list