I’m testing FreePBX 13 with Asterisk 13 in a LXC container. I used to install this [1] guide. The only difference is that in my case I did not install the dependencies for Google Voice, I installed the Pjproject bundle from Asterisk 13.10 (whose code was obtained from the Git repository) and I install Jansson from Debian packages.
Although Asterisk gets up and running using service asterisk start, fwconsole gives the following error:
root@pbxtest:~# fwconsole start
Running FreePBX startup...
Taking too long? Customize the chown command, See http://wiki.freepbx.org/display/FOP/FreePBX+Chown+Conf
Setting Permissions...
Collecting Files...Done
44558/44558 [============================] 100%
Finished setting permissions
Starting Asterisk...
[--------------->------------] 12 secs
[Exception]
Unable to connect to Asterisk. Did it start?
start [--pre] [--post] [--skipchown] [args1] ... [argsN]
Examining /var/log/asterisk/full, it does not show any record when run fwconsole.
It’s a little hard to diagnose from the fwconsiole, , essentially I belive it calls asterisk but safe asterisk watches /etc/init.d/asterisk with options (basically the pid of asterisk) and will restart on failure.
so , make sure safe_asterisk is NOT in ps -aux
(killall -9 safe_asterisk)
then begin with
asterisk -vvvc
which will attempt to start asterisk in the current console with a verbosity of three and in the foreground, if it fails you get your first clue. . . …
you probably need also to explore /etc/default/asterisk in Debian for how asterisk will be called by default and absolutely “man asterisk” to see tho options you have for starting asterisk.
`root@pbxtest:~# asterisk -vvvc
Asterisk 13.10.0, Copyright (C) 1999 - 2014, Digium, Inc. and others.
Created by Mark Spencer [email protected]
Asterisk comes with ABSOLUTELY NO WARRANTY; type ‘core show warranty’ for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type ‘core show license’ for details.
[ Initializing Custom Configuration Options ]
== Registered ‘audio’ codec ‘g723’ at sample rate ‘8000’ with id ‘1’
== Created cached format with name ‘g723’
== Registered ‘audio’ codec ‘ulaw’ at sample rate ‘8000’ with id ‘2’
== Created cached format with name ‘ulaw’
== Registered ‘audio’ codec ‘alaw’ at sample rate ‘8000’ with id ‘3’
== Created cached format with name ‘alaw’
== Registered ‘audio’ codec ‘gsm’ at sample rate ‘8000’ with id ‘4’
== Created cached format with name ‘gsm’
(…)
== Registered custom function ‘QUEUE_VARIABLES’
== Registered custom function ‘QUEUE_EXISTS’
== Registered custom function ‘QUEUE_MEMBER’
== Registered custom function ‘QUEUE_MEMBER_COUNT’
== Registered custom function ‘QUEUE_MEMBER_LIST’
== Registered custom function ‘QUEUE_WAITING_COUNT’
== Registered custom function ‘QUEUE_MEMBER_PENALTY’
== app_queue.so => (True Call Queueing)
Loading res_manager_devicestate.so.
== Manager registered action DeviceStateList
== res_manager_devicestate.so => (Manager Device State Topic Forwarder)
Loading res_manager_presencestate.so.
== Manager registered action PresenceStateList
== res_manager_presencestate.so => (Manager Presence State Topic Forwarder)
Asterisk Ready.
*CLI> core show version
Asterisk 13.10.0 built by root @ pbxtest on a x86_64 running Linux on 2016-07-25 00:06:18 UTC
*CLI>`
The contents of /etc/default/asterisk is the following (I remember to have changed AST_USER and AST_GROUP after having compiled Asterisk):
I have also executed fwconsole in debug mode with the intention of getting some more information that would suggest the cause of the problem:
root@pbxtest:~# fwconsole -vvv start
(...)
Finished setting permissions
Starting Asterisk...
[--------------->------------] 11 secs
[Exception]
Unable to connect to Asterisk. Did it start?
Exception trace:
() at /var/www/html/admin/libraries/Console/Start.class.php:166
FreePBX\Console\Command\Start->startAsterisk() at /var/www/html/admin/libraries/Console/Start.class.php:118
FreePBX\Console\Command\Start->execute() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
Symfony\Component\Console\Command\Command->run() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Symfony/Component/Console/Application.php:874
Symfony\Component\Console\Application->doRunCommand() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Symfony/Component/Console/Application.php:195
Symfony\Component\Console\Application->doRun() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Symfony/Component/Console/Application.php:126
Symfony\Component\Console\Application->run() at /var/lib/asterisk/bin/fwconsole:139
191 // the command name MUST be the first element of the input
192 $command = $this->find($name);
193
194 $this->runningCommand = $command;
195 $exitCode = $this->doRunCommand($command, $input, $output);
196 $this->runningCommand = null;
197
198 return $exitCode;`
It seems that /var/www/html/admin/libraries/Console/Start.class.php fails for connect to Asterisk Manager in the line 166 because FreePBX is unable to starts Asterisk. But I’m not sure why FreePBX is unable to do so.
This has nothing to do with cxpanel. All information provided here by dicko is completely inaccurate.
Symfony is a library we use for php. It is not to be confused with iSymphony. Not only are they spelled different they have nothing in common.
If you removed symfony you’d completely break freepbx. It would be unusable.
There’s no point in looking at the stack trace. There is a bigger problem with the particular installation and it not being able to communicate with asterisk over AMI.
The problem is that asterisk is being started and run by the ‘root’ user, not the correct user (which should be the user that is running the web server). Make sure that asterisk is NOT running with asterisk -rx 'core stop now' and then run ‘fwconsole start’. That will start asterisk as the correct user.
We can also see that Apache is running with the asterisk user, which was a necessary requirement.
I also made sure to set the user and group asterisk in /etc/default/asterisk, but this would only be useful if FreePBX uses the init script to start Asterisk.
root@pbxtest:~# fwconsole -vvv start
Running FreePBX startup...
Taking too long? Customize the chown command, See http://wiki.freepbx.org/display/FOP/FreePBX+Chown+Conf
Setting Permissions...
Collecting Files...Done
(...)
Finished setting permissions
Starting Asterisk...
[--------------->------------] 12 secs
[Exception]
Unable to connect to Asterisk. Did it start?
Exception trace:
() at /var/www/html/admin/libraries/Console/Start.class.php:166
FreePBX\Console\Command\Start->startAsterisk() at /var/www/html/admin/libraries/Console/Start.class.php:118
FreePBX\Console\Command\Start->execute() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
Symfony\Component\Console\Command\Command->run() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Symfony/Component/Console/Application.php:874
Symfony\Component\Console\Application->doRunCommand() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Symfony/Component/Console/Application.php:195
Symfony\Component\Console\Application->doRun() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Symfony/Component/Console/Application.php:126
Symfony\Component\Console\Application->run() at /var/lib/asterisk/bin/fwconsole:139
start [--pre] [--post] [--skipchown] [args1] ... [argsN]
I wonder if fwconsole is using a procedure outside the init script to start Asterisk. Maybe that’s what we have to be check.
Why don’t you try running that command. If when you run it manually nothing happens then something is misconfigured on your system. That’s what you need to figure out.
I did it. The ps shown in the previous message was after running this command where it seems that after running the safe_asterisk command did not appear any Asterisk process running.
I’m testing this version of FreePBX in a LXC container. Do you think that in this case I would have to have some particular consideration to run FreePBX?
On looking the script /usr/sbin/safe_asterisk, I uncomment on the LOGFILE variable to see if when I run the script manually, I can find in /var/log/asterisk/safe_asterisk.log something which give a little more light on this problem. And this was what I found:
So I checked again the script /usr/sbin/safe_asterisk and found this line:
TTY=9 # TTY (if you want one) for Asterisk to run on
Then I’ve commented this line and try again manually by running the script with the syntax used by FreePBX. This time the log does not show any new entry. Then I check the output of ps:
Curiously, after making this change, when trying to run fwconsole I got a Permission denied. The strange thing is that /var/lib/asterisk/bin/fwconsole did not have execution permission. This caught my attention because I do not remember having changed it. So I changed the permissions and tried again:
Great! This time seems to run smoothly. I guess the problem with the TTY would be linked to the configuration of the LXC container (or perhaps some limitation of LXC).
On the other hand, the systemd startup script [1] seems to work well:
root@pbxtest:/etc/systemd/system# systemctl start freepbx
root@pbxtest:/etc/systemd/system# systemctl status freepbx
● freepbx.service - FreePBX VoIP Server
Loaded: loaded (/etc/systemd/system/freepbx.service; enabled)
Active: active (exited) since lun 2016-08-01 14:46:15 ART; 6s ago
Process: 15773 ExecStart=/usr/sbin/fwconsole start (code=exited, status=0/SUCCESS)
Main PID: 15773 (code=exited, status=0/SUCCESS)
ago 01 14:46:11 pbxtest fwconsole[15773]: [-------->-------------------] 1 sec
ago 01 14:46:11 pbxtest fwconsole[15773]: [--------->------------------] 1 sec
ago 01 14:46:11 pbxtest fwconsole[15773]: [---------->-----------------] 1 sec
ago 01 14:46:12 pbxtest fwconsole[15773]: [----------->----------------] 1 sec
ago 01 14:46:12 pbxtest fwconsole[15773]: [------------>---------------] 2 secs
ago 01 14:46:12 pbxtest fwconsole[15773]: [------------->--------------] 2 secs
ago 01 14:46:15 pbxtest fwconsole[15773]: [-------------->-------------] 2 secs
ago 01 14:46:15 pbxtest fwconsole[15773]: [--------------->------------] 5 secs
ago 01 14:46:15 pbxtest fwconsole[15773]: Asterisk Started
ago 01 14:46:15 pbxtest systemd[1]: Started FreePBX VoIP Server.
root@pbxtest:/etc/systemd/system# systemctl stop freepbx
root@pbxtest:/etc/systemd/system# systemctl status freepbx
● freepbx.service - FreePBX VoIP Server
Loaded: loaded (/etc/systemd/system/freepbx.service; enabled)
Active: inactive (dead) since lun 2016-08-01 14:48:41 ART; 30s ago
Process: 16005 ExecStop=/usr/sbin/fwconsole stop (code=exited, status=0/SUCCESS)
Process: 15773 ExecStart=/usr/sbin/fwconsole start (code=exited, status=0/SUCCESS)
Main PID: 15773 (code=exited, status=0/SUCCESS)
ago 01 14:48:38 pbxtest systemd[1]: Stopping FreePBX VoIP Server...
ago 01 14:48:39 pbxtest fwconsole[16005]: Running FreePBX shutdown...
ago 01 14:48:39 pbxtest fwconsole[16005]: Shutting down Asterisk Gracefully. Will forcefully kill after 30 seconds.
ago 01 14:48:39 pbxtest fwconsole[16005]: Press C to Cancel
ago 01 14:48:39 pbxtest fwconsole[16005]: Press N to shut down NOW
ago 01 14:48:39 pbxtest fwconsole[16005]: stty: standard input: Inappropriate ioctl for device
ago 01 14:48:39 pbxtest fwconsole[16005]: stty: standard input: Inappropriate ioctl for device
ago 01 14:48:41 pbxtest fwconsole[16005]: [>---------------------------] 1 sec
ago 01 14:48:41 pbxtest fwconsole[16005]: [------>---------------------] 1 sec
ago 01 14:48:41 pbxtest fwconsole[16005]: [---------------->-----------] 1 secstty: standard input: Inappropriate ioctl for device
ago 01 14:48:41 pbxtest systemd[1]: Stopped FreePBX VoIP Server.
Do you thing the message Inappropriate ioctl for device may be due to some configuration of the container or is independent of it?