Asterisk WaitExten() Music on Hold Option Only Uses Default Class

Posted on in voice

vintage 1 (photo by coscurro) [id: 780414]This might be a bug with the particular version of Asterisk 1.2 I'm using, but it's pretty darn annoying. Hopefully, it doesn't effect you if you are using the latest version of 1.2 or 1.4.

What I'm trying to do is play some background music while I wait for the caller to enter an extension. The Background() plays the sound file that tells the caller to pick an extension and the WaitExten() command tells Asterisk to wait for a certain amount of time before moving on.

WaitExten(30|m(Fred));

The above code should play music on hold from the Fred class for 30 seconds while waiting for an extension to be entered. In at least some versions of Asterisk 1.2, the class portion of the m option seems to be totally ignored. No matter what I tried, the WaitExten() command behaved as though I hadn't entered an <acronym title="Music On Hold">MOH</acronym> class at all!

Once you come to terms with this little problem, the solution is pretty straight-forward. You can put it anywhere in your priority list, but the sooner the better.

SetMusicOnHold(Fred);
WaitExten(30|m);

The SetMusicOnHold() command sets the default MOH class for the active channel to the class designated between the parenthesis.

Note: These configuration examples are <acronym title="Asterisk Extension Language">AEL</acronym>-based, rather than using the plain old extensions.conf way of doing things.

My Bookshelf

Reading Now

Other Stuff