How can I play random announcements to on hold callers?

Hey everyone,

I’m looking for a way to play announcements to people that are on hold. So I want them to listen to hold music then every 30 seconds or so hear an ad. Right now I just have my hold music edited to include the ads, but if I want to change them it becomes a pain.

Is there any way to do this? I basically just want it to play the standard built in hold music, and then randomly, or even in order doesn’t matter, play them a 15 second message every 30-45 seconds or so similar to when you call into a large company. Is this possible without physically editing the hold music to apply the ad to the actual file? Thanks!

If you would like to consider using a professional service to manage this for you, I would be happy to give you some options.

I have not tested this extensively nor checked the Asterisk code to confirm, but it seems that when you are NOT using random mode, Asterisk plays the files in sequential order by filename.

So you could name your files in a way which ensures your desired ratio of ads to music. For example:


This still achieves your goal of avoiding constant re-editing of music files. However, 02-first_ad.wav will tend to be heard more often than 04-next_ad.wav (assuming that your average hold times vary).

I know you don’t think big companies with their high-end PBX’s go to a lot of trouble, but I happen to know that they often go to more trouble than you think. Check out (I have no financial interest in this company and I do not personally endorse themm, but I am aware of them as an example of what I’m talking about). Companies hire vendors like to create MOH-specific recordings (even if the companies already have audio ads created by a separate ad agency which were produced for radio!) so the MOH vendor takes care of any tedious work which might be needed for MOH like mixing the ad into music, among other things.

Thanks bodywave that could work I suppose. I just wanted it to be more like one song that’s playing for 30 seconds, it basically pauses and plays an ad, then the song resumes like when you call your phone company or a large call centre for example. I suppose though they are maybe creating their sound files from scratch every time.

My only concern with the above is that when it’s random, there’s a chance it could play 3 music files in a row so a minute and a half of music, and then play an ad. Or it could play 3 ads in a row followed by 30 secs of music then more ads. Just don’t want it to be overkill. I’ll look into it though just wanted to make sure there wasn’t an easier way that I was missing.

I am sorry if I am misunderstanding your question, but it seems obvious to me that you could simply upload your ads separately (like each ad were a “song”) into the /var/lib/asterisk/moh directory and create the .random file to enable random play. The GUI equivalent would be uploading thru the “Music on Hold” module in FreePBX and clicking the “Enable Random Play” button.

Make sure your real music files are only 30-45 seconds long, and Asterisk will take care of shuffling your ads between music, randomly.

If you don’t already have pieces of music which are 30-45 seconds long, you might need to cut your existing files into pieces but this only needs to be done once. When you want to add/delete/replace an ad, you simply add/delete/replace the ad file, no editing involved.

No one? This seems like something common no?