How to delete CDR and recording for certain phone number

Is there a way to delete the CDR and more importantly, the call recording, for a given phone number? Our system records call automatically. I have a business partner and I would like to keep the system from recording calls between us or be able to go in and delete those calls but no others. Is this possible?

I don’t see why not, but that’s a pretty specific request that I don’t think FreePBX will ever support…

A better solution would be to use the in-call recording and turn off the recording after you get connected. As far as the CDR goes, you can go into the database (and flat files) and delete it by hand or through a program.

To find all such files, NNNN can be an extension or a phone number:-

find /var/spool/asterisk/monitor/ -name "*-NNNN-*"

to delete them

find /var/spool/asterisk/monitor/ -name "*-NNNN-*" -delete

To do the same with the cdrs

mysql -u user -ppassword -D asteriskcdrdb -e "SELECT * FROM cdr WHERE (src='NNNN' AND dst='XXXX')  OR (dst='NNNN' AND src='XXXX')"

and

mysql -u user -ppassword -D asteriskcdrdb -e "DELETE FROM cdr WHERE (src='NNNN' AND dst='XXXX')  OR (dst='NNNN' AND src='XXXX') "
2 Likes

Thanks for the reply. I think that command is on the right track, but I think I need a wildcard in there.

I’m using the command find -name “-5155556030-” in the correct directory and it isn’t pulling the file. But if I put in the entire string of a file like the one below it pulls it.

out-5155556030-9008-20150220-140944-1424462984.7952.wav

So, find -name “-5155556030-” doesn’t do anything, but find -name “out-5155556030-9008-20150220-140944-1424462984.7952.wav” will pull that one file above. The problem is, the other numbers in that file change for each file. Would there be a command that would pull any file with 5155556030 in it regardless of the rest of the file name?

Stoopid forum formatting , I corrected it.

Thanks Dicko. The find command worked but the delete command gave me an error.

-bash: ind: command not found

another editing foobar, just add an f like the line before, (you will notice they where quite similar otherwise :wink: )

Oh duh, I should have realized that! Thanks for the help!

I think that should be:
mysql -u user -ppassword -D asteriskcdrdb -e “delete from cdr where src=‘NNNN’ and dst=‘XXXX’”
mysql -u user -ppassword -D asteriskcdrdb -e “delete from cdr where src=‘XXXX’ and dst=‘NNNN’”

Wouldn’t the Call Recordings commercial module make this easier?
$125

Thanks for pointing that out I fixed it (I think :slight_smile: )

Hi brother
Can you remove my telenor pakistan number history from data base?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.