我试图记录星号上的拨出电话,但总是得到空的音频文件。
可以理解为什么 :( 部分 [外拨] 呼叫测试
exten => 8916XXXXXXX,1,NoOp()
exten => 8916XXXXXXX,n,Verbose("Writing call")
exten => 8916XXXXXXX,n,Gosub(record_out,s,1(${EXTEN}))
exten => 8916XXXXXXX,n,Dial(SIP/sip-trunk/${EXTEN},,T)
exten => 8916XXXXXXX,n,Hangup()
转至录音文件:
[record_out]
exten => s,1,Set(MCALLER=${CALLERID(num)})
exten => s,n,Set(MCALLED=${MACRO_EXTEN})
exten => s,n,Set(MDIRECTION=${IF($["${ARG1}" = ""]?IN:${ARG1})})
exten => s,n,Verbose(Call from ${MCALLER} to ${MCALLED} direction ${MDIRECTION})
exten => s,n,Set(FOLDER=/mnt/data/${MCALLER})
exten => s,n,Set(CALLFILENAME=OUT_${STRFTIME(${EPOCH},,%C%y-%m-%d_%H-%M-%S)}_CID_${MCALLER}_CAID_${MCALLED}_ID${UNIQUEID}_${MDIRECTION})
exten => s,n,MixMonitor(${FOLDER}/${CALLFILENAME}.wav,b)
;exten => s,n,Dial(SIP/mtt-ariel/${EXTEN},,T)
exten => s,n,Return()
答案1
尝试使用 ulaw 代替 wav 并稍后重新编码,此外,将 caller-id 作为参数传递可能不太可靠,因此我通常将其作为拨号计划扩展传递。尝试以下操作以查看它是否有效(可能需要安装sox
):
exten => 8916XXXXXXX,1,NoOp()
exten => 8916XXXXXXX,n,Verbose("Writing call")
exten => 8916XXXXXXX,n,Gosub(record_out,${EXTEN},1)
exten => 8916XXXXXXX,n,Dial(SIP/sip-trunk/${EXTEN},,T)
exten => 8916XXXXXXX,n,Hangup()
[record_out]
exten => s,1,StopMixMonitor()
exten => s,2,System(sox -q --single-threaded -t ul -r 8000 -c 1 ${CALLFILENAME}.ulaw ${CALLFILENAME}.wav && rm ${CALLFILENAME}.ulaw)
exten => _X.,1,Set(MCALLER=${CALLERID(num)})
exten => _X.,n,Set(MCALLED=${MACRO_EXTEN})
exten => _X.,n,Set(MDIRECTION=${IF($["${EXTEN}" = ""]?IN:${EXTEN})})
exten => _X.,n,Set(AUDIOHOOK_INHERIT(MixMonitor)=yes)
exten => _X.,n,Verbose(Call from ${MCALLER} to ${MCALLED} direction ${MDIRECTION})
exten => _X.,n,Set(FOLDER=/mnt/data/${MCALLER})
exten => _X.,n,Set(CALLFILENAME=OUT_${STRFTIME(${EPOCH},,%C%y-%m-%d_%H-%M-%S)}_CID_${MCALLER}_CAID_${MCALLED}_ID${UNIQUEID}_${MDIRECTION})
exten => _X.,n,MixMonitor(${FOLDER}/${CALLFILENAME}.ulaw,a)
exten => _X.,n,Return()