[RESOLVED] WaitExten not working

Hi,

I am trying to implement the WaitExten function in my dialplan, however it is not working as expected. Basically I want to call a few numbers one by one, play them a message(press 1 to accept the call, press 2 to reject) asking for an input and decide what to do based on the number entered.

Here is my extensions.conf:

[code]exten=>400,1,Progress() ;telephony signaling
same => n,Playback(followme/pls-hold-while-try,noanswer)
same => n,Dial(PJSIP/6010,20,rU(ackcall^s^1)) ; call using ackcall context
same => n,Dial(PJSIP/6002,20,rU(ackcall^s^1)) ; my contacts in emergency
same => n,Playback(followme/sorry,noanswer)
same => n,Hangup()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; used for implementation of looped call with feedback
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[ackcall]
exten => s,1,Background(followme/no-recording&followme/options) ;1 to answer, 2 to reject
same=>n,WaitExten(5) ;wait for five seconds till the called person enterss a number
same=>n,Set(GOSUB_RESULT=BUSY) ;no number entered, this contact is marked as busy

exten=>1,1,Playback(you-entered)
same=>n,SayNumber(1)
same=>n,NoOp() ;pressed 1, do nothing, the call is bridged

exten=>2,1,Set(GOSUB_RESULT=BUSY) ;pressed 2, mark as busy
exten=>i,1,Set(GOSUB_RESULT=BUSY) ;pressed an invalid number [/code]
However, the call is bridged no matter what number is pressed. If no number is pressed, then the call is ended - works as expected (this is just for the moment, eventually i want to replay the message and wait for input again if nothing is pressed). Are there maybe other solutions for this scenario? Can anyone help me? Thank you very much in advance!

You should use the Read-application instead of Backgrund/WaitExten in Your ackcall-Context.

Thanks for the quick reply! Ok I will try with the Read application. Can you also tell me why the WaitExten is not working here? It would be nice to know when to use Read and when to use WaitExten.

WaitExten should - by documenation - even work in Your scenario (whenever the digits 1 or 2 are pressed).
You probably should dig into it by enabling dtmf logging (either on console or to file) to have a look, which keypress is detected by Asterisk.

However: For Your goal I find that the Read-command is more adequate - You even may combine the Message and the transfer of the result into a variable.

When using Background together with WaitExten You’ll often face the fact that somebody enters the digit while Background is still active. In this cases the WaitExten is even useless as the digit pressed while Background was running is immediately interpreted as the new extension (within the same context).

Great, thank you very much for the explanation!