Skip to content
Snippets Groups Projects
Commit 21ad428d authored by Matthew Nicholson's avatar Matthew Nicholson
Browse files

Added deadlock protection to try_suggested_sip_codec in chan_sip.c.

parent dcfe69ec
No related branches found
No related tags found
No related merge requests found
......@@ -6076,6 +6076,14 @@ static void try_suggested_sip_codec(struct sip_pvt *p)
{
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 @@ static void try_suggested_sip_codec(struct sip_pvt *p)
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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment