Skip to main content

CallTrackingNumber Model

The CallTrackingNumber model links a DID number to a call tracking campaign. When a call arrives on the DID, OPBX uses the assigned campaign for attribution and routing.

Table: call_tracking_numbers
Model: App\Models\CallTrackingNumber
Resource: App\Http\Resources\CallTrackingNumberResource

Database Schema

ColumnTypeNullableDefaultDescription
idbigint unsignedNoautoPrimary key
organization_idbigint unsignedNo-Foreign key to organizations
call_tracking_campaign_idbigint unsignedNo-Parent campaign
did_number_idbigint unsignedNo-Linked DID
friendly_namevarchar(255)YesnullDisplay label
statusvarchar(20)NoactiveNumber status enum
created_attimestampYesnullCreation timestamp
updated_attimestampYesnullLast update timestamp

Relationships

Belongs To

$number->organization() → Organization
$number->campaign() → CallTrackingCampaign
$number->did() → DidNumber

Has Many

$number->sessions() → CallTrackingSession[]

Status

ValueDescription
activeNumber is live and receiving calls
inactiveNumber is paused

Lifecycle

When a tracking number is created, the associated DID's routing_type is updated to call_tracking and routing_config.call_tracking_campaign_id is set to the parent campaign.