Skip to main content

CloudonixSettings Model

The CloudonixSettings model stores Cloudonix CPaaS integration configuration for an organization.

Overview

PropertyValue
NamespaceApp\Models
Tablecloudonix_settings
Primary Keyid

Database Schema

ColumnTypeNullableDescription
idbigint unsignedNoPrimary key
organization_idbigint unsignedNoOrganization ID
domain_uuidchar(36)YesCloudonix domain UUID
domain_namevarchar(255)YesCloudonix domain name
domain_api_keytextYesAPI key (encrypted)
domain_requests_api_keytextYesVoice webhook auth key (encrypted)
webhook_base_urlvarchar(500)YesBase URL for webhooks
voice_application_idintYesVoice app ID
voice_application_uuidchar(36)YesVoice app UUID
voice_application_namevarchar(255)YesVoice app name
no_answer_timeoutintNoNo answer timeout (default: 30)
recording_formatvarchar(20)NoRecording format (default: wav)
cloudonix_packagevarchar(100)YesSubscription package
created_attimestampNoCreation timestamp
updated_attimestampNoUpdate timestamp

Attributes

Fillable

protected $fillable = [
'organization_id',
'domain_uuid',
'domain_name',
'domain_api_key',
'domain_requests_api_key',
'webhook_base_url',
'voice_application_id',
'voice_application_uuid',
'voice_application_name',
'no_answer_timeout',
'recording_format',
'cloudonix_package',
];

Hidden

protected $hidden = [
'domain_api_key',
'domain_requests_api_key',
];

Casts

AttributeCastDescription
domain_uuidstringString cast
domain_api_keyencryptedEncrypted storage
domain_requests_api_keyencryptedEncrypted storage
no_answer_timeoutintegerInteger cast

Relationships

Belongs To

  • organization() → Organization

Methods

URL Generation

getCallbackUrl(): string

Get session update webhook URL.

$url = $settings->getCallbackUrl();
// https://api.example.com/api/webhooks/cloudonix/session-update

getCdrUrl(): string

Get CDR webhook URL.

$url = $settings->getCdrUrl();
// https://api.example.com/api/webhooks/cloudonix/cdr

getVoiceRouteUrl(): string

Get voice routing URL.

$url = $settings->getVoiceRouteUrl();
// https://api.example.com/api/voice/route

API Key Masking

getMaskedDomainApiKey(): ?string

Get masked API key (first 4 + *** + last 4).

$masked = $settings->getMaskedDomainApiKey();
// "abcd***wxyz"

getMaskedDomainRequestsApiKey(): ?string

Get masked requests API key.

$masked = $settings->getMaskedDomainRequestsApiKey();
// "xi12***abcd"

Status Checking

isConfigured(): bool

Check if Cloudonix is configured.

if ($settings->isConfigured()) {
// Ready for API calls
}

hasWebhookAuth(): bool

Check if webhook auth is enabled.

if ($settings->hasWebhookAuth()) {
// Voice webhooks use Bearer token auth
}

Webhook URL Management

getEffectiveWebhookBaseUrlAttribute(): ?string

Get effective webhook base URL (with override support).

isWebhookUrlOverridden(): bool

Check if webhook URL is overridden at application level.

getWebhookUrlDetails(): array

Get detailed webhook URL information.

$details = $settings->getWebhookUrlDetails();
// [
// 'effective_url' => 'https://...',
// 'application_url' => 'https://...',
// 'organization_url' => 'https://...',
// 'is_overridden' => true,
// 'source' => 'application',
// ]

Usage Example

use App\Models\CloudonixSettings;

$settings = CloudonixSettings::create([
'organization_id' => $orgId,
'domain_uuid' => '550e8400-e29b-41d4-a716-446655440000',
'domain_name' => 'example.cloudonix.io',
'domain_api_key' => 'XI-...',
'domain_requests_api_key' => 'XI-...',
'webhook_base_url' => 'https://api.example.com',
'no_answer_timeout' => 30,
'recording_format' => 'wav',
]);

// Get webhook URLs
$sessionUrl = $settings->getCallbackUrl();
$cdrUrl = $settings->getCdrUrl();
$voiceUrl = $settings->getVoiceRouteUrl();