diff --git a/channels/chan_sip.c b/channels/chan_sip.c index b7c2270e4e..9f95510db8 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -27724,10 +27724,12 @@ static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *i if (!ast_bridged_channel(chan) && !sip_cfg.directrtpsetup) /* We are in early state */ return 0; + ast_channel_lock(chan); sip_pvt_lock(p); if (p->alreadygone) { /* If we're destroyed, don't bother */ sip_pvt_unlock(p); + ast_channel_unlock(chan); return 0; } @@ -27736,6 +27738,7 @@ static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *i */ if (nat_active && !ast_test_flag(&p->flags[0], SIP_DIRECT_MEDIA_NAT)) { sip_pvt_unlock(p); + ast_channel_unlock(chan); return 0; } @@ -27778,6 +27781,7 @@ static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *i /* Reset lastrtprx timer */ p->lastrtprx = p->lastrtptx = time(NULL); sip_pvt_unlock(p); + ast_channel_unlock(chan); return 0; }