MixMonitor and Call UniqueID

Hello! I have next macro for voice recording:

[macro-record]
exten => s,1,NoOp(START RECORD)
exten => s,n,MixMonitor(/mnt/voicerecorder/${UNIQUEID}.wav,b v(3) V(3) W(3), /bin/bash /root/sh/date_mp3 ${UNIQUEID} ‘msk’)

…where bash date_mp3 script converts wav to mp3 and put in right folder (with current date).
When I was analyzing these files, I noticed that there are too many files:

1476168066.640650.mp3
1476181202.650431.mp3
1476187782.245.mp3
1476177989.647791.mp3
1476168083.640656.mp3

Actually there ar hurders of files. 90-95% of them like 1476177989.647791.mp3, and rest of them like 1476187782.245.mp3. Look at count of numbers after dot. 6 and 3.

I read that “${UNIQUEID}” - it is an unique id of CALL. As there is no easy way to get it via AMI (maybe through GetVar command) I looked to CDR files and Events list in AMI. So voice record like 1476187782.245.mp3 equals of channel unique id which initialized an conversation, i.e. Caller. But there is no any poing in file with name like “1476168083.640656”. There is no any channel with number of digits after dot more than 4.

Could you, please, explain how does it works? What is really ${UNIQUEID}? Why I get tons of files with 6 digits after dot?

The UNIQUEID is a channel variable. Each channel within Asterisk receives a unique identifier, and that identifier is stored in the UNIQUEID variable. The UNIQUEID is in the form of 1267568856.11, where 1267568856 is the Unix epoch, and 11 shows that this is the eleventh call on the Asterisk system since it was last restarted.

https://wiki.asterisk.org/wiki/display/AST/Using+the+CONTEXT,+EXTEN,+PRIORITY,+UNIQUEID,+and+CHANNEL+Variables

1 Like

Simple calls have two UNIQUEIDs, one for the originating channel, and one for terminating one. Complex dialplans can have a lot more per call.

1 Like