Thursday, November 11, 2004

Asterisk with MoH Patch on Debian Sarge

Music on hold is a nice feature of asterisk, implemented through res_musiconhold.so. To setup music on hold the standard way you need to download recompile and install mpg123 as voip-info suggests.

Note that on Debian there's a symlink between mpg123 and mpg321 (which is not supported currently). So, download mpg123-0.59r.tar.gz, compile it, and install it (by default the package is installed in /usr/local/bin, which is the first path searched by asterisk).

Another way to setup music on hold is to integrate MoH patch (the patch is bundled with chanspy) into the asterisk package, thus enabling native file format decoding and removing mpg123 dependancy. What follows are some simple steps to setup a MoH extension using ulaw encoded files.

0. Prerequisites

# apt-get install build-essential dh-make patch
# wget <url-to-chanspy-tar-gzip-archive>
# tar xzf chanspy.tar.gz

This command creates a directory named chanspy

1. Patch and rebuild asterisk

# apt-get source asterisk

This command creates a directory named asterisk-<current-version> (in my case asterisk-1.0.1)

# cd asterisk-1.0.1
# patch -p0 < ../chanspy/mohpatch.diff
# dpkg-buildpackage -D -b


If this last command fails, make sure to fulfill all the dependencies (don't be warned if more than 50 packages need to be installed).

# dpkg -i ../asterisk_*.deb

2. Add a sample extension to asterisk

First add the following lines to /etc/asterisk/extensions.conf

exten => 1234,1,Answer
exten => 1234,2,SetMusicOnHold(ulawfiles)
exten => 1234,3,MusicOnHold()

Then configure the ulawfiles class in /etc/asterisk/musiconhold.conf adding these lines

[moh_files]
ulawfiles => /usr/share/asterisk/sounds/ulawfiles

Make sure to have some files to be played in the right place

# mkdir -p /usr/share/asterisk/sounds/ulawfiles
# sox -V example.mp3 -t au -r 8000 -U -b -c 1 \
/usr/share/asterisk/sounds/ulawfiles/example.ulaw resample -ql

3. Restart asterisk and make a call to 1234 and enjoy the music on hold...

# /etc/init.d/asterisk restart

4. Fine tuning and audio improvements

With format_mp3.so module MoH can also play mp3 files. Some files may play scratchy due to the high volume level, you can adjust the amplitude with the "-v volume" flag of sox.

13 comments:

ZX81 said...

Great entry. Linked from Daily Asterisk News here:

http://www.sineapps.com/news.php?rssid=308

Keep up the good work!

Cheers,

Matt

gfutfy said...

You said you will love me wow gold the whole life, but WoW Gold you marry her. You said you will wow power leveling,come to marry me, but this will not be carried out forever.WoW Gold I am trying my best to forget you and do not love you anymore. wow leveling But I failed and I still love you. Maybe wow leveling she needs you more compared wow leveling with me. So I tell you that world of warcraft power leveling you should love world of warcraft power leveling her and take good world of warcraft leveling care of her. You said I was so kind.world of warcraft leveling Yes, because I love you,world of warcraft leveling I hope you will be power leveling happy forever.

SewhatSneev said...

cheap products for man penis enlargement ideal penis enlargement
penis enlargement pills penis enlargement pills
penis enlargement exercises fast weight loss supplements fast weight loss
penis enhancement
natural penis enlargement

dreaz said...

I am grateful to you for this great content.aöf thanks radyo dinle cool hikaye very nice ssk only cinsellik very nice ehliyet only home free kadın last go korku jomax med olsaoy hikaye lesto go müzik dinle free only film izle love aşk only mp3 indir only radyolar lest go açıköğretim free net only filmler

bing said...

http://www.chihairstraightener.us/ : chi hair straightener
http://www.chiflatiron.us/ : chi flat iron

http://www.polool.com/ : new polo shirts


http://www.pursecart.com/ : cheap handbags
http://www.pursecart.com/ : cheap bags
http://www.pumachaussures.com/ : puma chaussures
http://www.pumachaussures.com/ : chaussures puma
http://www.pumachaussure.com/ : chaussure puma

http://www.jacketsworld.com/ : Men's North Face
http://www.jacketscart.com/ : Women's North Face


http://www.myhairstraighteners.co.uk/ : hair straighteners
http://www.sexylingeriestore.us/ : sexy lingerie store
http://www.uggsoutlet.us/ : cheap ugg boots
http://www.12hot.com/ : tattoo wholesale
http://www.polooo.net/ : men's clothing
http://www.acrazystore.com/ : women's clothing




http://www.thehairstraighteners.com/ : cheap hair straighteners
http://www.polosales.com/ : cheap Lacoste polo shirts
http://www.superpolos.com/ : cheap Lacoste polo shirts
http://www.shoesbuying.com/ : 2009 nike shoes
http://www.shoesbuying.com/2009-nike-shoes-c-153.htm : new nike shoes
http://www.shoesbuying.com/air-max-classic-bw-c-185.htm : Women's max
http://www.shoesbuying.com/mens-max-93-c-188.htm : Men's max 93
http://www.shoesbuying.com/nike-shox-c-165.htm : nike shox
http://www.shoesbuying.com/nike-force-c-174.htm : Nike air force
http://www.shoesbuying.com/nike-2003-c-181.htm : Nike air max 2003
http://www.shoesbuying.com/nike-air-max-ltd-c-166.htm : nike air max ltd
http://www.shoesbuying.com/nike-air-max-tn-c-167.htm : nike air max tn
http://www.shoesbuying.com/nike-rift-shoes-c-162.htm : Nike air rift
http://www.shoesbuying.com/nike-yeezy-c-184.htm : Nike air Yeezy
http://www.shoesbuying.com/nike-airmax-c-154.htm : nike airmax
http://www.shoesbuying.com/nike-airmax-c-155.htm : Nike air max 90
http://www.shoesbuying.com/nike-airmax-c-157.htm : Nike air max 97
http://www.shoesbuying.com/nike-birds-nest-shoes-c-152.htm : nike birds nest shoes
http://www.shoesbuying.com/nike-dunk-high-c-177.htm : nike dunk
http://www.shoesbuying.com/nike-shoes-c-168.htm : nike RT1 shoes
http://www.shoesbuying.com/nike-sb-c-180.htm : nike SB
http://www.shoesbuying.com/nike-shox-shoes-c-156.htm : nike shox shoes
http://www.shoesbuying.com/nike-shox-shoes-c-158.htm : Nike shox OZ shoes
http://www.shoesbuying.com/nike-shox-shoes-c-159.htm : Nike shox R2 shoes
http://www.shoesbuying.com/nike-shox-shoes-c-160.htm : Nike shox R3 shoes
http://www.shoesbuying.com/nike-shox-shoes-c-163.htm : Nike shox R4 shoes
http://www.shoesbuying.com/nike-shox-shoes-c-164.htm : Nike shox R5 shoes
http://www.shoesbuying.com/nike-shox-c-171.htm : Nike shox TL3
http://www.shoesbuying.com/nike-trainers-lovers-c-118.htm : nike trainers lovers

http://www.racketsoffer.com/ : tennis rackets
http://www.racketsoffer.com/wilson-racquets-c-19/ : Wilson tennis rackets
http://www.racketsoffer.com/head-racquets-c-18/ : HEAD tennis rackets
http://www.racketsoffer.com/babolat-racquets-c-17/ : Babolat tennis rackets

Adi said...

Oes Tsetnoc one of the ways in which we can learn seo besides Mengembalikan Jati Diri Bangsa. By participating in the Oes Tsetnoc or Mengembalikan Jati Diri Bangsa we can improve our seo skills. To find more information about Oest Tsetnoc please visit my Oes Tsetnoc pages. And to find more information about Mengembalikan Jati Diri Bangsa please visit my Mengembalikan Jati Diri Bangsa pages. Thank you So much.

feiyang said...

When I surf the net, I come across your blog, and after I read your articles, I love your blog deeply.
Are you a fashion chaser? And do you like polo shirts, which are very chic, especially the polo t shirts, I love them very much. I also like playing tennis rackets, it can keep healthy, what do you like to do?
We are so honour to say that we are the outlet of
polo t shirts women
polo t shirts on sale
polo t shirts for women
polo shirts on sale
these products are warmly welcomed by our customers. And what's more we also sell
polo shirts men
men's polo shirt
men polo shirt
mens polo shirts
mens polo shirt
and the high-quality
cheap polo shirts
discount polo shirts
men's polo shirts
women's polo shirts
Our store are also famous for
cheap tennis racket
discount tennis racket
and the main product is
prince tennis racquet
head tennis rackets
wilson tennis racket
babolat tennis racquet
In this case, if you have time, you can buy many excellent things in our store, and we can assure you that we will not let you down.

uwanna said...

When I see your article, I really agree with you about the blog.I think people will know this after read the information. I hope you will share more with us. At the same time, you also can go to our website to find someting that maybe you like. We have
nike chaussures,nike shox chaussures,
nike tn,nike tn requin
nike air max chaussures,nike chaussures femmes.
nike chaussures homme,nike chaussures enfants
We have so many kinds of nike shoes that we are sure you will find the one that you like. Besides, we have the special
MBT chaussures.
If you like climbing then you can choose the vibram chaussures in our store.
You can find the Y-3 Yohji Yamamotoand
Nike Air Jordan are designed for you!

Ross said...

dsquareddsquared
dsquared shoesdsquared shoes
dsquared shoes 2011dsquared shoes 2011
dsquared jeans womendsquared jeans women
dsquared t shirtsdsquared t shirts
dsquared jeans mendsquared jeans men
dsquared hoodiesdsquared hoodies
dsquared beltsdsquared belts
asics shoes saleasics shoes sale
asics shoesasics shoes
asics running shoesasics running shoes
asics mexico 66asics mexico 66
onitsuka kanuchionitsuka kanuchi
timberland bootstimberland boots
christian louboutin shoeschristian louboutin shoes
karen millen dresseskaren millen dresses

abercrombiefitch said...

Both sides also collectively released a 3 festivities to commemorate the tenth anniversary of cooperation
Nike Air Max Shoes
Nike Air Max 2011
Nike Air Max
Nike Air Max 2009
Nike Air Max 95
Nike Air Max 91
Nike Air Max 87
Nike Air Max 180
Nike Air Max Griffey Max 1
Nike Air Max 90
Nike Air Max 1
Nike Air Max Wildwood Supreme
Nike Air Max Turbulence
Nike Air Max Skyline
Nike Air Max Goadome
Nike Air Max Fitsole
Nike Air Max Zenyth
Nike Air Max Boots
Nike Air Max Zoom Kobe
Nike Air Max Tn
Nike Air Max LTD
Nike Air Max Presto
Nike Air Max BW
Nike Air Max 24 7
Nike Air Max 2010
Nike Air Max 2011
Abercrombie and Fitch London
Abercrombie & Fitch Clothes
Vibram Shoes
Cheap Air Max
Nike Air Max Shoes
I saw peach falling from the window in your house. Walking really happy, to ensure that all of the uncomfortable into simple

silence. I'm the only person who heard one's heart beat.

jelish said...

Christian Louboutin Outlet Online Store offer 2011 new-style Christian Louboutin Sale Outlet online store.We will provide you with all kinds of CL.The Christian Louboutin Ankle Boots serve different functions and keep your feet stylish and warm,Christian Louboutin High Heels can always show our body in the best charming way, making her legs look as long as possible.Christian Louboutin New Style are the best choice for you to choose the brand, especially you want to keep steps to the fashion world.Christian Louboutin Peep Toes that are considered as classic due to the fact they are comfortable.Buy cheap Christian Louboutin Outlet Online shoes, get your favorite.
http://www.christianlouboutinoutletonline.org

jelish said...

You wish for getting to create people nowadays worried about women? can you need a awesome coloring as women? We are Louboutin 2011store. we are able to provide you using a broad wide variety of Sale Louboutin. For example:Christian Louboutin Slingbacks,Christian Louboutin Peep Toe,Christian Louboutin Evenings,Christian Louboutin Pumps. andChristian Louboutin Mensis a very distinctive design, its design reflects its style. You put on it, that means you have its style.You put on it, that means you have its style.They are astonishingly psychological color. Please do not pass up an superb chance.
http://www.sale-louboutin-shoes.us

sport said...

Discount Uggs
Discount Ugg Boots
Ugg Boots Discount
Uggs Discount
Discount Uggs Boots