Seeking advice on CDR reports management solution

Hi,

I would like your opinion on the best way to manage user access to call recordings.

I would like to be able to grant access of specific users call recordings to their managers, without the manager being able to see call recordings of every staff member; only their subordinates.

Does anyone know of a solution (commericial, or otherwise) that would allow this? I’ve examined the marketing materials for the commercial “Call Recording Report” module, however there’s not much there. It seems to have even less features than the “CDR Reports” that comes included with the system.

Thanks for your time.

anyone? …

The call recording reports module is not intended to replace the CDR reports module, it filters out call recordings, and gives you one place to archive, and review recordings.

I’m not aware of any other module that will give you the functionality you are looking for… You could open a feature request at issues.freepbx.org , or I can work with the development team on custom development if you open a sales ticket at support.schmoozecom.com

Also it’s likely that this wouldn’t be an easy module to build (I could be wrong) the issue becomes, with call transfers, queues, other misc. dial plan, determining who owns a call. What happens when two employees from different groups call each other, which manager gets to listen to the call. I know the roadmap is to give more granular control of features in the future, (example user manger module) but this one could be tough to lay out.

Thanks for your reply. I appreciate your time in responding. The answer is: both managers get to listen to the call.

I will be implementing the following solution:
For each user extension which needs monitoring, populate the accountcode field with a unique identifier.
For each manager, create an administrator account on FreePBX and limit their access to only 'CDR Reports’
Write some custom code in /var/www/html/admin/modules/cdr/page.cdr.php to limit the SQL results of searches to only the accountcode that each manager has access to.

Now, all I need to know how to do is get the username in PHP of the administrator who is logged into the administration module.

Do you think there’s any problems with this solution?

If you are using queues you are going to have a bad time with this solution.

Thank you for your input. I truly appreciate your time in writing. I am a novice with the FreePBX system. Obviously I would prefer a commercial solution, however, as you have already indicated, this is not available. I am less interested in support/sales tickets and more interested in implementing a functional solution immediately.

Are you able to elaborate on why queues will cause me a ‘bad time’?

Do you know how to get the username of the logged in account in PHP?

Mmm, I apologize. This method does not working… But i think that is a good idea to the Feature Request.

You must use a FreePBX “Administrators” module. Create account with only access to “CDR Reports” and set “Extension Range” value. CDR Reports must report only this extensions (with the ability play records).

I don’t program in PHP so it took me a few minutes to figure out that in the file ‘page.modules.php’ you can access the username of the admin logged in by reading this variable:

$_SESSION[‘AMP_user’]->username

Here’s the custom code added to the file /var/www/html/admin/modules/cdr/page.cdr.php.

As I’m not a PHP programmer, nor do I know anything at all about how FreePBX works, this is clearly a brutish hack, unsuitable for deployment in any environment including test environments.

  • Please note that the first subordinate entry for each manager requires the initial ‘AND’ operator and subsequent subordinates requires the ‘OR’ operator.

  • Pay attention to updates, especially updates to the CDR module as your changes may be overwritten.

  • I have not tested this with a queue as I’m expecting my ‘bad time’ to start any minute now. I’ll keep you posted.

After line 640, before this line:
// Build the "WHERE" part of the query

add the following code:

/* CUSTOM CODE ADDED TO ENABLE MANAGER ACCESS TO SUBORDINATES CALL RECORDINGS */
$username=$_SESSION['AMP_user']->username;

if ($username == 'MANAGER1') {
	$accountcode .= ' AND (';
	$accountcode .= '(accountcode LIKE \'SUBORDINATE1%\' OR (accountcode = \'\' AND (dst = \'SUBORDINATE1_EXTENSION\' OR dstchannel = \'SUBORDINATE1_EXTENSION\')))';
	$accountcode .= ' OR ';
	$accountcode .= '(accountcode LIKE \'SUBORDINATE2%\' OR (accountcode = \'\' AND (dst = \'SUBORDINATE2_EXTENSION\' OR dstchannel = \'SUBORDINATE2_EXTENSION\')))';
	$accountcode .= ')';
}

if ($username == 'MANAGER2') {
	$accountcode .= ' AND (';
	$accountcode .= '(accountcode LIKE \'SUBORDINATE3%\' OR (accountcode = \'\' AND (dst = \'SUBORDINATE3_EXTENSION\' OR dstchannel = \'SUBORDINATE3_EXTENSION\')))';
	$accountcode .= ' OR ';
	$accountcode .= '(accountcode LIKE \'SUBORDINATE4%\' OR (accountcode = \'\' AND (dst = \'SUBORDINATE4_EXTENSION\' OR dstchannel = \'SUBORDINATE4_EXTENSION\')))';
	$accountcode .= ')';
}

if ($username == 'MANAGER3') {
	$accountcode .= ' AND (';
	$accountcode .= '(accountcode LIKE \'SUBORDINATE2%\' OR (accountcode = \'\' AND (dst = \'SUBORDINATE2_EXTENSION\' OR dstchannel = \'SUBORDINATE2_EXTENSION\')))';
	$accountcode .= ' OR ';
	$accountcode .= '(accountcode LIKE \'SUBORDINATE3%\' OR (accountcode = \'\' AND (dst = \'SUBORDINATE3_EXTENSION\' OR dstchannel = \'SUBORDINATE3_EXTENSION\')))';
	$accountcode .= ' OR ';
	$accountcode .= '(accountcode LIKE \'SUBORDINATE4%\' OR (accountcode = \'\' AND (dst = \'SUBORDINATE4_EXTENSION\' OR dstchannel = \'SUBORDINATE4_EXTENSION\')))';
	$accountcode .= ')';
}

// ETC...



/* END CUSTOM CODE */

I appreciate any feedback or comments on improvement regarding this solution.

Thank you.

Open source software thrives through contributions of time, code, documentation etc. If you have tested this and it is functional please feel free to submit it in to the project. This will ensure a subsewuent update doesn’t nuke your changes and that they will be functional through changes in code.

Here is what you need:
FreePBX Developers Corner

Code Submission Agreement

After submitting a CSA fork the repo on github. Make the edits, Submit a pull request.
If the devs have any feedback of a more “FreePBX way” of doing anything they will let you know.

Ok so outside of the boiler plate response for contributing…

It is probably better to do a case rather than a if stack…

switch($foo){
    case "bar":
        bar code;
   break;
   case "baz":
       baz code;
   break;
}

Hard coding names may work for you but it is not a broad solution. You need to be able to manage users and their subordinates. Maybe hook in to userman…
This is where this almost needs to be a separate module. That way you can say
Mcrabs is a manager:
MCrabs has permissions over:

  • sbob
  • sworth
  • pstar

Would be great if this could be implemented so you can filter on account code and/or extension numbers. I too now have to manually modify this in the code to prevent them from seeing call recordings of other departments.

It also would be nice if being able to see the call recording links can be limited trought the permissions system.