The extensions doesn`t send to the right context

The dial plan is this:

[ivrsystem]
exten => _X.,1,Answer()
exten => _X.,n,Goto(extensions,s,1)
exten => _X.,n,Hangup()

[extensions]
exten => _X.,n,Answer() ; Answer the line
exten => _X.,n,Background(ivr/choice_1)
exten => _X.,n,WaitExten()

exten => i,1,Background(ivr/choice_1)
same => n,WaitExten()
exten => t,1,Set(TIMEOUT(digit)=10) ; Set Digit Timeout to 5 seconds
exten => t,2,Set(TIMEOUT(response)=20) ; Set Response Timeout to 10 seconds
exten => t,3,Hangup()

exten => 1,1,Goto(right,s,1)
exten => 2,2,Goto(wrong,s,2)

[right]
whatever i want

[wrong]
thank you whatever

The problem i`m having is that the 1 [right] and 2 [ wrong] is not sending to the context. It just hangs up or just repeats the intro. Thank you if you can help.

  1. in extensions there is no “s” context
  2. in extensions the “_X.” do not have a line 1
  3. in extensions I belive that “_X.” should be “s”
  4. please use “same” where possible
  5. “exten => 2,2,Goto(wrong,s,2)” to many “2”
  6. “TIMEOUT” should be set before WaitExten
  7. “TIMEOUT” should be set in the “s” part
  8. change “exten => i,1,Playback” to exten => i,1,Goto(s,1)
  9. naming of “ivrsystem” & “extensions” are illogical, maybe swap them

try use a syntax check

Hello TheMark,

I am brand new at asterisk, so its a lot of trial and error, and i learn as i go along. Someone made this for me, and im changing it to suit my needs, but it`s a lot of trial and error. I get help where i can and try that.
Thank you for all your valuable imput, and will see how it goes.

Hello,

[ivrsystem]
exten => _X.,1,Answer()
exten => _X.,n,Goto(extensions,s,1)
exten => _X.,n,Hangup()

[extensions]
exten => _X.,n,Answer() ; Answer the line
exten => _X.,n,Background(ivr/choice_1)
exten => _X.,n,WaitExten()

exten => i,1,Background(ivr/choice_1)
same => n,WaitExten()
exten => t,1,Set(TIMEOUT(digit)=10) ; Set Digit Timeout to 5 seconds
exten => t,2,Set(TIMEOUT(response)=20) ; Set Response Timeout to 10 seconds
exten => t,3,Hangup()

exten => 1,1,Goto(right,_X.,1)
exten => 2,2,Goto(wrong,_X.,1)

[right]

– Executing [_X.@right:3] NoOp(“PJSIP/signalwire-00000000”, “First we start by getting the phone number”) in new stack
– Executing [_X.@right:4] Set(“PJSIP/signalwire-00000000”, “phone=_X.”) in new stack

This is the result. If i put with S and same, it shows “phone=s” .

I don`t understand why.

Any help with be apreciated.

You shouldn’t use patterns in Goto’s, etc. They will be treated as literal strings, and _ is not a digit from 0-9, so will not match the _X pattern in the right and wrong contexts. I’m not sure what you are trying to achieve here, so I can’t tell you what it should be. However, if you are expecting the original destination extension, you lost that at the WaitExten.

exten => 2,2 is unreachable , as WaitExten will always go to priority 1.

Furthermore, its GoTo will fail, as there is no wrong context.

Priority 3 of ivrsystem is unreachable, as it is after an unconditional GoTo.

I do have the [wrong] context, if press 2 it will go to thank you for calling, i just didnt put the context here because it has no point. What im interested is why it does not recognizing the phone number and not display it.

It should`ve been
– Executing [_X.@right:4] Set(“PJSIP/signalwire-00000000”, “phone=+1800000000.”) in new stack

I’ve already answered that. You lost the number when you replaced it with the menu choice, and “_X.” on the right hand side has no special meaning, it is just the literal three characters.

You would need to save the contents of ${EXTEN} to another variable, before you overwrote it with the WaitExten.