Asterisk can't connect, no idea what to do

As part of my update/migration from old x86 version of FreePBX Distro to the latest x64, I was going through some of the stuff that wasn’t brought over by the conversion tool.

Specifically SIP settings. Enabling pjsip and chan_sip. Changing the Asterisk manager password. Then going into the sip settings and updating the pjsip and chan_sip settings.

When saving the sip settings it noted that asterisk would need to be restarted (not just reloaded) since bind/ports changed. I click ok but immediately now all I see is a warning that the system “can not connect to Asterisk”.

I’ve gone to the CLI and stopped and started asterisk. Tried using fwconsole restart/stop/start and just service asterisk restart/stop/start. Ran fwconsole chown. Nothing is working.

From what I can tell it looks like the best I can get is Asterisk running as a “root” user, which I KNOW is wrong but I can’t fix it.

[root@freepbx ~]# ps aux |grep asterisk
asterisk  1321  0.0  0.7 734376 28608 ?        S    17:24   0:00 /usr/sbin/httpd -DFOREGROUND
asterisk  1322  0.0  1.2 744948 48112 ?        S    17:24   0:00 /usr/sbin/httpd -DFOREGROUND
asterisk  1326  0.0  1.2 745028 50032 ?        S    17:24   0:00 /usr/sbin/httpd -DFOREGROUND
asterisk  1327  0.0  1.4 742892 57708 ?        S    17:24   0:00 /usr/sbin/httpd -DFOREGROUND
asterisk  1328  0.0  0.5 730132 22060 ?        S    17:24   0:00 /usr/sbin/httpd -DFOREGROUND
asterisk  2482  0.0  0.2 197980  8488 ?        Ss   17:24   0:00 /usr/bin/python /usr/local/bin/pnp_server
asterisk  2566  0.0  0.5 730132 21492 ?        S    17:24   0:00 /usr/sbin/httpd -DFOREGROUND
asterisk 12370  0.0  1.1 744948 46060 ?        S    17:25   0:00 /usr/sbin/httpd -DFOREGROUND
asterisk 12379  0.0  0.5 730128 20716 ?        S    17:25   0:00 /usr/sbin/httpd -DFOREGROUND
asterisk 12380  0.0  0.5 730128 20716 ?        S    17:25   0:00 /usr/sbin/httpd -DFOREGROUND
asterisk 12389  0.0  1.2 742956 47540 ?        S    17:25   0:00 /usr/sbin/httpd -DFOREGROUND
asterisk 13407  0.0  0.7 917716 30128 ?        Ssl  17:31   0:00 PM2 v2.10.6: God Daemon (/home/asterisk/.pm2)
root     14298  0.0  0.0 113176   780 pts/0    S    17:31   0:00 /bin/sh /usr/sbin/safe_asterisk -U asterisk -G asterisk
asterisk 14300  0.5  1.1 3031356 46404 pts/0   Sl   17:31   0:03 /usr/sbin/asterisk -f -U asterisk -G asterisk -vvvg -c
root     15330  0.0  0.0 112712   948 pts/0    S+   17:42   0:00 grep --color=auto asterisk

trying to restart freepbx with fwconsole

[root@freepbx ~]# fwconsole restart --verbose
Asterisk not currently running
Running FreePBX shutdown...

Running Asterisk pre from Core module
Core FastAGI Server is not running
Running Asterisk pre from Restapps module
RestApps Server is not running
Running Asterisk pre from Ucp module
UCP Node Server is not running
Running Asterisk pre from Xmpp module
Chat Server is not running
Running Asterisk pre from Zulu module
Zulu Server is not running

Wanrouter: No valid Sangoma Hardware found, if you have no Sangoma cards this is OK
Stopping DAHDi for Digium Cards
DAHDi Stopped
Queue Callback Server is not running
Queue Callback Event Server is not running
Running FreePBX startup...
Running Asterisk pre from Dahdiconfig module
Wanrouter: No valid Sangoma Hardware found, if you have no Sangoma cards this is OK
Starting DAHDi for Digium Cards
DAHDi Started
Running Asterisk pre from Firewall module
Running Asterisk pre from Sysadmin module
Running Sysadmin Hooks
Restarting fail2ban
fail2ban Restarted
Updating License Information for "deploymentID"
Checking Vpn server
Starting Asterisk...
[--------------->------------] 2 mins
In Start.class.php line 189:

  [Exception]
  Unable to connect to Asterisk. Did it start?


Exception trace:
 () at /var/www/html/admin/libraries/Console/Start.class.php:189
 FreePBX\Console\Command\Start->startAsterisk() at /var/www/html/admin/libraries/Console/Start.class.php:127
 FreePBX\Console\Command\Start->execute() at /var/www/html/admin/libraries/Console/Restart.class.php:33
 FreePBX\Console\Command\Restart->execute() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Application.php:960
 Symfony\Component\Console\Application->doRunCommand() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Application.php:255
 Symfony\Component\Console\Application->doRun() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Application.php:148
 Symfony\Component\Console\Application->run() at /var/lib/asterisk/bin/fwconsole:163

restart [-i|--immediate] [--] [<args>]...

Asterisk is not running as root. If Asterisk is running and the GUI can’t connect, the issue is probably mismatched AMI (manager) password. Ensure the value in advanced settings matches the value in the file:

/etc/asterisk/manager.conf
1 Like

whats this line for?

root 14298 0.0 0.0 113176 780 pts/0 S 17:31 0:00 /bin/sh /usr/sbin/safe_asterisk -U asterisk -G asterisk

This was the problem. I actually was just looking at that file and noticed the password wasn’t correct as reflected in the web UI. Wonder how this got out of wack.

safe_asterisk is a script that generates core dumps and restarts if Asterisk crashes. It’s normal and runs as root.

Okay thanks. Looks like everything in the core system is up and running and configured correctly.

Now I have to figure how or if I can move commercial modules to this new install and pull any configurations over (like EPM). Problem being the “updates” for these modules expired years ago while stuck on the old x86 v10.13.66-22 install. Something tells me they’re not going to just work if I move them and try to install them from module admin.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.