Backend Administration Platform (admin-alta.alta-voce.tech)
Auto-generated Documentation Links
API REST Documentation (Scribe) : View API Documentation - Automatically generated OpenAPI/Postman docs.
1. Architectural Role & Specifications
The admin-alta backend serves as the core orchestration and control tower for the entire Alta Voce ecosystem. Built on Laravel 10 / PHP 8.1, it handles three critical systems:
- High-Frequency Telemetry Ingestion: A REST API entry point that receives diagnostic payloads from desktop clients, sanitizes inputs, and applies optimization filters (reducing JSON payload storage footprint by 96%).
- Filament Admin Dashboard (v3): A secure Livewire, Alpine.js, and Tailwind CSS administrative portal designed for customer onboarding, subscription control, and system health checks.
- Scheduled Automated Workloads (CRON / CLI): A temporal engine orchestrating nightly calculations, invoicing, data retention policies, and automated audio tuning.
2. REST API Authentication
The REST API uses Laravel Sanctum opaque tokens (not JWT). Tokens are created on login and passed as a Bearer header on all protected requests.
Token lifecycle
- Expiration: 2 hours after creation (configurable via
sanctum.expiration). - Proactive refresh: The frontend client automatically calls
POST /api/refresh-tokenwhen fewer than 30 minutes remain on the current token. - Reactive refresh: On a
401response, the client retries refresh once if the user was active within the last 5 minutes; otherwise it forces logout.
Authentication endpoints
| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /api/login | — | Authenticate and receive a bearer token |
| POST | /api/logout | ✅ | Revoke current token |
| POST | /api/register | — | Create a new account |
| POST | /api/forgot-password | — | Request password reset email (token valid 1h) |
| POST | /api/reset-password | — | Apply password reset using the token |
| POST | /api/invite | ✅ | Invite a new account by email (admin/client-admin only) |
| GET | /account-setup/{token} | — | Account setup web form (email invitation link) |
| POST | /api/account/setup | — | Complete invited account setup (name, password) |
| POST | /api/refresh-token | ✅ | Refresh Sanctum token (only within 30 min of expiry) |
| PUT | /api/complete_onboarding | ✅ | Mark onboarding as complete |
| GET | /api/user / /api/me | ✅ | Get current authenticated account profile |
Password policy (account setup)
New accounts set via the invitation flow must choose a password that contains at least one uppercase letter, one lowercase letter, one digit, and one special character (minimum 8 characters). The setup link is valid for 3 days.
Role system
Three roles exist in the roles table:
| Role | Permissions |
|---|---|
admin | Full access: manage all clients, all resources, impersonation |
client-admin | Manage their own organization's accounts and groups |
member | Read/write access to their group's resources |
Impersonation
Admin accounts can impersonate any other account:
POST /api/impersonate— Start impersonation. Returns a new token scoped to the target account. The event is logged in theimpersonationstable.POST /api/impersonate/stop— Restore the original admin session and token.- The frontend (
ImpersonateWidget.vue) shows a persistent banner while impersonation is active and allows stopping it at any time.
3. Desktop Plugin API (/api/altacall/*)
Routes used exclusively by the AltaCall Windows desktop client. Authentication is handled by a custom AltaAuthMiddleware that supports three schemes simultaneously: PHP Basic Auth (PHP_AUTH_USER/PHP_AUTH_PW), HTTP Basic Auth (Authorization: Basic ...), and a proprietary Digest scheme (Authorization: Digest clientId:userId:sha256checksum).
All plugin routes also pass through AltacallMonitoringMiddleware, which records request metrics (duration, memory, response size, IP, license info).
| Method | Path | Description |
|---|---|---|
| GET / POST | /api/altacall/license | Validate a license key. Returns license_status: valid|invalid + user. Results cached 30 min (valid) / 5 min (invalid). |
| POST | /api/altacall/config | Get the plugin's merged dynamic configuration. Layers: general → app → version → license client → user/machine. Injects active issue messages. |
| POST | /api/altacall/telemetry | Submit a periodic diagnostic telemetry payload. |
| POST | /api/altacall/event | Notify of a plugin event (device.capture.added, device.capture.removed, device.capture.none, audio.state.changed, noop). |
| POST | /api/altacall/process | Declare a new running process instance. |
| GET / POST | /api/altacall/consent | Read or update the agent's data collection consent. |
| POST | /api/altacall/logs | Upload a diagnostic log bundle. |
| POST | /api/it/recordings | Upload an audio recording from the plugin. |
Event handling
The POST /api/altacall/event endpoint dispatches each event to a typed handler:
| Event type | Handler | Effect |
|---|---|---|
device.capture.added | DeviceCaptureAddedHandler | If policy is auto, updates device_capture in user config with the new device. |
device.capture.removed | DeviceCaptureRemovedHandler | Selects a replacement device via regex matching against known good/bad device lists. |
device.capture.none | DeviceCaptureNoneHandler | Handles no-device state. |
audio.state.changed | NoopHandler | No-op, logged only. |
noop | NoopHandler | No-op. |
Returns {"actions": ["config.update"]} when the client must refresh its config, {"actions": []} otherwise.
4. Filament Admin Dashboard Architecture (v3)
The dashboard is structured around Filament Resources that map to Eloquent database models. Each resource implements lists (tables), forms, filters, and custom operational actions:
4.1. ABTestsResource (A/B Test Campaign Management)
- Role: Configures and monitors voice transformation campaigns, comparing acoustical algorithms (SMA, VMO, Smile) against control groups.
- Table Columns:
id,name,status(badges:active/pending/completed),start_date,end_date,goal_progress(interactive progress bar showing % of target agent hours captured). - Form Inputs: Campaign settings (name, dates, client target group), voice enhancement preset selection (link to
transfos), target segmentation by agent skill labels. - Custom Actions:
- Download CSV: Raw dump of all telemetries and KPIs for data science analysis.
- Force Rotation: Instantly triggers preset rotation.
4.2. ClientResource (Tenant Account Administration)
- Role: Manages subscribed corporate clients (contact centers).
- Table Columns:
name,email,email_billing,vat_number,groups_count. - Form Inputs: Fiscal identifiers, contact details, JSON
configEditor (network constraints, telemetry thresholds, alert rules).
4.3. UserResource (Caller Agents)
- Role: Manages profiles of caller agents registered via telemetry.
- Table Columns:
name(Windows username),vmo_user_id(desktop UUID),last_update,status. - Custom Actions:
- Export Usage Trace (CSV/JSON): Daily voice usage, active presets, and median F0/Pitch histories.
4.4. AccountsResource (Portal Accounts)
- Role: Manages portal user accounts (admins and client-admins who log in to the web dashboard).
- Separate from
users(which are the Alta Call agents on workstations). Portal accounts use email/password via Sanctum.
4.5. MachinesResource (Workstations Inventory & Health)
- Role: Manages active computer workstations executing the desktop application.
- Table Columns:
computer(hostname),vmo_machine_id,version,local_ip_address,status(green/red based on open issues). - Custom Actions: Diagnostics tab listing open anomalies (from
machines_issues).
4.6. InvoicesResource (Automated Invoicing Engine)
- Role: Handles monthly invoice calculations and processing.
- Table Columns:
invoice_number,client.name,period_start,period_end,amount_excl_tax,amount_incl_tax,status(paid/unpaid/frozen). - Custom Actions:
- Download PDF: Official invoice PDF from Blade template.
- Send Email Notification: Emails the PDF download link to the billing contact.
4.7. LicenseResource (Handshake Keys Management)
- Role: Configures authentication licenses for desktop clients.
- Form Inputs: Auto-generation of cryptographically secure license tokens,
fancynamelabel for support desk,validtoggle to revoke.
4.8. TransformationsResource (Voice Transformation Presets)
- Role: Manages voice enhancement algorithm presets (
transfostable). Each preset defines thetransfo_mode(SMA,VMO,MANUAL) and its parameter JSON payload injected into plugin configs.
4.9. GroupsResource & MonitoringResource
- GroupsResource: Manage tenant departments/teams. Groups link clients, users, machines, and licenses.
- MonitoringResource: Inspect the
AltacallMonitoringMiddlewarerecorded request metrics for plugin API calls (latency, error rates, slow requests).
4.10. AltacallLogResource & PluginLogResource
- Role: Inspect and download system diagnostic log bundles and softphone integration logs sent by workstations.
4.11. SoftwareVersionResource (Release Versioning Control)
- Role: Manages desktop application build deployments, download links, and minimum required version enforcement.
4.12. RecordingsResource & SuggestionResource & ExternalUtilityResource
- RecordingsResource: Rules and files for on-demand audio recording capture, used during A/B test quality control.
- SuggestionResource: User feedback tickets submitted from the desktop client.
- ExternalUtilityResource: Companion tool/utility downloads distributed via the portal.
5. Scheduled Automated Workloads (CRON / CLI)
[!IMPORTANT] Asynchronous Execution Architecture (FastCGI) Because the application runs on Gandi Simple Hosting with strict 30-second HTTP timeouts, scheduled tasks are processed via an asynchronous mechanism:
- An external scheduler (cron-job.org) triggers routes under
/cron/*via HTTP GET.- The route calls
fastcgi_finish_request(), returning HTTP 200 immediately to close the network connection.- PHP continues running in the background (
set_time_limit(170)) to complete long-running aggregations.
Complete Cron Endpoints Reference
| HTTP Cron Route | Artisan command / service | Frequency | Description |
|---|---|---|---|
/cron/summaries-build | summaries:build | Daily 02:00 | Build daily users_summaries from raw telemetry (F0, dB, durations). |
/cron/billing-save-daily-usage | InvoiceService::saveDailyUsage | Daily 00:05 | Compute and store transformed voice seconds per agent in daily_usages. |
/cron/billing-save-monthly-usage | billing:save-monthly-usage | 1st of month 00:10 | Aggregate daily_usages into monthly_usages. |
/cron/billing-generate-auto-invoices | billing:generate-auto-invoices | 1st of month 01:00 | Generate draft invoices from monthly_usages × pricing matrix. |
/cron/billing-freeze-auto-invoices | billing:freeze-auto-invoices | 5th of month 08:00 | Lock draft invoices to frozen status. |
/cron/billing-notify-ready-invoices | billing:notify-ready-invoices | 5th of month 09:00 | Email PDF download links to billing contacts. |
/cron/billing-notify-usage-data | billing:notify-usage-data | Monthly | Email usage stats to clients. |
/cron/abtest-prune-telemetry | abtest:prune-telemetry | Daily 03:00 | Delete raw telemetry older than 7 days. |
/cron/abtest-prune-user-summaries | abtest:prune-user-summaries | Periodic | Prune old users_summaries records. |
/cron/incidents-archive-and-prune | incidents:archive-and-prune | Daily 00:00 | Archive and purge resolved incidents older than 30 days. |
/cron/job/abtests-compute-progress | AbtestProgressService::computeAllProgress | Hourly | Update goal_progress for active A/B tests. |
/cron/abtest-notify-tests-progress | AbtestProgressService::notifyTestsProgress | Mondays 08:00 | Weekly KPI summary email for ongoing A/B tests. |
/cron/job/rotate-transformations | AbtestRotationService::rotateTransformations | Every 4h | Rotate voice preset assignments across test groups. |
/cron/abtest-autotune-smile-scaling | abtest:autotune-smile-scaling | Daily 04:00 | Adjust Smile preset scaling from previous day's F0/dB data. |
/cron/abtest-send-reports | abtest:send-reports | Configurable | Email A/B test reports to stakeholders. |
/cron/abtest-delete-expired-recordings | abtest:delete-expired-recordings | Daily 03:30 | Delete expired audio recording files and DB references. |
/cron/abtest-delete-expired-data | abtest:delete-expired-data | Daily | General A/B test data expiry cleanup. |
/cron/abtest-delete-expired-outdated-machines | abtest:delete-expired-outdated-machines | Daily | Remove stale entries from outdated_machines. |
/cron/abtest-disable-expired-tests | abtest:disable-expired-tests | Daily | Automatically disable A/B tests past their end date. |
/cron/abtest-prune-obsolete-issues | abtest:prune-obsolete-issues | Daily | Remove machine issues that have auto-resolved. |
/cron/abtest-prune-event | abtest:prune-event | Daily | Prune old events from the events table. |
/cron/abtest-trigger-recordings | abtest:trigger-recordings | Periodic | Activate audio recording rules for quality control. |
/cron/abtest-trigger-recording-pool-progress | abtest:trigger-recording-pool-progress | Periodic | Advance the recording pool state machine. |
/cron/abtest-trigger-quality-control | abtest:trigger-quality-control | Periodic | Trigger QC analysis on collected recordings. |
/cron/abtest-trigger-needs-tuning | abtest:trigger-needs-tuning | Periodic | Flag A/B test groups that need parameter tuning. |
/cron/abtest-notify-tuning-progress | abtest:notify-tuning-progress | Periodic | Notify engineers of tuning progress. |
/cron/notify-upcoming-abtests | notify:upcoming-abtests | Daily 09:00 | Warn supervisors of A/B tests starting the next day. |
/cron/telescope-prune | telescope:custom-prune --hours=1 | Hourly | Prune Telescope debug entries (keeps 1h of data). |
/cron/app-clear-cache | app:clear-cache | On demand | Clear all application caches. |
/cron/monitoring-sync | monitoring:sync | Periodic | Sync monitoring data. |
6. Telemetry Processing Pipeline
Every telemetry report received by the backend passes through a multi-stage pipeline inside TelemController@postTelemetry:
graph TD
A[Incoming Telemetry Packet] --> B[AltaAuthMiddleware — License/Digest auth]
B --> C{Valid auth?}
C -- No --> X1[401 Unauthorized]
C -- Yes --> D[Version Check against min required version]
D --> E[Resolve Entities: User / Machine / Process]
E --> F{Downtime Payload?}
F -- Yes --> G[Store raw telemetry & return early]
F -- No --> H["TelemetryCleaningService — 96% payload reduction"]
H --> I[Process Audio Devices & Audiostream]
I --> J[Calculate Running Process Stats]
J --> K["Atomic DB Transaction: Update Process, Machine, User"]
K --> L["IssueDetectionService — scan for anomalies"]
L --> M[Insert into machines_issues & telemetry_incidents if anomaly found]
M --> N[Broadcast IncidentCreated via Laravel Reverb if new incident]
N --> O[Return 200 OK]
- Auth:
AltaAuthMiddlewarevalidates PHP Basic Auth, HTTP Basic Auth, or the proprietary Digest scheme. - Telemetry Sanitization:
TelemetryCleaningServicewhitelists approved keys only, reducing each JSON entry by 96% (from ~14 KB to ~535 bytes average). - Issue Detection:
IssueDetectionServicescans the payload for anomalies (HIGH_LATENCY,EXCESSIVE_XRUNS,AUDIO_CRASHED, etc.) and raises or resolves records inmachines_issues. - Real-time Broadcasting: When a new
TelemetryIncidentis created, theIncidentCreatedevent is broadcast on theincidentschannel via Laravel Reverb (WebSockets), enabling live alerts in the admin dashboard.