Skip to content

NethVoice: choose the softphone codecs of an instance #8418

Description

@edospadoni

Since NethVoice 1.8 the softphone devices (web client, NethLink, mobile app) use the Opus audio codec first. When the provider line (trunk) does not support Opus, every external call is converted between two codecs by the PBX, and the conversion to and from Opus is expensive: on a busy instance it takes about three times the processor time per call of the previous G.711 setup, and under load the audio becomes choppy. Today there is no supported way to choose a different codec list for the softphones of one instance: a list changed by hand is replaced with the default one at every module update, and every new softphone device gets the default list again.

The purpose is to let an administrator keep a lighter codec on the softphones of an instance that needs it, for example a call center with many concurrent calls on a G.729 or G.711 provider line, without losing the choice at the next update.

Proposed solution

A setting of the instance for the list of audio and video codecs of softphone devices. When it is set, it is used for new softphone devices and it is kept by module updates, restores and imports. When it is not set, nothing changes: the default list with Opus first stays as it is today.

Alternative solutions

  • Leave values changed by hand untouched during updates. It keeps the choice on existing devices, but new devices still get the default list.
  • Change the default list for everybody. It gives up the better audio quality and network tolerance of Opus also where the load is not a problem.
  • Lower the Opus encoding effort (complexity) on the PBX. Its effect on the processor load and on quality has not been measured.

Additional context

Measured on a test instance with NethVoice 1.8.7, 10 concurrent calls: G.729 on the provider line and G.711 on the extension take about 2.6% of a processor core per call, G.729 and Opus about 7.9%.

On Asterisk 22 putting G.711 first in a list that still contains Opus is not enough: the codec used is the first one in the order of the side that starts the call, so a softphone that offers Opus first still gets Opus. The list has to contain only the wanted audio codec.

See also

Activity

  1. added this to the NethVoice 1.8 milestone on Dec 4, 2026
  2. self-assigned this
    on Dec 4, 2026
  3. added
    nethvoice
    on Dec 4, 2026
  4. added
    testing
    on Dec 4, 2026
  5. moved this from Todo to Testing in NethVoiceon Dec 4, 2026
  6. edospadoni commented on Dec 4, 2026

    @edospadoni
    MemberAuthor

    Test

    PRs: nethesis/ns8-nethvoice#1429 (docs: NethServer/nethvoice-docs#114)

    Setup: a NethVoice instance updated to the testing release below, with web client, NethLink, mobile app and physical phone devices, and a provider line (trunk). The setting has no user interface yet, it is changed from the node shell with api-cli.

    Test Case 1 - Set the softphone codecs

    • With a call in progress, run api-cli run module/nethvoiceX/set-softphone-codecs --data '{"softphone_codecs": "alaw,h264,vp8"}': the action ends without errors and the call stays up
    • Web client, NethLink and mobile app devices have the list alaw,h264,vp8 (asterisk -rx "pjsip show endpoint <extension>" inside the freepbx container, line allow)
    • Physical phones keep the list they had before
    • A new call between the provider line and a softphone, and between two softphones, uses G.711 a-law on the softphone side (asterisk -rx "core show channels verbose" or core show channel <name>)
    • Audio works in both directions on web client, NethLink and mobile app; a video call between two softphones still works

    Test Case 2 - New devices and updates keep the setting

    • Create a new softphone device (for example enable the web client or the mobile app for a user): it gets alaw,h264,vp8
    • Update the module again to the same testing image: softphone devices still have alaw,h264,vp8
    • Backup and restore the instance (or clone it): the restored instance has the same softphone list

    Test Case 3 - Back to the default

    • Run the action with an empty value, --data '{"softphone_codecs": ""}': softphone devices go back to opus,g722,ulaw,alaw,h264,vp8, also the ones created afterwards
    • An instance where the action was never run keeps the default list after the update

    Test Case 4 - Invalid values are refused

    • --data '{"softphone_codecs": "g729"}', an unknown codec name, or a list without an audio codec (h264,vp8): the action fails on validation and the device lists do not change

    Testing release: 1.8.8-testing.53 (nethesis/ns8-nethvoice#1429)

    ghcr.io/nethesis/nethvoice:1.8.8-testing.53
    
    api-cli run update-module --data '{"module_url":"ghcr.io/nethesis/nethvoice:1.8.8-testing.53","instances":["nethvoiceX"],"force":true}'
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

nethvoicetesting

Projects

  • Status
    Testing

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions