Skip to main content

Inbound Blacklist and Outbound Whitelist

Call blocking and outbound routing rules.

InboundBlacklist​

A caller ID pattern that is blocked on all numbers or on selected numbers.

Table: inbound_blacklists
Model: App\Models\InboundBlacklist
Tenant scoped: yes (OrganizationScope)

ColumnTypeNullableDefaultDescription
idbigint unsignedNoautoPrimary key
organization_idbigint unsignedNo-Tenant. Foreign key to organizations, on delete cascade
match_typeenumNoexactHow caller_id_pattern is matched. Values: exact, prefix, wildcard (cast to InboundBlacklistMatchType)
caller_id_patternvarchar(50)No-Pattern
descriptionvarchar(255)YesnullDescription
is_globalbooleanNofalseApplies to every number; otherwise only to the linked numbers
rejection_strategyenumNodropWhat happens to a blocked call. Values: drop, reject, torment (cast to InboundBlacklistRejectionStrategy)
torment_room_prefixvarchar(20)YesnullRandom conference room prefix, generated for torment entries
torment_music_timeoutintNo300Seconds a tormented caller is held
statusenumNoactiveActive or inactive. Values: active, inactive (cast to InboundBlacklistStatus)
expires_attimestampYesnullNot used by the current code
blocked_countintNo0Calls blocked so far
created_attimestampYesnull
updated_attimestampYesnull

Indexes

  • inbound_blacklists_organization_id_caller_id_pattern_index: organization_id, caller_id_pattern
  • inbound_blacklists_organization_id_did_number_id_index: organization_id
  • inbound_blacklists_organization_id_is_global_status_index: organization_id, is_global, status
  • inbound_blacklists_organization_id_status_index: organization_id, status

Not mass assignable: description, expires_at

Relationships

$inboundBlacklist->organization() → Organization (organization_id) [BelongsTo]
$inboundBlacklist->didNumbers() → DidNumber (pivot inbound_blacklist_did_number) [BelongsToMany]
$inboundBlacklist->blockedCallLogs() → BlockedCallLog (inbound_blacklist_id) [HasMany]

Methods: didNumber(), matches(), incrementBlockedCount(), toggleStatus(), isActive()

matches() compares exactly (exact), with str_starts_with (prefix) or with fnmatch (wildcard). Numbers are linked through the inbound_blacklist_did_number pivot (below).

inbound_blacklist_did_number​

Pivot between blacklist entries and the numbers they apply to.

Table: inbound_blacklist_did_number (no Eloquent model)

ColumnTypeNullableDefaultDescription
idbigint unsignedNoautoPrimary key
inbound_blacklist_idbigint unsignedNo-Blacklist entry. Foreign key to inbound_blacklists, on delete cascade
did_number_idbigint unsignedNo-Number. Foreign key to did_numbers, on delete cascade
created_attimestampYesnull
updated_attimestampYesnull

Indexes

  • bl_did_unique (unique): inbound_blacklist_id, did_number_id
  • inbound_blacklist_did_number_did_number_id_index: did_number_id
  • inbound_blacklist_did_number_inbound_blacklist_id_index: inbound_blacklist_id

OutboundWhitelist​

A destination that outbound calls may reach, and the trunk they use.

Table: outbound_whitelists
Model: App\Models\OutboundWhitelist
Tenant scoped: yes (OrganizationScope)

ColumnTypeNullableDefaultDescription
idbigint unsignedNoautoPrimary key
organization_idbigint unsignedNo-Tenant. Foreign key to organizations, on delete cascade
namevarchar(255)No-Rule name
destination_countryvarchar(255)No-Country
destination_prefixvarchar(255)YesnullNumber prefix
outbound_trunk_namevarchar(255)No-Cloudonix trunk name
default_caller_id_did_idbigint unsignedYesnullCaller ID for calls that match. Foreign key to did_numbers, on delete set null
statusenumNoactiveActive or inactive. Values: active, inactive (cast to WhitelistStatus)
created_attimestampYesnull
updated_attimestampYesnull

Indexes

  • outbound_whitelists_default_caller_id_did_id_foreign: default_caller_id_did_id
  • owl_org_dest_country_idx: organization_id, destination_country
  • owl_org_dest_prefix_idx: organization_id, destination_prefix
  • owl_org_trunk_name_idx: organization_id, outbound_trunk_name

Relationships

$outboundWhitelist->organization() → Organization (organization_id) [BelongsTo]
$outboundWhitelist->defaultCallerId() → DidNumber (default_caller_id_did_id) [BelongsTo]

Scopes: forOrganization(), search()
Methods: toggleStatus(), isActive()

BlockedCallLog​

A call rejected by the inbound blacklist.

Table: blocked_call_logs
Model: App\Models\BlockedCallLog
Tenant scoped: yes (OrganizationScope)
Traits: PrunesByRetention

ColumnTypeNullableDefaultDescription
idbigint unsignedNoautoPrimary key
organization_idbigint unsignedNo-Tenant. Foreign key to organizations, on delete cascade
inbound_blacklist_idbigint unsignedYesnullEntry that matched. Foreign key to inbound_blacklists, on delete set null
did_number_idbigint unsignedYesnullNumber called. Foreign key to did_numbers, on delete set null
caller_idvarchar(50)No-Caller
called_numbervarchar(50)No-Number called
call_sidvarchar(100)YesnullCloudonix call ID
session_idvarchar(50)YesnullCloudonix session
rejection_strategyenumNo-Strategy applied. Values: drop, reject, torment (cast to InboundBlacklistRejectionStrategy)
torment_room_idvarchar(100)YesnullConference room used for torment
torment_durationintYesnullSeconds held
webhook_payloadjsonYesnullVoice webhook payload
source_ipvarchar(45)YesnullWebhook source IP
blocked_attimestampNo-When the call was blocked

Indexes

  • bcl_org_blocked_idx: organization_id, blocked_at
  • bcl_org_caller_idx: organization_id, caller_id
  • bcl_org_did_blocked_idx: organization_id, did_number_id, blocked_at
  • blocked_call_logs_did_number_id_foreign: did_number_id
  • blocked_call_logs_inbound_blacklist_id_foreign: inbound_blacklist_id

Casts: webhook_payload (array)

Relationships

$blockedCallLog->organization() → Organization (organization_id) [BelongsTo]
$blockedCallLog->inboundBlacklist() → InboundBlacklist (inbound_blacklist_id) [BelongsTo]
$blockedCallLog->didNumber() → DidNumber (did_number_id) [BelongsTo]

Rows whose blocked_at is older than RETENTION_BLOCKED_CALL_LOGS_DAYS (default 90) are deleted daily by model:prune.