Menu

Can not Connect to asterisk pbx

2017-03-18
2017-03-18
  • Aristotelis Poyrfiotis

    Hello to all.
    I'm trying to install raspbx but every time(10) i have the same problem
    at freepbx i get the red "can not connect to asterisk" message.
    every time i follow the tutorial(i install it 10 times word by word).
    when first boot at raspbx i run raspi-config (expand_rootfs) - reboot- then run raspbx-upgrade - reboot
    and i get "can not connect to asterisk".......
    after

    ps -ef | grep /usr/sbin/asterisk``
    

    and i get
    root 19090 16638 0 12:18 pts/0 00:00:00 grep /usr/sbin/asterisk

    chmod 755 /var/lib/asterisk/bin/fwconsole
    fwconsole chown
    fwconsole start
    ps -ef | grep /usr/sbin/asterisk
    

    i get
    asterisk 18662 18660 74 12:16 pts/0 00:01:00 /usr/sbin/asterisk -f -U asterisk -G asterisk -vvvg -c
    root 19090 16638 0 12:18 pts/0 00:00:00 grep /usr/sbin/asterisk

    and then i can connect to asterisk with freepbx.
    if i reboot i have to do again

    chmod 755 /var/lib/asterisk/bin/fwconsole
    fwconsole chown
    fwconsole start
    

    What Is Wrong?

    Thank you.

     
  • Gernot

    Gernot - 2017-03-19

    It is a bit strange you have this problem, as we have been through this before. Have a look at the file /usr/sbin/safe_fwconsole it does exactly the same what you described. And the startup script /etc/systemd/system/freepbx.service uses the safe_fwconsole script to start Asterisk. Run the command systemctl status freepbx to make sure the above script is active. Maybe you have different startup scripts on your system?

     
  • Maxim

    Maxim - 2017-04-14

    Hi. I have the same problem. What needs to be changed?

    /usr/sbin/safe_fwconsole

    FILE1=/var/lib/asterisk/bin/fwconsole

    if [ -f $FILE1 ]
    then
    if [ ! -x $FILE1 ]
    then
    chmod 755 $FILE1
    $FILE1 chown
    fi
    $FILE1 $@
    else
    exit 1
    fi

    /etc/systemd/system/freepbx.service

    [Unit]
    Description=FreePBX VoIP Server
    After=mysql.service

    [Service]
    Type=oneshot
    RemainAfterExit=yes
    ExecStart=/usr/sbin/safe_fwconsole start
    ExecStop=/usr/sbin/safe_fwconsole stop

    [Install]
    WantedBy=multi-user.target

    systemctl status freepbx

    ● freepbx.service - FreePBX VoIP Server
    Loaded: loaded (/etc/systemd/system/freepbx.service; enabled)
    Active: failed (Result: exit-code) since Пт 2017-04-14 08:30:20 +06; 1h 45min ago
    Process: 1294 ExecStart=/usr/sbin/safe_fwconsole start (code=exited, status=1/FAILURE)
    Main PID: 1294 (code=exited, status=1/FAILURE)

    апр 14 08:30:15 raspbx safe_fwconsole[1294]: [------------>--------------...s
    апр 14 08:30:16 raspbx safe_fwconsole[1294]
    : [------------->-------------...s
    апр 14 08:30:17 raspbx safe_fwconsole[1294]
    : [-------------->------------...s
    апр 14 08:30:18 raspbx safe_fwconsole[1294]
    : [--------------->-----------...s
    апр 14 08:30:18 raspbx safe_fwconsole[1294]
    : [Exception]
    апр 14 08:30:18 raspbx safe_fwconsole[1294]: Unable to connect to Asteris...?
    апр 14 08:30:18 raspbx safe_fwconsole[1294]: start [--pre] [--post] [--sk...]
    апр 14 08:30:18 raspbx systemd[1]: freepbx.service: main process exited,...RE
    апр 14 08:30:20 raspbx systemd[1]: Failed to start FreePBX VoIP Server.
    апр 14 08:30:20 raspbx systemd[1]: Unit freepbx.service entered failed state.
    Hint: Some lines were ellipsized, use -l to show in full.

    Thank you in advance

     
    • Gernot

      Gernot - 2017-04-16

      Does it start when you call fwconsole start ?
      Is this a Pi1 with a rather slow SD card? The error looks like the chown phase of fwconsole took too long. It can happen on a Pi1, if the process takes much more than 5 minutes the FreePBX startup script just stops because it thinks it should have finished by then.
      It might help to use a faster SD card if you still want to stick with the Pi 1.

       
  • Evgenii

    Evgenii - 2017-04-23

    Gernot,
    I have recently came across pretty much the same problem. Once I restart my FreePBX Server (rides on top of Raspberry Pi model B) with /sbin/reboot then it doesn't strat up automatically:

     
  • Evgenii

    Evgenii - 2017-04-23

    ● freepbx.service - FreePBX VoIP Server
    Loaded: loaded (/etc/systemd/system/freepbx.service; enabled)
    Active: failed (Result: exit-code) since Sat 2017-04-22 19:34:04 CDT; 7min ago
    Process: 1585 ExecStart=/usr/sbin/safe_fwconsole start (code=exited, status=1/FAILURE)
    Main PID: 1585 (code=exited, status=1/FAILURE)

     
  • Evgenii

    Evgenii - 2017-04-23

    I read your guess that it might be due to the raspberry pi 1 model B hardware capabilities, however it was running like a charm without any problems for along time and only a while ago I noticed this issue. This makes me to believe that the code itself may cause the problem, not hardware.

     
  • Evgenii

    Evgenii - 2017-04-23

    I went ahead and performed some testing. I have two devices: RPI 3 model B and RPI 1 model B. Both run Raspbx (Asterisk + FreePBX, nothing more). The issue I described above is specific to RPI 1 model B only. I rebooted my RPI 3 model B a few times and it successfully restarted.
    With that in mind it is likely to be what Gernot mentined above. However, let me be repiatative, this was not observed, for example, a month ago. I have a steady feeling that it with some updates.

    Gentlemen,
    I would appreciate any help on this, as the problem drives me nuts.

     
  • Evgenii

    Evgenii - 2017-04-25

    For those, who may stumble across the same issue - the workaround is to disable FreePBX web interface and a few adjacent service to allow for bare Asterisk startup and run:

    systemctl disable mysql.service
    systemctl disable apache2.service
    systemctl disable freepbx.service
    

    This configuration will persist after reboot and make it possible for Asterisk to start. You may also play with unused Asterisk modules to speed up the boot process as well.

    You can always revert to where your starting point:

    systemctl start mysql.service
    systemctl start apache2.service
    fwconsole start
    systemctl start freepbx.service
    
     
  • Gernot

    Gernot - 2017-05-06

    Could you please try this: Edit the file /etc/systemd/system/freepbx.service and change this line from

    ExecStart=/usr/sbin/safe_fwconsole start
    

    to

    ExecStart=/usr/sbin/safe_fwconsole --skipchown start
    

    Then reboot. This will considerably speed up boot time.

    I took an old Pi 1 with a class 6 SD card here and it showed the same problem, but not every time I rebooted, just once in a while. It looks like a timeout in the fwconsole script. But it is not clear to me what really causes the timeout, because the start process always takes about the same amount of time, and one time it workes and another time it does not.

    If you can confirm everything is working stable with the --skipchown modification I will put this into the image for everyone.

     

Log in to post a comment.