[asterisk-bugs] [JIRA] (ASTERISK-29018) pbx: Channel redirect might be missed if redirected channel is executing dialplan

Kevin Harwell (JIRA) noreply at issues.asterisk.org
Fri Aug 7 16:36:43 CDT 2020


    [ https://issues.asterisk.org/jira/browse/ASTERISK-29018?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=251604#comment-251604 ] 

Kevin Harwell commented on ASTERISK-29018:
------------------------------------------

Steps I used to replicate.

Dialplan (I altered the given example to be an infinite loop):
{noformat}
exten => echo,1,NoOp()
	same => n,Answer()
	same => n,Echo()
	same => n,Hangup()

exten => caladan,1,Answer()
same => n,Set(i=0)
same => n,While($[${i} < 10000])
same => n,Set(Dummy=${PRIORITY})
;same => n,Set(i=$[${i}+1])
same => n,EndWhile
same => n,NoOp(Loop end)
same => n,Hangup()
same => n(end),NoOp(Terminated)
same => n,Hangup()

exten => arrakis,1,NoOp()
same => n,Verbose(0, he who controls the spice)
same => n,Hangup()
{noformat}
Asterisk CLI:
{noformat}
*CLI> channel originate Local/echo extension caladan
*CLI> channel redirect Local/echo at default-00000000;1 arrakis,1
Channel 'Local/echo at default-00000000;1' successfully redirected to arrakis,1
*CLI> core show channels
Channel              Location             State   Application(Data)             
Local/echo at default-0 caladan at default:3    Up      While(1)                      
Local/echo at default-0 echo at default:3       Up      Echo()                        
2 active channels
2 active calls
2 calls processed
{noformat}
As mentioned it may take a few times to replicate, but it'll state it successfully redirected but doesn't actually redirect.

> pbx: Channel redirect might be missed if redirected channel is executing dialplan
> ---------------------------------------------------------------------------------
>
>                 Key: ASTERISK-29018
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-29018
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Core/Channels, Core/PBX
>    Affects Versions: 16.8.0
>            Reporter: Patrick Wakano
>            Assignee: Patrick Wakano
>            Severity: Minor
>
> When using the Channel Redirect feature (either the dialplan app ChannelRedirect or the CLI channel redirect) it has been observed that the redirection might just not work in case the channel being redirected is executing something else in the dialplan.
> Take for example the dialplan below just to simulate the issue. If while the channel is looping, the channel redirect command is issued for that channel from the CLI, the redirect might simply not work and the channel keeps executing the loop.
> Given the channel redirect is an explicit action to alter the channel execution, I think it should always override whatever dialplan execution the channel is doing, so it should just terminate the current priority and then immediately go to where the channel redirect determined. However there are cases where the next dialplan priority gets executed and so the redirection silently fails to happen even tough it says the redirection was successful.
> The problem does not happen every time, it seems to be a 30% chance of having the issue for the example below.
> {noformat}
> [pstn-outgoing]
> exten => 8888,1,Answer()
> same => n,Set(i=0)
> same => n,While($[${i} < 10000])
> same => n,Set(Dummy=${PRIORITY})
> same => n,Set(i=$[${i}+1])
> same => n,EndWhile
> same => n,NoOp(Loop end)
> same => n,Hangup()
> same => n(end),NoOp(Terminated)
> same => n,Hangup()
> {noformat}
> Logs:
> {noformat}
>     -- Executing [8888 at pstn-outgoing:4] Set("SIP/9000-0000000f", "Dummy=4") in new stack
>     -- Executing [8888 at pstn-outgoing:5] Set("SIP/9000-0000000f", "i=69") in new stack
>     -- Executing [8888 at pstn-outgoing:6] EndWhile("SIP/9000-0000000f", "") in new stack
>     -- Executing [8888 at pstn-outgoing:3] While("SIP/9000-0000000f", "1") in new stack
>     -- Executing [8888 at pstn-outgoing:4] Set("SIP/9000-0000000f", "Dummy=4") in new stack
>     -- Executing [8888 at pstn-outgoing:5] Set("SIP/9000-0000000f", "i=70") in new stack
>     -- Executing [8888 at pstn-outgoing:6] EndWhile("SIP/9000-0000000f", "") in new stack
>     -- Executing [8888 at pstn-outgoing:3] While("SIP/9000-0000000f", "1") in new stack
>     -- Executing [8888 at pstn-outgoing:4] Set("SIP/9000-0000000f", "Dummy=4") in new stack
> pstn8*CLI> channel redirect SIP/9000-0000000f pstn-outgoing,8888,end
> Channel 'SIP/9000-0000000f' successfully redirected to pstn-outgoing,8888,end
>     -- Executing [8888 at pstn-outgoing:5] Set("SIP/9000-0000000f", "i=287") in new stack
>     -- Executing [8888 at pstn-outgoing:6] EndWhile("SIP/9000-0000000f", "") in new stack
>     -- Executing [8888 at pstn-outgoing:3] While("SIP/9000-0000000f", "1") in new stack
>     -- Executing [8888 at pstn-outgoing:4] Set("SIP/9000-0000000f", "Dummy=4") in new stack
>     -- Executing [8888 at pstn-outgoing:5] Set("SIP/9000-0000000f", "i=288") in new stack
>     -- Executing [8888 at pstn-outgoing:6] EndWhile("SIP/9000-0000000f", "") in new stack
>     -- Executing [8888 at pstn-outgoing:3] While("SIP/9000-0000000f", "1") in new stack
>     -- Executing [8888 at pstn-outgoing:4] Set("SIP/9000-0000000f", "Dummy=4") in new stack
>     -- Executing [8888 at pstn-outgoing:5] Set("SIP/9000-0000000f", "i=289") in new stack
> .....
>     -- Executing [8888 at pstn-outgoing:5] Set("SIP/9000-0000000f", "i=9997") in new stack
>     -- Executing [8888 at pstn-outgoing:6] EndWhile("SIP/9000-0000000f", "") in new stack
>     -- Executing [8888 at pstn-outgoing:3] While("SIP/9000-0000000f", "1") in new stack
>     -- Executing [8888 at pstn-outgoing:4] Set("SIP/9000-0000000f", "Dummy=4") in new stack
>     -- Executing [8888 at pstn-outgoing:5] Set("SIP/9000-0000000f", "i=9998") in new stack
>     -- Executing [8888 at pstn-outgoing:6] EndWhile("SIP/9000-0000000f", "") in new stack
>     -- Executing [8888 at pstn-outgoing:3] While("SIP/9000-0000000f", "1") in new stack
>     -- Executing [8888 at pstn-outgoing:4] Set("SIP/9000-0000000f", "Dummy=4") in new stack
>     -- Executing [8888 at pstn-outgoing:5] Set("SIP/9000-0000000f", "i=9999") in new stack
>     -- Executing [8888 at pstn-outgoing:6] EndWhile("SIP/9000-0000000f", "") in new stack
>     -- Executing [8888 at pstn-outgoing:3] While("SIP/9000-0000000f", "1") in new stack
>     -- Executing [8888 at pstn-outgoing:4] Set("SIP/9000-0000000f", "Dummy=4") in new stack
>     -- Executing [8888 at pstn-outgoing:5] Set("SIP/9000-0000000f", "i=10000") in new stack
>     -- Executing [8888 at pstn-outgoing:6] EndWhile("SIP/9000-0000000f", "") in new stack
>     -- Executing [8888 at pstn-outgoing:3] While("SIP/9000-0000000f", "0") in new stack
>     -- Executing [8888 at pstn-outgoing:7] NoOp("SIP/9000-0000000f", "Loop end") in new stack
>     -- Executing [8888 at pstn-outgoing:8] Hangup("SIP/9000-0000000f", "") in new stack
>   == Spawn extension (pstn-outgoing, 8888, 8) exited non-zero on 'SIP/9000-0000000f'
> pstn8*CLI> 
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list