Random Sound Playback for Load Testing

Features Asterisk 18+ -- Last reviewed 2026-04-14 testing load-testing audio Found this useful? Upvote it. ×

Random Sound Playback for Load Testing

When you need to simulate active calls for load testing or verify audio paths across a system, this extension plays random sounds from Asterisk's sound library in an infinite loop. Point a SIP load generator at it and watch how the system handles sustained call volume.

The dialplan

[testing]
exten => 999,1,Answer()
same => n(loop),Set(RANDSOUND=${SHELL(ls /var/lib/asterisk/sounds/en/*.wav 2>/dev/null | shuf -n1 | xargs -I{} basename {} .wav | tr -d '\n')})
same => n,GotoIf($["${RANDSOUND}" = ""]?done)
same => n,Playback(${RANDSOUND})
same => n,Goto(loop)
same => n(done),Hangup()

Each iteration picks a random .wav file from the English sound directory, strips the extension, and plays it. The loop runs until the caller hangs up.

Generating test calls

From the Asterisk CLI, originate a batch of test calls:

# Single test call (30 second timeout)
asterisk -rx 'channel originate Local/999@testing application Wait 30'

# 10 concurrent calls
for i in $(seq 1 10); do
    asterisk -rx "channel originate Local/999@testing application Wait 60" &
done

Notes

User Notes

Know a tip or gotcha for this topic? Share it below and help others.

Contribute a note

Share a tip, gotcha, or practical example. Keep it under 2000 characters. No questions (use the Asterisk community forums for support). Wrap code in backticks.

Moderated before publishing. Email never shown.
Related Snippets