Stream File

Since 0.4.0 AGI Commands Found this useful? Upvote it. ×

Sends audio file on channel.

Last reviewed 2026-04-14

stream file filename escape_digits sample offset
Description

Send the given file, allowing playback to be interrupted by the given digits, if any. Returns 0 if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed, or -1 on error or if the channel was disconnected. If musiconhold is playing before calling stream file it will be automatically stopped and will not be restarted after completion.

It sets the following channel variables upon completion:

  • PLAYBACKSTATUS - The status of the playback attempt as a text string.
    • SUCCESS
    • FAILED
Arguments
  • filename required - File name to play. The file extension must not be included in the filename.
  • escape_digits required - Use double quotes for the digits if you wish none to be permitted.
  • sample offset - If sample offset is provided then the audio will seek to sample offset before play starts.

User Notes

No notes yet. Be the first to contribute a tip or example.

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.