Skip to content

NethLink: heartbeat migrate to nethcti-middleware and expose client version/OS in the wizard #8102

Description

@tonyco97

Currently the NethLink heartbeat (POST /user/nethlink) is served only by the legacy nethcti-server, which stores just user, extension and a server-side timestamp in nethcti3.user_nethlink. With the ongoing migration from nethcti-server to nethcti-middleware, this endpoint should be owned by the middleware. On top of that, admins have no way to see which NethLink version and OS a user is running, which makes support and troubleshooting harder.

  1. WHY: nethcti-server is being phased out; the heartbeat is still stuck on the legacy backend (today /api/user/nethlink just falls through the middleware NoRoute catch-all and gets proxied to V1). We also lack any visibility on the NethLink client environment.
  2. PURPOSE: make the middleware the native owner of the heartbeat, enrich it with NethLink version and OS details (type, release, architecture), and surface this info to admins in the FreePBX wizard, per user.

Proposed solution

  • nethcti-middleware: add a native POST /user/nethlink handler (username from JWT, extension from body, server-side timestamp) that persists into nethcti3.user_nethlink, extended with nethlink_version, os_type, os_release, arch. Schema handled via create.sql/upgrade.sql (idempotent ADD COLUMN IF NOT EXISTS).
  • NethLink: the client sends its version (app.getVersion()), OS type, OS release and arch along with the heartbeat (exposed via preload contextBridge).
  • ns8-nethvoice (FreePBX wizard): in Configurations → Preferences → Users, add an Info button on the NethLink device row (mirroring the physical-phone Info button) that opens a modal showing extension, NethLink version, OS, OS version, architecture and last-seen. New FreePBX REST endpoint GET /nethlink/info/{username} reads user_nethlink via NethCTI::Database(). user_nethlink init schema updated with the new columns.
    The legacy nethcti-server endpoint is left untouched as a /webrest fallback — the migration is additive, zero regression for older clients (extra body fields are ignored by the legacy handler).

Alternative solutions

Keep the heartbeat on nethcti-server and just add columns there — rejected: goes against the middleware migration and keeps new logic on the deprecated backend.
Store version/OS in a separate table — rejected: user_nethlink is already the natural per-user NethLink record; extending it keeps a single source of truth.
Read the data in the wizard directly from the middleware /api — rejected: the wizard already talks to the FreePBX REST layer, which has a ready PDO to nethcti3 (NethCTI::Database()); no cross-auth needed.

Additional context

Affected repos: nethcti-middleware, nethlink, ns8-nethvoice. The user_nethlink last-seen table is independent from the Asterisk-based online/presence state used for click-to-call.

Metadata

Metadata

Assignees

Labels

nethlinkThe issue is related to NethLink (NethVoice Desktop client)nethvoiceBug or features releted to the NethVoice project

Fields

No fields configured for Feature.

Projects

Status
In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions