Skip to main content

Playing recording external media

1. CLI examples

1.1 Play WAV into a conference

Assuming that a conference named freeswitch is configured, and at least one party is connected:

freeswitch@host> conference freeswitch play /tmp/foo.wav

foo.wav will have to be 8kz, 16-bit, 1 channel, otherwise the audio will sound distorted because the timing will be wrong. (At least when testing with a Sipura ATA)

1.2 Play local MP3 into a conference

To play MP3 files, mod_shout needs to be built and loaded.

Assuming that a conference named freeswitch is configured, and at least one party is connected:

freeswitch@host> conference freeswitch play /tmp/foo.mp3

MP3 can be encoded at either 8Khz or 44,100khz, and it will sound correct in both cases.

1.3 Broadcast WAV into live call

Issue show channels at the console, find the UUID for the call you are interested in, and use

uuid_broadcast <uuid> /path/to/file.wav both

2. Python examples

2.1 Play remote MP3

To play MP3 files, mod_shout needs to be built and loaded.

Create a Python script that calls

session.playFile("shout://some.server.com/file.mp3")

See mod_python for a sample script this can be plugged into.

3. Dialplan examples

  <extension name="wavs">
<condition field="destination_number" expression="^2009$">
<action application="playback" data="/path/to/your.wav"/>
</condition>
</extension>