;
; Music on Hold -- Sample Configuration
;
[general]
;cachertclasses=yes     ; use 1 instance of moh class for all users who are using it,
                        ; decrease consumable cpu cycles and memory
                        ; disabled by default

;preferchannelclass=yes ; Prefer the musicclass as defined by CHANNEL(musicclass),
                        ; over a class set by an application (e.g. a musicclass set on a queue).
                        ; Defaults to yes.

; valid mode options:
; files		-- read files from a directory in any Asterisk supported
;		   media format
; playlist	-- provide a fixed list of filenames or HTTP(S) URLs to play
; quietmp3 	-- default
; mp3 		-- loud
; mp3nb		-- unbuffered
; quietmp3nb	-- quiet unbuffered
; custom	-- run a custom application (See examples below)

; =========
; File-based (native) music on hold
; =========
;
; This plays files directly from the specified directory, no external
; processes are required. Files are played in normal sorting order
; (same as a sorted directory listing), and no volume or other
; sound adjustments are available. If the file is available in
; the same format as the channel's codec, then it will be played
; without transcoding (same as Playback would do in the dialplan).
; Files can be present in as many formats as you wish, and the
; 'best' format will be chosen at playback time.
;
; The path specified can be either an absolute path (starts with '/'),
; or a relative path; relative paths are interpreted as being relative
; to the 'astdatalibdir' in asterisk.conf, which defaults to
; .
;
; NOTE:
; If you are not using "autoload" in modules.conf, then you
; must ensure that the format modules for any formats you wish
; to use are loaded _before_ res_musiconhold. If you do not do
; this, res_musiconhold will skip the files it is not able to
; understand when it loads.
;
; =========
; Playlist (native) music on hold
; =========
;
; This mode is similar to 'files' mode in that it plays through a list
; of files, but instead of scanning a directory the files are
; explicitly configured using one or more 'entry' options.
;
; Each entry must be one of:
;
;   * An absolute path to the file to be played, without an extension.
;   * An HTTP(S) URL
;
; The entries are played in the order in which they appear in the
; configuration. The 'sort' option is not used for this mode.
;

[default]
mode=files
directory=moh
;
;[native-random]
;mode=files
;directory=moh
;digit=#        ; If this option is set for a class, then when callers are
;               ; listening to music on hold, they can press this digit, and
;               ; they will switch to listening to this music class.
;announcement=queue-thankyou	;If this option is set for a class, then
;               ; when callers get put on hold, the specified sound will be
;               ; be played to them. Also, if using modes that Asterisk
;               ; controls the playlist for (files, mp3, etc), the same
;               ; sound will also be played between MOH songs.
;sort=random    ; Sort the files in random order. Other sort options are:
;               ; 'alpha' and 'randstart'. If 'alpha', the files are sorted
;               ; in alphabetical order. If 'randstart', the files are sorted
;               ; in alphabetical order as well, but the first file is chosen
;               ; at random. If unspecified, the sort order is undefined.
;loop_last=no   ; If enabled, once the end of the directory is reached,
                ; the last file played will be looped perpetually, rather than
                ; starting over at the beginning again.
                ; Can be used with sort=alpha or randstart so you can control
                ; which file gets looped (the last one sorted alphabetically).
                ; (If sort=alpha, all files will be played at least once, but
                ; this may not be true with sort=randstart.)
                ; Default is no.
;answeredonly=yes       ; Only allow answered channels to have music on hold.
                        ; Enabling this will prevent MOH on unanswered channels.
                        ; (default: "no")

;[native-alphabetical]
;mode=files
;directory=moh
;sort=alpha     ; Sort the files in alphabetical order.

;[sales-queue-hold]
;mode=playlist
;entry=/sounds/en/yourcallisimportant
;entry=http://example.local/sales-queue-hold-music.ulaw
;entry=/moh/macroform-robot_dity

; =========
; Other (non-native) playback methods
; =========

;[manual]
;mode=custom
; Note that with mode=custom, a directory is not required, such as when reading
; from a stream.
;directory=/mohmp3
;application=/usr/bin/mpg123 -q -r 8000 -f 8192 -b 2048 --mono -s

;[ulawstream]
;mode=custom
;application=/usr/bin/streamplayer 192.168.100.52 888
;format=ulaw    ; The 'format' option specifies the audio format that the
;               ; 'application' will provide to Asterisk. In this example,
;               ; streamplayer will output ulaw samples so we need to set the
;               ; format to ulaw so that Asterisk knows how to interpret the
;               ; incoming audio.

; mpg123 on Solaris does not always exit properly; madplay may be a better
; choice
;[solaris]
;mode=custom
;directory=/mohmp3
;application=/site/sw/bin/madplay -Q -o raw:- --mono -R 8000 -a -12

; By default, when res_musiconhold reloads or unloads, it sends a HUP signal
; to custom applications (and all descendants), waits 100ms, then sends a
; TERM signal, waits 100ms, then finally sends a KILL signal.  An application
; which is interacting with an external device and/or spawns children of its
; own may not be able to exit cleanly in the default times, expecially if sent
; a KILL signal, or if it's children are getting signals directly from
; res_musiconhoild.  To allow extra time, the 'kill_escalation_delay'
; class option can be used to set the number of milliseconds res_musiconhold
; waits before escalating kill signals, with the default being the current
; 100ms.  To control to whom the signals are sent, the "kill_method"
; class option can be set to "process_group" (the default, existing behavior),
; which sends signals to the application and its descendants directly, or
; "process" which sends signals only to the application itself.

;[sox_from_device]
;mode=custom
;directory=/mohmp3
;application=/usr/bin/sox -q -t alsa -c 2 -r 48000 hw:1 -c 1 -r 8000 -t raw -s -
; Wait 500ms before escalating kill signals
;kill_escalation_delay=500
; Send signals to just the child process instead of all descendants
;kill_method=process
