How to decrypt the filename of the Call Recording

Status
Not open for further replies.

kwangmien

Member
Oct 3, 2018
59
1
8
52
Hi,

The filename of the call recording in Fusion PBX is in encrypted format.

Is there a way to decrypt the filename to show the caller, callee and time of call recording.
The reason is because we need to archive the call recordings.

Thank you.

Regards,
Kwang Mien
 

ad5ou

Active Member
Jun 12, 2018
892
204
43
There is nothing to really decrypt. The default file name is the UUID of the call. The call recording default name can easily be changed to include other information.
 

kwangmien

Member
Oct 3, 2018
59
1
8
52
There is nothing to really decrypt. The default file name is the UUID of the call. The call recording default name can easily be changed to include other information.

Hi,

Can you advise how i can include other information, e.g. caller and called number in the recording file name ?

Thanks.
 

ad5ou

Active Member
Jun 12, 2018
892
204
43
In the "user_record" dial plan, find record_name=${uuid}.${record_ext} and change it to whatever variables you want to include.
 

kwangmien

Member
Oct 3, 2018
59
1
8
52
i changed the record_name to record_name=${destination_number} , but after recording the filename is still the uuid. Is there other settings that i need to change also ?
 

ad5ou

Active Member
Jun 12, 2018
892
204
43
Also, you probably want to include more in the file name or you will end up with a single file for each destination. It also does not have an extension in the file name as shown.
 

kwangmien

Member
Oct 3, 2018
59
1
8
52
sip status > flush cache
i flush the cache but still it shows the uuid in the filename. i also re-created the inbound route, but still it doesn't help. in the logs i can see that the PBX is still putting in the uuid in the filename

Action set(record_name=${uuid}.${record_ext}) INLINE
set(record_name=90566f5c-5553-11e9-98d9-1fc78e217555.wav)
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,070
577
113
Are you really, really sure you do not want to leave it as UUID?

When I first started using fusionpbx I too wanted to change it until I realise it caused other problems.

Let me give you an example from above...

They wanted to use destination number in the filename. If that call goes to an extension and then is transferred, it will have the original extensions name.
 
Easier storagewise for me, I figured it out but the variable in dialplan doesn't seem to be used when creating any new inbound routes etc.

Call recordings, search by anything other than uid is fruitless. Scripts to remove or highlight particular inbound numbers (or even did's) impossible without looking up database first.

I get you with the transfer, but for my purposes is better to have the original CID of the call anyway.

Anything else I should look out for? I'm currently using the filename date/time/Cid/did.$ext
 

mingus

Member
Mar 23, 2018
43
7
8
53
When you set the recording options for an extension in FusionPBX, it employs the user_record dial plan. You can set the filename there using the following string, "${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav", for example. The variable name might be "record_name" or "record_filename". Set them both if you aren't sure. It shouldn't hurt anything. ;)

However, when an end-user presses the "Record" button on their phone, most phones send a "SIP INFO" message to record the call by default. The filename in this scenario is set in a variable called, "record-template". You'll also need to set this variable to "/$${recordings_dir}/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav".

Take a look at https://freeswitch.org/confluence/display/FREESWITCH/mod_dptools:+record_session to learn more about recording sessions.

Additionally, I highly recommend creating a Lua script for post-recording tasks such as resetting the record_name variable with the current date-time information and setting the variable, "record_post_process_exec_app", to this Lua script. You'll need to set this variable early in the dial plan too.

I hope this helps. Happy hacking.
 

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,498
413
83
I then decide to add in tenths of seconds.
It doesn't matter how accurately you store the time, if it is the same time - it IS the same time!

If you have to deal with a corrupt db, the file names of call recordings will be the least of your worries.

Below is a quick and dirty hack that will allow you to fine recording file names at the command line - you will need to put in your db pasword, adapt to suit your needs...
Code:
#!/usr/bin/php
<?php

if ($argc < 4 )
{
    exit( "Usage: find-recording.php <days> <cid> <did>\n   Eg: find-recording.php 2 0123456789 0987654321\n\n" );
}

$look_back_days = $argv[1];
$did = $argv[3];
$cid = $argv[2];

$sql = "select start_stamp, caller_id_number, destination_number, record_path, record_name, xml_cdr_uuid from v_xml_cdr
 where to_timestamp(end_epoch) > current_date -".$look_back_days."
 and to_timestamp(end_epoch) < current_date
 and caller_destination = '".$did."'
 and caller_id_number = '".$cid."'
 and record_name is not NULL";


$dbconn = pg_connect("host=127.0.0.1 port=5432 dbname=fusionpbx user=fusionpbx password=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX");

if (!$dbconn) {
    echo "An error occurred connecting to the database.\n";
    exit(1);
}


$result = pg_query($dbconn, $sql);
if (!$result) {
    echo "An error occurred with the database query.\n";
    exit(1);
}

$rec_count = pg_num_rows($result);
echo $rec_count." recording(s) to list.\n";


        while ($row = pg_fetch_row($result)) {
            $calltime = str_replace(" ", "_", str_replace(":", "-", $row[0]));
            $caller = str_replace("+", "", $row[1]);
            $callee = str_replace("+", "", $row[2]);
            $recording_file = $row[3]."/".$row[4];
            $call_uuid = $row[5];
            echo $call_uuid.", ".$recording_file.", ".$callee.", ".$caller.", ".$calltime."\n";
        }

pg_free_result($result);

pg_close($dbconn);
echo "Listing complete.\n\n";
exit(0);

?>
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,070
577
113
Just out of curiosity, what is the purpose of this change of recording name?

I have clients who want archived recordings but we just offload them to a modified version of fusionpbx that essentially just gives them a GUI with the CDRs.

That way they can search and playback/download as they wish on their own premises and they have a backup of all recordings on site.
 

ad5ou

Active Member
Jun 12, 2018
892
204
43
I don't know the reasoning of the OP but my record_name is changed to record_name=${sip_from_user}-${destination_number}-${uuid}.${record_ext}

As mentioned above, some call scenarios can end up with misleading recording name but since I also include the uuid there are no potential conflicts.
The one particular customer that requested the above name format was coming from a different call recording option and is used to similarly named files in the CRM system. They record all calls, but generally only download certain calls to import into their other system. Most of the "saved" calls are from internal users making outbound calls.
 
Just out of curiosity, what is the purpose of this change of recording name?

I have clients who want archived recordings but we just offload them to a modified version of fusionpbx that essentially just gives them a GUI with the CDRs.

That way they can search and playback/download as they wish on their own premises and they have a backup of all recordings on site.
Partly easier to search, but also easier to archive and search at a later date. Some of our recordings go back well over a decade, sticking to a same or similar filename makes it easier from a historic point of view.

I completely get why the uuid has been used, and adding the info I need makes for a huge filename and a good few wasted bytes over time.

Still hunting for the variable to change so the routes don't need to be edited manually, though I suspect there's more than one.

It's been good to discuss this though, pro's and con's, the method I'm using suits my situation, different method for a different cake.
 
Status
Not open for further replies.