[asterisk-users] Switching between Music on Hold streams. [13.8.2]
Jonathan H
lardconcepts at gmail.com
Fri Aug 12 09:23:18 CDT 2016
Hello!
I thought having finally "cracked it", I might as well post what I've done.
https://github.com/lardconcepts/asterisk-digitalocean-voipfone-config/blob/master/moh-switching.md
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?
Basically, it uses an app called crudini to add sections to
musiconhold.conf, then does an moh reload.
When the user has finished listening and presses * then the remote
extension is dropped and the caller returns to the current menu.
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.
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.
----------------
[general]
cachertclasses=yes ; use 1 instance of moh class for all users who are
using it
----------------
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
voicerss.org.
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!).
On 11 May 2016 at 11:09, Dovid Bender <dovid at telecurve.com> wrote:
> If you ever figure out AAC in Asterisk for MOH let me know. The ones that
> I have working is MP3 and MMS.
>
> On Mon, May 9, 2016 at 1:18 PM, Jonathan H <lardconcepts at gmail.com> wrote:
>
>> Thanks Joshua and everyone,
>>
>> Joshua's solution seems a lot simpler and works well. Only one thing
>> now - The reason I named the classes as I did, was so that I could
>> select the class based on callerID plus extension.
>>
>> Unless I've misread it, I'm limited to 9 switchable classes via the
>> "digit=#" option, is that correct?
>>
>> Or is there a clever hack around this?
>>
>> extensions.conf
>>
>> [streamdemo]
>> exten => s,1,Answer
>> exten => s,2,BackGround(menu)
>> exten => s,3,WaitExten
>> exten => _[2,3,4,5],1,MusicOnHold(${CALLERID(name)}${EXTEN})
>> ;exten => s,5,Goto(s,2)
>> exten => _[X,t,i],1,Goto(streamdemo,s,2)
>>
>> and in musiconhold.conf (4 is commented out as it's AAC and I've not
>> figured that one out yet - bonus points to someone who can point the
>> way!)
>>
>> [streamdemo2]
>> mode=custom
>> digit=2
>> application=/usr/bin/mpg123 -q -r 8000 -f 32768 --mono -s
>> http://185.14.85.162:8020
>>
>> [streamdemo3]
>> mode=custom
>> digit=3
>> application=/usr/bin/mpg123 -q -r 8000 -f 32768 --mono -s
>> http://stream.acbradio.org:8000/mainstream.mp3
>>
>> ;[streamdemo4]
>> ;mode=custom
>> ;digit=4
>> ;application=/usr/bin/mpg123 -q -r 8000 -f 32768 --mono -s
>> http://199.180.75.27:80/
>> ;http://www.mushroomfm.com/media/listen.pls
>>
>> [streamdemo5]
>> digit=5
>> mode=custom
>> application=/usr/bin/mpg123 -q -r 8000 -f 32768 --mono -s
>> http://206.225.87.121:8000/
>>
>> On 9 May 2016 at 18:00, A J Stiles <asterisk_list at earthshod.co.uk> wrote:
>> > On Monday 09 May 2016, Jonathan H wrote:
>> >> ..... {stuff deleted} .....
>> >> [streamdemo]
>> >> exten => s,1,Answer
>> >> exten => s,2,BackGround(menu)
>> >> exten => s,3,WaitExten
>> >> exten => s,4,Goto(s,2)
>> >> exten =>
>> >> _[2,3,4,5],1,Dial(Local/${EXTEN}@play-radio,,G(play-radio^${EXTEN}^2))
>> >> exten => _[2,3,4,5],2,Goto(s,2)
>> >
>> > You have an error in your dialplan! The pattern _[2,3,4,5] will match
>> any of
>> > 2, a comma, 3, a comma (again), 4, a comma or 5.
>> >
>> > I think you might mean _[2345] which will match any of 2, 3, 4 or 5
>> (but
>> > not a comma), and contains no tautologies.
>> >
>> >
>> > --
>> > AJS
>> >
>> > Note: Originating address only accepts e-mail from list! If replying
>> off-
>> > list, change address to asterisk1list at earthshod dot co dot uk .
>> >
>> > --
>> > _____________________________________________________________________
>> > -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>> > New to Asterisk? Join us for a live introductory webinar every Thurs:
>> > http://www.asterisk.org/hello
>> >
>> > asterisk-users mailing list
>> > To UNSUBSCRIBE or update options visit:
>> > http://lists.digium.com/mailman/listinfo/asterisk-users
>>
>> --
>> _____________________________________________________________________
>> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>> New to Asterisk? Join us for a live introductory webinar every Thurs:
>> http://www.asterisk.org/hello
>>
>> asterisk-users mailing list
>> To UNSUBSCRIBE or update options visit:
>> http://lists.digium.com/mailman/listinfo/asterisk-users
>>
>
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
> http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20160812/54fdaa27/attachment.html>
More information about the asterisk-users
mailing list