|
Page 2 of 2 Configuring Asterisk To use your nicely converted sound files, copy them to the /var/lib/asterisk/mohmp3 directory on your Asterisk server. Then edit /etc/asterisk/musiconhold.conf: ; Music on Hold [default] mode=files directory=/var/lib/asterisk/mohmp3 random=yes
Asterisk will play them in sequence if you leave off the "random=yes" option. Testing your new Hold Music Create a test extension, using a high-numbered extension to avoid conflict with your real extensions. Add these lines to /etc/asterisk/extensions.conf: exten => 9000,1,Answer exten => 9000,n,SetMusicOnHold(default) exten => 9000,n,WaitMusicOnHold(15) exten => 9000,n,Hangup
Asterisk will answer this extension with music from the "Default" class for 15 seconds, then hang up. Now restart Asterisk from the Asterisk CLI (see VoIPowering Your Office With Asterisk: Moving to the Grownup Version to learn about basic commands) to load the new sound files: # asterisk -r *CLI> restart gracefully Now call extension 9000 and listen to your customized tunes. Different sounds for different occasions You may create a variety of directories containing sound files for different occasions. This is called creating music classes. Create a new sound files directory, then edit /etc/asterisk/musiconhold.conf to add the new class: # mkdir /var/lib/asterisk/mohmp3/newclass
[newclass] mode=files directory=/var/lib/asterisk/mohmp3/newclass
You can test this new class just like the default class: exten => 9000,1,Answer exten => 9000,n,SetMusicOnHold(newclass) exten => 9000,n,WaitMusicOnHold(15) exten => 9000,n,Hangup
Sound files can go into any directory, as long as you enter the correct directory in the class definition. Using streaming audio If you have a reliable MP3 streaming audio source, such as Internet radio, you can pipe it into your Asterisk hold music. First create an empty directory, which in this example is /var/lib/asterisk/mohmp3/streaming. Then create the class this way, using the IP address of the stream: [streaming] /var/lib/asterisk/mohmp3/streaming,http://12.34.56.78/
|