Music On Hold Module
From Yate Documentation
(Difference between revisions)
(→Sample for using a VLC wrapper script to play an Internet radio channel) |
(Added Javascript example) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 29: | Line 29: | ||
; same madplay but with wideband support | ; same madplay but with wideband support | ||
wideband=while true; do madplay -q --no-tty-control -m -R ${rate$8000} -o raw:- -z sounds/*.mp3; done | wideband=while true; do madplay -q --no-tty-control -m -R ${rate$8000} -o raw:- -z sounds/*.mp3; done | ||
+ | |||
+ | ; analog line input | ||
+ | linein=arecord -c 1 -f S16 -r 8000 | ||
===Sample for using a VLC wrapper script to play an Internet radio channel=== | ===Sample for using a VLC wrapper script to play an Internet radio channel=== | ||
Line 43: | Line 46: | ||
trap "kill $vlcpid" SIGPIPE SIGTERM | trap "kill $vlcpid" SIGPIPE SIGTERM | ||
wait "$vlcpid" 2>/dev/null | wait "$vlcpid" 2>/dev/null | ||
+ | |||
+ | ===Javascript=== | ||
+ | For connecting to MOH with javascript use | ||
+ | |||
+ | // connecting to 'linein' (see config above) | ||
+ | Channel.CallJust("moh/linein"); | ||
+ | |||
'''See also''' | '''See also''' | ||
* [[Modules]] | * [[Modules]] | ||
− | * [[Conference]] | + | * [[Conference room module]] |
+ | |||
+ | [[Category:PBX]] [[Category:MOH]] |
Latest revision as of 22:24, 9 March 2016
This module allows playing arbitrary raw audio streams from an external data source. It is typically used to provide entertainment to people waiting on hold or in a queue.
Multiple named sources can be specified, for each only one external process is created and data is distributed internally to all consumers.
Don't forget to check the licensing conditions of the media files or streams used!
[edit] Configuration
File moh.conf:
[mohs] ; List of pipelines that will be used as sources of music (on hold). ; Each pipeline should write to stdout in 16bit signed linear ; at default rate 8000/s or as specificed in the "rate" parameter. ; From outside (e.g. routing modules) mohs are addressed ; as moh/default, moh/noise etc. ; use mpg123 to play a bunch of mp3 files (shuffled) default=while true; do mpg123 -q -m -r 8000 -s -Z sounds/*.mp3; done ; just (loud) random noise from our favorite source noise=cat /dev/urandom ; a relatively new madplay (>=0.15) is the best choice - low CPU usage, ; built-in resampling, plays multiple files (shuffled) madplay=while true; do madplay -q --no-tty-control -m -R 8000 -o raw:- -z sounds/*.mp3; done ; same madplay but with wideband support wideband=while true; do madplay -q --no-tty-control -m -R ${rate$8000} -o raw:- -z sounds/*.mp3; done ; analog line input linein=arecord -c 1 -f S16 -r 8000
[edit] Sample for using a VLC wrapper script to play an Internet radio channel
streaming=./vlc_wrapper.sh http://stream.profm.ro:8012/profm.mp3 ${rate$8000}
The script would be like:
#! /bin/bash test -z "$1" && exit 1 cvlc --aout file --aout-rate "${2:-8000}" --audiofile-format s16 --audiofile-channels 1 --audiofile-file - --no-audiofile-wav "$1" 2>/dev/null & vlcpid="$!" trap "kill $vlcpid" SIGPIPE SIGTERM wait "$vlcpid" 2>/dev/null
[edit] Javascript
For connecting to MOH with javascript use
// connecting to 'linein' (see config above) Channel.CallJust("moh/linein");
See also