Discussion: Asterisk cmd MusicOnHold


 
Comments Filter

Working around mpg123

Like many others, I was having issues with streaming via mpg123. I wrote the following script to eliminate the need for mpg123 by using curl and ffmpeg. I hope this helps!

  1. !/bin/bash
  2. Copyright (c) 2010 Ryan Hass <majost@pixelshelf.com>
  3. All rights reserved.
  4. Permission is hereby granted, free of charge, to any person
  5. obtaining a copy of this software and associated documentation
  6. files (the "Software"), to deal in the Software without
  7. restriction, including without limitation the rights to use,
  8. copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. copies of the Software, and to permit persons to whom the
  10. Software is furnished to do so, subject to the following
  11. conditions:
  12. The above copyright notice and this permission notice shall be
  13. included in all copies or substantial portions of the Software.
  14. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  15. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  16. OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  17. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  18. HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  19. WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  21. OTHER DEALINGS IN THE SOFTWARE.

STREAMSVR='http://STREAMURI:PORT'
PLAYER='/usr/bin/ffmpeg'
  1. -i = input file; -ar = audio bitrate; -ac = audio channels; -f = force format
  2. -acodec = output audio codec; -vol is volume, 256 is default and we set it to
  3. 3/5 the normal volume.
PLAYERARGS="-i $INFILE -ar 8000 -ac 1 -f mulaw -acodec pcm_mulaw -vol 154 $OUTFILE"
  1. - is the shell operator for stdout, we want to read from it for the curl
  2. output and write back to it for the ffmpeg output.
INFILE="-"
OUTFILE="-"

function playStream() {
curl -s "$STREAMSVR" | "$PLAYER" $PLAYERARGS
}

playStream

by majost, Sunday 21 of March, 2010 (22:38:29 UTC)

We have just upgraded to 1.4.20-rc1 and found that the following method to turn off music on hold no longer works, it just reverts to the default moh class which we use for our IVR. Basically we are trying to turn off the MOH for agents and even playing a silence sound file produces noise on the line that you can hear in a quiet environment. Does anyone have any other suggestions?


   [none] 
   mode=files 
   directory=/dev/null 


by mattfox71, Saturday 12 of May, 2012 (20:46:21 UTC)
My MOH isnt working.

[features]
  
;MeetMeConferenceRoom 1
exten => 510,1,MeetMe(510,i,54321)

;MOH
exten => 520,n,MusicOnHold(default)

include = parkedcalls


by cutter5o, Saturday 12 of May, 2012 (20:46:34 UTC)
Music on hold quality

I had some trouble with the music on hold quality and did the following:
Removed previous MPG123 which was in /usr/local

Installed different version of mpg123
1.) cd /usr/local
2.) wget http://superb-west.dl.sourceforge.net/sourceforge/mpg123/mpg123-0.59r-gpl.tar.gz
3.) tar zxvf mpg123-0.59r-gpl.tar.gz
4.) cd mpg123-0.59r-gpl
5.) make linux
6.) make install

Your etc/asterisk/musiconhold.conf configuration should look like the following:

;
; Music on Hold --
;

[default]
mode=quietmp3
directory=/var/lib/asterisk/mohmp3

Your /etc/asterisk/Zapata.conf should look something like the following:


[channels]
relaxdtmf=yes
;       group 5
;
language=en
signalling=em_w
rxwink=300
switchtype=national
emdigitwait=2000
usecallerid=yes
threewaycalling=yes
transfer=yes
musiconhold=default
busydetect=no          ;leave this on for detecting hangups
;jitterbuffers=10
;echocancel=yes
;echocancelwhenbridged=yes
group=5
channel => 1-24

You should also have at least one MP3 file on /var//lib/asterisk/mohmp3

by lumpy, Saturday 12 of May, 2012 (20:46:57 UTC)
Legal Requirements

Be sure to meet any legal requirements for music-on-hold.

