We are using Asterisk 18.4, working for Disability education.
We are thinking to connect live radio/fm channel , so that users who connected with our system with simple phone , can also take benefit of live radio listening.
pls guide with your suggestions.
thanks
Do you have many stations or just a few? Do you want something basic where people call a number and listen or more complex.
If you want to do something simple I would suggest using MusicOnHold.
musiconhold.conf
[general]
cachertclasses=yes ; use 1 instance of moh class for all users who are using it,
preferchannelclass=no ; Needed so that we use what's set in MusicOnHold() and not the channel default
[default]
mode=files
directory=moh
[jewish_music_stream]
mode=custom
application=/etc/asterisk/moh/jewish_music_stream.sh
jewish_music_stream.sh
#!/bin/bash
/usr/bin/ffmpeg -i http://stream.jewishmusicstream.com:9000 -vn -ar 8000 -ac 1 -f s16le -
echo "[$(date +%F) $(date +%T)] $0" >> /tmp/streams_down #Log downed streams for now. In the future put out an alert
sleep $(( ( RANDOM % 60 ) )) #This is extremley important as if it's not here the repeat will lockup a core on the box
You can then have a dialplan that looks like this.
[from-external]
Exten => s,1,Answer
same => n,MusicOnHold(jewish_music_stream)
Of course you get a lot more complicated than that. For instance the way I have musichold set up (cachertclasses=yes), asterisk will start pulling the stream on start. If you have 100 stations then your box will be busy. If you set it to no then every time someone calls it will start a new stream (so if 100 people are listening thatās 100 instances of ffmpg running). We have a platform that has about 150+ streams on it. To get around this issue we use Asterisk realtime which only starts the moh thread if there is a call for it. When the call hangs up we have a bash script that waits 3 seconds and seeās if anyone else is listening to this class. If there is the script exits. If not it unregisters the moh class freeing up resources.
I have tried to implement but errors from musiconhold.conf
We want to use 4-5 different channels for radio/fm , so that user can select by pressing 1ā¦2ā¦3
my musiconhold.conf as you suggested.
[general]
cachertclasses=yes ; use 1 instance of moh class for all users who are using it,
preferchannelclass=no ;
echo ā[$(date +%F) $(date +%T)] $0ā >> /tmp/streams_down #Log downed streams for now. In the future put out an alert
sleep $(( ( RANDOM % 60 ) )) #This is extremley important as if itās not here the repeat will lockup a core on the box
Please put triple back ticks before and after quotes from logs and configuration files, to stop their being interpreted as mark up.
Although it may indicate a problem, interrupted system call on poll should not normally be treated as an error, and the fact that you get multiple reports suggests it isnāt being treated as an error.
There are many sites/channel , some are available with news and other information/music. but at this moment we are unable to use same due to settings. We are not working commercially, We are Not for profit trust working for Disability education and others.
I suspect that that would still be considered commercial use, and, in any case it isnāt personal use. You should approach the site. You may need some sort of API key, or they may not have the rights to waive the restriction, and you may need to approach the individual stations.
You may be right , but listening live radio news Govt/private is seems not any offence, This is just for help for those who donāt have smart phones.
Do you find any issue/error in my setup as shared above. pls guide.
I understand legal issue, thanks for sharing more info about radio listening copyright rules.
I still willing to test radio listening. I see in different posts , many people doing same, I followed previous instruction above but not resolved yet.
Hi,
when we use link through shell script .sh file, it is showing warning/notice/error but when we try direct with musiconhold.conf , it seems workable but not playing
/usr/bin/ffmpeg -i http://stream.jewishmusicstream.com:9000 -vn -ar 8000 -ac 1 -f s16le -
music is playing after clicking on play on above web link.
Based on his name it seems like he is in India so FCC rules would not apply. I think itās appropriate to tell people here that there may be legality issues here but itās not our place to police others.
The copyright issues aside, unless your users are listening on a phone, a better application for music playout and streaming is Rivendell http://www.rivendellaudio.org/