5.15. Customizing Hold Music

You want to add your own custom tunes to the hold music that comes with Asterisk, or replace it entirely.

Easy as falling asleep. Just plunk your own WAVE-or GSM-formatted soundfiles into the /var/lib/asterisk/moh directory. Then, configure /etc/asterisk/musiconhold like this:

	[default]
	mode=files
	directory=/var/lib/asterisk/moh
	random=yes

Next, set up a test context for testing your hold music:

	exten => 1000,1,Answer
	exten => 1000,n,SetMusicOnHold(default)
	exten => 1000,n,WaitMusicOnHold(30)
	exten => 1000,n,Hangup

Changes to hold music require a server restart:

	asterisk1*CLI> restart gracefully

Then, dial 1000 to hear your music. It will play for 30 seconds, then hang up.

Hold music is enabled globally by default, so you don't need to explicitly turn it on.