FreePBX Can Not Connect to Asterisk

I’ve googled a lots for this error message and tried a lots solutions, seems no lucky.
Messages here:

Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)
Unable to run Pre-Asterisk hooks, because Asterisk is already running on PID 16234 and has been running for ERROR
Running Asterisk post from Dahdiconfig module
Running Asterisk post from Endpoint module
Running Asterisk post from Pagingpro module
Running Asterisk post from Ucp module
Starting UCP Node Server…
[>---------------------------] 6 secs
Started UCP Node Server. PID is 16946
Running Asterisk post from Vqplus module
RestApps is not licensed.
Running Asterisk post from Xmpp module
Resetting PBX Users Failed: The command “node /var/www/html/admin/modules/xmpp/node/resetpbxusers.js” failed.

Exit Code: 1(General error)

Working directory: /etc/asterisk

Output:

Error Output:

/var/www/html/admin/modules/xmpp/node/node_modules/freepbx/lib/freepbx.js:107
throw “There was an error with Asterisk Manager Connection is Asterisk running?”;
^
There was an error with Asterisk Manager Connection is Asterisk running?

Running Asterisk post from Zulu module
This product is not licensed

Please advise …

The system is reporting that Asterisk appears to be running, but all attempts to connect to it are failing. This can be caused by a couple of errors, most of which should be resolvable with a power off/power on cycle.

Once you’re back up, check to see if asterisk is actually running. You can log into the console and issue a “ps aux | grep asterisk” command. You should get a hit on that. If you don’t, I think rebooting should clear the ‘run’ file and get you back up and running.

It’s possible that you started asterisk in some “unsupported” way - maybe you started it as ‘root’ or are using the chkconfig command to start it. Normally, when you start the server, the fwconsole command in your /etc/rc.d structure should start the program and get you running.

If a reboot doesn’t help, let us know.

Yes, I did many times reboot, also module updates won’t help.

Here is the result:
]# ps aux | grep asterisk
asterisk 1549 2.7 2.9 742212 54596 ? S 13:05 0:04 /usr/sbin/httpd -DFOREGROUND
asterisk 1551 0.4 1.5 737720 29044 ? S 13:05 0:00 /usr/sbin/httpd -DFOREGROUND
asterisk 1553 0.3 1.0 647648 20244 ? S 13:05 0:00 /usr/sbin/httpd -DFOREGROUND
asterisk 1612 0.1 0.4 195840 8088 ? Ss 13:05 0:00 /usr/bin/python /usr/local/bin/pnp_server 2>&1 | logger -t sangoma_pnp
asterisk 1672 1.6 2.3 742912 43608 ? S 13:05 0:02 /usr/sbin/httpd -DFOREGROUND
asterisk 1706 0.6 1.6 738228 30976 ? S 13:05 0:00 /usr/sbin/httpd -DFOREGROUND
asterisk 1708 0.9 1.4 650252 27768 ? S 13:05 0:01 /usr/sbin/httpd -DFOREGROUND
asterisk 1709 0.3 1.2 723444 22772 ? S 13:05 0:00 /usr/sbin/httpd -DFOREGROUND
asterisk 1711 0.1 1.1 723072 21188 ? S 13:05 0:00 /usr/sbin/httpd -DFOREGROUND
asterisk 1712 0.4 1.3 649904 25148 ? S 13:05 0:00 /usr/sbin/httpd -DFOREGROUND
asterisk 3140 0.0 0.5 541440 9964 ? S 13:07 0:00 /usr/sbin/httpd -DFOREGROUND
asterisk 3189 1.1 0.8 390672 16228 ? S 13:07 0:00 php /var/www/html/admin/modules/dashboard/classes/…/netmon.php
root 3469 0.0 0.0 112660 976 pts/0 S+ 13:08 0:00 grep --color=auto asterisk

Asterisk isn’t starting.

Log in as ‘root’, then ‘su’ to ‘asterisk’. Use the command ‘fwconsole start’ from the console window to start the asterisk services and see what happens.

Let us know the outcome of the process.

[[email protected] ~]# su -m asterisk
bash: /root/.bashrc: Permission denied
bash-4.2$

[[email protected] ~]# su - asterisk
Last login: Tue Jan 30 16:13:48 EST 2018 on pts/0
-bash-4.2$ fwconsole restart
You need to be root to run this command

