Dovid Bender
2018-Jun-26 22:57 UTC
[asterisk-users] Asterisk not matching longest prefix with include
Hi, My dialplan looks like this: [from-external] Exten => _X.,1,Noop(CALL IS COMING INTO FROM EXTERNAL CONTEXT) Exten => _X.,n,Noop(IP: ${CHANNEL(recvip)}) Exten => _X.,n,Noop(CALLED NUMBER: ${EXTEN}) Exten => _X.,n,Ringing Exten => _X.,n,WaitExten(15) Exten => _X.,n,Congestion() Exten => _X.,n,Hangup() include => test [test] Exten => 8282,1,Noop(--- WE GOT TO CONTEXT TEST!--------- ) If I dial 8282 I would thing that I would see in the CLI " --- WE GOT TO CONTEXT TEST!---------" however when I make a test call I see: == Using SIP RTP CoS mark 5 -- Executing [8282 at from-external:1] NoOp("SIP/192.168.200.32-00000000", "CALL IS COMING INTO FROM EXTERNAL CONTEXT") in new stack -- Executing [8282 at from-external:2] NoOp("SIP/192.168.200.32-00000000", "IP: 192.168.200.10") in new stack -- Executing [8282 at from-external:3] NoOp("SIP/192.168.200.32-00000000", "CALLED NUMBER: 8282") in new stack -- Executing [8282 at from-external:4] Ringing("SIP/192.168.200.32-00000000", "") in new stack -- Executing [8282 at from-external:5] WaitExten("SIP/192.168.200.32-00000000", "15") in new stack == Spawn extension (from-external, 8282, 5) exited non-zero on 'SIP/192.168.200.32-00000000' It seems that the 8282 in test is being ignored now if I comment out all lines starting with " Exten => _X.,1" so my dialplan looks like this: [from-external] Exten => 1234,1,Noop() ;Exten => _X.,1,Noop(CALL IS COMING INTO FROM EXTERNAL CONTEXT) ;Exten => _X.,n,Noop(IP: ${CHANNEL(recvip)}) ;Exten => _X.,n,Noop(CALLED NUMBER: ${EXTEN}) ;Exten => _X.,n,Ringing ;Exten => _X.,n,WaitExten(15) ;Exten => _X.,n,Congestion() ;Exten => _X.,n,Hangup() include => test [test] Exten => 8282,1,Noop(--- WE GOT TO CONTEXT TEST!--------- ) Then there is no issue and I see in the console: == Using SIP RTP CoS mark 5 -- Executing [8282 at from-external:1] NoOp("SIP/204.145.219.32-00000001", "--- WE GOT TO CONTEXT TEST!--------- ") in new stack Is this a bug or is this operating as designed (which I don't think is the case). TIA. Dovid -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20180626/445b35d1/attachment.html>
Doug Lytle
2018-Jun-26 23:06 UTC
[asterisk-users] Asterisk not matching longest prefix with include
On 06/26/2018 06:57 PM, Dovid Bender wrote:> Hi, > > My dialplan looks like this: > [from-external] > > Exten => _X.,1,Noop(CALL IS COMING INTO FROM EXTERNAL CONTEXT) > Exten => _X.,n,Noop(IP: ${CHANNEL(recvip)}) > Exten => _X.,n,Noop(CALLED NUMBER: ${EXTEN}) > Exten => _X.,n,Ringing > Exten => _X.,n,WaitExten(15) > Exten => _X.,n,Congestion() > Exten => _X.,n,Hangup() > > > include => test > > [test] > > Exten => 8282,1,Noop(--- WE GOT TO CONTEXT TEST!--------- ) >Dovid, This has to do with sort order, try this: [from-external] ; Order DOES count include => test include => match_all [match_all] Exten => _X.,1,Noop(CALL IS COMING INTO FROM EXTERNAL CONTEXT) Exten => _X.,n,Noop(IP: ${CHANNEL(recvip)}) Exten => _X.,n,Noop(CALLED NUMBER: ${EXTEN}) Exten => _X.,n,Ringing Exten => _X.,n,WaitExten(15) Exten => _X.,n,Congestion() Exten => _X.,n,Hangup() [test] Exten => 8282,1,Noop(--- WE GOT TO CONTEXT TEST!--------- )
Dovid Bender
2018-Jun-26 23:20 UTC
[asterisk-users] Asterisk not matching longest prefix with include
On Tue, Jun 26, 2018 at 7:06 PM, Doug Lytle <support at drdos.info> wrote:> On 06/26/2018 06:57 PM, Dovid Bender wrote: > >> Hi, >> >> My dialplan looks like this: >> [from-external] >> >> Exten => _X.,1,Noop(CALL IS COMING INTO FROM EXTERNAL CONTEXT) >> Exten => _X.,n,Noop(IP: ${CHANNEL(recvip)}) >> Exten => _X.,n,Noop(CALLED NUMBER: ${EXTEN}) >> Exten => _X.,n,Ringing >> Exten => _X.,n,WaitExten(15) >> Exten => _X.,n,Congestion() >> Exten => _X.,n,Hangup() >> >> >> include => test >> >> [test] >> >> Exten => 8282,1,Noop(--- WE GOT TO CONTEXT TEST!--------- ) >> >> > > Dovid, > > This has to do with sort order, try this: > > > [from-external] > > ; Order DOES count > > include => test > include => match_all > > > [match_all] > > Exten => _X.,1,Noop(CALL IS COMING INTO FROM EXTERNAL CONTEXT) > Exten => _X.,n,Noop(IP: ${CHANNEL(recvip)}) > Exten => _X.,n,Noop(CALLED NUMBER: ${EXTEN}) > Exten => _X.,n,Ringing > Exten => _X.,n,WaitExten(15) > Exten => _X.,n,Congestion() > Exten => _X.,n,Hangup() > > [test] > > Exten => 8282,1,Noop(--- WE GOT TO CONTEXT TEST!--------- ) > > -- > >Doug, I tried that as well. Even with my dialplan looking like this: [from-external] Exten => 1234,1,Noop() include => test Exten => _X.,1,Noop(CALL IS COMING INTO FROM EXTERNAL CONTEXT) Exten => _X.,n,Noop(IP: ${CHANNEL(recvip)}) Exten => _X.,n,Noop(CALLED NUMBER: ${EXTEN}) Exten => _X.,n,Ringing Exten => _X.,n,WaitExten(15) Exten => _X.,n,Congestion() Exten => _X.,n,Hangup() [test] Exten => 8282,1,Noop(--- WE GOT TO CONTEXT TEST!--------- ) It still didnt work. Now if I did: [from-external] Exten => 1234,1,Noop() include => test Exten => _X.,1,Noop(CALL IS COMING INTO FROM EXTERNAL CONTEXT) Exten => _X.,n,Noop(IP: ${CHANNEL(recvip)}) Exten => _X.,n,Noop(CALLED NUMBER: ${EXTEN}) Exten => _X.,n,Ringing Exten => _X.,n,WaitExten(15) Exten => _X.,n,Congestion() Exten => _X.,n,Hangup() Exten => 8282,1,Noop(--- WE GOT TO CONTEXT TEST!--------- ) OR if I did: [from-external] Exten => 1234,1,Noop() include => test Exten => _X.,1,Noop(CALL IS COMING INTO FROM EXTERNAL CONTEXT) Exten => _X.,n,Noop(IP: ${CHANNEL(recvip)}) Exten => _X.,n,Noop(CALLED NUMBER: ${EXTEN}) Exten => _X.,n,Ringing Exten => _X.,n,WaitExten(15) Exten => _X.,n,Congestion() Exten => _X.,n,Hangup() Exten => 8282,1,Noop(--- WE GOT TO CONTEXT TEST!--------- ) Either way it worked. It seems that when there is an include so long as there is something else that matches in the context you are in, even if it's shorter that takes preference to a longer match which seems like a bug. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20180626/217d804c/attachment.html>
Seemingly Similar Threads
- Asterisk not matching longest prefix with include
- Asterisk not matching longest prefix with include
- How to obtain SIPCHANINFO variables within custom application?
- security: SIP header spoofing CHANNEL(recvip)?
- Switching between Music on Hold streams. [13.8.2]