
tgeo
New User
Dec 19, 2012, 11:58 AM
Post #5 of 6
(3598 views)
|
Re: [FishMonger] Need help modifing a script
[In reply to]
|
Can't Post
|
|
here is the recording script from elastix file: extensions_override_elastix.conf
[macro-record-enable] include => macro-record-enable-custom exten => s,1,GotoIf($["${BLINDTRANSFER}" = ""]?check) exten => s,n,ResetCDR(w) exten => s,n,StopMixMonitor() exten => s,n(check),ExecIf($["${ARG1}"=""]?MacroExit()) exten => s,n,GotoIf($["${ARG2}"="Group"]?Group:OUT) exten => s,n(Group),Set(LOOPCNT=${FIELDQTY(ARG1,-)}) exten => s,n,Set(ITER=1) exten => s,n(begin),GotoIf($["${CUT(DB(AMPUSER/${CUT(ARG1,-,${ITER})}/recording),=,3)}" != "Always"]?continue) exten => s,n,Set(TEXTEN=${CUT(ARG1,-,${ITER})}) exten => s,n,Noop(Recording enable for ${TEXTEN}) exten => s,n,Set(CALLFILENAME=PBX-IN-${CALLERID(number)}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${UNIQUEID}) exten => s,n,System(echo -n -e "PBX-IN-${CALLERID(number)}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${UNIQUEID}" | nc -u -w 1 192.168.135.36 30000) exten => s,n,Goto(record) exten => s,n(continue),Set(ITER=$[${ITER}+1]) exten => s,n,GotoIf($[${ITER}<=${LOOPCNT}]?begin) exten => s,n(OUT),GotoIf($["${ARG2}"="IN"]?IN) exten => s,n,ExecIf($["${CUT(DB(AMPUSER/${ARG1}/recording),\\\|,1):4}" != "Always"]?MacroExit()) exten => s,n,Noop(Recording enable for ${ARG1}) exten => s,n,Set(CALLFILENAME=PBX-OUT-${MACRO_EXTEN}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${UNIQUEID}) exten => s,n,System(echo -n -e "PBX-OUT-${MACRO_EXTEN}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${UNIQUEID}" | nc -u -w 1 192.168.135.36 30000) exten => s,n,Goto(record) exten => s,n(IN),ExecIf($["${CUT(DB(AMPUSER/${ARG1}/recording),\\\|,2):3}" != "Always"]?MacroExit()) exten => s,n,Noop(Recording enable for ${ARG1}) exten => s,n,Set(CALLFILENAME=PBX-INTERNAL-${CALLERID(number)}-${ARG1}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${UNIQUEID}) exten => s,n(record),MixMonitor(${MIXMON_DIR}${CALLFILENAME}.${MIXMON_FORMAT},a,${MIXMON_POST}) exten => s,n,Set(CDR(userfield)=audio:${CALLFILENAME}.${MIXMON_FORMAT}) exten => s,n,MacroExit() There isn't anywhere else use of monitor() I don't get any error while running the script buy it doesn't merge files with the same id, i think i need to alter something on the code below in order to check if two files have the same id and if they do run the system command /usr/bin/sox
if(($FileName)=($File=~/(.+)\-out.wav/)) { system("/usr/bin/sox -m $FileName-in.wav $FileName-out.wav $FileName.wav"); unlink "$FileName-in.wav"; unlink "$FileName-out.wav"; } elsif(($FileName)=($File=~/(.+)\-in.wav/)) { system("/usr/bin/sox -m $FileName-in.wav $FileName-out.wav $FileName.wav"); unlink "$FileName-in.wav"; unlink "$FileName-out.wav"; } else { ($FileName) = ($File=~/(.+)\.wav/); } Below you can see some files of my /var/spool/asterisk/monitor directory
PBX-IN-6979551616-20121219-212116-1355944876.18832.wav PBX-INTERNAL-6979551616-206-20121219-212151-1355944876.18832.wav PBX-OUT-92610426000-20121219-212326-1355945006.18851.wav PBX-IN-6975907292-20121219-212416-1355945056.18853.wav PBX-OUT-92610622182-20121219-214602-1355946364.18878.wav PBX-INTERNAL-2610622182-399-20121219-214635-1355946364.18878.wav At the above directory the script should merge file 1 and 2 with the same name as file 1 it should also merge file 5 with file 6 Those 4 files are actualy 2 phonecalls, one incoming witch was tranfered to ext 206 and one outgoing witch was transfered to ext 399 I hope the problem is clear now and someone could help. PS: Forgive my terible English
|