Telecom

Asterisk Dialplan: Playback Application (Latest Versions)

MYLINEHUB Team • 2026-02-10 • 9 min

Updated guide for modern Asterisk (PJSIP era): playback application with real configs, common mistakes, and troubleshooting steps.

Asterisk Dialplan: Playback Application (Latest Versions)

The Playback() application is one of the most commonly used building blocks in Asterisk dialplan. It allows the system to play an audio prompt to the caller without expecting any input.

Almost every real telecom flow uses Playback(): IVR greetings, queue announcements, error messages, hold instructions, voicemail guidance, and automated notifications.

This guide explains Playback() in the context of modern Asterisk with PJSIP, including correct file placement, supported formats, and real production troubleshooting.

Basic Syntax of Playback()

Playback(filename)

Example:

exten => 1000,1,Answer()
 same => n,Playback(hello-world)
 same => n,Hangup()

This answers the call, plays the file hello-world, then hangs up.

Where Audio Files Must Be Stored

Default sound directory:

/var/lib/asterisk/sounds/

Example file path:

/var/lib/asterisk/sounds/en/hello-world.wav

Important rule: Do not include the file extension in Playback().

Playback(hello-world)   ✔ correct
Playback(hello-world.wav)   ✖ wrong

Supported Audio Formats in Modern Asterisk

  • WAV (PCM 16-bit, 8kHz) → safest universal format
  • GSM → smaller size, telephony optimized
  • ULAW / ALAW → native telephony codecs
  • SLN / SLIN16 → raw signed linear audio

Recommended production format: mono, 8000 Hz, 16-bit PCM WAV.

Playing Multiple Prompts Sequentially

Playback() can chain files using &:

Playback(welcome&please-hold&music)

Asterisk plays each prompt in order without extra dialplan steps.

Difference Between Playback() and Background()

  • Playback() → plays audio and ignores keypad input
  • Background() → plays audio and listens for DTMF

Use Playback() when:

  • No user interaction is required
  • Announcement must complete fully

Use Background() for IVR menus.

Playback with Variables (Dynamic Audio)

Playback() supports dynamic filenames:

same => n,Set(LANG_PROMPT=welcome-en)
same => n,Playback(${LANG_PROMPT})

Useful for:

  • Multi-language IVR
  • Database-driven announcements
  • Customer-specific audio

Handling Missing Audio Files Safely

If a file is missing, Asterisk logs an error and continues. To avoid silent failures:

same => n,ExecIf($[${STAT(e,/var/lib/asterisk/sounds/en/welcome.wav)}]?Playback(welcome):Playback(invalid))

This ensures a fallback prompt exists.

Playback in Real Production Call Flows

Inbound Greeting Before Ringing Agent

[from-trunk]
exten => s,1,Answer()
 same => n,Playback(thank-you-for-calling)
 same => n,Dial(PJSIP/1001,20)
 same => n,Voicemail(1001@default)
 same => n,Hangup()

Queue Announcement

same => n,Playback(all-agents-busy)
same => n,Queue(support)

Common Playback Problems and Fixes

No Sound Heard

  • RTP / NAT issue (not audio file problem)
  • Firewall blocking UDP media ports

File Not Found Error

  • Wrong filename or language folder
  • Incorrect audio format

Audio Distorted

  • Wrong sample rate (must be 8kHz for telephony)
  • Stereo instead of mono

Always check CLI logs:

asterisk -rvvv

Best Practices for Production Prompts

  • Keep prompts short and clear
  • Normalize volume across all files
  • Use consistent voice tone and language
  • Store custom prompts in organized folders

Clear audio design improves customer experience and conversion rates.

Key Takeaway

Playback() is the simplest yet most powerful way to communicate with callers inside Asterisk.

Mastering file formats, storage paths, chaining, and troubleshooting ensures your IVR, queues, and automation flows sound professional and reliable.

Try it

Want to see API-driven CRM + Telecom workflows in action? Try the WhatsApp bot or explore the demos.

💬 Try WhatsApp Bot ▶️ Watch CRM YouTube Demos
Tip: Comment “Try the bot” on our YouTube videos to see automation in action.
M
MYLINEHUB Team
Published: 2026-02-10
Quick feedback
Was this helpful? (Yes 0 • No 0)
Reaction

Comments (0)

Be the first to comment.