Send DTMF Digit with dialplan - asterisk

I have the following dialplan:
exten => 224,1,NoOp(IN CALL : ${CALLERID(num)} => ${EXTEN})
exten => 224,n,Dial(${PJSIP_DIAL_CONTACTS(97,97)})
;exten => 224,n,Wait(3)
exten => 224,n,SendDTMF(*11234*,200)
exten => 224,n,Wait(3)
exten => 224,n,SendDTMF(#*)
exten => 224,n,Hangup()
When I call the extension 97 and it is connected, it doesnt seem to go next in line SendDTMF. What am I doing wrong?
Greetings

For who is looking for something like this without SendDTMF application, you can send DTMF with D option:
exten => n, Dial (SIP/97,60,D(1234))
If the DTMF passed are getted on the other side incomplete, use w option to delay 500 milliseconds.
Here I'm delaying 1 second
exten => n,Dial (SIP/97,60,D(ww1234))

Did you try using macros
[macro-send]
exten => s,1,SendDTMF(*11234*,200)
exten => s,n,Wait(3)
exten => s,n,SendDTMF(#*)
[yourDialPlan]
exten => 224,1,NoOp(IN CALL : ${CALLERID(num)} => ${EXTEN})
exten => 224,n,Dial(${PJSIP_DIAL_CONTACTS(97,97)},,M(send))
exten => 224,n,Hangup()

Related

Asterisk autodial and play recording

I am trying to originate a call using rawman, sending a phone number (57522666) as a parameter and playing a message to the answering party.
This is what I have so far:
http://192.168.11.11:8088/rawman?action=originate&channel=????&context=outboundmsg1&exten=s&priority=1&timeout=30000
And in extensions.conf:
[outboundmsg1]
exten => s,1,Answer
exten => s,2,Wait(1)
exten => s,3,Background(custom/message)
exten => t,1,Playback(vm-goodbye)
exten => t,2,Hangup
I have a SIP ATA as trunk with the following name: 23656429
I have no clue what to put in the channel parameter. I have tried SIP/23656429#57522666, but I don't get the outbound call.
In case someone else runs into this question... I got it to work by using the following:
http://192.168.11.11:8088/rawman?action=originate&channel=SIP/23656429/57522666&context=outboundmsg1&exten=s&priority=1&timeout=30000&callerid=23656429
And in extensions.conf
[outboundmsg1]
exten => s,1,Answer
exten => s,2,WaitExten()
exten => s,n,Wait(1)
exten => s,n,Playback(custom/elcodigo) ; "play outbound msg"
exten => s,n,SayDigits(1498)
exten => 2,n, Wait(1)
exten => s,n,Hangup

Identify DTMF is pressed or not on Asterisk IVR

I need help to identify that DTMF is pressed or not on the Asterisk IVR.
Scenario is:
I want to call an AGI script on the basis of DTMF pressed or not. If DTMF(IVR Menus) is pressed nothing to do.
If DTMF is not pressed call and AGI and save the information.
Any help is highly appreciated.
I am using asterisk-11
Use timeout option
[mainmenu]
exten => s,1,Answer
exten => s,2,SetMusicOnHold(default)
exten => s,3,DigitTimeout,5
exten => s,4,ResponseTimeout,10
;SAI menu - 1 for tech support, 2 for voicemail, 3 for echo test
exten => s,5,Background(sai-welcome)
exten => s,6,Background(sai-choose)
; Tech Support
exten => 1,1,AGI(dima-test.agi)
exten => 1,2,SetGlobalVar(ACCOUNTCODE=${callerid})
exten => 1,3,SetVar(testcallerid=${callerid})
exten => 1,4,Background(sai-reptech-welcome)
exten => 1,5,Queue(rep-tech)
; Leave Voicemail
exten => 2,1,VoicemailMain()
exten => 2,2,Hangup
; Play Music-on-Hold
exten => 5,1,MusicOnHold(default)
exten => 5,2,Goto(mainmenu,s,6)
; #=hangup
exten => #,1,Playback(sai-thanks)
exten => #,2,Hangup
exten => t,1,Goto(#,1) ; If they take too long, give up
exten => i,1,Playback(invalid) ; "That's not valid, try again"

Asterisk automatic incoming call answering

I am trying to learn ASterisk PBX and i have a problem that i did not saw in any tutorial.
I want to have and extension to automatically anser the call and transfert to extension 101 or 102 depending on the user selection from the softphone keyboard or voice. How can i implement that?
[default]
Exten => 101,1,Answer
Exten => 101,n,NoOp(Test101)
Exten => 101,n,Dial(SIP/101,12,r)
Exten => 101,n,VoiceMail(101#interno-ipca)
Exten => 101,n,Hangup()
Exten => 102,1,Answer
Exten => 102,n,NoOp(Test102)
Exten => 102,n,Dial(SIP/102,12,r)
Exten => 102,n,VoiceMail(102#interno-ipca)
Exten => 102,n,Hangup()
Hi if you want to anwser any call you can use
exten => _X,1,Answer()
exten => _X,2,Read($Number,,[max digits])
exten => _X,3,Dial(SIP/$Number)
You can use [max digits], otherwise asterisk waits until the maximum of digits is reached, or you end the typing with "#"

Asterisk Dialplan preventing dialplan from repeating continuously

I have the following macro in my diaplan which is excuted each time an incoming call comes.
Problem is that it is repeating itself indefinitely. I want it to repeat 3 times, if no input from the user, it should say goodbye and quit. Could anyone help me with this please.
Thanks
[macro-test]
;exten => s,1,Answer()
;exten => s,n,Wait(2)
exten => s,1,Set(AGISIGHUP=no)
exten => s,n,NoOp(AGISUGHUP: ${AGISIGHUP})
exten => s,n,Set(CALLED=${MACRO_EXTEN})
exten => s,n,Set(CALLER=${CUT(CUT(SIP_HEADER(From),#,1),:,2)})
exten => s,n(action),Set(EXIT=0)
exten => s,n,Set(TOKEN="")
exten => s,n,Set(INIT="true")
exten => s,n,While($[${EXIT}<1])
exten => s,n,Set(EXIT=1)
exten => s,n,Agi(agi://${ARG1}/server.agi?caller=${CALLER}&called=${CALLED}&init=${INIT})
exten => s,n,Set(INIT="false")
exten => s,n,NoOp(AGISTATUS: ${AGISTATUS})
exten => s,n,GotoIf($["${AGISTATUS}" != "SUCCESS"]?fail:succ)
exten => s,n(succ),EndWhile()
exten => s,n,Set(INIT="end")
exten => s,n,Agi(agi://${ARG1}/server.agi?caller=${CALLER}&called=${CALLED}&init=${INIT})
exten => s,n,Hangup()
exten => s,n(fail),Wait(2)
exten => s,n,Playback(vm-goodbye)
exten => s,n,Hangup()
exten => h,1,NoOp(Notify Billing System)
exten => h,n,NoOp(Other Tasks)
exten => h,n,Hangup()
Simple loop dialplan
exten =>s ,1,Set(loop=3)
exten =>s,n(loop),Noop(loop start here)
exten =>s,n,Noop(do something here)
exten =>s,n,Set(loop=$[ ${loop} - 1 ]);decrease loop countr
exten =>s,n,GotoIf($[ ${loop} > 0 ]?loop); if still have something, do again
exten => h,n,Hangup()
Don't call hangup, when you're already hung up.

How to prevent Macro from returning to Gosub

I'm using Asterisk. Here is my scenario:
[my-custom-ivr]
exten => s,1,Background(fa/main_menu)
exten => 1,1,Gosub(ghesse-sub,s,1(1))
[ghesse-sub]
exten => s,n,Macro(get-subfolder,${ARG1})
exten => S,n,Read(digitsDetected,"barg/1-Ghesseh/GhesseMenu/1",1,,2,10)
exten => s,n,NoOp(${digitsDetected});
exten => s,n,Macro(get-storyfilename,${digitsDetected})
exten => s,n,Playback(${StoryFileName})
exten => s,n,NoOp(${MaxStoryID})
exten => s,n,NoOp(${StoryFolderID})
After executing Macro(get-subfolder,${ARG1}) it goes back to Gosub(ghesse-sub,s,1(1)). How to prevent it from doing that?
This is the desired behavior of GoSub (execute a subroutine and then continue where you left off).
If you don't want this behavior, then you should be using Goto instead.

Resources