Unable to play music on hold in asterisk

deogratias picture deogratias · Jul 3, 2014 · Viewed 8.9k times · Source

In my dialplan music on hold was working earlier but its not working now.My musiconhold.conf

;
; Music on Hold -- Sample Configuration
;

    [old-default]
    mode=files
    directory=/var/lib/asterisk/mohmp3
    random=yes 

    [old-quiet]
    mode=files
    directory=/var/lib/asterisk/quiet-mp3

    #include musiconhold-vicidial.conf

    ; valid mode options:
    ; quietmp3      -- default
    ; mp3           -- loud
    ; mp3nb         -- unbuffered
    ; quietmp3nb    -- quiet unbuffered
    ; custom        -- run a custom application
    ; files         -- read files from a directory in any Asterisk supported format

my cli shows Music class default requested but no musiconhold loaded.

the output of moh reload

localhost*CLI> moh reload
  == Parsing '/etc/asterisk/musiconhold.conf':   == Found
[Jul  4 11:23:08] WARNING[4504]: res_musiconhold.c:1068 moh_scan_files: Cannot open dir /var/lib/asterisk/mohmp3 or dir does not exist
[Jul  4 11:23:08] WARNING[4504]: res_musiconhold.c:1068 moh_scan_files: Cannot open dir /var/lib/asterisk/quiet-mp3 or dir does not exist

I dont know what hapened it was working fine earlier.

Thanks in advance

Answer

Vivek Raj picture Vivek Raj · Jul 4, 2014

As per your warnings, It shows /var/lib/asterisk/mohmp3 does not exist. You have to create your music on hold directory(i.e mohmp3,quiet-mp3) within /var/lib/asterisk/moh and then edit your musiconhold.conf ex: [mohmp3] mode=files directory=/var/lib/asterisk/moh/mohmp3

And atlast reload music on hold asterisk -rx'moh reload'.

If it is successfully then asterisk -rx'moh show classes' will give you output of your created music on hold directory