MP3Player multiple streaming stations

admin
Joined:

Re: MP3Player multiple streaming stations

Posted:Tue 24 of Apr, 2012 (19:22 UTC)
This forum uses the tiki wiki syntax so hash tags change to numbers. you can enter ~np~ before the hash and then again after the hash but with a / in front of the n to keep the hash intact
daveosx
Joined: Sun 15 of Apr, 2012

Re: MP3Player multiple streaming stations

Posted:Sun 15 of Apr, 2012 (07:52 UTC)
The strange 1. are actually hash # do not know why they change after preview to post
daveosx
Joined: Sun 15 of Apr, 2012

MP3Player multiple streaming stations

Posted:Sun 15 of Apr, 2012 (07:49 UTC)
Running Asterisk 1.8.11 CMD MP3Player refused to work on Streams so I figured out a hack.

MP3player calls /usr/bin/mpg123 and pass arguments (never did figure out the string syntax)
When a local file is called the filename in MP3Player(FILENAME) is passed as $8 $ARGV
So here is what I did

first
sudo su to gain root if not already

look to see if mpg123 has been moved to mpg123.bin under /usr/bin on Ubuntu 11.10
if not
mv /usr/bin/mpg123 /usr/bin/mpg123.bin

if already moved then /usr/bin/mpg123 will be a symbolic link so
mv /usr/bin/mpg123 /usr/bin/mpg123.bk

next
vi /usr/bin/mpg123

and enter

  1. !/bin/bash
/etc/asterisk/radio/$8
:wq

next
chmod +x /usr/bin/mpg123

next
mkdir /etc/asterisk/radio

next
cd /etc/asterisk/radio

next move any MP3 files you may want to play to this directory
ie...
mv /path/to/file.mp3 /etc/asterisk/radio/file.mp3

next make new FAKE mp3 files
touch FK_filename.mp3

next
vi FK_filename.mp3
  1. !/bin/bash
/usr/bin/mpg123.bin -q -s --mono -r 8000 -f 8192 \ -Z URL_FROM_INSIDE_PLS URL_FROM_INSIDE_PLS
:wq
or

  1. !/bin/bash
/usr/bin/mpg123.bin -q -s --mono -r 8000 -f 8192 \ -Z PATH_TO_FIRST_FILE PATH_TO_SECOND_FILE
:wq

next make the fake mp3s executable
chmod +x FK_*
chown -R asterisk /etc/asterisk/radio
chgrp -R asterisk /etc/asterisk/radio

next we add the extensions to extensions.conf create a different extension for each stream you want to create.
vi /etc/asterisk/extensions.conf

...
exten => ###,1,Answer
exten => ###,2,MP3Player(FK_filename.mp3)
...
:wq

Now just restart Asterisk and you can test by dialing in the streams will play over the phone!
For some reason Asterisk needs to be restarted after you change mpg123.
Total Hack but I just started with Asterisk in june of 2011.
Thought I would share;-)