Control Stream File

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

Sends audio file on channel and allows the listener to control the stream.

Last reviewed 2026-04-14

control stream file filename escape_digits skipms ffchar rewchr pausechr offsetms
Description

Send the given file, allowing playback to be controlled by the given digits, if any. Use double quotes for the digits if you wish none to be permitted. If offsetms is provided then the audio will seek to offsetms before play starts. 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. Returns the position where playback was terminated as endpos.

It sets the following channel variables upon completion:

  • CPLAYBACKSTATUS - Contains the status of the attempt as a text string
    • SUCCESS
    • USERSTOPPED
    • REMOTESTOPPED
    • ERROR
  • CPLAYBACKOFFSET - Contains the offset in ms into the file where playback was at when it stopped. -1 is end of file.
  • CPLAYBACKSTOPKEY - If the playback is stopped by the user this variable contains the key that was pressed.
Arguments
  • filename required - The file extension must not be included in the filename.
  • escape_digits required
  • skipms
  • ffchar - Defaults to #
  • rewchr - Defaults to *
  • pausechr
  • offsetms - Offset, in milliseconds, to start the audio playback

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.