This is the content of my musiconhold.conf
;
; 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
; 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.
;
; 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
; /var/lib/asterisk.
;
; 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.
;
[default]
mode=files
directory=moh
[waiting-audio]
mode=files
directory=/var/lib/asterisk/sounds/ivr/WAITING_AUDIO
This my dialplan on the incoming call on the extension 115 and 116
[from-external] ;========================================================================== Incoming Calls
exten => ${TEST_IN},1,NoOp(## Incoming Call from ${CALLERID(all)} ##)
same => n,Verbose(Call start time: ${CDR(start)})
same => n,Set(CDR(calldate)=${CDR(start)})
same => n,Set(CDR(useragent)=${CALLERID(name)})
same => n,Set(POSTE_EXT=${CALLERID(num)})
same => n,Ringing()
same => n,System(echo "--appel_sortant --- callerid : ${CALLERID(num)} ---- ${STRFTIME(${EPOCH},,%Y/%m/%d %H:%M:%S)} ----" >> /var/spool/asterisk/log/debug.txt)
same => n,Set(REC_FILE_NAME=IN_${NOW}_${EXTEN}_${POSTE_EXT}.wav)
same => n,Set(RETURNED_VALUE=${ODBC_LASTCALL(${CALLERID(num)})})
same => n,MixMonitor(${REC_FILE_NAME},b V(1))
same => n,ChanIsAvail(PJSIP/115&PJSIP/116,sa)
same => n,Set(PHONESTATUS=${AVAILSTATUS})
same => n,Set(PHONEAVAIL=${AVAILORIGCHAN})
same => n,NoOp(## Status of device is ${PHONESTATUS} ##)
same => n,GotoIf($["${PHONESTATUS}"="3&3"]?busy:call)
same => n(busy),Dial(${PHONEAVAIL},120,m(waiting-audio)r)
same => n,Playback(ivr/REPONDEUR_2_OCCUPE_PLATEAU_VENTE_LOOPING)
same => n,VoiceMail(${VM_TEST},s)
same => n,Goto(end)
same => n(call),Dial(${PHONEAVAIL},120,m(waiting-audio)r)
same => n,Playback(ivr/REPONDEUR_2_OCCUPE_PLATEAU_VENTE_LOOPING)
same => n,VoiceMail(${PHONEAVAIL}@default,s)
same => n,Goto(end)
same => n(end),Hangup()
This is what I have in CLI when I call to the DID of this two extension :
== Setting global variable 'SIPDOMAIN' to 'ip address'
-- Executing [042770677@from-external:1] NoOp("PJSIP/belgium-voip-00000140", "## Incoming Call from "Arnold" <028992018> ##") in new stack
-- Executing [042770677@from-external:2] Verbose("PJSIP/belgium-voip-00000140", "Call start time: 2018-10-12 11:52:29") in new stack
Call start time: 2018-10-12 11:52:29
-- Executing [042770677@from-external:3] Set("PJSIP/belgium-voip-00000140", "CDR(calldate)=2018-10-12 11:52:29") in new stack
-- Executing [042770677@from-external:4] Set("PJSIP/belgium-voip-00000140", "CDR(useragent)=Arnold") in new stack
-- Executing [042770677@from-external:5] Set("PJSIP/belgium-voip-00000140", "POSTE_EXT=028992018") in new stack
-- Executing [042770677@from-external:6] Ringing("PJSIP/belgium-voip-00000140", "") in new stack
-- Executing [042770677@from-external:7] System("PJSIP/belgium-voip-00000140", "echo "--appel_sortant --- callerid : 028992018 ---- 2018/10/12 11:52:29 ----" >> /var/spool/asterisk/log/debug.txt") in new stack
-- PJSIP/belgium-voip-0000013f is ringing
-- PJSIP/belgium-voip-0000013f is ringing
-- Executing [042770677@from-external:8] Set("PJSIP/belgium-voip-00000140", "REC_FILE_NAME=IN__042770677_028992018.wav") in new stack
-- Executing [042770677@from-external:9] Set("PJSIP/belgium-voip-00000140", "RETURNED_VALUE=bel") in new stack
-- Executing [042770677@from-external:10] MixMonitor("PJSIP/belgium-voip-00000140", "IN__042770677_028992018.wav,b V(1)") in new stack
-- Executing [042770677@from-external:11] ChanIsAvail("PJSIP/belgium-voip-00000140", "PJSIP/115&PJSIP/116,sa") in new stack
-- Executing [042770677@from-external:12] Set("PJSIP/belgium-voip-00000140", "PHONESTATUS=1&1") in new stack
-- Executing [042770677@from-external:13] Set("PJSIP/belgium-voip-00000140", "PHONEAVAIL=PJSIP/115&PJSIP/116") in new stack
-- Executing [042770677@from-external:14] NoOp("PJSIP/belgium-voip-00000140", "## Status of device is 1&1 ##") in new stack
-- Executing [042770677@from-external:15] GotoIf("PJSIP/belgium-voip-00000140", "0?busy:call") in new stack
-- Goto (from-external,042770677,20)
-- Executing [042770677@from-external:20] Dial("PJSIP/belgium-voip-00000140", "PJSIP/115&PJSIP/116,120,m(waiting-audio)r") in new stack
-- Called PJSIP/115
-- Called PJSIP/116
[Oct 12 11:52:29] WARNING[2016][C-000000a0]: res_musiconhold.c:918 _get_mohbyname: Music on Hold class 'waiting-audio' not found in memory. Verify your configuration.
[Oct 12 11:52:29] WARNING[2016][C-000000a0]: res_musiconhold.c:918 _get_mohbyname: Music on Hold class 'waiting-audio' not found in memory. Verify your configuration.
-- Started music on hold, class 'default', on channel 'PJSIP/belgium-voip-00000140'
[Oct 12 11:52:29] WARNING[2016][C-000000a0]: translate.c:407 framein: no samples for ulawtolin
-- PJSIP/116-00000144 connected line has changed. Saving it until answer for PJSIP/belgium-voip-00000140
-- PJSIP/115-00000143 connected line has changed. Saving it until answer for PJSIP/belgium-voip-00000140
== Begin MixMonitor Recording PJSIP/belgium-voip-00000140
-- PJSIP/115-00000143 is ringing
-- PJSIP/115-00000143 is ringing
-- PJSIP/116-00000144 is ringing
-- PJSIP/116-00000144 is ringing
== Spawn extension (from-internal, 042770677, 26) exited non-zero on 'PJSIP/100-0000013e'
== MixMonitor close filestream (mixed)
== End MixMonitor Recording PJSIP/100-0000013e
[Oct 12 11:52:34] ERROR[543]: cdr_odbc.c:176 odbc_log: Unable to retrieve database handle. CDR failed.
-- Stopped music on hold on PJSIP/belgium-voip-00000140
== Spawn extension (from-external, 042770677, 20) exited non-zero on 'PJSIP/belgium-voip-00000140'
== MixMonitor close filestream (mixed)
== End MixMonitor Recording PJSIP/belgium-voip-00000140
[Oct 12 11:52:34] ERROR[543]: cdr_odbc.c:176 odbc_log: Unable to retrieve database handle. CDR failed.
[Oct 12 11:52:34] ERROR[543]: cdr_odbc.c:176 odbc_log: Unable to retrieve database handle. CDR failed.
-- Channel PJSIP/belgium-voip-0000013d left 'simple_bridge' basic-bridge <9f2d9bd1-82d2-480f-b0a1-3a6329b6ae5e>
-- Channel PJSIP/101-0000013c left 'simple_bridge' basic-bridge <9f2d9bd1-82d2-480f-b0a1-3a6329b6ae5e>
== Spawn extension (from-internal, 0476283547, 26) exited non-zero on 'PJSIP/101-0000013c'
== MixMonitor close filestream (mixed)
== End MixMonitor Recording PJSIP/101-0000013c
[Oct 12 11:52:35] ERROR[543]: cdr_odbc.c:176 odbc_log: Unable to retrieve database handle. CDR failed.