Mod local stream
From FreeSWITCH Wiki
Contents |
[edit]
What is it?
It streams files from a directory and multiple channels connected to the same stream will hear the same (looped) file playback .. similar to a shoutcast stream. Useful for Music-on-hold type scenarios.
[edit]
Configuration
Sample config
<directory name="foo" path="/tmp"> <param name="rate" value="8000"/> <param name="channels" value="1"/> <param name="interval" value="20"/> <param name="timer_name" value="soft"/> </directory>
Where interval is specified in milliseconds.
[edit]
How do I call it?
[edit]
Dialplan
Call it from the dialplan as follows:
<extension name="Music">
<condition field="destination_number" expression="^787326$">
<action application="playback" data="local_stream://foo"/>
</condition>
</extension>
To set for legs/bridges etc:
<extension name="Music">
<condition field="destination_number" expression="^787326$">
<action application="set" data="hold_music=local_stream://foo"/>
<action application="bridge" data="sofia/default/$1@1.2.3.4"/>
</condition>
</extension>
[edit]
Script
[edit]
FAQ
[edit]
What file formats can be in directory?
Q: Do the files need to be of a certain format (eg, wav) and/or a certain sample rate / bit width?
A. It can handle any format, bitrate, and bit width supported by sndfile (See: FreeSwitch Dependencies), but optimal performance will be achieved by resampling to PCM encapsulated in a WAV container at the native bitrate and bit width of the channel. For example, 8kHz, 16kHz, and 32kHz.
