Streaming MOH from mic in line

A little background on what I’m doing. I run a live online podcast/radio show that has a call in line. When I have users on hold I want them to be able to hear the live show so I’m feeding the live feed into the mic-in port of my asterisk server that Im running freedoh on, Ubuntu 10.04 i386. Now onto my problem and what I’ve done.

I added a streaming category called ‘liveshow’. The command for ‘liveshow’ is /var/lib/liveshow.

/var/lib/liveshow contents:
#!/bin/bash
/usr/bin/arecord -q -f S16_LE

/var/lib/liveshow perms:
-rwxrwxrwx 1 asterisk asterisk 42 2011-04-23 10:03 /var/lib/liveshow

I then added both the root and asterisk users to the audio group since /dev/snd/* is owned by the audio group.

sudo adduser asterisk audio
sudo adduser root audio

Then I added this line to /etc/rc.local
chmod -R a+rwX /dev/snd

I have assigned my inbound route on my asterisk/freepbx box to ‘liveshow’ for MOH.

I then did a reboot. Called the number, then put it on hold. And just like its done for the past two days with everything else I’ve tried the MOH instead plays the ‘Default’ MOH. Before you ask if my liveshow script is actually able to capture audio the answer is yes. I have tried this with regular users by adding them to the audio group and running it. It works fine. It’s only an issue with asterisk.

Here is a grep of every process with the word asterisk in it so you can see whats running:

[email protected]:/etc/asterisk# ps -ef | grep asterisk
root 1232 1 0 11:07 ? 00:00:00 /bin/sh /usr/sbin/safe_asterisk -U asterisk -G www-data
asterisk 1233 1232 0 11:07 ? 00:00:01 /usr/sbin/asterisk -f -U asterisk -G www-data
asterisk 1248 1233 0 11:07 ? 00:00:00 /bin/bash /var/lib/liveshow
asterisk 1256 1248 0 11:07 ? 00:00:03 /usr/bin/arecord -q -f S16_LE
asterisk 1259 1 0 11:07 ? 00:00:09 /usr/bin/pulseaudio --start --log-target=syslog
asterisk 1269 1259 0 11:07 ? 00:00:00 /usr/lib/pulseaudio/pulse/gconf-helper
asterisk 1337 1 0 11:07 ? 00:00:00 sh /var/www/html/panel/safe_opserver
asterisk 1342 1337 0 11:07 ? 00:00:01 /usr/bin/perl /var/www/html/panel/op_server.pl
root 1552 1302 0 11:26 pts/0 00:00:00 grep --color=auto asterisk

ok, i got it working. basically asterisk is broken in the streaming category. This is what I did.

  1. Delete any additional MOH categories you have madein the gui, go back to a base install.
  2. Manually edit /etc/asterisk/musiconhold_additional.conf to this:

[default]
mode=custom
directory=/var/lib/asterisk/mohmp3/
application=/var/lib/liveshow
[none]
mode=files
directory=/var/lib/asterisk//mohmp3/.nomusic_reserved

Notice my streaming category is now [default], this is a MUST. Also, notice how i removed one of the forward slashes between asterisk and mohmp3, this is also a must. // is a no-go.

joeshowradio,
We run a daily talk radio show in Baltimore, have Asterisk, and need the same music on hold with the line-in but see the anquish in the forums to get it running. I have a plain asterisk 1.8.3.3/freePBX (PIAF distro). Whenever I read forum posts I see ‘pieces’ of the steps needed for this but never all the steps in one post. Can you help?

Thanks for your notes and how to. I tried the same and 2 other sets of instructions and everything seems to be working but the sound.

I know I am getting inbound sound because I have speakers on the PBX and the audio in plays through them like a champ.

I’ve tried it on a system running Asterisk 1.6.2.18 and FreePBX 2.8x AND a system running fpbx 2.9 and ast 1.8x

I tried it with mic in and line in on both boxes and turned up volume on capture to the max with alsamixer.

Is there anywhere where you got log messages that gave you clues when you were debugging. /var/log/asterisk/full looks normal (like it’s working)

[2011-06-18 20:36:45] VERBOSE[18096] app_dial.c: – SIP/6010-00000004 is ringing
[2011-06-18 20:36:45] NOTICE[2783] res_musiconhold.c: Request to schedule in the past?!?!
[2011-06-18 20:36:47] VERBOSE[18096] app_dial.c: – Connected line update to SIP/66.193.176.35-00000003 prevented.
[2011-06-18 20:36:47] VERBOSE[18096] app_dial.c: – SIP/6010-00000004 answered SIP/66.193.176.35-00000003
[2011-06-18 20:36:48] VERBOSE[18096] res_musiconhold.c: – Started music on hold, class ‘liveshow’, on channel ‘SIP/66.193.176.35-00000003’
[2011-06-18 20:36:57] VERBOSE[18096] res_musiconhold.c: – Stopped music on hold on SIP/66.193.176.35-00000003
[2011-06-18 20:36:57] VERBOSE[18096] pbx.c: – Executing [[email protected]:1] Macro(“SIP/66.193.176.35-00000003”, “hangupcall,”) in new stack
[2011-06-18 20:36:57] VERBOSE[18096] pbx.c: – Executing [[email protected]:1] GotoIf(“SIP/66.193.176.35-00000003”, “1?theend”) in new stack
[2011-06-18 20:36:57] VERBOSE[18096] pbx.c: – Goto (macro-hangupcall,s,3)