Debian 12 and new deployment script

1st wanted say thank you for debian install script. I was able to get new server up and testing now.

What is the proper migration path from existing instance to new deployment. Used webui to backup the existing install and on new instance restore using tarball it created. When I try to apply/fwconsole reload gives an error. Let me know if you need anything else.

fwconsole reload -vv
Reload Started

In PJSip.class.php line 1440:

[Exception]
Endpoint already exists.

Exception trace:
at /var/www/html/admin/modules/core/functions.inc/drivers/PJSip.class.php:1440
FreePBX\modules\Core\Drivers\PJSip->generateEndpoint() at /var/www/html/admin/modules/core/functions.inc/drivers/PJSip.class.php:1089
FreePBX\modules\Core\Drivers\PJSip->generateEndpoints() at /var/www/html/admin/modules/core/functions.inc/drivers/PJSip.class.php:432
FreePBX\modules\Core\Drivers\PJSip->genConfig() at /var/www/html/admin/modules/core/Core.class.php:300
FreePBX\modules\Core->genConfig() at /var/www/html/admin/libraries/BMO/FileHooks.class.php:99
FreePBX\FileHooks->processNewHooks() at /var/www/html/admin/libraries/BMO/FileHooks.class.php:28
FreePBX\FileHooks->processFileHooks() at /var/www/html/admin/libraries/Console/Reload.class.php:340
FreePBX\Console\Command\Reload->reload() at /var/www/html/admin/libraries/Console/Reload.class.php:95
FreePBX\Console\Command\Reload->execute() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Command/Command.php:312
Symfony\Component\Console\Command\Command->run() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Application.php:1022
Symfony\Component\Console\Application->doRunCommand() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Application.php:314
Symfony\Component\Console\Application->doRun() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Application.php:168
Symfony\Component\Console\Application->run() at /var/lib/asterisk/bin/fwconsole:163

reload [–json] [–dry-run] [–skip-registry-checks] [–dont-reload-asterisk]

PBX Version:
16.0.33
PBX Distro:
12.7.8-2302-1.sng7
Asterisk Version:
18.16.0

cat /etc/os-release
NAME=“Sangoma Linux”
VERSION=“7 (Core)”
ID=“sangoma”
ID_LIKE=“centos rhel fedora”
VERSION_ID=“7”
PRETTY_NAME=“Sangoma Linux 7 (Core)”
ANSI_COLOR=“0;31”

CENTOS_MANTISBT_PROJECT=“Sangoma-7”
CENTOS_MANTISBT_PROJECT_VERSION=“7”
REDHAT_SUPPORT_PRODUCT=“sangoma”
REDHAT_SUPPORT_PRODUCT_VERSION=“7”

New version:
PBX Version:
17.0.15.20
PBX Distro:
12.7.8-2402-3.sng12
Asterisk Version:
21.0.2

cat /etc/os-release
PRETTY_NAME=“Debian GNU/Linux 12 (bookworm)”
NAME=“Debian GNU/Linux”
VERSION_ID=“12”
VERSION=“12 (bookworm)”
VERSION_CODENAME=bookworm
ID=debian

You could try export/import using the bulk handler module. Did you have any existing extensions on the Debian server before trying to restore the backup?

SamShomi,

Thanks for the response.

No extensions on the new system, it is a fresh install.
On existing system backup everything and tried restoring and received my previous posted error. Reverted the snapshot to fresh install tried backup and restored only the “core” modules and received same error.

Reverted the snapshot and validate the new system is working, setup couple of extensions and able to make phone calls.

I’ll revert again and try bulk handler, trying to avoid re-provisioning 100+ phones across 4 sites.

Where do we define endpoints? Guessing it is in mysql database, what table?

We define these vars in a private function that is throwing the exception. Slightly modified the function in hope of identifying the problem record after a restore. Record contains null and zero space data most like just needs to be deleted to apply. Any pointers on what table?

            if (isset($retarr["pjsip.endpoint.conf"][$endpointname])) {
                    throw new \Exception("Endpoint XX $endpointname XX $authname XX $aorname already exists.");
            } 

[Exception]
Endpoint XX XX -auth XX already exists.

This boiled down to a user being clever. Deleting corresponding record allowed me to apply configuration.

I modified the throw to see where data was wrong.
delete from devices where id = ‘sting in question’;

i modified below function to output $config, and grepped it out sql dump to delete
if (isset($retarr[“pjsip.endpoint.conf”][$endpointname])) {

                    throw new \Exception("Endpoint $endpointname already exists.");
            }