[[email protected] ~]# fwconsole start
Running FreePBX startup…
Taking too long? Customize the chown command, See http://wiki.freepbx.org/display/FOP/FreePBX+Chown+Conf
Setting Permissions…
Setting base permissions…Done
Setting specific permissions…
30883 [============================]
Finished setting permissions
Running Asterisk pre from Dahdiconfig module
Wanrouter: No valid Sangoma Hardware found, if you have no Sangoma cards this is OK
DAHDi: Already started
Running Asterisk pre from Firewall module
Running Asterisk pre from Pms module
Running Asterisk pre from Sysadmin module
Running Sysadmin Hooks
Restarting fail2ban
fail2ban Restarted
Updating License Information for 32286064
Connection timed out after 30000 milliseconds
Checking Vpn server
Starting Asterisk…
[--------------->------------] 1 min
In Start.class.php line 181:

Unable to connect to Asterisk. Did it start?

start [–pre] [–post] [–skipchown] [–] []…

[[email protected] ~]#

[[email protected] ~]# fwconsole reload
Reloading FreePBX
Error(s) have occured, the following is the retrieve_conf output:
exit: 1
Unable to connect to Asterisk Manager from /var/lib/asterisk/bin/retrieve_conf, aborting
[[email protected] ~]#

When I run
asterisk -vvvc
There are many WARNINGs and ERRORs:

[2018-01-30 20:33:00] ERROR[11971]: config_options.c:658 aco_process_config: Unable to load config file ‘acl.conf’

[2018-01-30 20:33:02] ERROR[11971]: config_options.c:658 aco_process_config: Unable to load config file 'statsd.conf’
Loading res_odbc_transaction.so.

[2018-01-30 20:33:03] ERROR[11971]: res_sorcery_config.c:230 sorcery_config_internal_load: Unable to load config file ‘codecs.conf’
== Registered translator ‘lintoopus’ from codec slin to opus, table cost, 600000, computational cost 999999
== Registered translator ‘opustolin’ from codec opus to slin, table cost, 900000, computational cost 999999
== codec_opus.so => (OPUS Coder/Decoder)
Loading res_pjproject.so.
[2018-01-30 20:33:03] ERROR[11971]: res_sorcery_config.c:230 sorcery_config_internal_load: Unable to load config file ‘pjproject.conf’
== res_pjproject.so => (PJPROJECT Log and Utility Support)
Loading res_pjsip.so.

[2018-01-30 20:33:05] ERROR[11971]: res_pjsip_config_wizard.c:1086 object_type_loaded_observer: Unable to load config file ‘pjsip_wizard.conf’

[2018-01-30 20:33:05] ERROR[11971]: netsock2.c:305 ast_sockaddr_resolve: getaddrinfo(“gvoice.freesoftwareservers.com”, “(null)”, …): Name or service not known
[2018-01-30 20:33:05] WARNING[11971]: acl.c:800 resolve_first: Unable to lookup ‘gvoice.freesoftwareservers.com
[2018-01-30 20:33:05] ERROR[11971]: netsock2.c:305 ast_sockaddr_resolve: getaddrinfo(“gvoice.freesoftwareservers.com”, “(null)”, …): Name or service not known
[2018-01-30 20:33:05] WARNING[11971]: acl.c:800 resolve_first: Unable to lookup ‘gvoice.freesoftwareservers.com

[2018-01-30 20:33:05] ERROR[11971]: res_pjsip_config_wizard.c:1086 object_type_loaded_observer: Unable to load config file ‘pjsip_wizard.conf’

[2018-01-30 20:33:06] ERROR[11971]: res_xmpp.c:3976 xmpp_client_config_post_apply: Jabber identity ‘hansen.ca’ could not be created for client ‘ghansenca’ - client not active

[2018-01-30 20:33:07] WARNING[11971]: res_stun_monitor.c:340 load_config: Unable to load config res_stun_monitor.conf
Loading res_ari.so.

[2018-01-30 20:33:07] ERROR[11971]: config_options.c:658 aco_process_config: Unable to load config file 'hep.conf’
Loading res_speech.so.

[2018-01-30 20:33:07] ERROR[11971]: res_calendar.c:1055 load_config: Unable to load config calendar.conf
Loading codec_silk.so.

