<div dir="ltr">Hello!<div><br></div><div>I thought having finally "cracked it", I might as well post what I've done.</div><div><br></div><div><a href="https://github.com/lardconcepts/asterisk-digitalocean-voipfone-config/blob/master/moh-switching.md">https://github.com/lardconcepts/asterisk-digitalocean-voipfone-config/blob/master/moh-switching.md</a><br></div><div><br>Can someone please take a quick look and see if there's anything I could have done better or more efficiently, or if anything stands out as particularly horrific?</div><div><br></div><div>Basically, it uses an app called crudini to add sections to musiconhold.conf, then does an moh reload.</div><div><br></div><div>When the user has finished listening and presses * then the remote extension is dropped and the caller returns to the current menu.<br><br></div><div>The nice thing about this is that even if two callers call and listen to the same moh stream, when one hangs up, even though it deletes the config and reloads moh, Asterisk is nice to the other caller and they keep listening.</div><div><br></div><div>The end result is what I wanted, which is to not have any extra CPU load or network usage when no-one is listening. And if more than one person is listening, it's still only "using" one remote stream, as I've uncommented the cachertclasses value.</div><div><br></div><div>----------------</div><div><div>[general]</div><div>cachertclasses=yes ; use 1 instance of moh class for all users who are using it</div></div><div>----------------<br></div><div><br></div><div>As a little bonus, I've put what I think is a clever little "menu maker" in, which grabs and caches short audio files using the free plan from <a href="http://voicerss.org">voicerss.org</a>.</div><div><br>If anyone wants to try it in practice, call UK +44 20 36 37 60 70 - this number is working as of the 12th of August and I'll leave it up at least over the weekend, but if you're reading this in a few weeks, don't expect it to work! (I'm allowed to use these streams before anyone panics!).</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 11 May 2016 at 11:09, Dovid Bender <span dir="ltr"><<a href="mailto:dovid@telecurve.com" target="_blank">dovid@telecurve.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">If you ever figure out AAC in Asterisk for MOH let me know. The ones that I have working is MP3 and MMS.<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 9, 2016 at 1:18 PM, Jonathan H <span dir="ltr"><<a href="mailto:lardconcepts@gmail.com" target="_blank">lardconcepts@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks Joshua and everyone,<br>
<br>
Joshua's solution seems a lot simpler and works well. Only one thing<br>
now - The reason I named the classes as I did, was so that I could<br>
select the class based on callerID plus extension.<br>
<br>
Unless I've misread it, I'm limited to 9 switchable classes via the<br>
"digit=#" option, is that correct?<br>
<br>
Or is there a clever hack around this?<br>
<br>
extensions.conf<br>
<br>
[streamdemo]<br>
exten => s,1,Answer<br>
exten => s,2,BackGround(menu)<br>
exten => s,3,WaitExten<br>
exten => _[2,3,4,5],1,MusicOnHold(${<wbr>CALLERID(name)}${EXTEN})<br>
;exten => s,5,Goto(s,2)<br>
exten => _[X,t,i],1,Goto(streamdemo,s,<wbr>2)<br>
<br>
and in musiconhold.conf (4 is commented out as it's AAC and I've not<br>
figured that one out yet - bonus points to someone who can point the<br>
way!)<br>
<br>
[streamdemo2]<br>
mode=custom<br>
digit=2<br>
application=/usr/bin/mpg123 -q -r 8000 -f 32768 --mono -s<br>
<a href="http://185.14.85.162:8020" rel="noreferrer" target="_blank">http://185.14.85.162:8020</a><br>
<br>
[streamdemo3]<br>
mode=custom<br>
digit=3<br>
application=/usr/bin/mpg123 -q -r 8000 -f 32768 --mono -s<br>
<a href="http://stream.acbradio.org:8000/mainstream.mp3" rel="noreferrer" target="_blank">http://stream.acbradio.org:<wbr>8000/mainstream.mp3</a><br>
<br>
;[streamdemo4]<br>
;mode=custom<br>
;digit=4<br>
;application=/usr/bin/mpg123 -q -r 8000 -f 32768 --mono -s<br>
<a href="http://199.180.75.27:80/" rel="noreferrer" target="_blank">http://199.180.75.27:80/</a><br>
;<a href="http://www.mushroomfm.com/media/listen.pls" rel="noreferrer" target="_blank">http://www.mushroomfm.com/<wbr>media/listen.pls</a><br>
<br>
[streamdemo5]<br>
digit=5<br>
mode=custom<br>
application=/usr/bin/mpg123 -q -r 8000 -f 32768 --mono -s<br>
<a href="http://206.225.87.121:8000/" rel="noreferrer" target="_blank">http://206.225.87.121:8000/</a><br>
<br>
On 9 May 2016 at 18:00, A J Stiles <<a href="mailto:asterisk_list@earthshod.co.uk" target="_blank">asterisk_list@earthshod.co.uk</a><wbr>> wrote:<br>
> On Monday 09 May 2016, Jonathan H wrote:<br>
>> ..... {stuff deleted} .....<br>
>> [streamdemo]<br>
>> exten => s,1,Answer<br>
>> exten => s,2,BackGround(menu)<br>
>> exten => s,3,WaitExten<br>
>> exten => s,4,Goto(s,2)<br>
>> exten =><br>
>> _[2,3,4,5],1,Dial(Local/${<wbr>EXTEN}@play-radio,,G(play-<wbr>radio^${EXTEN}^2))<br>
>> exten => _[2,3,4,5],2,Goto(s,2)<br>
><br>
> You have an error in your dialplan!  The pattern _[2,3,4,5] will match any of<br>
> 2, a comma, 3, a comma  (again), 4, a comma or 5.<br>
><br>
> I think you might mean  _[2345]  which will match any of 2, 3, 4 or 5  (but<br>
> not a comma),  and contains no tautologies.<br>
><br>
><br>
> --<br>
> AJS<br>
><br>
> Note:  Originating address only accepts e-mail from list!  If replying off-<br>
> list, change address to asterisk1list at earthshod dot co dot uk .<br>
<span><font color="#888888">><br>
> --<br>
> ______________________________<wbr>______________________________<wbr>_________<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/<wbr>mailman/listinfo/asterisk-<wbr>users</a><br>
<br>
--<br>
______________________________<wbr>______________________________<wbr>_________<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/<wbr>mailman/listinfo/asterisk-<wbr>users</a><br>
</font></span></blockquote></div><br></div>
</div></div><br>--<br>
______________________________<wbr>______________________________<wbr>_________<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/<wbr>mailman/listinfo/asterisk-<wbr>users</a><br></blockquote></div><br></div>