Listening to DTMF Read while playing a Playback file

Good day. I have a voicemail dialplan. While it is playing the Playback I want it to be able to listen to DTMF at the same time such that once it reads the required input it will stop Playback and proceed to the next steps.

exten => s,1,Playback(vm-nobodyavail)
exten => s,n(begin),Playback(“custom/voicemail-request”)
exten => s,n,Log(NOTICE,INit---->)
exten => s,n,Set(wait=2)
exten => s,n,Set(gottries=0)
exten => s,n,Set(got=)
exten => s,n(getmore),Set(timer=${EPOCH})
exten => s,n,Read(get,“silence/1”,${wait})
exten => s,n,Log(NOTICE,reading ${get})
exten => s,n,Log(NOTICE,reading–> $[${REGEX(“1” ${get})} = 1]==1)
exten => s,n,Set(timer=$[${EPOCH}-${timer}])
exten => s,n,GotoIf($[${timer}==$[${wait}+1]]?gotnothing:gotsomething)
exten => s,n(gotnothing),Set(gottries=$[${gottries}+1])
exten => s,n,Log(NOTICE,${gottries} Waiting for voicemail input)
exten => s,n,GotoIf($[${LEN(${get})} == 0]?reallynothing:gotdigit)
exten => s,n(reallynothing),GotoIf($[${gottries}>2]?end:getmore)
exten => s,n(gotsomething),Set(gottries=0)
exten => s,n,GotoIf($[${LEN(${get})} == 0]?end:gotdigit)
exten => s,n(gotdigit),GotoIf($[${REGEX(“1” ${get})} = 1] == 1]?tovoicemail:end)
exten => s,n(tovoicemail),VoiceMail(${ARG1}@default)
exten => s,n,Hangup()
exten => s,n(end),Hangup()
;

You need to use Background and WaitExten for this sort of behaviour. They require a different dialplan structure.

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