<div dir="ltr"><div><div><div><div>Steve,<br><br></div>These are live streams of events so I can't simply rip the audio. As I mentioned at the end of my email putting in a sleep did help a bit however there are only so many streams Asterisk will grab nicely at once with out spiking the CPU. I also tinkered a bit with real time here is what I found:<br></div>1) If we have cachertclasses=no then Asterisk will only pull the stream if some one is listening to that particular class. the upside of this is that we only pull a stream if we need it. The down side is if say there are four people listening to StreamX then we have four separate connections to StreamX.<br></div>2) If we have cachertclasses=yes set then Asterisk then we have the opposite of #1. The stream will be pulled if some one starts listening to it. If anyone hangs up then we still keep pulling the stream so over time if every stream is touched then we will over load the CPU.<br><br></div>I guess I am trying to find a match between the two. Only pull the stream if some one is invoking MOH for this moh class and if there is no one else on hold to kill it. If this is not available yet we are willing to pay for a patch.<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 16, 2016 at 4:03 PM, Steve Edwards <span dir="ltr"><<a href="mailto:asterisk.org@sedwards.com" target="_blank">asterisk.org@sedwards.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wed, 16 Mar 2016, Dovid Bender wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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>
</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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.<br>
</blockquote>
<br></span>
For these and other reasons, I think streaming is dumb (in most cases).<br>
<br>
I have a client that wanted to allow his customers to enter URLs for their moh. Bad idea. They kept entering invalid URLs which would cause bits to crash. Further, we started getting complaints from URL providers as to why we were streaming 24x7 and from our colo about the bandwidth.<br>
<br>
My solution* (which the customers either haven't figured out yet or don't mind) was:<br>
<br>
1) Customers submit URLs to my client.<br>
<br>
2) Once entered into the system, the customer can select the 'station' from a web page.<br>
<br>
3) I record 24 hours of the stream and then use sox to break into separate files on the silence between songs.<br>
<br>
4) I create a moh class that random plays the files.<br>
<br>
*) My client approved the solution which may be of questionable legality depending on the stream.<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
Thanks in advance,<br>
-------------------------------------------------------------------------<br>
Steve Edwards       <a href="mailto:sedwards@sedwards.com" target="_blank">sedwards@sedwards.com</a>      Voice: <a href="tel:%2B1-760-468-3867" value="+17604683867" target="_blank">+1-760-468-3867</a> PST<br>
            <a href="https://www.linkedin.com/in/steve-edwards-4244281" rel="noreferrer" target="_blank">https://www.linkedin.com/in/steve-edwards-4244281</a></font></span><br>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" rel="noreferrer" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
               <a href="http://www.asterisk.org/hello" rel="noreferrer" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
   <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" rel="noreferrer" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br></blockquote></div><br></div>