how to use to check duplicate data for astercc database

By May 21, 2011asterCRM

There is a perl script named in astercc scripts directory, you can use it to check duuplicate or truncate for your astercc database.

First, need to configure astercc.conf about tow segment [check_duplicate] and [truncate_table], let’s go to astercc scripts dirctory(/opt/asterisk/scripts/astercc/), and edit astercc.conf

[check_duplicate] for configure paramer of checking duplicate data:

Format:  table = field1:field2:[field1,field2]|orderfield(default:id),order(default ASC)|condition_table:condition_display:foreign_key

for example: we want to check duplicate phonenumber in customer table  and order by created time asc, just add following line :

customer = phone:mobile:phone,mobile|cretime,asc

we define three table in default astercc.conf, customer, customer_lead and diallist. just like following:

[check_duplicate] ;Format=> table = field1:field2:[field1,field2]|orderfield(default:id),order(default ASC)|condition_table:condition_display:foreign_key
customer = phone:mobile:phone,mobile|cretime,asc
customer_leads = phone:mobile:phone,mobile
diallist = dialnumber|cretime,asc|campaign:campaignname:campaignid

and the configuration for truncate table is samlply, just add table name = 1 in  [truncate_table] segment:

[truncate_table] mycdr = 1
customer= 1
customer_leads= 1
note= 1
note_lead= 0
diallist= 1
dialedlist= 0

Now,  let’s execute  and follow the prompts to check dumpliate or truncate table step by step.


first step, you should select what you want to do , check duplicate or truncate, I selected check duplicate , just type “C” and press enter.

and then need to select which table you want to check,  just type the number of  table, I selected 1 for customer table;

next select which fields in table you want to check duplicate, I select ‘3’ for check phone and mobile .

now you should select a option from check duplicate :

the last step, it’ll list all of you selected and you need confirm to run:

press ‘Y’ to start checking

It’ll delete the duplicate and record data to a csv file.


Leave a Reply