Using an external sound source (i.e. Muzak)
for MOH via the sound card in
your Asterisk server.
By
John Johnson 7/20/2012
|
First connect the output from your
sound source to the input/mic port on your soundcard (input is probably blue, the
pink one is usually the microphone jack) then:
|
1. Add the following to
/etc/asterisk/musiconhold.conf
[default]
mode=custom
directory=/var/lib/asterisk/mohmp3
application=/var/lib/playlinein
You will probably also need to
comment out (add ; at the line beginning) the “includes” for the additional
conf files like this:
;#include musiconhold_custom.conf
;#include musiconhold_additional.conf
You will end up with only the
“external sound source” as the default MOH by doing this, but it makes it
simpler.
|
2. Create the file: /var/lib/playlineinand place the following two lines in the file:
#!/bin/bash
/usr/bin/arecord -q -c 1 -r 8000 --buffer-size=2048 -f
S16_LE
|
3. Type the following in a linux command line prompt to set ownership:
cd /var/lib
chown asterisk:asterisk ece-playlinein
chmod 777 playlinein
|
4. Type the following in a linux command line prompt:
groupadd -g 525 audio
usermod -G audio root
usermod -G audio asterisk
|
5. Add the following lines to
the bottom of /etc/rc.d/rc.local:
chown asterisk
/dev/tty9
chown -R root:audio /dev/snd
chmod -R a+rwX /dev/snd
|
6. Copy an mp3 file into /var/lib/mohmp3 so there is at least one file there, it
won’t play but in some circumstances is required, it’s just as easy to put
it there anyway.
~now reboot the system~
|
7. Upon system startup, from a linux command line prompt enter: alsamixer
This is the sound mixer control
system, you can access “all” settings by pressing F5. Only some settings
are required to be enabled, (the “mute” function is toggled by moving to
the setting and pressing “m”). Which settings are required varies from one
main board/sound card to another, (our XR1000 required us to un-mute/enable
“capture” and “digital” with “input” set to “mic”) This requires some “fiddling around” to get the sound
right, so be prepared to play with it for a while. It seemed easiest to
connect a couple of phones and put ourselves on hold and adjust things till
it sounded right. Remember that in this system the sound is being converted
to a “file” of 2048 bytes so when you make a change in alsamixer the sound will play for a few seconds (maybe 30) until
the change shows up, be patient, make changes in small increments.
|
8. You can also connect speakers
(they have to be amplified/powered) to the output (probably green) and they
will probably play also giving you a sound comparison from your input to
what you are hearing on the phone sets. Incidentally, if you add the “line
in” MOH functionality it will kill the “sound card output paging” I have
described in an earlier post. The two features cannot coincide, so to use
external paging with this line in MOH feature will require an external
paging module.
|
The following are some of the
references I used to work the above out:
http://www.elastix.org/index.php/en/component/kunena/26-tips-and-tricks/32378-music-on-hold-via-line-in-on-the-sound-card.html
http://www.sthomas.net/2007/12/using-a-sound-card-as-a-music-on-hold-source-in-asterisk/
http://www.voip-info.org/wiki/view/Asterisk+config+musiconhold.conf
|