This module allow one to play local and remote mp3 files at any sample rate.
Install Dependencies
On Debian:
apt-get install libvorbis0a libogg0 libogg-dev libvorbis-dev
|
On CentOS 5.x:
yum install libvorbis libvorbis-devel libogg libogg-devel
|
On CentOS 6.x:
yum install libshout-devel lame-devel libmpg123-devel
|
Enable module in build.
Edit modules.conf in source directory to add mod_shout.
formats/mod_sndfile
formats/mod_shout <--- NEW
#languages/mod_perl
|
Configure/Make:
./configure && make install
|
Can play local mp3 files at any sample rate (8khz, 16khz, 44.5khz) in mono/stereo, re-sampling happens on the fly. (note: re-sampling can be expensive for the CPU)
session.streamFile("shout://some.server.com/file.mp3", "")
Can play icecast streams. TODO: example
<
extension
name
=
"shout"
>
<
condition
field
=
"destination_number"
expression
=
"^750$"
>
<
action
application
=
"answer"
/>
<
action
application
=
"playback"
data
=
"shout://scfire-dll-aa02.stream.aol.com:80/stream/1074"
/>
</
condition
>
</
extension
>
<
extension
name
=
"moh_for_bridges"
>
<
condition
field
=
"destination_number"
expression
=
"^(15145555555)$"
>
<
action
application
=
"set"
data
=
"hold_music=shout://scfire-dll-aa01.stream.aol.com:80/stream/1018"
/>
<
action
application
=
"bridge"
data
=
"sofia/default/$1@1.2.3.4"
/>
</
condition
>
</
extension
>
|
To use shoutcast for moh you have to do three things.
NOTE: If you just use "hold_music=shout://url" you will have issues after the first time you place the call on hold.
<directory name="moh/shout" path="$${base_dir}/sounds/music/shout"> <param name="rate" value="8000"/> <param name="shuffle" value="true"/> <param name="channels" value="1"/> <param name="interval" value="10"/> <param name="timer-name" value="soft"/> </directory>
<configuration name="shout.conf" description="mod shout config"> <settings> <!-- Don't change these unless you are insane --> <!--<param name="decoder" value="i586"/>--> <param name="volume" value="0.7"/> <!--<param name="outscale" value="8192"/>--> </settings> </configuration>
Using mod_shout for TTS is not recommend in a live environment due to lack of caching. For setup examples see http://wiki.freeswitch.org/wiki/Category:TTS#Via_mod_shout_using_online_TTS
Can record to local MP3 files.
Can record to icecast and/or shoutcast streams.
Certain things like fast-forwarding and rewinding might not work especially if the mp3 is "badly encoded". If you need those features, one thing to try is to decode the mp3 to a wave, and re-encode it back to an mp3 in order to cleanse it of errors. If this still does not work, consider converting it to a wave and using it in that format.
Edit /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml to add mod_shout to the list.
<
load
module
=
"mod_native_file"
/>
<!--For icecast/mp3 streams/files-->
<
load
module
=
"mod_shout"
/> <------- NEW
|
from the CLI, run "load mod_shout"
See Playing/Recording External Media for instructions on how to play an MP3 file into a conference call.
If its not working, try the following:
Rather than relying on the overall configure script to invoke this, go to the src/lib/libshout directory and run configure directly. If you get an error like:
checking for libogg... not found
checking for VORBIS... checking for libvorbis... not found
configure: error: requisite Ogg Vorbis library not found
|
Also, try deleting both the libs/libshout-2.2.2 and libs/lame-3.97 directory and rerunning make.
To record to Icecast server from your conference or your call:
<
action
application
=
"record"
data
=
"shout://source:pass@10.10.10.10:8000/stream.mp3"
/>
|
For conference, I do it from console:
conference 3001-10.10.10.10 record shout://source:pass@10.10.10.10:8000/stream.mp3
|