[2018-01-30 20:33:07] WARNING[11971]: res_pktccops.c:1041 load_pktccops_config: Unable to load config file res_pktccops.conf
Loading res_stasis.so.

[2018-01-30 20:33:09] WARNING[11971]: loader.c:573 load_dynamic_module: Error loading module ‘res_pjsip_phoneprov_provider.so’: /usr/lib64/asterisk/modules/res_pjsip_phoneprov_provider.so: undefined symbol: ast_phoneprov_std_variable_lookup
[2018-01-30 20:33:09] WARNING[11971]: loader.c:1054 load_resource: Module ‘res_pjsip_phoneprov_provider.so’ could not be loaded.
[2018-01-30 20:33:09] WARNING[11971]: loader.c:573 load_dynamic_module: Error loading module ‘res_pjsip_phoneprov_provider.so’: /usr/lib64/asterisk/modules/res_pjsip_phoneprov_provider.so: undefined symbol: ast_phoneprov_std_variable_lookup
[2018-01-30 20:33:09] WARNING[11971]: loader.c:1054 load_resource: Module ‘res_pjsip_phoneprov_provider.so’ could not be loaded.
[2018-01-30 20:33:09] WARNING[11971]: loader.c:573 load_dynamic_module: Error loading module ‘res_pjsip_phoneprov_provider.so’: /usr/lib64/asterisk/modules/res_pjsip_phoneprov_provider.so: undefined symbol: ast_phoneprov_std_variable_lookup
[2018-01-30 20:33:09] WARNING[11971]: loader.c:1054 load_resource: Module ‘res_pjsip_phoneprov_provider.so’ could not be loaded.
[2018-01-30 20:33:09] WARNING[11971]: loader.c:573 load_dynamic_module: Error loading module ‘res_pjsip_phoneprov_provider.so’: /usr/lib64/asterisk/modules/res_pjsip_phoneprov_provider.so: undefined symbol: ast_phoneprov_std_variable_lookup
[2018-01-30 20:33:09] WARNING[11971]: loader.c:1054 load_resource: Module ‘res_pjsip_phoneprov_provider.so’ could not be loaded.
[2018-01-30 20:33:09] WARNING[11971]: loader.c:573 load_dynamic_module: Error loading module ‘res_pjsip_phoneprov_provider.so’: /usr/lib64/asterisk/modules/res_pjsip_phoneprov_provider.so: undefined symbol: ast_phoneprov_std_variable_lookup
[2018-01-30 20:33:09] WARNING[11971]: loader.c:1054 load_resource: Module ‘res_pjsip_phoneprov_provider.so’ could not be loaded.
Loading res_parking.so.

[2018-01-30 20:33:10] ERROR[11971]: res_config_sqlite.c:733 load_config: Unable to load res_config_sqlite.conf

[2018-01-30 20:33:10] ERROR[11971]: res_pjsip_config_wizard.c:1086 object_type_loaded_observer: Unable to load config file ‘pjsip_wizard.conf’

[2018-01-30 20:33:10] WARNING[11971]: chan_sip.c:32641 reload_config: Invalid address for externaddr keyword: gvoice.freesoftwareservers.com
== SIP Listening on 0.0.0.0:5060
== Using SIP TOS bits 96
== Using SIP CoS mark 4
[2018-01-30 20:33:10] WARNING[11971]: chan_sip.c:31994 display_nat_warning: !!! PLEASE NOTE: Setting ‘nat’ for a peer/user that differs from the global setting can make
[2018-01-30 20:33:10] WARNING[11971]: chan_sip.c:31995 display_nat_warning: !!! the name of that peer/user discoverable by an attacker. Replies for non-existent peers/users
[2018-01-30 20:33:10] WARNING[11971]: chan_sip.c:31996 display_nat_warning: !!! will be sent to a different port than replies for an existing peer/user. If at all possible,
[2018-01-30 20:33:10] WARNING[11971]: chan_sip.c:31997 display_nat_warning: !!! use the global ‘nat’ setting and do not set ‘nat’ per peer/user.
[2018-01-30 20:33:10] WARNING[11971]: chan_sip.c:31998 display_nat_warning: !!! (config category=‘201’ global force_rport=‘Yes’ peer/user force_rport=‘No’)

