FreePBX Error “Can Not Connect to Asterisk”

I’ve been getting an error when trying to administer Asterisk through FreePBX. Asterisk logfiles would only indicate that there was an authentication error every time I loaded the FreePBX GUI. This has prompted me to want to change the password used by FreePBX when communicating with the AMI. After trawling through many many .conf files, I discovered FreePBX in my case was getting the AMI credentials from the Asterisk MariaDB table shown below.

I had to install HeidiSQL on my windows desktop, and make changes to the database permissions to allow connections from my local subnet.

mysql asterisk

GRANT ALL PRIVILEGES ON *.* TO 'sam'@'192.168.%.%' IDENTIFIED BY 'New Password' WITH GRANT OPTION;

After this, I could login, but not update settings. To resolve run

/var/lib/asterisk/bin/retrieve_conf

Which returns

Exception: Unable to locate the FreePBX BMO Class 'Sipsettings'A required module might be disabled or uninstalled. Recommended steps (run from the CLI): 1) fwconsole ma install sipsettings 2) fwconsole ma enable sipsettings in file /var/www/html/admin/libraries/BMO/Self_Helper.class.php on line 216
Stack trace:
1. Exception->() /var/www/html/admin/libraries/BMO/Self_Helper.class.php:216
2. FreePBX\Self_Helper->loadObject() /var/www/html/admin/libraries/BMO/Self_Helper.class.php:104
3. FreePBX\Self_Helper->autoLoad() /var/www/html/admin/libraries/BMO/Self_Helper.class.php:37
4. FreePBX\Self_Helper->__get() /var/www/html/admin/modules/core/functions.inc/drivers/PJSip.class.php:860
5. FreePBX\modules\Core\Drivers\PJSip->generateEndpoints() /var/www/html/admin/modules/core/functions.inc/drivers/PJSip.class.php:313
6. FreePBX\modules\Core\Drivers\PJSip->genConfig() /var/www/html/admin/modules/core/Core.class.php:204
7. FreePBX\modules\Core->genConfig() /var/www/html/admin/libraries/BMO/FileHooks.class.php:97
8. FreePBX\FileHooks->processNewHooks() /var/www/html/admin/libraries/BMO/FileHooks.class.php:26
9. FreePBX\FileHooks->processFileHooks() /var/lib/asterisk/bin/retrieve_conf:892

So
fwconsole ma install sipsettings
fwconsole ma enable sipsettings in file /var/www/html/admin/libraries/BMO/Self_Helper.class.php on line 216

And the dashboard works!
…still getting errors when trying to reload config.

chkconfig asterisk off
fwconsole start

FreePBX settings for Draytel

Its taken a few hours work, but the below settings seem to work for incoming calls on Draytel to my Asterisk installation


PEER DETAILS

username=MYUSERNAME
usereqphone=yes
type=friend
secret=MYPASSWORD
port=5065
outboundproxy=nat.draytel.org
host=draytel.org
fromuser=MYUSERNAME
fromdomain=draytel.org
dtmfmode=rfc2833
context=from-trunk
canreinvite=no
allow=alaw,g711,ulaw

REGISTRATION STRING

MYUSERNAME:MYPASSWORD:MYUSERNAME@draytel.org/MYUSERNAME

These are loosely based on the settings described here:
https://support.voiptalk.org/hc/en-us/articles/115006438427-Configuration-of-a-FreePBX-with-a-VoIPtalk-trunk

Changing Network Interface on Centos

Now I’ve got wired connectivity into the basement, I dont need to have the uplink between the comms pc and the router on Wifi. The interface shown here as wlp3s0 will now be called eth1

 

This article basically describes the process

https://unix.stackexchange.com/questions/205010/centos-7-rename-network-interface-without-rebooting/219277

 

However, I’ll also need to change theĀ /etc/sysconfig/network-scripts/ifcfg-eth1 file to contain the IP address previously assigned to wlp3s0, and run

ip link set dev wlp3s0 down
service network restart

This is to ensure that incoming requests from the internet hit the new adapter, not the old one, which may be reassigned to something else later on.

Next, I’ll need to check firewalld has kept up with the changes

firewall-cmd --get-active-zones

and check eth1 is in the external zone