Skip to content

NethCTI Middleware: WebSocket transcription not working for users with string boolean settings #7758

@edospadoni

Description

@edospadoni

Problem

Users are unable to receive WebSocket transcription messages when their user settings contain boolean fields as empty strings instead of actual boolean values.

Root Cause

The /user/me API endpoint returns some settings fields (specifically desktop_notifications and chat_notifications) as empty strings ("") for some users, while the Go structs in nethcti-middleware expect actual boolean values.

This causes a JSON unmarshal error:

json: cannot unmarshal string into Go struct field Settings.settings.desktop_notifications of type bool

When this error occurs, the entire user info loading fails, preventing the WebSocket connection from being properly registered with user details (DisplayName and PhoneNumbers). As a result, the authorization check in IsAuthorizedForTranscription fails and transcription messages are not delivered to the affected users.

Example

User with the problem:

{
  "name": "Antonio Colapietro",
  "username": "antonio",
  "settings": {
    "desktop_notifications": "",
    "chat_notifications": "",
    "default_extension": "228"
  }
}

Impact

  • Affected users cannot receive real-time transcription messages via WebSocket
  • The issue only manifests for users with string boolean values in their settings
  • Other users with proper boolean values work correctly

Related Components

  • nethcti-middleware: methods/user.go (Settings struct)
  • WebSocket transcription authorization logic

Metadata

Metadata

Assignees

No one assigned

    Labels

    nethvoiceBug or features releted to the NethVoice projectnethvoice-ctiThe issue is related to NethLink (NethVoice Web client)

    Type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions