diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 5fd1bc11a3..274e9787df 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -24858,16 +24858,18 @@ static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int ast_party_redirecting_init(&redirecting); memset(&update_redirecting, 0, sizeof(update_redirecting)); change_redirecting_information(p, req, &redirecting, &update_redirecting, FALSE); + + /* Do not hold the pvt lock during a call that causes an indicate or an async_goto. + * Those functions lock channels which will invalidate locking order if the pvt lock + * is held.*/ + sip_pvt_unlock(p); ast_channel_update_redirecting(current.chan2, &redirecting, &update_redirecting); ast_party_redirecting_free(&redirecting); - /* Do not hold the pvt lock during the indicate and async_goto. Those functions - * lock channels which will invalidate locking order if the pvt lock is held.*/ /* For blind transfers, move the call to the new extensions. For attended transfers on multiple * servers - generate an INVITE with Replaces. Either way, let the dial plan decided * indicate before masquerade so the indication actually makes it to the real channel * when using local channels with MOH passthru */ - sip_pvt_unlock(p); ast_indicate(current.chan2, AST_CONTROL_UNHOLD); res = ast_async_goto(current.chan2, refer_to_context, refer_to, 1);