You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NethVoice: disable mailboxes without an account during FreePBX 17 migration #8279
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:
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.
Migrate the installation to the FreePBX 17 version on NethVoice's main branch.
Let FreePBX initialize, or run fwconsole reload inside the test FreePBX container.
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.
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
Activity
edospadoni commentedon Oct 28, 2026
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.phpat 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
INSERT INTO sip (id, keyword, data, flags) VALUES ('999', 'mailbox', '999@device', 0);and keep a real device with both itsaccountandmailboxrowsfwconsole reloadin the log ends withoutUndefined array key "account"SELECT * FROM sip WHERE id IN ('999', '<real device>') ORDER BY id, keyword;shows the999mailbox row gone and the real device rows unchangedrunagent -m nethvoiceX podman exec freepbx asterisk -rx "pjsip show endpoint <real device>"still lists the mailbox; the message waiting indicator on that phone still worksTest Case 2 - Instance already stuck after the migration
accounterrorTest Case 3 - Regression
sip, extensions, voicemail and device settings are unchangedsipstays identical (the cleanup is idempotent)php local_testing/mailbox_migration_test.php 'mysql:host=127.0.0.1;port=3306'against a disposable MariaDB passesTesting release: 1.8.0-testing.62 (nethesis/ns8-nethvoice#1114, first shipped in 1.8.0-testing.47; the same image also covers #8280)
Update command (replace
nethvoiceXwith the NethVoice instance):