login | register
Wed 01 of Aug, 2007 [09:17 UTC]

voip-info.org

Search with Google
Search this site with Google. Results may not include recent changes.

Web www.voip-info.org
Shoutbox
  • Aykut, Wed 01 of Aug, 2007 [07:53 UTC]: Hi all, does anybody know about Thomson ST2030 SIP phone. I have upgraded it to latest version (1.56) but "Hold" and "Conf" features are not working after the upgrade ?? Do you know any solution or do you have Ver. 1.52 ?? Where can I find it?
  • Edward J Brown, Tue 31 of Jul, 2007 [23:33 UTC]: Has anybody experienced Choppy voice quality when using a Linksys SPA942 in an Asterisk Conference bridge? It works fine with my polycom and Cisco, but sucks with my Linksys.
  • www.astawerks.com, Fri 27 of Jul, 2007 [18:00 UTC]: does anyone use asterisk on top of clark connect? does it work good?
  • simon, Fri 27 of Jul, 2007 [14:16 UTC]: Hi All, Has anyone here managed to get the Cisco79x1 to successfully fail over to the backup proxy. I have 2 asterisk servers , handsets all register and function, except that backup proxy function doesn't work. Any working example would be very apprecia
  • Matthew Richmond, Thu 26 of Jul, 2007 [03:40 UTC]: using the page() application to page across our building...often the meetme conferences don't disconnect after the caller hangs up. Anyone else having this problem. (using Polycom phones)
  • Matthew Richmond, Wed 25 of Jul, 2007 [02:58 UTC]: thanks Nicholas Blasgen! I haven't worked with AGI before, but there's always a first! Thanks again!
  • Nicholas Blasgen, Tue 24 of Jul, 2007 [19:18 UTC]: Matthew Richmond, AGI will handle all that for you.
  • sam, Mon 23 of Jul, 2007 [16:39 UTC]: need help - certain voicemail extension will stop working and recording voicemail on asterisk - anyone know why and how to fix it? Thanks
  • john haji, Mon 23 of Jul, 2007 [14:55 UTC]: free calls to pakistan
  • bong, Sat 21 of Jul, 2007 [19:09 UTC]: hi good day to all can anyone help me how to configured the nortel sip to the signaling server and how to activate in mobile w/ sip compatible without mcs
Server Stats
  • Execution time: 0.19s
  • Memory usage: 2.20MB
  • Database queries: 32
  • GZIP: Disabled
  • Server load: 3.38

Asterisk mpg123 faking it

How to replace MPG123 with SOX for musiconhold


Note: Asterisk 1.2 has solved the "mpg123 issue" and comes with a cleaner solution, so what is described below essentially is only of interest for Asterisk 1.0.x users.

As an alternative to using mpg123 you can use sox to convert a wav file into the right format for asterisk and use cat to "play" the file

Example with converted files if you do not want to install mpg123 or sox
Note: If the rawplayer method is not playing back any music, try adding ".mp3" to the end of the .raw filenames.

sox -V moh.wav -r 8000 -c 1 -w moh.raw


You could use audacity (open the mp3 then File -> Export as WAV...) or xmms to convert the mp3 to wav

  • Option 1: Hacking mpg123 and playing a single file
Then make a file called /usr/local/bin/mpg123 with the following contents

#!/bin/sh
while [ 1 ]; do cat /path/to/moh.raw || exit; done

I think you need to uncomment the default line in the sample musiconhold config for Asterisk to try and launch mpg123

  • Option 2: Use custom mode in musiconhold.conf and use rawplayer script
The musiconhold configuration includes a "custom" mode that lets you specify the program to run in order to play your (faked) mp3's. We can use this to run our own "rawplayer" instead of mpg123.
Put something like this in musiconhold.conf:

[classes]
default => custom:/var/lib/asterisk/mohmp3/default,/usr/bin/rawplayer
classic => custom:/var/lib/asterisk/mohmp3/classic,/usr/bin/rawplayer


Then make an executable file /usr/bin/rawplayer like this:

#!/bin/sh
for name in $@; do
cat $name ;
done


And finally convert your mp3 files to raw as stated above an place them in subdirectories default an classic under /var/lib/asterisk/mohmp3 and (VERY IMPORTANT!) rename them from *.raw to *.mp3 (as Asterisk expect they are named that way):

# cd /var/lib/asterisk/mohmp3/default
# rename .raw .mp3 *.raw


Now restart Asterisk and you have your "default" and "classic" music available with less cpu load.

See Also



Asterisk | Tips & Tricks | FAQ
Created by stan, Last modification by JustRumours on Tue 08 of Nov, 2005 [09:19 UTC]

Comments Filter

Other sax manipulations

by slamb on Friday 13 of May, 2005 [02:31:17 UTC]
sax supports quite a few other manipulations. I ended up with a commandline something like this:

   sox INPUT -t raw -c 1 -r 8000 -w -v 0.25 OUTPUT resample -ql

The "-v 0.25" between INPUT and OUTPUT will reduce the volume to 25%.

The "resample -ql" after OUTPUT should make the rate reduction sound better.

There are a lot of other things you can; see the sox manpage.

Use mpg321 and sox to emulate mpg123

by tries on Monday 14 of March, 2005 [21:22:12 UTC]
The mpg321 package is not cabable of producing the proper raw stream format required by Asterisk. Mpg321 simply ignores unknown commandline switches and produces a raw stream with the same sample rate and chanels as the input file (e.g. 44100, stereo). Asterisk needs a single channel (mono) raw stream with 8000Hz sample rate.
As I did not want to start installing another mp3 player software on that box, I made s small wrapper script to combine (the existing) mpg321 and sox to generate the proper output format:

/usr/local/bin/asterisk_play.sh:
  1. !/bin/sh
mpg321 -q -s -z --wav - $* | sox -t wav - -t raw -c1 -r8000 -w2 - 2>/dev/null;

My musiconhold.conf looks:
;
; Music on hold class definitions
;
[classes]]
default => custom:/home/hb9xar/asterisk/var/lib/asterisk/mohmp3,/usr/local/bin/asterisk_play.sh
loud => mp3
/home/hb9xar/asterisk/var/lib/asterisk/mohmp3

random => quietmp3
/home/hb9xar/asterisk/var/lib/asterisk/mohmp3,-z


That's it.

Please update this page with new information, just login and click on the "Edit" or "Add Comment" button above. Get a free login here: Register Thanks! - support@voip-info.org

Page Changes | Comments

Sponsored by:

Terms of Service Privacy Policy
© 2003-2007 Arte Marketing, Inc.

Powered by bitweaver