[Home]

Summary:ASTERISK-24536: AMI redirect with PJSIP fails to move extra channel
Reporter:Niklas Larsson (pnlarsson)Labels:
Date Opened:2014-11-18 08:38:05.000-0600Date Closed:2014-12-18 09:08:50.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Channels/chan_pjsip Core/Bridging Core/ManagerInterface
Versions:13.0.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Attachments:( 0) redirect.txt
Description:We have one softmix with one or two PJSIP channels in. Then we are sending an AMI action:
{quote}
action: Redirect
actionid: 1416320876.9306
channel: PJSIP/tjoho-00000044
exten: moh
context: hold-bridge
priority: 1
extrachannel: PJSIP/wid3-00000045
extraexten: moh
extracontext: hold-bridge
extrapriority: 1
{quote}

Result: the first channel is placed in hold-bridge,moh,1 but the second is hunged up.

{noformat}
[Nov 18 15:26:47] WARNING[1370]: channel.c:10376 ast_channel_move: Can't move channel. One or both is dead (Surrogate/PJSIP/wid3-00000045 <-- PJSIP/wid3-00000045)
[Nov 18 15:26:47] WARNING[1370]: pbx.c:9687 ast_async_goto: Unable to gain control of channel PJSIP/wid3-00000045
[Nov 18 15:26:47] ERROR[1370]: utils.c:1449 ast_careful_fwrite: fwrite() returned error: Broken pipe
{noformat}
Comments:By: Niklas Larsson (pnlarsson) 2014-11-18 08:43:12.308-0600

asterisk log with core set debug 9

By: Niklas Larsson (pnlarsson) 2014-11-18 09:24:56.834-0600

Same result with simple_bridge and softmix (don't know where I got softbridge from).

By: Matt Jordan (mjordan) 2014-12-02 09:46:54.213-0600

I have a feeling this will happen with any channel. The {{Redirect}} action is performing an {{ast_async_goto}} on the first channel - however, since the bridge is set up to hang up the second channel when the first leaves, this causes the second {{ast_async_goto}} to fail.

If we have a dual redirect, we need to first notify the bridge to not hangup the second channel when the first leaves.

By: Mark Michelson (mmichelson) 2014-12-15 15:37:20.321-0600

I have not been able to reproduce this problem yet. Here is my test extensions.conf file:

{panel: title=extensions.conf}
{noformat: nopanel=true}
[default]
exten => _2xx,1,NoOp()
same => n, Dial(PJSIP/${EXTEN},,tT)

exten => 306,1,Answer()
same => n,Playback(demo-congrats)
same => n,Hangup()
{noformat}
{panel}

I place a call from PJSIP/200 to PJSIP/201 by dialing 201. I have the "tT" in the Dial() to force a basic bridge since that's what appears in your logs. I then issue a redirect like the following:

{noformat}
action: redirect
channel: PJSIP/200-00000000
exten: 306
context: default
priority: 1
extrachannel: PJSIP/201-00000001
extraexten: 306
extracontext: default
extrapriority: 1
{noformat}

Both phones are succesfully redirected to {{306@default}}. I've tried the test about 20 times and it has been successful every time. I suspect there is either a difference in
A) The way that you are establishing the initial bridge. I use the Dial() application. Are you doing it some other way? Originate? The Bridge() application? Since you filled in the choice that this issue happens constantly, I suspect that this may be where our setups differ.
B) The load on the system. When I run my test, it's the only call in the entire Asterisk system. I suspect that if there is a race condition, and you're using a more heavily-loaded system, you may see the issue more frequently than me. However, that would not necessarily contribute towards the issue happening constantly.

By: Niklas Larsson (pnlarsson) 2014-12-16 09:05:29.766-0600

I tried to reproduce it as well (both on latest and on r428079) and it's just working. Tried dialling phone to phone and using Originate but no luck.

So something has change but I have no clue - please close this issue.

By: Mark Michelson (mmichelson) 2014-12-16 10:25:55.714-0600

I did some looking at the code and I found where it may be possible for the issue you reported to occur sometimes. I have placed this possible fix on review board at https://reviewboard.asterisk.org/r/4268/

I will close this issue when the review request has been approved.