[asterisk-commits] mnicholson: branch 1.4 r202022 - /branches/1.4/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jun 19 16:21:20 CDT 2009


Author: mnicholson
Date: Fri Jun 19 16:21:15 2009
New Revision: 202022

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=202022
Log:
Added deadlock protection to try_suggested_sip_codec in chan_sip.c.

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

Modified:
    branches/1.4/channels/chan_sip.c

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=202022&r1=202021&r2=202022
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Fri Jun 19 16:21:15 2009
@@ -3729,8 +3729,20 @@
 	int fmt;
 	const char *codec;
 
-	codec = pbx_builtin_getvar_helper(p->owner, "SIP_CODEC");
-	if (!codec) 
+	while (p->owner && ast_channel_trylock(p->owner)) {
+		sip_pvt_unlock(p);
+		sched_yield();
+		sip_pvt_lock(p);
+	}
+
+	if (!p->owner)
+		return;
+
+	codec = ast_strdupa(S_OR(pbx_builtin_getvar_helper(p->owner, "SIP_CODEC"), ""));
+
+	ast_channel_unlock(p->owner);
+
+	if (ast_strlen_zero(codec))
 		return;
 
 	fmt = ast_getformatbyname(codec);




More information about the asterisk-commits mailing list