V
V
Vasya Pupkin2019-07-19 19:32:47
Asterisk
Vasya Pupkin, 2019-07-19 19:32:47

How to correct Extension to write to folders by dates?

There is an extension that records, converts to mp3 and puts everything in one shared folder.
Please help me correct it so that the records fall not into the shared folder, but /2019/07/19/"record name"
.mp3 ), but did not succeed in achieving the desired.

The extension itself

Глобал
DIR_RECORDS=/opt/calls/
[macro-recording]
exten => s,1,Set(fname=${UNIQUEID}-${STRFTIME(${EPOCH},,%Y-%m-%d-%H_%M)}-${ARG1}-${ARG2});
exten => s,n,Set(monopt=nice -n 19 /usr/local/bin/lame -b 32 --silent "${DIR_RECORDS}${fname}.wav" "${DIR_RECORDS}${fname}.mp3" && rm -f "${DIR_RECORDS}${fname}.wav" && chmod o+r "${DIR_RECORDS}${fname}.mp3");
exten => s,n,Set(CDR(filename)=${fname}.mp3);
exten => s,n,Set(CDR(realdst)=${ARG2});
exten => s,n,MixMonitor(${DIR_RECORDS}${fname}.wav,b,${monopt});
exten => s,n(no),Verbose(Exit record);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2019-07-19
@Desert-Eagle

exten => s,1,Set(fname=${STRFTIME(${EPOCH},,%Y/%m/%d)}/${UNIQUEID}-${STRFTIME(${EPOCH},,%Y-%m-%d-%H_%M)}-${ARG1}-${ARG2});

But the folders must be created in advance

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question