Skip to main content

SessionUpdate Model

The SessionUpdate model stores real-time session update events from Cloudonix for monitoring and debugging.

Table: session_updates
Model: App\Models\SessionUpdate

Database Schema​

ColumnTypeNullableDescription
idbigint unsignedNoPrimary key
organization_idbigint unsignedNoTenant scope. Foreign key, ON DELETE CASCADE
session_idbigintNoCloudonix session ID
session_tokenvarchar(64)YesToken for Cloudonix API disconnect
event_idvarchar(36)NoIdempotency key
domain_idintNoCloudonix domain ID
domainvarchar(255)NoDomain name
subscriber_idintYesSubscriber ID
outgoing_subscriber_idintYesOutgoing subscriber ID
caller_idvarchar(50)NoCaller number
destinationvarchar(50)NoCallee number
directionenumNoincoming, outgoing, internal, application. Copied to the CDR at ingest
statusvarchar(50)NoCurrent status
session_created_attimestampNoSession creation time
session_modified_attimestampNoLast modification time
call_start_timebigintYesStart timestamp (ms)
start_timetimestampYesParsed start time
call_answer_timebigintYesAnswer timestamp (ms)
answer_timetimestampYesParsed answer time
time_limitintYesCall time limit
vapp_servervarchar(45)YesVoice app server
actionvarchar(50)NoCloudonix session action
reasonvarchar(100)NoCloudonix status reason
last_errortextYesLast error reported by Cloudonix
call_idsjsonNoAssociated call IDs
profilejsonNoSession profile (QoS, AMD)
processed_attimestampNoWhen OPBX processed the event. Default CURRENT_TIMESTAMP
created_attimestampYes
updated_attimestampYes

Indexes​

IndexColumns
unique_session_event (unique)organization_id, session_id, event_id
su_org_session_status_idxorganization_id, session_id, status
su_org_status_updated_idxorganization_id, status, updated_at
session_updates_organization_id_created_at_indexorganization_id, created_at
idx_caller_destinationcaller_id, destination
idx_created_atsession_created_at
idx_event_idevent_id
session_updates_session_id_indexsession_id
session_updates_session_token_indexsession_token

Relationships​

$sessionUpdate->organization() → Organization

Scopes​

SessionUpdate::forOrganization($orgId)
SessionUpdate::forSession($sessionId)
SessionUpdate::withStatus($status)
SessionUpdate::withDirection($direction)
SessionUpdate::search($term) // caller_id or destination

Usage Notes​

  • The Live Calls module queries this table to display active sessions.
  • The profile field is the Cloudonix session profile. For auto-dialer calls it can include the AMD result, which Laravel writes to the Cloudonix profile when the AMD worker reports.
  • Session updates are processed idempotently using event_id; the unique index on (organization_id, session_id, event_id) rejects a duplicate row.
  • Every 15 minutes, session-updates:cleanup marks sessions stuck in an active state (no CDR or delete event arrived) as deleted.
  • Rows whose updated_at is older than RETENTION_SESSION_UPDATES_DAYS (default 30) are pruned daily at 03:00 UTC by model:prune.