Outbound Call Files (.call): Preventing Audio Clipping / Premature Playback on Answer

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:

  1. Drop a .call file to trigger an outbound call to an external number.

  2. Ensure the remote party answers.

  3. Immediately play an announcement audio file cleanly without clipping the beginning.

  4. 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.conf using BackGround(), Wait(), and the U() 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!

My Conspiracy Mind says: “For some unknown reason some providers didn’t listen(packets are garbage for them) your rtp media right after they answer 200 OK to you. They wait for an initial amount of RTP to really starts relay your media to B leg.”

That’s said, replace your Wait(1.5) right after Answer() with Playback(silence/1) and check if that was enough to stablish rtp media without clipp your main audio.