SOLVED Inserting date in recording extension


im having trouble getting recordings to right folders.

default _1. 1 System /bin/mkdir -p /mnt/outgoing/date +%y-%m-%d
default _1. 2 Set MONITOR_FILENAME=/mnt/outgoing/${UNIQUEID}

in line 2 i need to get it into the newly created folder in line 1

please help!

The second line isn’t referencing the directory you created…

I would try something like this…

default _1. 1 Set xPath=/mnt/outgoing/${STRFTIME(${EPOCH},,%Y%m%d)} 
default _1. 2 System /bin/mkdir -p ${xPath}
default _1. 3 Set MONITOR_FILENAME=${xPath}/${UNIQUEID}

thanks for your reply but it seems to work apart from tha fact that it wont take notice of the ${STRFTIME(${EPOCH},%Y%m%d)} variable.

What verison of Asterisk are you running?

asterisk version

I found this when looking at STRFTIME.

[quote]This will vary from distribution to distribution, as their are different implementations of strftime. If these values do not work correctly on your system, please consult the man page for your implementation of strftime (you can do this by running man 3 strftime from your server’s command line).

perhaps it isn’t implemented on your system. I’m using CentOS 5.4/5.5.

Alternatively, I think you can use ${DATETIME}, while being depreciated in 1.2, I didn’t see where it was removed. I’m on 1.6.2 and don’t have a 1.4 setup to test…

Try this instead…

default _1. 1 Set xPath=/mnt/outgoing/${DATETIME:5:4}${DATETIME:3:2}${DATETIME:1:2} 

did not work either. though i tested inserting ${UNIQUEID} , which worked. so its weird that timestamp or strftime or datetime dont work.

exten => s,n,Set(DIRNAME=${CALLERID(num)}/${STRFTIME(${EPOCH},%Y%m/%d)})
exten => s,n,Set(FILENAME=${DIRNAME}/${STRFTIME(${EPOCH},%H%M%S)}-${EXTEN:2})
exten => s,n,System(/bin/mkdir -p /var/spool/asterisk/monitor/${DIRNAME})
exten => s,n,MixMonitor(${FILENAME}.gsm)

works for me

thanks for your input but it doesnt want to take strftime, datetime, timestamp or anything else than uniqueid which seems to work. im using relatime database also, might be good to know?

/ Marcus

just tried to set date in globals in extension.conf and got

ERROR[26294]: pbx.c:1551 ast_func_read: Function STRFTIME not registered
[Aug 16 14:04:56] == Setting global variable ‘TIMESTAMP’ to ‘’

how to i get it registered?

found the culprit, i compiled func_strings and also made it load on start which was the problem. thank you for the help!!