From: Jasper Hafkenscheid Date: Tue, 9 Oct 2018 12:44:57 +0000 (+0200) Subject: chan_sip: Attempt ast_do_pickup in handle_invite_replaces X-Git-Tag: 13.24.0-rc1~35^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf193d53ad7d88463ac384d43e2c8eb5f4e222e9;p=thirdparty%2Fasterisk.git chan_sip: Attempt ast_do_pickup in handle_invite_replaces When a call pickup is performed using and invite with replaces header the ast_do_pickup method is attempted and a PICKUP stasis message is sent. ASTERISK-28081 #close Reported-by: Luit van Drongelen Change-Id: Ieb1442027a3ce6ae55faca47bc095e53972f947a --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index ff4c5609ee..97ce93c554 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -25684,7 +25684,13 @@ static int handle_invite_replaces(struct sip_pvt *p, struct sip_request *req, } ao2_ref(bridge, -1); } else { - ast_channel_move(replaces_chan, c); + int pickedup; + ast_channel_lock(replaces_chan); + pickedup = ast_can_pickup(replaces_chan) && !ast_do_pickup(c, replaces_chan); + ast_channel_unlock(replaces_chan); + if (!pickedup) { + ast_channel_move(replaces_chan, c); + } ast_hangup(c); } ast_channel_unref(c);