How to move recording files only when call is finished

Encironment
Asterisk: 13.29.2
FreePBX: 13.0.197.31

Requirement
I would like to copy a recording call file only after call is finished

Actual Scenario
Right now, I have my Inbound Route set as Force to record all calls, and all files are being created on “var/spools/asterisk/monitor/year/month/day”, but the file is increasing as long as the call is during.

Looking at the conf, I could see the MixMonitor is liek this:

[ext-did-0002]
include => ext-did-0002-custom
.....

exten => 4810,1,Set(__DIRECTION=INBOUND)
exten => 4810,n,Gosub(sub-record-check,s,1(in,${EXTEN},force))
[sub-record-check]
......
exten => recordcheck,n,MixMonitor(${MIXMON_DIR}${YEAR}/${MONTH}/${DAY}/${CALLFILENAME}.${MON_FMT},abi(LOCAL_MIXMON_ID)${MIXMON_BEEP},${MIXMON_POST})

But I need to copy this file to a backup dir into another server.

Question
How the proper way to safely move this file to another dir only after the call is finished?

I was thinking that I could create a sub-record-cancel-custom and try to move it to another folder. Is thar a good way?

[sub-record-cancel]
include => sub-record-cancel-custom
exten => s,1,Return()

Thanks,

Assuming Asterisk 13 is the same as currently supported versions, in this respect, use the command parameter of MixMonitor.

Could you please give some sample?

The Asterisk CLI has it’s uses:

pbx11*CLI> core show application MixMonitor 
blah, blah, blah
MixMonitor(filename.extension[,options[,command]])
blah, blah, blah
command
    Will be executed when the recording is over.

Sir, I’m already aware of this documentation, but whith my little experience I need to say that I don’t know how to write the command in this line to move the file to another folder. If you know I would be very happy if yu could teach me and show me the proper way to do that.

[sub-record-check]
......
exten => recordcheck,n,MixMonitor(${MIXMON_DIR}${YEAR}/${MONTH}/${DAY}/${CALLFILENAME}.${MON_FMT},abi(LOCAL_MIXMON_ID)${MIXMON_BEEP},${MIXMON_POST})

The command is only run when the recording is finished.

Could you please give me some example or show me a documentation with samples of that?

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.