Call dtmf in diaplan crash asterisk server

I am having this simple diaplan. When caller press any key its crashing the asterisk server without dtmf no issues at all.

[incoming]
exten => _X.,1,NoOp(Inbound call from: ${CALLERID(all)} to: ${EXTEN}, Call Unique ID: ${UNIQUEID})
same => n,Set(COUNTER=0)
same => n,WaitExten(1)
same => n,Background(selection1)
same => n,Set(COUNTER=$[${COUNTER} + 1])
same => n,Read(DTMF,1,1,3)
same => n,GotoIf($[“${DTMF}” = “1” | “${DTMF}” = “2” | “${DTMF}” = “3”]?route_to_queue)
same => n,GotoIf($[${COUNTER} < 3]?start)
same => n(end),Hangup()
[route_to_queue]
exten => _X.,1,Queue(Queue444)
same => n,Hangup()

kindly help how can i resolve this.

{Using Asterisk 20.8.1 with PJSIP}

I am a bit confused you are using Background and also Read because I think you should either use one or the other.
What you are trying to do should be possible with Background alone I think.

1 Like

As noted above and the order of WaitExten and Background is also wrong.

For a crash, we need a backtrace created with an unoptimised build with full debugging symbols. Also you should say what “crash” means, in practice.

I assume that you mean daemon, not server.

yes, the asterisk service crashes and stop, i need to start it again to continue my testing.

I am using this one to create a delay for 1 second before playing the file using Background.
same => n,WaitExten(1)
Using same => n,Read(DTMF,1,1,3) like i want capture the pressed DTMF.

kindly advice if am using incorrectly the functions.

thanks

You should use Wait, if you want a delay, or simply include silence at the start of the message.

If you are going to use Read, you probably want to use Playback. rather than Background.

1 Like

On a normal installation, the Asterisk daemon is automatically restarted if it crashes, so I suspect you have deadlock. In any case, you need to provide the information requested, see:

https://docs.asterisk.org/Development/Debugging/Getting-a-Backtrace/?h=backtrace

1 Like

I believe you should just use Wait(1);
Remove same => n,Background(selection1)
Replace same => n,Read(DTMF,1,1,3) with same => n,Read(DTMF,selection1,1, ,1,3)

I would also avoid using ${DTMF} , I’m not sure if this is a reserved variable but I would try something else like ${MY_DTMF}

1 Like

@david551 and @logikanet

thank you for your help and support. After changing the diaplan as per your instructions, its working.

[incoming]
exten => _X.,1,NoOp(Inbound call from: ${CALLERID(all)} to: ${EXTEN}, Call Unique ID: ${UNIQUEID})
same => n,Set(COUNTER=0)
same => n,Wait(1)
;same => n(start),Background(selection1)
same => n(start),Read(DTMF,selection1,1,1,3)
same => n,Set(COUNTER=$[${COUNTER} + 1])
;same => n,Read(DTMF,1,1,3)
same => n,GotoIf($[“${DTMF}” != “”]?route_to_queue,s,1)
same => n,GotoIf($[${COUNTER} < 3]?start)
same => n,Hangup()

exten => i,1,Playback(invalid)
same => n,Hangup()

exten => e,1,Playback(error)
same => n,Hangup()

[route_to_queue]
exten => s,1,NoOp(Routing to queue with dtmf : ${DTMF})
same => n,GotoIf($[“${DTMF}” = “1” | “${DTMF}” = “2” | “${DTMF}” = “3”]?route_to_queue,queue,1)
same => n,Playback(invalid)
same => n,Hangup()

exten => queue,1,Queue(Queue444)
same => n,Hangup()

Console log:

PBX-ASTRCLI>
– Executing [91739624844@incoming:1] NoOp(“PJSIP/pjsip-00000019”, “Inbound call from: “91739624795” <91739624795> to: 91739624844, Call Unique ID: 1720314157.50”) in new stack
– Executing [91739624844@incoming:2] Set(“PJSIP/pjsip-00000019”, “COUNTER=0”) in new stack
– Executing [91739624844@incoming:3] Wait(“PJSIP/pjsip-00000019”, “1”) in new stack
– Executing [91739624844@incoming:4] Read(“PJSIP/pjsip-00000019”, “DTMF,selection1,1,1,3”) in new stack
– Accepting a maximum of 1 digits.
> 0x7fcac4080b80 – Strict RTP learning after remote address set to: 10.159.21.13:36028
> 0x7fcac4080b80 – Strict RTP switching to RTP target address 10.159.21.13:36028 as source
– <PJSIP/pjsip-00000019> Playing ‘selection1.slin’ (language ‘en’)
PBX-ASTR
CLI>
> 0x7fcac4080b80 – Strict RTP learning complete - Locking on source address 10.159.21.13:36028
– User entered ‘3’
– Executing [91739624844@incoming:5] Set(“PJSIP/pjsip-00000019”, “COUNTER=1”) in new stack
– Executing [91739624844@incoming:6] GotoIf(“PJSIP/pjsip-00000019”, “1?route_to_queue,s,1”) in new stack
– Goto (route_to_queue,s,1)
– Executing [s@route_to_queue:1] NoOp(“PJSIP/pjsip-00000019”, “Routing to queue with dtmf : 3”) in new stack
– Executing [s@route_to_queue:2] GotoIf(“PJSIP/pjsip-00000019”, “1?route_to_queue,queue,1”) in new stack
– Goto (route_to_queue,queue,1)
– Executing [queue@route_to_queue:1] Queue(“PJSIP/pjsip-00000019”, “Queue444”) in new stack
– Started music on hold, class ‘default’, on channel ‘PJSIP/pjsip-00000019’
PBX-ASTR*CLI>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.