Asterisk cmd MusicOnHold
Business PBX Solution
| Provider | Solution Details | |
|---|---|---|
![]() |
Become an ITSP Now!
|
Details |
Synopsis
Play Music On Hold indefinitely.Description
MusicOnHold([class])Plays hold music specified by class. If omitted, the default music source for the channel will be used. If you have configured MusicOnHold in musiconhold.conf it will get played automatically if the extension is put on hold. This command FORCES musiconhold music.
The default MusicOnHold class is set with the SetMusicOnHold command (Deprecated in 1.6).
Example
Extension defined in extensions.conf with "forced" MusicOnHold. Remember to Answer before letting the music pour down the line. Otherwise music on hold will not work correctly.; Answer required as Music On Hold does not answer the call
exten => 6000,1,Answer
exten => 6000,2,MusicOnHold()
It is often useful to turn off music on hold in several situations:
- when a particular extension calls (originates)
- when connectiong to a particular extension
- when traversing a particularly expensive network
- when connecting to a conference
(So, how do we do handle each situation?)
You can turn off MOH on a per call by using the SetMusicOnHold command (Deprecated in 1.6).
Add a new class to musiconhold.conf
[none]
mode=files
directory=/dev/null
Create a macro in extensions.conf to turn off MOH
[macro-nomusic]
exten => s,1,NoOp(Turn off MOH for this channel)
exten => s,2,SetMusicOnHold(none)
Now call this macro when you dial an extension
exten => 7020,1,NoOp(Dial -> IAX2/outbound/${EXTEN})
exten => 7020,n,Dial(IAX2/outbound/${EXTEN},,M(nomusic))
exten => 7020,n,Hangup
Asterisk 1.6
MusicOnHold(class[,duration])Plays hold music specified by class. If class is omitted, the default music source for the channel will be used. Change the default class with Set(CHANNEL(musicclass)=...). If duration is given, hold music will be played specified number of seconds. If duration is ommited, music plays indefinitely.
Returns 0 when done, -1 on hangup.
play-fifo (3rd party addition)
This small C program will create if necessary, open and listen on a fifo for slinear audio and delivers it to STDOUT. If STDOUT is blocking, it discards the data. The idea is that you would use it in a custom class in res_musiconhold. Now you can use whatever means you choose in a seperate process to deliver raw 8khz mono slin to the fifo which will be heard as the music class fifo. An example would be to play your line-in into the fifo and the buffer will not overflow because this program does a poll on the STDOUT and discards STDIN when STDOUT is busy.You can find it here, it is not part of the Asterisk distribution.
See also
- MusicOnHold Configuration
- Asterisk cmd SetMusicOnHold
- bug 16091: Asterisk 1.4 plays own MOH when put on hold by remote ISDN trunk
- Asterisk cmd MP3Player
- Music on Hold - where to find music both free and paid
- Asterisk MOH Uploader - convert and upload MP3 using Charozt
- Sounddogs Royalty Free Music
- Signate Free Music On Hold Free Classical Music on Hold in MP3,ULAW and SLN
- BMI Commercial Music Licenses
- Using ffmpeg to convert Music On Hold files Convert to WAV and u-Law PCM in one step using ffmpeg
- Using ffmpeg to convert to Asterisk Native SLN Convert just about any audio to Asterisk Native SLN using ffmpeg
- Using Slimserver for Music on Hold: How to use a local or remote slimserver for your Music on Hold
- Asterisk MoH Patch How to play native file formats in asterisk
- StarTel has a large collection of MP3's suitable for Music on hold
- VoiceStudio offers 100 MP3 Music tracks for free download approx 170Mb.
- Configuration
- Sound files
Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ
Created by: oej, Last modification: Thu 26 of Jul, 2012 (15:20 UTC) by dlewis7444
Featured -
Search:


Page Changes