[2018-01-30 20:33:10] WARNING[11971]: iax2/firmware.c:237 iax_firmware_reload: Error opening firmware directory ‘/var/lib/asterisk/firmware/iax’: No such file or directory
[2018-01-30 20:33:10] NOTICE[11971]: iax2/provision.c:562 iax_provision_reload: No IAX provisioning configuration found, IAX provisioning disabled.
== chan_iax2.so => (Inter Asterisk eXchange (Ver 2))
Loading chan_console.so.
[2018-01-30 20:33:10] NOTICE[11971]: chan_console.c:1441 load_config: Unable to open configuration file console.conf!
Loading chan_dahdi.so.

[2018-01-30 20:33:10] ERROR[11971]: chan_dahdi.c:19158 setup_dahdi_int: Unable to load config chan_dahdi.conf

That’s a lot of missing files and modules. Are you sure the installation is complete?

Yes, Long story.

It has installed completely and no issues. Then I started to add Google Voice (Unsupported module), I’ve seen GV always show ‘disconnected’ (another ticket: FreePBX 14 unable to connect to Google Voice). Started to troubleshoot, modules update, system update, etc…after that got error of “Error(s) have occured, the following is the retrieve_conf output:
exit: 1” when ‘Apply Config’, during the time rebooted many times, and final seen error: “Unable to connect to Asterisk Manager”.

Anyway is it easy to fix or I have to go over reinstall again (It really took a lots of time, Nearly to give up)? Please advise…

I don’t know - it depends on how broken your installation is.

To start, I’d probably start with a ‘yum reinstall’ (or whatever command you’d need to use to make sure you are completely up-to-date with yum) and then make sure your ‘fwconsole ma update’ returns clean.

I don’t solve this problem every day, so I’m probably not the perfect person to help with unf*cking your system. You can try submitting a ticket or wait for one of the Sangoma Pros (like @jfinstrom or @tm1000) to hook up with us and try to clear your log jam.

Asterisk is starting as root. Don’t do that. Asterisk should be started with fwconsole start

You can try stopping asterisk with fwconsole stop

You may want to:

killall -9 safe_asterisk
killall -9 asterisk
fwconsole start

[[email protected] ~]# killall -9 safe_asterisk
safe_asterisk: no process found
[[email protected] ~]# killall -9 asterisk
asterisk: no process found
[[email protected] ~]# fwconsole start
Running FreePBX startup…
Taking too long? Customize the chown command, See http://wiki.freepbx.org/display/FOP/FreePBX+Chown+Conf
Setting Permissions…
Setting base permissions…Done
Setting specific permissions…
30654 [============================]
Finished setting permissions
Running Asterisk pre from Dahdiconfig module
Wanrouter: No valid Sangoma Hardware found, if you have no Sangoma cards this is OK
DAHDi: Already started
Running Asterisk pre from Firewall module
Running Asterisk pre from Pms module
Running Asterisk pre from Sysadmin module
Running Sysadmin Hooks
Restarting fail2ban
fail2ban Restarted
Updating License Information for 32286064
Could not resolve host: katanafpbx.schmoozecom.com; Name or service not known
Checking Vpn server
Starting Asterisk…
[--------------->------------] 30 secs
In Start.class.php line 181:

Unable to connect to Asterisk. Did it start?

start [–pre] [–post] [–skipchown] [–] []…

[[email protected] ~]#

[[email protected] ~]# yum reinstall
Loaded plugins: fastestmirror, versionlock
Error: Need to pass a list of pkgs to reinstall
Mini usage:

reinstall PACKAGE…

reinstall a package
[[email protected] ~]#

[[email protected] ~]# fwconsole ma update
[FATAL] Missing module name
[[email protected] ~]#

@hanshen what exactly are you trying to accomplish. You are just running commands blindly. The output tells you that you are doing it wrong yet you continue to post it here without looking into the reasoning (or at least listening to the command that says you need to tell it what to install or upgrade)

Your continual posts doing this are starting to just look like spam.

2 Likes

Sorry for posting too much, actually I am newer here, I was followed the suggestions and posted results. I still have no clue what were wrong for my installation/configuration…
Before the last step to clean reinstall, I was trying to update modules, system, yum, asterisk or FreePBX to see if it fix. However no luck at all.

@tm1000 The big challenge for me is that I don’t know what exactly to do even I see what the command says. By posting here, hope getting more detailed instructions to follow. Anyway thanks for everybody’s time.