Skip to content

NethVoice: disable mailboxes without an account during FreePBX 17 migration #8279

Open
nethesis/ns8-nethvoice
#1114

Description

@Stell0

Problem description

The migration to FreePBX 17 should disable mailbox settings that have no associated account. Otherwise configuration generation can fail and prevent FreePBX startup.

The public FreePBX 17 PJSIP driver checks whether mailbox exists, then accesses $config['account'] without checking whether the account exists. NethVoice's startup script treats a failed reload as an initialization failure, and its systemd unit restarts the container.

Steps to reproduce

Use an isolated test installation:

  1. Prepare a legacy PJSIP test device with a mailbox setting in the asterisk.sip table, but no account setting for the same device ID. Keep the mailbox message-waiting indicator subscription mode at its default, auto.
  2. Migrate the installation to the FreePBX 17 version on NethVoice's main branch.
  3. Let FreePBX initialize, or run fwconsole reload inside the test FreePBX container.
  4. Check whether configuration generation fails with Undefined array key "account" in PJSip.class.php, and whether the container enters a restart loop.

These steps describe the invalid configuration fixture; the synthetic migration test still needs to be run as part of the fix.

Expected behavior

Migration detects and disables mailbox settings without an associated account before generating the FreePBX configuration. FreePBX starts and reloads successfully. Valid mailbox settings remain unchanged.

Actual behavior

The unchecked account access aborts configuration generation. Startup cannot complete and the container keeps restarting.

Components

NethVoice main branch, FreePBX 17 migration.

See also

Public source references:

Activity

  1. added this to the NethVoice 1.8 milestone on Oct 27, 2026
  2. added theissue type on Oct 27, 2026
  3. added
    nethvoiceBug or features releted to the NethVoice project
    on Oct 27, 2026
  4. modified the milestone: NethVoice 1.8 on Oct 27, 2026
  5. added
    testingPackages are available from testing repositories
    on Oct 27, 2026
  6. moved this from Todo to Testing in NethVoiceon Oct 27, 2026
  7. edospadoni commented on Oct 28, 2026

    @edospadoni
    Member

    Test

    PR: nethesis/ns8-nethvoice#1114

    Setup: a disposable NethVoice instance on the stable line (1.7.14, FreePBX 16) with at least one PJSIP device with voicemail, to be updated to the testing image below. The cleanup runs in /initdb.d/migration.php at every start of the freepbx container, before the FreePBX reload, so it also repairs instances already stuck after a failed migration. SQL on the module database: runagent -m nethvoiceX podman exec -i mariadb sh -c 'export MYSQL_PWD="$MARIADB_ROOT_PASSWORD"; exec mysql -u root -h 127.0.0.1 -P "$NETHVOICE_MARIADB_PORT" asterisk' with the statements on stdin. FreePBX log: runagent -m nethvoiceX podman logs freepbx.

    Note: the testing images from 1.8.0-testing.49 on upgrade MariaDB to 11.8; an instance updated to them cannot go back to 1.7.x, so use a test instance.

    Test Case 1 - Migration from FreePBX 16 with an orphan mailbox

    • On the 1.7.14 instance add a mailbox row without an account for an unused device id, e.g. INSERT INTO sip (id, keyword, data, flags) VALUES ('999', 'mailbox', '999@device', 0); and keep a real device with both its account and mailbox rows
    • Update to the testing image: the freepbx container starts once, no restart loop, fwconsole reload in the log ends without Undefined array key "account"
    • SELECT * FROM sip WHERE id IN ('999', '<real device>') ORDER BY id, keyword; shows the 999 mailbox row gone and the real device rows unchanged
    • runagent -m nethvoiceX podman exec freepbx asterisk -rx "pjsip show endpoint <real device>" still lists the mailbox; the message waiting indicator on that phone still works

    Test Case 2 - Instance already stuck after the migration

    • Reproduce the loop with a current main/testing image older than 1.8.0-testing.47 (or with the orphan row inserted on an instance that already migrated): the freepbx container restarts and the log shows the account error
    • Update to the testing image: the container comes up and the orphan row is removed; valid mailboxes are untouched

    Test Case 3 - Regression

    • Update a clean instance (no orphan rows): nothing is deleted from sip, extensions, voicemail and device settings are unchanged
    • Restart the freepbx container twice: the start completes each time and sip stays identical (the cleanup is idempotent)
    • Optional: php local_testing/mailbox_migration_test.php 'mysql:host=127.0.0.1;port=3306' against a disposable MariaDB passes

    Testing release: 1.8.0-testing.62 (nethesis/ns8-nethvoice#1114, first shipped in 1.8.0-testing.47; the same image also covers #8280)

    ghcr.io/nethesis/nethvoice:1.8.0-testing.62
    

    Update command (replace nethvoiceX with the NethVoice instance):

    api-cli run update-module --data '{"module_url":"ghcr.io/nethesis/nethvoice:1.8.0-testing.62","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

nethvoiceBug or features releted to the NethVoice projecttestingPackages are available from testing repositories

Type

Projects

  • Status
    Testing

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions