Hi everyone,
I’m trying to set up a custom outbound dialing script using a .call file and Asterisk custom dialplan.
My Goal:
- Trigger an outbound call via a JMP SIP trunk to a mobile phone.
- When the person answers, play a custom audio recording cleanly right from the start (without clipping the first syllable).
- Allow the callee to press “1” during or after the message to bridge the call over to a local PJSIP extension (e.g., extension 100 running on MicroSIP).
What I’ve tried:
- Using a standard Background() routine inside a subroutine: The audio plays, but the timing is sometimes out of sync or clips the beginning.
- Using the A() dial option: Plays the announcement cleanly and instantly upon answer, but it’s a one-way stream and doesn’t allow capturing DTMF keypresses (like pressing “1”) to route the call back to my local extension.
- Using the G() option to split the legs: Allows custom routing, but managing the split state between the callee leg playing the audio and capturing the extension input has been tricky.
Here is what my current custom extensions configuration looks like:
[outbound-trigger]
exten => _X.,1,NoOp(— Outbound Trigger Initiated —)
exten => _X.,n,Dial(PJSIP/${EXTEN}@Trunk,U(play-audio-sub))
exten => _X.,n,Hangup()
[play-audio-sub]
exten => s,1,NoOp(— Answer Confirmed: Interactive Prompt —)
exten => s,n,Answer()
exten => s,n,Wait(0.5)
exten => s,n,Background(custom/Request,m)
exten => s,n,WaitExten(10)
exten => s,n,Return()
exten => 1,1,NoOp(— User Pressed 1: Ringing MicroSIP —)
exten => 1,n,Dial(PJSIP/100,tT)
exten => 1,n,Return()
If anyone has a recommended best practice or example of how to cleanly play an announcement to an outbound callee and capture a DTMF digit to bridge them to an internal local extension, I would greatly appreciate the guidance!