MOH only plays a few seconds

Please help me on this, Thanks!

I’m new to asterisk, just want to use it as a standalone MOH server for my ip phones. I followed the instructions online and eventially make it work, but only plays music for just a few seconds ( 1bout 10 seconds).

Is there anyone can help me on this?


What is your timing source? Do you have internal timing turned on?

Thanks for your reply:-)

Here is my asterisk.conf
directories ; remove the (!) to enable this
astetcdir => /etc/asterisk
astmoddir => /usr/lib/asterisk/modules
astvarlibdir => /usr/share/asterisk
astdbdir => /var/spool/asterisk
astkeydir => /usr/share/asterisk
astdatadir => /usr/share/asterisk
astagidir => /usr/share/asterisk/agi-bin
astspooldir => /var/spool/asterisk
astrundir => /var/run/asterisk
astlogdir => /var/log/asterisk

;verbose = 3
;debug = 3
;alwaysfork = yes ; same as -F at startup
;nofork = yes ; same as -f at startup
;quiet = yes ; same as -q at startup
;timestamp = yes ; same as -T at startup
;execincludes = yes ; support #exec in config files
;console = yes ; Run as console (same as -c at startup)
;highpriority = yes ; Run realtime priority (same as -p at startup)
;initcrypto = yes ; Initialize crypto keys (same as -i at startup)
;nocolor = yes ; Disable console colors
;dontwarn = yes ; Disable some warnings
;dumpcore = yes ; Dump core on crash (same as -g at startup)
;languageprefix = yes ; Use the new sound prefix path syntax
internal_timing = no
;systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues
;autosystemname = yes ; automatically set systemname to hostname - uses ‘localhost’ on failure, or systemname if set
;maxcalls = 10 ; Maximum amount of calls allowed
;maxload = 0.9 ; Asterisk stops accepting new calls if the load average exceed this limit
;maxfiles = 1000 ; Maximum amount of openfiles
;minmemfree = 1 ; in MBs, Asterisk stops accepting new calls if the amount of free memory falls below this watermark
;cache_record_files = yes ; Cache recorded sound files to another directory during recording
;record_cache_dir = /tmp ; Specify cache directory (used in cnjunction with cache_record_files)
;transmit_silence_during_record = yes ; Transmit SLINEAR silence while a channel is being recorded
;transmit_silence = yes ; Transmit SLINEAR silence while a channel is being recorded or DTMF is being generated
;transcode_via_sln = yes ; Build transcode paths via SLINEAR, instead of directly
;runuser = asterisk ; The user to run as
;rungroup = asterisk ; The group to run as

; Changing the following lines may compromise your security.
;astctlpermissions = 0660
;astctlowner = root
;astctlgroup = apache
;astctl = asterisk.ctl


As you can see, the internal timing has been turned off, but the problem still happens every time.

internal timing should be ON, and you need to have dahdi_dummy or a real dahdi device’s driver loaded.

Here is my musiconhold.conf

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

; valid mode options:
; files – read files from a directory in any Asterisk supported
; media format
; 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.
; 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.

;digit=0 ; 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.
;sort=random ; Sort the files in random order

;sort=alpha ; Sort the files in alphabetical order. If this option is
; ; not specified, the sort order is undefined.

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

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

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

Here is the extensions.conf

include => stdexten
exten => 888,1,Answer()
exten => 888,n,MusicOnHold(default)