Skip to main content

Database Models

OPBX uses Laravel Eloquent models. Most models are scoped by organization_id through OrganizationScope. Platform admin models are not tenant-scoped.

Model Reference Pages​

Auto Dialer​

Call & Logging​

  • CallDetailRecord — CDR from Cloudonix (call_detail_records), with the warm-tier ArchivedCallDetailRecord (archived_call_detail_records)
  • CallLog — Legacy call log, created by the call-initiated webhook (call_logs)
  • SessionUpdate — Real-time session events (session_updates)
  • CallNotificationsSettings — Webhook notification config (call_notifications_settings)
  • CallNotificationLog — Notification delivery log (call_notification_logs)
  • EmailLog — Transactional email log (email_logs)
  • PlatformAuditLog — Cross-tenant audit trail (platform_audit_logs)
  • PlatformHealthCheck — Platform Status history (platform_health_checks)

Core PBX​

Call Queues​

  • CallQueue — Call queues (call_queues)
  • CallQueueAgent — Queue agent membership (call_queue_agents)
  • QueueCall — One row per queued call, for reports (queue_calls)

Live queue state (positions, agent states) is not in MySQL; the ACD worker keeps it in Redis.

AI Integration​

Recordings​

Security​

  • InboundBlacklist — Blocked caller patterns (inbound_blacklists), linked to numbers through inbound_blacklist_did_number
  • OutboundWhitelist — Outbound routing rules (outbound_whitelists)
  • BlockedCallLog — Log of blocked calls (blocked_call_logs)

Users & Organizations​

API Access​

Framework Tables​

These tables belong to Laravel and have no OPBX model: migrations, sessions, password_reset_tokens, cache, cache_locks, jobs, job_batches and failed_jobs. locks is used by App\Services\Fallback\DatabaseLockService, a database lock with an expires_at column.

Tenancy Notes​

  • Models with #[ScopedBy([OrganizationScope::class])] are automatically filtered by the authenticated user's organization.
  • Webhook handlers and platform admin operations must use OrganizationScope::bypass() when querying tenant-scoped models.
  • Not tenant-scoped: Organization, PlatformAuditLog, PlatformHealthCheck, EmailLog, ApiKey, ApiKeyPermission, PersonalAccessToken, UserSocialIdentity and the child tables reached through a scoped parent (RingGroupMember, IvrMenuOption, AiAssistantLoadBalancerMember, the business-hours days, ranges and exceptions, AutoDialerCampaignCallerId, AutoDialerCallerIdStat).
  • Rows of several tables are pruned daily by retention settings; call records are tiered instead. See Data Retention.