TUTORIAL Gotcha-Free PBX: Music on Hold

Joined
Jul 3, 2014
Messages
66
Reaction score
21
Location
Ann Arbor, Michigan
Problem: Cannot add new music through the "Music On Hold" menu. It says the music is uploaded, but you cannot see any list of sound files.

Setup: Incredible PBX 11.16-05 for Asterisk-GUI, running on Ubuntu 14.04 x64

Also, I am not sure the exact sound format required (I understand about WAV files, but Googling led me to believe the many PBXs are sensitive to file formats). I found this link (http://snafder.blogspot.com/2011/01/saving-wav-files-in-ccitt-u-law-format.html) with instructions for how to convert files in Audacity to ULAW wav files.
 

rossiv

Guru
Joined
Oct 26, 2008
Messages
2,626
Reaction score
138
Location
Atlanta, GA
At least for FreePBX, I've always uploaded 8000hz Mono 16-bit WAV files. Anything else just doesn't work.
 

rossiv

Guru
Joined
Oct 26, 2008
Messages
2,626
Reaction score
138
Location
Atlanta, GA
Hmm, I'll try that. But, shouldn't a mono 8-bit ulaw .wav file work? Also, shouldn't it display the uploaded file or files?
Haven't done much with the Asterisk GUI. Don't know how it works in the back end, but you make a valid point. Can't speak to the formatting thing but you'd think it would show the uploaded file. Do you see it on the file system anywhere?
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
15,136
Reaction score
2,627
I confess. We punted on this one. It was easier just to drop the files in /var/lib/asterisk/moh and forget about it.
 
Joined
Jul 3, 2014
Messages
66
Reaction score
21
Location
Ann Arbor, Michigan
Ah! Since I am working from a Windows machine, I wanted to offer the steps to upload a file (this was new to me, so hopefully someone else finds it useful):

How To Securely Upload File(s) From Windows To Your PBX In The Cloud
  1. Assuming you already have "Putty," download "pscp" here (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html)
  2. There are two ways to connect (with or without a SSH key).
  3. Without a SSH Key:
    1. Click on the Start menu and in the "Search programs and files box," type "cmd," then right click "cmd.exe" and click "Run as Administrator."
    2. Change directory to wherever you downloaded "pscp.exe" (this is usually your downloads folder);
    3. Then try running
      Code:
      pscp.exe filename.extension [email protected]:directory/subdirectory
  4. With a SSH Key:
    1. Click on the Start menu and in the "Search programs and files box," type "cmd," then right click "cmd.exe" and click "Run as Administrator."
    2. Change directory to wherever you downloaded "putty.exe"
    3. [Your Putty and PSCP directory] -i [Location of your PPK file] [File with location] [username]@[server or IP]:/[Location of Server to Deposit Files]
    4. Example listed below (Hat tip: http://dafis.ucdavis.edu/install/sftp/PuttyPSCPKey.cfm)
Code:
c:\putty\pscp.exe -i putty_id_rsa_1024.ppk c:\putty\File1.txt c:\putty\File2.txt c:\putty\File3.txt [email protected]:/Directory/
So, that worked for me and I confirmed I uploaded the file. How to I select it for my Music on Hold?

Thanks!
 
  • Like
Reactions: vic555
Joined
Jul 3, 2014
Messages
66
Reaction score
21
Location
Ann Arbor, Michigan
Wow! So, yeah, WinSCP is far easier than my instructions above. But, I guess it's good to learn how to do things the old school way before walking into the light (sure makes you appreciate such a program)!
 
  • Like
Reactions: lgaetz

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
15,136
Reaction score
2,627
magnus_stout: Looks like there should be a guimohdir_custom subdirectory under /var/lib/asterisk/moh. If you copy files into there and then go into Music on Hold in Asterisk-GUI and select Custom, they should appear. You should also be able to create a new class there with the New MOH Class button. See also musiconhold.conf. Because of old legacy code in various places, it's probably a good idea to create a symlink for mohmp3 as well:
Code:
ln -s /var/lib/asterisk/mohmp3 /var/lib/asterisk/moh
There are several places where you can set the MOH class. Changing an entry from Default to Custom should get you what you need. Same with other classes. See, for example, Global SIP Settings -> TOS in Asterisk-GUI. The info icon explains how to set it on a per channel basis.
 
  • Like
Reactions: magnus_stout
Joined
Jul 3, 2014
Messages
66
Reaction score
21
Location
Ann Arbor, Michigan
Phew! Thanks, Ward!

Okay, so here's what I did to get custom music on hold:
  1. First, make sure you have a properly formatted WAV file (read here: http://snafder.blogspot.com/2011/01/saving-wav-files-in-ccitt-u-law-format.html). Note that to export from Audacity to the same format as the default music, you would click the "Options" button in the save field in Audacity, and then under the "Specify Uncompressed Options" box, you would select "WAV (Microsoft)" as the "Header" and under the "Encoding" option you would select "Signed 16 bit PCM." (This assumes you already made your file "Mono" and then dropped the Project Rate Hz down to 8000).
  2. With your handy-dandy WinSCP Program, connect to your PBX box. As Ward mentioned above, your files are located in "/var/lib/asterisk/moh". Start there with WinSCP and you should see a directory called, "guimohdir_custom." Go there.
  3. Now, upload your properly-formatted WAV to "/var/lib/asterisk/moh/guimohdir_custom."
    NOTE: pay attention to the permissions of the file you uploaded (in WinSCP you can see the "Owner" column). Since I was logged in as "root," it automatically changed the owner to "Root." You should probably change your file permission to "asterisk," by Right Clicking your file, then selecting "asterisk" under the "group" and "owner" fields. Keep that in mind if you upload files in the future.
  4. Restart your asterisk interface ("amportal restart" at the command line).
  5. Go to your PBX's web interface and click on "Music on Hold" to the left side. Under the "Manage 'Music-on-Hold' Classes " dropdown box, select "custom" and you should see the sound file you uploaded. If not, go back to step 3 to review where you uploaded your files.
  6. Go to your PBX's web interface and click on "SIP Setting" to the left side. When that page loads, you will see a page with tabs. Click on the "TOS" tab. Under the "Music On Hold Interpret:" field, add the following text: "custom" Click "save"at the bottom and then restart.
  7. Restart your asterisk interface ("amportal restart" at the command line).
  8. Test by answering a call and then putting it on hold.
That worked like a charm for me. I suggest you don't bother with MP3s, as it will just eat up CPU to convert the file every time. Learn how to use Audacity and export it to the right format.
 

Alan Painter

New Member
Joined
Feb 18, 2015
Messages
4
Reaction score
0
I confess. We punted on this one. It was easier just to drop the files in /var/lib/asterisk/moh and forget about it.
Hey Ward ~ I am guessing this is similar to the issue(s) I am having trying to upload custom voice prompts via the GUI. Is there a location that I can drop them in as well to get going?
 

DamienPBX

New Member
Joined
Aug 20, 2016
Messages
4
Reaction score
0
In the latest release of IncrediblePBX on raspberry pi3(raspbian jessie) , have the issues mentioned above been resolved?
Do I for instance need to create any folders in which to upload my hold1.wav file? I want to do this the proper way, command line via terminal on mac
 

jerrm

Guru
Joined
Sep 23, 2015
Messages
514
Reaction score
213
The GUI upload has worked fine for me on the Pi.

If you want to try a command line, I google for scp on the mac.
 

DamienPBX

New Member
Joined
Aug 20, 2016
Messages
4
Reaction score
0
I hadnt tried, the GUI. I assumed because of these topics that in was essential to do it via scp or terminal. It worked! Thanks jerrm
 

Members online

PIAF 5 - Powered by 3CX

Forum statistics

Threads
22,367
Messages
137,355
Members
14,575
Latest member
Issue