Renaming Recording File name?


#1

Hi all,
I really appreciate it if someone help me to rename recording filename in FreePBX. I posted this topic for weeks. There was one person saying something but I could not do it.
The thing is, by default FreePBX names a recording file name like this:
Date_Time_UniqueID_someNumber.wav (UniqueID doesnot contain the extension
number, or channel name)
Now, I would like to change it like:
Date_Time_ExtensionNumber.wav

Thank you so much for helping me,


How to change mixmonitor recording filenames properly?
#2

I got it. Thank you!!!
It’s so simple if you found it out. It’s just a line of coding…


#3

It is possible to let me know how this was done please?


#4

copy [macro-record-enable] from extensions_additional.conf to extensions_override_freepbx.conf and then add -${REALCALLERIDNUM}-${ARG1} to end of set filename, there are three places, then reload config. I cannot however set an outside number being dialed in the filename


#5

Samo was almost there, so here’s how to do the whole thing. You just have to pass your variables to the PHP AGI script from your dialplan.

Like above, paste the following to /etc/asterisk/extensions_override_freepbx.conf:

------------ CUT -------------
[macro-record-enable]
include => macro-record-enable-custom
exten => s,1,GotoIf($["${BLINDTRANSFER}" = “”]?check)
exten => s,n,ResetCDR(w)
exten => s,n,StopMonitor()
exten => s,n(check),AGI(recordingcheck,${STRFTIME(${EPOCH},%Y%%d%H%M%S)},${UNIQUEID},${REALCALLERIDNUM},${CALLERID(dnid)})
exten => s,n,MacroExit()
exten => s,1+998(record),MixMonitor(${MIXMON_DIR}${CALLFILENAME}.${MIXMON_FORMAT},${MIXMON_POST})

; end of [macro-record-enable]

------------ CUT -------------

Now, edit /var/lib/asterisk/agi-bin/recordingcheck and add these two lines just below the line $agi = new AGI();:

$icid = $argv[3];
$dial = $argv[4];

Now you can use {$icid} and {$dial} for your incoming and outgoing numbers. Just insert those variables into the filename strings lower down in the recordingcheck file.

For reference:

$icid = Incoming Caller ID
$dial = Outbound Number Dialed

There you have it!

Gary Allen
Solution Stars, LLC


Also do not forget to chmod the recordingcheck file to read only or it will get overwritten. Changing permissions on this file will not cause any other issues that I have found.

Inbound Usage Example:

$agi->verbose(“Recording enabled for”.$exten);
$agi->verbose(“CALLFILENAME=IN{$exten}-{$timestamp}-{$icid}”); $agi->set_variable(“CALLFILENAME”,“IN{$exten}-{$timestamp}-{$icid}”);
$agi->set_priority(‘record’);
exit(0);

Outbound Usage Example:

$agi->verbose(“Outbound recording enabled.”); $agi->verbose(“CALLFILENAME=OUT{$exten[‘data’]}-{$timestamp}-{$dial}”); $agi->set_variable(“CALLFILENAME”,“OUT{$exten[‘data’]}-{$timestamp}-{$dial}”);
$agi->set_priority(‘record’);
exit(0);


#6

I haven’t looked at this in a long time now. My above fix was based on an old TB distro, and Asterisk 1.6. What we do today is cron a script I made that parses the CDR database and renames the files. It’s much more elegant, cross-platform and requires no modification to any system files. I recommend doing it this way.


#7

Hello Please help me to solve this problem where to change the line for renameing the voice mail file like this Date_Time_ExtensionNumber.wav

Default format is msg000


#8

i am using freepbx2.10


#9

Hi,

There is no file recordingcheck in the path specified above.
I am using freepbx 2.9
I tried to create a new and paste above given lines in it but no success :frowning:

Any help please.
I am new to freepbx/asterisk!!

regards


#10

please help me to slove same problem in freepbx 2.10


#11

Thanks for the explanation, everything works fine. I have a last thing to do for having my files as I wish. the Situation is that all entering calls come in one ext and that person than transfer the call to the right ext. In this case I receive 2 files recorded

  1. outsideCid - entryExt
  2. entryExt - anotherExt

how can I modify the IN case in entry check in order to save the second file name with outsideCid - anotherExt ?!
meaning to put the orginal cid when that call is transferred and not the transferrer cid

I am ready to pay for a solution.


(Chris) #12

I too need a solution to this.
Can you advise what file this code should be in.
I have spent days trying to figure out how to include the CLI of the caller/number being called and getting nowhere.

$agi->verbose("Outbound recording enabled."); $agi->verbose("CALLFILENAME=OUT{$exten['data']}-{$timestamp}-{$dial}"); $agi->set_variable("CALLFILENAME","OUT{$exten['data']}-{$timestamp}-{$dial}"); $agi->set_priority('record'); exit(0);

(Chris) #13

I solved it for my own needs by modifying

/etc/asterisk/extensions_additional.conf

** Note you are not meant to edit this file so be very careful if you choose to do so. **

For outbound calls I appended this variable
-${CALLERID(dnid)
For inbound I appended this variable
-${CALLERID(num)

Complete mod is as follows:

exten => s,n,Set(CALLFILENAME=g${TEXTEN}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${UNIQUEID}-${CALLERID(dnid)}) exten => s,n,Set(CALLFILENAME=${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${UNIQUEID}-${CALLERID(num)})

This puts the CLI at the end of the file name so can easily be searched for by ls number
now my contents of var/spool/asterisk/monitor look like this (asterisks added for privacy here - no pun!)

-rw–w---- 1 asterisk asterisk 911295 Jan 18 18:57 OUT10107-20130118-184752-1358534872.1-086888.gsm
-rw------- 1 asterisk asterisk 34254 Jan 18 18:59 20130118-185911-1358535551.2-086
395.gsm
-rw------- 1 asterisk asterisk 2937 Jan 18 19:02 OUT10107-20130118-190215-1358535735.18-028***84.gsm
-rw------- 1 asterisk asterisk 323584 Jan 18 19:03 OUT10002-20130118-185947-1358535587.16-****40059.gsm

Might be crude but solves the issue for me.

Restart asterisk and all set.

I’m really tired so sorry if this is a bit muddled but hopefully will help someone else.


(Chris) #14

I forgot this file gets overwritten by the system! So I’m back to square one. I’ll post an update when I figure out which files to update.


#15

I am running freePBX 2.9 with Elastix 2.4 on CentOS 5.9 and since a recent upgrade from Elastix 2.3 can’t get my calls to save with DID or CID in the .gsm filename. eg.

DATE_TIME_ID_CALL NUMBER.gsm

I have tried various combinations of what has been written on this post but because of version changes and the age of the post I am struggling to piece together a solution that works for the above mentioned environment.

Throw me a bone fellows…


#16

The bone is Elastix is a fork of FreePBX, I suggest you ask in their forums. We don’t know anything about what they do.


(system) closed #17