<div dir="ltr">Hi all,<br><div class="gmail_quote"><div dir="ltr"><div><div><div><div><br></div>A long time ago I built an Asterisk system that plays IceCast streams via moh.<br><br></div>extensions.conf:<br>Exten => moh,1,Set(SIP_CODEC=ulaw)<br>Exten => moh,2,Answer<br>Exten => moh,3,MusicONHold(test_new)<br>Exten => moh,4,Hangup<br><br></div>musiconhold.conf<br>; test_new<br></div>[test_new]<br><div>mode=custom<br>application=/etc/mystreams/test_new.sh<br><br></div><div>test_new.sh<br>#!/bin/bash<br>wget -q -T 120 -O - '<a href="http://myURL.com/my_test_stream" target="_blank">http://myURL.com/my_test_stream</a>' | /usr/local/bin/madplay -Q -o raw:- --mono -R 8000 -a -10 -<br></div><div><br></div><div>Over all this does work good however:<br></div><div>1)
I want to be able to add a few hundred streams per box. Not all streams
are being listed to at once. Once you add a MOH class to
musiconhold.conf it stays up forever (which I can understand why). When
trying realtime madplay wont be loaded until it's called in the dial
plan. After that it is in Asterisk until I restart asterisk. If we have
20-30 streams it's OK but once that grows it can bog down the machine.<br></div><div>2)
I found that it for some reason the stream returns a 404 (it goes off
line etc.) then 10-15% of one core gets locked up until the stream comes
back online. The issue is that if a few streams have an issue then I
am locking up one care. From debuging the scripts it seems Asterisk
keeps calling my bash script over and over. In the full I get:<br></div><div>[2016-03-14 06:39:23] WARNING[12534] res_musiconhold.c: poll() failed: Interrupted system call<br>[2016-03-14 06:39:23] WARNING[12534] res_musiconhold.c: poll() failed: Interrupted system call<br></div><div>I
tried using realtime along with a script that would check each stream
and if there was a 404 to delete it from MySQL. This did not help.
Asterisk would keep repeating the above logs till Asterisk was
restarted.<br></div><div><br></div><div>Is there any way to have
Asterisk remove a class if it's not in use? What would be the right way
to go about building such a system?<br><br></div><div>EDIT: I found that
adding a simple sleep 2 to my bash script would slow things down and if
a stream went down it would lower the CPU usage by a lot.<br><br></div><div>TIA.<span class=""><font color="#888888"><br><br></font></span></div><span class=""><font color="#888888"><div>Dovid<br><br></div></font></span></div>
</div><br></div>