[svn-commits] mnicholson: trunk r201717 - /trunk/channels/chan_sip.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jun 18 12:41:13 CDT 2009


Author: mnicholson
Date: Thu Jun 18 12:41:09 2009
New Revision: 201717

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

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

Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=201717&r1=201716&r2=201717
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu Jun 18 12:41:09 2009
@@ -6076,6 +6076,14 @@
 {
 	int fmt;
 	const char *codec;
+	struct ast_channel* chan;
+
+	chan = ast_channel_ref(p->owner);
+	while (ast_channel_trylock(chan)) {
+		sip_pvt_unlock(p);
+		usleep(1);
+		sip_pvt_lock(p);
+	}
 
 	if (p->outgoing_call) {
 		codec = pbx_builtin_getvar_helper(p->owner, "SIP_CODEC_OUTBOUND");
@@ -6083,7 +6091,12 @@
 		codec = pbx_builtin_getvar_helper(p->owner, "SIP_CODEC");
 	}
 
-	if (!codec) 
+	codec = ast_strdupa(S_OR(codec, ""));
+
+	ast_channel_unlock(chan);
+	chan = ast_channel_unref(chan);
+
+	if (ast_strlen_zero(codec))
 		return;
 
 	fmt = ast_getformatbyname(codec);




More information about the svn-commits mailing list