Hello everyone,
I am working on an automated outbound calling script using Asterisk .call files and a PJSIP trunk, but I am running into a timing issue where the audio announcement starts playing a split-second too early or before the handset is fully in the “Up” state, leading to clipped audio.
The Goal:
-
Drop a
.callfile to trigger an outbound call to an external number. -
Ensure the remote party answers.
-
Immediately play an announcement audio file cleanly without clipping the beginning.
-
Capture DTMF input (specifically pressing
1) to bridge the call to a local extension (MicroSIP via PJSIP/100).
Current Setup & What I’ve Tried:
-
I have been experimenting with
extensions_custom.confusingBackGround(),Wait(), and theU()subroutine option. -
Using
Dial(PJSIP/${EXTEN}@JMP_Trunk,,U(subroutine))works well for catching DTMF and bridging, but on the first call, the audio path sometimes initializes a fraction late or clips the first syllable. -
Adding pre-dial or post-answer buffers helps, but sometimes results in the audio playing right on the edge of pickup or slightly out of sync.
Here is a snippet of my current approach:
[outbound-trigger]
exten => _X.,1,NoOp(--- Outbound Trigger Initiated ---)
exten => _X.,n,Dial(PJSIP/${EXTEN}@SIP_Trunk,,U(interactive-audio-sub))
exten => _X.,n,Hangup()
[interactive-audio-sub]
exten => s,1,NoOp(--- Callee Answered ---)
exten => s,n,Answer()
exten => s,n,Wait(1.5)
exten => s,n,Background(custom/custom_file)
exten => s,n,WaitExten(10)
exten => s,n,Return()
exten => 1,1,NoOp(--- User Pressed 1: Bridging ---)
exten => 1,n,Playback(auth-thankyou)
exten => 1,n,Dial(PJSIP/100,,tT)
exten => 1,n,Return()
Question: What is the recommended best practice in Asterisk 23 for synchronizing outbound call channel answers with Background() or announcement playback so that the audio strictly starts after the handset answers, without clipping or premature playback?
Any advice or examples on handling robust outbound IVR synchronization would be greatly appreciated!