@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-ASTRCLI>
> 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>