Play Files To Caller In Asterisk

Home » Asterisk Users » Play Files To Caller In Asterisk
Asterisk Users 10 Comments

I want to be able to allow a caller to dial a DDI system to verify identity etc (this is all done), I then want them to sit listening to music, until an event happens.

When this (external) event happens, I want to play a certain file to the caller, using playback (so that they have ff / rw etc), and when finished, go back to the music.

1) I thought of redirecting to an extension that played the file, and then jump back to the original Asterisk dialplan entry to start again. However, If I want to redirect, then this external event would need to know their channel.

2) I thought of a meetme / conference, but then they would not be able to control the playback of the file, right ?

Anyone got any other thoughts ?

10 thoughts on - Play Files To Caller In Asterisk

  • Thanks Steve,

    Not sure how this would allow the caller to ff / rw the file currently
    being played – would that portion have to be written in the external
    program ?

    Are there any examples of how to use externalivr anywhere (I can’t
    find on google)



    href=””>      Voice: +1-760-468-3867 PST

  • Thanks for that – I had already seen that particular page.

    Still can’t figure out how to fastforward / rewind the current file
    being played.


    2010/8/29 Ondrej Škopek :
    href=””>      Voice: +1-760-468-3867

  • (Just an idea:) how about if you create an extention that executes the
    externalivr in case of an event, and then make some external app that would
    ff if the user inputs some DTMF event, rw if he inputs some other DTMF
    event, etc. I don’t know exactly what would be required, but I think it
    could work somehow like that..

    href=””> Voice: +1-760-468-3867

  • Un-top-posting…

    Your program receives the DTMF out of band. It would be easier if the DTMF
    event included the file “interrupt” offset and the S command allowed you
    to specify the starting offset… Bounty?

    I’m wondering if you could do anything with specifying a named pipe to S
    and specifying the starting offset to the process filling the pipe?

    A VERY trivial example is available at

    How about another tack?

    How about an AGI playing (“stream file”) a series of short “music”
    segments while checking for your external event. (Remember that AGIs can
    be multi-threaded if your external event needs it.) Then use “control
    stream file” for your content playback?

    Can you reply with a bit more narrative about your application?

    What is the external event?

  • Hi Tilghman , thanks for the help.

    ControlPlayback can’t be used with ExternalIVR, can it ?

    We use ControlPlayback in our current dialplan, what I am wanting (in
    concept) is to have a meetme/conference room where one of the parties
    is a caller, and the other party a file to be controlplaybacked by the
    caller 😉

    Best I have come up with so far is to start an attendant menu, get
    some curl data, if blank WaitExten() loop back to start, if not
    ControlPlayback the data. If I also background() some music file, will
    that play while the loop is running ? I suspect that it will start
    again from the beginning.


  • No, ControlPlayback can’t be used with ExternalIVR, because ExternalIVR
    passes *all* DTMF input from the connected channel to the ExternalIVR
    process, since that is necessary to be able to interrupt playback.

    It wouldn’t be terribly hard to extend the ExternalIVR protocol to allow
    the external process to rewind/fast-forward the file being played back,
    and then it could do that based on receiving DTMF input.