I hope somebody with a legal background will comment on this because I really don't know. Are the three mp3 files included in the Asterisk distribution royalty-free or do we need to pay somebody for the right to use them in a production environment? (this is probably documented somewhere but I haven't found it yet) I do know the included files came from www.freeplaymusic.com and that the FAQ there mentions a licensing fee for music-on-hold usage, don't know if this is "grandfathered" for the three included files though. Ideas?

by Pepperdotnet, Friday 22 of September, 2006 (22:08:05 UTC)
Cant turn it off , but can CHANGE it....

I wanted to have my FAX line to ring instead of music on hold so that it does not confuse any fax machines with the music. Here is what i came up with to change it in my stealth auto attendant:

exten => 111,1,Zapateller(answer|nocallerid)
exten => 111,2,SetMusicOnHold(default)
exten => 111,3,DigitTimeout,3
exten => 111,4,ResponseTimeout,3
exten => 111,5,Background(custom/welcome)

exten => 0,1,Dial(local/420@from-internal,35,m)
exten => 0,2,VoiceMail(420@default)
exten => 0,3,Hangup
exten => 1,1,Dial(local/499@from-internal,20,m)
exten => 1,2,Hangup
exten => 7,1,Authenticate(1234)
exten => 7,2,DISA(no-password|from-internal)

In the Dial lines above (exten => 1,1,Dial(local/499@from-internal,20,m) the last "m" denotes play music while waiting, by simply changing the "m" to an "r" it will pass the regualr ring tone instead of music, like this:

(exten => 1,1,Dial(local/499@from-internal,20,r)

Worked great!

Cerebral

by Cerebral, Wednesday 15 of February, 2006 (18:50:01 UTC)
Turn OFF Music on Hold

Well, there's plenty of talk about how to turn MOH ON, but I see nothing on how to TURN IT OFF! I'd like to turn it off on certain phones, so as to not put out music when I happen to be on a conference call. But, I'd settle for completely turning it off, if I can't individually control it.

Ideas?


by rgrokett, Friday 27 of January, 2006 (02:06:00 UTC)
MusicOnHold never triggered!

My system is Debian3 running 2.6.7 with Asterisk CVS-HEAD-07/23/04-11:30:06.

For some reason my MOH was never triggered when anyone called either of my 5 queues. I tried all setting I could think off before I turned to the mailing list.

I used some hours on this - so I hope this can help others...

This is a snippet from my mail at the asterisk-users mailing list (Link to archive):

It seems that the script /usr/sbin/safe_asterisk is never replaced when you "make install" in asterisk. While it's nice that your own hacks are preserved, I think it would be a lot nicer to have a warning if that file was updated since your last install - and it could simply backup your existing safe_asterisk and replace it with the updated version.

I did not actually find out the real reason why that safe_asterisk script did not work in the first place. Maybe someone more experienced can answer that better.

Solution: replacing the safe_asterisk with whatever HEAD version I had downloaded last made "everything" (about MOH) work.

Or: Simply run asterisk manually and/or with your own "safe" wrapper.

by avizion, Thursday 29 of July, 2004 (12:41:30 UTC)
Re: mpg123 ver. 0.59s

mpg123 0.59s has broken -f (scaling) processing.

asterisk passes -f 32768 and -r 8000. currently only passing it -f 1 seems to work (to version 0.59s). I have not tested to see if the -r 8000 parameter is part of the problem or not.

asterisk has no current way to change the -f parameter to 1, besides a source code change. I could not find out where the problem lay in mpg123-0.59s, as the changes (between 0.59s and 0.59r) that I spotted seemed benign.

in anycase 0.59r does work with the current asterisk code. I would like to see an overhaul in the MOH options. Like being able to specify your entire commandline (so that you can run OGG files or whatever).

by , Monday 12 of July, 2004 (22:49:52 UTC)
mpg123 ver. 0.59s

mpg123 version 0.59s sounded bad (too loud, distorted)
Version 0.59r works fine.

by , Sunday 23 of May, 2004 (02:38:47 UTC)

Page Changes | Comments

 

Featured -

Search: