# Blog

## How to export callbacks from ViCiDial

In order to export all callbacks (CBHOLD) from the entire dialer, please log into the MySQL and run the following query:

```sql
SELECT * FROM `vicidial_list` WHERE `status`='CBHOLD' INTO OUTFILE '/var/www/html/vicidial/cbholds.zip' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY 'rn'
```

After that, navigate to http://your-dialer-address/vicidial/cbholds.zip, download and rename the file from .ZIP to [...]

## How to reduce dialer database size by deleting logs

Small, clean database will always perform better than a huge one. In order to see what is the total size of all the databases in the dialer, log in via SSH and run the following command:

```bash
du -kh /var/lib/mysql
```

To check the size of the asterisk database only, you can run:

```bash
du -kh /var/lib/mysql/asterisk
```

## Finding files larger than … in Linux

In order to locate any files larger than a certain size, please run the following command. The below example searches for all files larger than 500MB:

```bash
find / -size +500M
```

To display more details and sort the items in the list by size, run the following:

```bash
find / -type f -size +500M -exec du -h {}
```

## Searching for a string in Asterisk

If you wish to search for a certain string in Asterisk only (Example: only show carrier congestion), launch the Asterisk CLI along with the grep command, i.e.:

```bash
asterisk -rvvvvv | egrep -i "string"
```

Example (showing only congestion notices / errors):

```bash
asterisk -rvvvvv | egrep -i "congested"
```

## Deleting recordings older than X days

To remove recordings older than X days (i.e. 3 days), SSH into your dialer and run the following command:

```bash
find /var/spool/asterisk/monitorDONE/MP3 -type f -mtime +3 -exec rm {} ;
find /var/spool/asterisk/monitorDONE/ORIG -type f -mtime +3 -exec rm {} ;
```

## How to export leads with certain disposition only from ViCiDial / GoAutoDial using PHPMyAdmin

To export only leads with a specific disposition (in this example SALE) from only certain campaigns (in this example 1000, 2000), please log in to PHPMyAdmin and run the following SQL:

```sql
select * from vicidial_list where status="SALE" and list_id in (select list_id from vicidial_lists where campaign_id=1000 or campaign_id=2000);
```

Click on the Export button on the bottom.

## How to export all leads from specific certain cities from the entire database / dialer

Just run the following from your MySQL / MariaDB console:

```sql
SELECT first_name, last_name, address1, city, postal_code, phone_number FROM vicidial_list WHERE list_id in (select list_id from vicidial_lists) and city in ('X','Y','Z') INTO OUTFILE '/tmp/cities.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY 'n';
```

## Installing Fail2Ban on a CentOS server

If you are running a predictive dialer (or any kind of Asterisk server) or a web hosting server, you have probably experienced often hacker/lamer brute force attempts. These attacks can be easily blocked by implementing optimal server configuration, using a good Firewall (i.e. SonicWall, PfSense, Tomato) etc. A very useful method of blocking brute force attacks is installing Fail2Ban.

## Resetting only specific call statuses within a specific campaign

Sometimes, admin would like to change/reset only specific dial statuses within only specific campaign – i.e. Reset all NA, NI, NP and similar statuses while keeping others (like DNC, SALE etc.) intact. To do so, log SSH in and open mysql:

```bash
mysql -u cron -p1234
use asterisk;
```

Afterwards, run the following command (Example –

## Deleting ViCiDial list records with missing information

Some list vendors will often sell low-quality dialer lists with a lot of missing information. As an example, here is a command to delete all records with missing Last Name field within the list ‘123’. You can permutate last with first or any other column:

```sql
DELETE from vicidial_list WHERE list_id='123' AND last_name='';
```
