Page 329 - Asterisk™: The Future of Telephony
P. 329

$ yum install sox
                 2. Download the music that you have chosen to a working folder on your system
                   (/tmp is probably a suitable location). As an example, the following command
                   downloaded some nice piano music by Pachelbel for us:

                       $ wget http://upload.wikimedia.org/wikipedia/commons/6/62/Pachelbel%27s_Canon.ogg
                 3. Now we have to convert the song from ogg-Vorbis format to a format more suitable
                   to Asterisk:
                       $ sox Pachelbel\'s_Canon.ogg -r 8000 -c 1 -s -w moh1.wav resample -ql


                              You may also need to adjust the amplitude with the -v option.




                   We’ve now taken our source file, converted it to a .wav file suitable to Asterisk, †
                   and saved the resulting file as moh1.wav.
                 4. Almost done now. We just need to create a folder for the permanent home of the
                   new files (/tmp is certainly no place for them):

                       $ mkdir /var/lib/asterisk/mohwav
                   and then move them there:
                       $ mv *.wav /var/lib/asterisk/mohwav
                 5. Since we have placed our music files in a different folder from that where Asterisk
                   installs its sample music, we will need to change the configuration file to reflect
                   this.  Edit  your  /etc/asterisk/musiconhold.conf  file  with  one  that  contains  the
                   following:
                       [default]
                       mode=files
                       directory=/var/lib/asterisk/mohwav
                       random=yes
               As for what to play, that will depend on what image you want to project to your callers.
               Regardless of your choice, you should keep some things in mind:

                 • People don’t actually want to be on hold, so they are not usually planning to be
                   there for long. This means that there is not much point in providing them with a
                   mind-expanding musical experience. If things go as they hope, they won’t be there
                   long enough to get into it.





               † Note that we could have used any format that was compatible with Asterisk; we’ve just chosen .wav for this
                 example because it is easy for the CPU to transcode into μlaw/alaw/slin on the fly, yet remains easy to work
                 with in other environments.

                                                                          Music on Hold | 301
   324   325   326   327   328   329   330   331   332   333   334