Failed to start FreePBX Voip Server on boot

Dear Gurus,
I used to use a lot of automation (shell scripts) to make sure my Raspberry Pi with FreepBX on-board will be running mostly without my interference. However, since a while ago I noticed that once I have my Raspberry Pi romtely rebooted with /sbin/renoot (being a root) via script, sometimes Asterisk doesn’t start automatically, or I am getting the following error when Issue systemctl status -l freepbx.service

root@raspbx:~# systemctl status freepbx.service
Display all 208 possibilities? (y or n)
root@raspbx:~# systemctl status freepbx.service
* freepbx.service - FreePBX VoIP Server
_ Loaded: loaded (/etc/systemd/system/freepbx.service; enabled)_
_ Active: failed (Result: exit-code) since Sat 2017-04-22 12:15:25 CDT; 1min 46s ago_
_ Process: 1572 ExecStart=/usr/sbin/safe_fwconsole start (code=exited, status=1/FAILURE)_
_ Main PID: 1572 (code=exited, status=1/FAILURE)_

Apr 22 12:14:09 raspbx safe_fwconsole[1572]: [------------>---------------] 2 mins
Apr 22 12:14:10 raspbx safe_fwconsole[1572]: [------------->--------------] 2 mins
Apr 22 12:14:10 raspbx safe_fwconsole[1572]: [-------------->-------------] 2 mins
Apr 22 12:14:11 raspbx safe_fwconsole[1572]: [--------------->------------] 2 mins
Apr 22 12:14:11 raspbx safe_fwconsole[1572]: [Exception]
Apr 22 12:14:11 raspbx safe_fwconsole[1572]: Unable to connect to Asterisk. Did it start?
Apr 22 12:14:11 raspbx safe_fwconsole[1572]: start [–pre] [–post] [–skipchown] [args1] … [argsN]
Apr 22 12:14:12 raspbx systemd[1]: freepbx.service: main process exited, code=exited, status=1/FAILURE
Apr 22 12:15:25 raspbx systemd[1]: Failed to start FreePBX VoIP Server.
Apr 22 12:15:25 raspbx systemd[1]: Unit freepbx.service entered failed state.
root@raspbx:~# systemctl start freepbx.service

After that I have to make Asterisk and FreePBX to work with fwconsole restart command.

Please give me an idea where to look for the root of the problem.

Thank you.

With regards, Evgenii.