Apply Config gives Unable to connect to Asterisk through the CLI

Hi,

Exception: Unable to connect to Asterisk through the CLI

Recently upgraded from 12 from 13 which was a bit bumpy - currently it reports:
FreePBX 13.0.192.16 ‘VoIP Server’

Asterix is working fine (calls in and out work), and FreePBX front end is working apart from applying changes.

I’ve added a bit more detail to the php exception string to try to get some more detail.

If I run the command from the console as root it works fine:

/usr/sbin/asterisk -rx ‘core show version’

Asterisk 11.12.0 built by root @ foobar on a i686 running Linux on 2014-09-14 19:43:36 UTC

echo $?

0

$loc = fpbx_which(“asterisk”);
if(empty($loc)) {
throw new \Exception((“Unable to find the Asterisk binary”));
} else {
exec($loc . " -rx ‘core show version’",$out,$ret);
if($ret != 0) {
$foo=implode("|",$out);
throw new \Exception(
(“Unable to connect to Asterisk through the CLI $loc $foo $ret”));
}
}

exit: 1
Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)
Exception: Unable to connect to Asterisk through the CLI /usr/sbin/asterisk 1 in file /var/lib/asterisk/bin/retrieve_conf on line 42
Stack trace:

  1. Exception->() /var/lib/asterisk/bin/retrieve_conf:42

I’m running Ubuntu 16.04 with php5.6 backport.

All modules up to date apart from Digium Addons, iSymphonyV3 and Parking Lot.

Any ideas?

Asterisk is running as root instead of the user asterisk. That’s the issue. Asterisk needs to run as the proper user for FreePBX to be able to manage and communicate with it.

1 Like

Yes - of course thanks.

I’ve started it as a using /etc/init.d/asterix, when I should use, for example, amportal start.

if you use init.d on a debian based system, then edit to suit

/etc/default/asterisk