extensions.ael
Код: Выделить всё
globals {
WAV=/var/www/bitrix_portal/callme/records/wav; //Временный каталог с WAV
MP3=/var/www/bitrix_portal/callme/records/mp3; //Куда выгружать mp3 файлы
URLRECORDS=https://callme.example.com/records/mp3;
RECORDING=1; // Запись, 1 - включена.
};
macro recording(calling,called) {
if ("${RECORDING}" = "1"){
Set(fname=${UNIQUEID}_${STRFTIME(${EPOCH},,%d.%m.%Y_%H-%M)}-from.${calling}-to.${called});
Set(datedir=${STRFTIME(${EPOCH},,%Y/%m/%d)});
System(mkdir -p ${MP3}/${datedir});
System(mkdir -p ${WAV}/${datedir});
Set(monopt=nice -n 19 /usr/bin/lame -b 32 --silent "${WAV}/${datedir}/${fname}.wav" "${MP3}/${datedir}/${fname}.mp3" && rm -f "${WAV}/${datedir}/${fname}.wav" && chmod o+rwx "${MP3}/${datedir}/${fname}.mp3");
Set(FullFname=${URLRECORDS}/${datedir}/${fname}.mp3);
Set(CDR(filename)=${fname}.mp3);
Set(CDR(recordingfile)=${fname}.wav);
Set(CDR(realdst)=${called});
MixMonitor(${WAV}/${datedir}/${fname}.wav,b,${monopt});
if ("${CDR(billsec)}" = "0"){
StopMixMonitor();
System(rm -f "${MP3}/${datedir}/${fname}.mp3");
};
};
};
context incoming {
222222 => {
&recording(${CALLERID(number)},${EXTEN});
Dial(SIP/999,10,t);
Set(CallMeDISPOSITION=${CDR(disposition)});
Set(CallMeDURATION=${CDR(billsec)});
Hangup();
}
h => {
Set(CDR_PROP(disable)=true);
Set(CallMeDURATION=${CDR(billsec)});
ExecIF(${ISNULL(${CallMeDISPOSITION})}?Set(CallMeDISPOSITION=${CDR(disposition)}):NoOP(=== CallMeDISPOSITION already was set ===));
ExecIF($[ ${CallMeDURATION} = 0 ]?StopMixMonitor():Log(NOTICE,Duration > 0));
System(rm -f "${MP3}/${datedir}/${fname}.mp3");
if ("${CallMeDURATION}" = "0"){
StopMixMonitor(${MIXMONITORIDVARIABLE});
System(rm -f "${MP3}/${datedir}/${fname}.mp3");
};
System(curl -s https://callme.examle.com/CallMeOut.php --data action=sendcall2b24 --data call_id=${CallMeCALL_ID} --data-urlencode FullFname=${FullFname} --data CallIntNum=${CallIntNum} --data CallDuration=${CallMeDURATION} --data-urlencode CallDisposition=${CallMeDISPOSITION});
}
};
Код: Выделить всё
== Using SIP RTP CoS mark 5
-- Executing [222222@incoming:1] Gosub("SIP/trunk-zadarma-000001bf", "recording,~~s~~,1(79602222222,222222)") in new stack
-- Executing [~~s~~@recording:1] MSet("SIP/trunk-zadarma-000001bf", "LOCAL(calling)=79602222222") in new stack
-- Executing [~~s~~@recording:2] MSet("SIP/trunk-zadarma-000001bf", "LOCAL(called)=222222") in new stack
-- Executing [~~s~~@recording:3] GotoIf("SIP/trunk-zadarma-000001bf", "1?4:18") in new stack
-- Goto (recording,~~s~~,4)
-- Executing [~~s~~@recording:4] Set("SIP/trunk-zadarma-000001bf", "fname=1562746898.669_10.07.2019_11-21-from.79602222222-to.222222") in new stack
-- Executing [~~s~~@recording:5] Set("SIP/trunk-zadarma-000001bf", "datedir=2019/07/10") in new stack
-- Executing [~~s~~@recording:6] System("SIP/trunk-zadarma-000001bf", "mkdir -p /var/www/bitrix_portal/callme/records/mp3/2019/07/10") in new stack
-- Executing [~~s~~@recording:7] System("SIP/trunk-zadarma-000001bf", "mkdir -p /var/www/bitrix_portal/callme/records/wav/2019/07/10") in new stack
-- Executing [~~s~~@recording:8] Set("SIP/trunk-zadarma-000001bf", "monopt=nice -n 19 /usr/bin/lame -b 32 --silent "/var/www/bitrix_portal/callme/records/wav/2019/07/10/1562746898.669_10.07.2019_11-21-from.79602222222-to.222222.wav" "/var/www/bitrix_portal/callme/records/mp3/2019/07/10/1562746898.669_10.07.2019_11-21-from.79602222222-to.222222.mp3" && rm -f "/var/www/bitrix_portal/callme/records/wav/2019/07/10/1562746898.669_10.07.2019_11-21-from.79602222222-to.222222.wav" && chmod o+rwx "/var/www/bitrix_portal/callme/records/mp3/2019/07/10/1562746898.669_10.07.2019_11-21-from.79602222222-to.222222.mp3"") in new stack
-- Executing [~~s~~@recording:9] Set("SIP/trunk-zadarma-000001bf", "FullFname=https://callme.example.com/records/mp3/2019/07/10/1562746898.669_10.07.2019_11-21-from.79602222222-to.222222.mp3") in new stack
-- Executing [~~s~~@recording:10] Set("SIP/trunk-zadarma-000001bf", "CDR(filename)=1562746898.669_10.07.2019_11-21-from.79602222222-to.222222.mp3") in new stack
-- Executing [~~s~~@recording:11] Set("SIP/trunk-zadarma-000001bf", "CDR(recordingfile)=1562746898.669_10.07.2019_11-21-from.79602222222-to.222222.wav") in new stack
-- Executing [~~s~~@recording:12] Set("SIP/trunk-zadarma-000001bf", "CDR(realdst)=222222") in new stack
-- Executing [~~s~~@recording:13] MixMonitor("SIP/trunk-zadarma-000001bf", "/var/www/bitrix_portal/callme/records/wav/2019/07/10/1562746898.669_10.07.2019_11-21-from.79602222222-to.222222.wav,b,nice -n 19 /usr/bin/lame -b 32 --silent "/var/www/bitrix_portal/callme/records/wav/2019/07/10/1562746898.669_10.07.2019_11-21-from.79602222222-to.222222.wav" "/var/www/bitrix_portal/callme/records/mp3/2019/07/10/1562746898.669_10.07.2019_11-21-from.79602222222-to.222222.mp3" && rm -f "/var/www/bitrix_portal/callme/records/wav/2019/07/10/1562746898.669_10.07.2019_11-21-from.79602222222-to.222222.wav" && chmod o+rwx "/var/www/bitrix_portal/callme/records/mp3/2019/07/10/1562746898.669_10.07.2019_11-21-from.79602222222-to.222222.mp3"") in new stack
== Begin MixMonitor Recording SIP/trunk-zadarma-000001bf
-- Executing [~~s~~@recording:14] GotoIf("SIP/trunk-zadarma-000001bf", "1?15:17") in new stack
-- Goto (recording,~~s~~,15)
-- Executing [~~s~~@recording:15] StopMixMonitor("SIP/trunk-zadarma-000001bf", "") in new stack
== MixMonitor close filestream (mixed)
-- Executing [~~s~~@recording:16] System("SIP/trunk-zadarma-000001bf", "rm -f "/var/www/bitrix_portal/callme/records/mp3/2019/07/10/1562746898.669_10.07.2019_11-21-from.79602222222-to.222222.mp3"") in new stack
-- Executing [~~s~~@recording:17] NoOp("SIP/trunk-zadarma-000001bf", "Finish if_if_recording_284_285") in new stack
-- Executing [~~s~~@recording:18] NoOp("SIP/trunk-zadarma-000001bf", "Finish if_recording_284") in new stack
-- Executing [~~s~~@recording:19] Return("SIP/trunk-zadarma-000001bf", "") in new stack
-- Executing [222222@incoming:2] ExecIf("SIP/trunk-zadarma-000001bf", "?Set(CALLERID(name)=):NoOp()") in new stack
-- Executing [222222@incoming:3] Dial("SIP/trunk-zadarma-000001bf", "SIP/999,10,t") in new stack
== Using SIP RTP CoS mark 5
-- Called SIP/999
== Manager 'callme' logged on from 127.0.0.1
== Manager 'callme' logged off from 127.0.0.1
-- SIP/999-000001c0 is ringing
-- Nobody picked up in 10000 ms
-- Executing [222222@incoming:4] Set("SIP/trunk-zadarma-000001bf", "CallMeDISPOSITION=NO ANSWER") in new stack
-- Executing [222222@incoming:5] Set("SIP/trunk-zadarma-000001bf", "CallMeDURATION=0") in new stack
-- Executing [222222@incoming:6] Hangup("SIP/trunk-zadarma-000001bf", "") in new stack
== Spawn extension (incoming, 222222, 6) exited non-zero on 'SIP/trunk-zadarma-000001bf'
-- Executing [h@incoming:1] Set("SIP/trunk-zadarma-000001bf", "CDR_PROP(disable)=true") in new stack
-- Executing [h@incoming:2] Set("SIP/trunk-zadarma-000001bf", "CallMeDURATION=0") in new stack
-- Executing [h@incoming:3] ExecIf("SIP/trunk-zadarma-000001bf", "0?Set(CallMeDISPOSITION=NO ANSWER):NoOP(=== CallMeDISPOSITION already was set ===)") in new stack
-- Executing [h@incoming:4] ExecIf("SIP/trunk-zadarma-000001bf", "1?StopMixMonitor():Log(NOTICE,Duration > 0)") in new stack
-- Executing [h@incoming:5] System("SIP/trunk-zadarma-000001bf", "rm -f "/var/www/bitrix_portal/callme/records/mp3/2019/07/10/1562746898.669_10.07.2019_11-21-from.79602222222-to.222222.mp3"") in new stack
-- Executing [h@incoming:6] GotoIf("SIP/trunk-zadarma-000001bf", "1?7:9") in new stack
-- Goto (incoming,h,7)
-- Executing [h@incoming:7] StopMixMonitor("SIP/trunk-zadarma-000001bf", "") in new stack
-- Executing [h@incoming:8] System("SIP/trunk-zadarma-000001bf", "rm -f "/var/www/bitrix_portal/callme/records/mp3/2019/07/10/1562746898.669_10.07.2019_11-21-from.79602222222-to.222222.mp3"") in new stack
-- Executing [h@incoming:9] NoOp("SIP/trunk-zadarma-000001bf", "Finish if_incoming_286") in new stack
-- Executing [h@incoming:10] System("SIP/trunk-zadarma-000001bf", "curl -s https://callme.example.com/CallMeOut.php --data action=sendcall2b24 --data call_id= --data-urlencode FullFname=https://callme.example.com/records/mp3/2019/07/10/1562746898.669_10.07.2019_11-21-from.79602222222-to.222222.mp3 --data CallIntNum= --data CallDuration=0 --data-urlencode CallDisposition=NO ANSWER") in new stack
== Executing [nice -n 19 /usr/bin/lame -b 32 --silent "/var/www/bitrix_portal/callme/records/wav/2019/07/10/1562746898.669_10.07.2019_11-21-from.79602222222-to.222222.wav" "/var/www/bitrix_portal/callme/records/mp3/2019/07/10/1562746898.669_10.07.2019_11-21-from.79602222222-to.222222.mp3" && rm -f "/var/www/bitrix_portal/callme/records/wav/2019/07/10/1562746898.669_10.07.2019_11-21-from.79602222222-to.222222.wav" && chmod o+rwx "/var/www/bitrix_portal/callme/records/mp3/2019/07/10/1562746898.669_10.07.2019_11-21-from.79602222222-to.222222.mp3"]
== End MixMonitor Recording SIP/trunk-zadarma-000001bf
Код: Выделить всё
-rw-r--rwx 1 asterisk asterisk 864 Jul 10 11:21 1562746898.669_10.07.2019_11-21-from.79602222222-to.222222.mp3