Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[asterisk-users] Switching between Music on Hold streams. [13.8.2]


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users
View previous topic :: View next topic  
Author Message
lardconcepts at gmail.com
Guest





PostPosted: Fri Aug 12, 2016 9:24 am    Post subject: [asterisk-users] Switching between Music on Hold streams. [1 Reply with quote

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@telecurve.com (dovid@telecurve.com)> wrote:
Quote:
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@gmail.com (lardconcepts@gmail.com)> wrote:
Quote:
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@earthshod.co.uk (asterisk_list@earthshod.co.uk)> wrote:
Quote:
On Monday 09 May 2016, Jonathan H wrote:
Quote:
..... {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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services