AutoDialerCampaign Model
The AutoDialerCampaign model represents an outbound dialing campaign with configuration for routing, scheduling, rate limiting, AMD actions, and Caller ID pooling.
Table: auto_dialer_campaigns
Model: App\Models\AutoDialerCampaign
Resource: App\Http\Resources\AutoDialerCampaignResource
Database Schema
| Column | Type | Nullable | Default | Description |
|---|---|---|---|---|
id | bigint unsigned | No | auto | Primary key |
organization_id | bigint unsigned | No | - | Foreign key to organizations |
name | varchar(255) | No | - | Campaign name |
description | text | Yes | null | Campaign description |
status | varchar(20) | No | draft | Campaign status enum |
auto_start | boolean | No | false | Auto-start when ready |
routing_destination_type | varchar(50) | No | - | ai_assistant, ai_load_balancer, hangup |
routing_destination_id | bigint unsigned | Yes | null | Target destination ID |
dial_timeout | int | No | 60 | Seconds to ring before timeout |
destination_connect | varchar(20) | No | connected | connected or immediately |
caller_id | varchar(50) | Yes | null | Default Caller ID (legacy) |
caller_id_strategy | varchar(20) | No | round_robin | Distribution strategy for pool |
caller_id_pool_enabled | boolean | No | false | Whether pool mode is enabled |
max_dial_attempts | int | No | 1 | Max retries per destination |
concurrent_active_calls | int | No | 1 | Max concurrent calls (CAC, 1-50) |
calls_per_second | int | No | 1 | Call initiation rate (CPS, 1-30) |
days_active | json | Yes | null | Legacy schedule days |
start_time | int | Yes | null | Legacy start hour |
end_time | int | Yes | null | Legacy end hour |
start_date | date | Yes | null | Campaign start date |
end_date | date | Yes | null | Campaign end date |
timezone | varchar(50) | Yes | UTC | Schedule timezone |
schedule | json | Yes | null | Full weekly schedule |
time_limit | int | Yes | null | Max call duration (seconds) |
record_calls | boolean | No | false | Enable recording |
action_voicemail | string | Yes | null | AMD action for voicemail |
action_human | string | Yes | null | AMD action for human |
action_unknown | string | Yes | null | AMD action for unknown |
total_destinations | int | No | 0 | Total destinations count |
completed_calls | int | No | 0 | Completed calls count |
failed_calls | int | No | 0 | Failed calls count |
voicemail_calls | int | No | 0 | Voicemail calls count |
pending_calls | int | No | 0 | Pending calls count |
pause_reason | varchar(50) | Yes | null | Reason for pause |
resume_at | timestamp | Yes | null | Scheduled resume time |
started_at | timestamp | Yes | null | When campaign started |
completed_at | timestamp | Yes | null | When campaign completed |
created_at | timestamp | Yes | null | Creation timestamp |
updated_at | timestamp | Yes | null | Last update timestamp |
Relationships
Belongs To
campaign.organization() → Organization
Has Many
campaign.lists() → AutoDialerList[]
campaign.destinations() → AutoDialerDestination[] (through list)
campaign.callSessions() → AutoDialerCallSession[]
campaign.callerIdStats() → AutoDialerCallerIdStat[]
Belongs To Many
campaign.callerIds() → DidNumber[]
- Pivot: auto_dialer_campaign_caller_ids
- With pivot: weight
Enums
CampaignStatus
| Case | Value |
|---|---|
DRAFT | draft |
ACTIVE | active |
PAUSED | paused |
COMPLETED | completed |
ARCHIVED | archived |
RoutingDestinationType
| Case | Value |
|---|---|
AI_ASSISTANT | ai_assistant |
AI_LOAD_BALANCER | ai_load_balancer |
HANGUP | hangup |
CallerIdStrategy
| Case | Value |
|---|---|
ROUND_ROBIN | round_robin |
RANDOM | random |
LEAST_RECENTLY_USED | least_recently_used |
DestinationConnect
| Value | Description |
|---|---|
connected | Connect when call answered |
immediately | Connect immediately |
Caller ID Pooling
Enable Pool Mode
$campaign->update([
'caller_id_pool_enabled' => true,
'caller_id_strategy' => 'round_robin', // or 'random', 'least_recently_used'
]);
Assign Caller IDs
$syncData = [
$didId1 => ['weight' => 1],
$didId2 => ['weight' => 1],
];
$campaign->callerIds()->sync($syncData);
Methods
Scopes
AutoDialerCampaign::forOrganization($orgId)
AutoDialerCampaign::active()
AutoDialerCampaign::paused()
AutoDialerCampaign::draft()
AutoDialerCampaign::runnable() // Active and within schedule
Business Logic
$campaign->isRunnable(): bool
$campaign->getProgressPercentage(): int
$campaign->getApiIntervalMilliseconds(): float
$campaign->hasValidCac(): bool
$campaign->hasValidCps(): bool
$campaign->hasList(): bool
$campaign->canStart(): bool
$campaign->canPause(): bool
$campaign->canAcceptList(): bool