# Caller ID in VICIdial: CID groups and the AREACODE fallback

> How the VICIdial dialer picks the number a customer sees, in order, why CID groups work without use_custom_cid, and how to check which number went out.

URL: https://trustane.com/blog/vicidial-caller-id-cid-groups
By Trustane. Published 2026-11-05.

> **To the point**
> A CID group works whether or not `use_custom_cid` is set. The dialer checks a campaign's `cid_group_id` on every call unless it is exactly `---DISABLED---`. The AREACODE setting only adds an older list, used last.
>
> - Six rules in order, first number wins: list group, list override, campaign group, second group, area-code numbers, `campaign_cid`.
> - A group beats the area-code list. A list-level override beats a campaign-level group.
> - Anything other than `---DISABLED---` is read as a group name, and a missing group falls through silently.
> - `vicidial_dial_cid_log` records which rule won for every call.

We read `AST_VDauto_dial.pl` on a ViciBox 12 server and followed the lookup line by line.

## The order, from the code

![Diagram: the six rules the dialer tries in order to choose the caller ID number](https://trustane.com/media/807c1a0cf7f58cf8-1600x1223.webp "The first rule that produces a number wins")

The section runs from about line 2100 to 2330 in the version we read, with the group lookup near 2185 and the AREACODE branch near 2309. Line numbers move between releases, so use them to find the place, not as a promise. A value of `Y` in `use_custom_cid` uses the lead's own number field instead.

A group picks the number used least so far today, which spreads volume evenly. Nothing in the lookup judges how a number performs. Watching that is your job.

## The off value, and the trap in it

> **Only ---DISABLED--- means off**
> An empty string or `-NONE-` is not off. The dialer takes any other string as a group name, finds nothing and moves to the next rule without complaint. The field looks configured, but the numbers come from further down. If you set groups from a script or the API, send the exact value.

## Set it up, step by step

The caller ID fields below are from our test server, campaign `SUNQ4`.

### In VICIdial's admin

![VICIdial campaign page with Campaign CallerID, Custom CallerID, CID Group and CID Group Failover marked](https://trustane.com/media/41d8fbaeee5b1b23-1600x357.webp "The four caller ID fields on the campaign page")

1. **Campaign CallerID** (`campaign_cid`): a number you own and your carrier will present. The manual's recipes set a real number.
2. **Custom CallerID** (`use_custom_cid`): leave at `N` unless you use the legacy area-code list.
3. **CID Group** (`cid_group_id`): a group that has numbers in it. An empty group falls through.
4. **CID Group Failover** (`cid_group_id_two`): used when the first group found nothing.

### In the Trustane console

![Trustane console Set Up tab with Caller ID group, Default caller ID and Custom caller ID marked](https://trustane.com/media/9b0a3971915e4767-1600x442.webp "Campaigns, the campaign, then Set Up")

1. **Caller ID group**: the same as CID Group.
2. **Default caller ID**: the same as Campaign CallerID.
3. **Custom caller ID**: the legacy switch; leave it Off.

The manual does not check that your carrier will present each number. A number it does not recognize is replaced or fails the call, depending on the carrier ([which carrier carried a call](https://trustane.com/blog/vicidial-which-carrier-carried-call)).

## Seeing which number actually went out

Each outbound call writes a row to `vicidial_dial_cid_log`, with `caller_code`, `call_date`, `outbound_cid` and `outbound_cid_type`. The type says which rule won: `CAMPAIGN_CID`, `CID_GROUP`, `CID_GROUP_TWO`, `AREACODE`, `CUSTOM_CID`, `LIST_CID`, `LIST_CID_GROUP`, `AGENT` and others.

```sql
SELECT outbound_cid_type, COUNT(*) AS calls
FROM vicidial_dial_cid_log
WHERE call_date >= CURDATE()
GROUP BY outbound_cid_type;
```

If you expect `CID_GROUP` and see `CAMPAIGN_CID`, the group is disabled, empty or overridden at list level.

### Answer rate per number

Join to `vicidial_carrier_log`, which holds the carrier's verdict in `dialstatus` (`ANSWER`, `BUSY`, `NOANSWER`, `CANCEL`, `CHANUNAVAIL`, `CONGESTION`). The obvious join is a trap. The carrier table is indexed on `uniqueid`, `call_date` and `lead_id`, not `caller_code`, so joining the CID log to it on `caller_code` scans the carrier table once per call. On about 1.1 million rows each it ran 232 seconds and kept running on the server after we disconnected.

Drive it from the carrier table by date and force the order:

```sql
SET STATEMENT max_statement_time=25 FOR
SELECT d.outbound_cid, c.dialstatus, COUNT(*) AS calls
FROM vicidial_carrier_log c FORCE INDEX(call_date)
STRAIGHT_JOIN vicidial_dial_cid_log d ON d.caller_code = c.caller_code
WHERE c.call_date >= NOW() - INTERVAL 7 DAY
GROUP BY d.outbound_cid, c.dialstatus;
```

That took about 0.6 seconds for 65,000 calls. `max_statement_time` is MariaDB syntax; MySQL uses the `MAX_EXECUTION_TIME` hint. Keep a time limit on anything you run against a live dialer. The table is only filled when `sip_event_logging` is on.

## A check before go-live

Place a handful of test calls to phones you control. Compare the five latest `vicidial_dial_cid_log` rows for the campaign with what each handset showed. If they agree, the dialer side is fine and any later complaint is between the carrier and the receiving network. If they disagree, the carrier changed the number on the way out.

## What we did not test

Whether spreading calls over more numbers changes answer rates, and how any carrier or handset treats a number. This post covers the dialer's selection logic, which is deterministic and readable.

## Questions people ask

### Do I need use_custom_cid set to AREACODE for groups to work?

No. Groups are consulted on every call unless `cid_group_id` is `---DISABLED---`.

### Which wins, a campaign group or a list override?

The list-level override.

## Next steps

Run the first query on a busy campaign and compare the types with what you intended. Check for placeholder `campaign_cid` values and empty groups. If calls still fail, see [why a campaign is not dialing](https://trustane.com/guides/why-vicidial-is-not-dialing-hopper). On [hosted VICIdial](https://trustane.com/vicidial-hosting) we can look over your CID setup: [see pricing](https://trustane.com/vicidial-pricing).

VICIdial is a trademark of its owner. Trustane is an independent hosting provider.
