GOOD NEWS Incredible PBX for RasPi3

Discussion in 'Open Discussion' started by wardmundy, Sep 14, 2017.

  1. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,172
    Likes Received:
    2,391
    A less elaborate, but still helpful, rendition of @TirsoJRP masterpiece...

    [​IMG]

    [​IMG]
     
  2. TirsoJRP

    TirsoJRP Member

    Joined:
    Jan 8, 2015
    Messages:
    79
    Likes Received:
    27
    pbxstatus mod for Raspberry Pi users:

    Adds CPU temperature and chan_dongle details: name, provider, signal level and states.

    replace /usr/local/sbin/pbxstatus with the code below:

    Code:
    #!/bin/bash
    DN="\Z1\ZrDN\Z0\ZR";
    UP="\Zr\Z2UP\Z0\ZR";
    
    if hostname -I > /etc/hostip; then
        _IP="Private IP: `cat /etc/hostip`"
      if [ -f "/etc/pbx/.phone" ]; then
        _PHONE="Ph: `cat /etc/pbx/.phone`"
      else
        _PHONE=" "
      fi
        _PUBLIC="Public  IP: `curl -s -S --user-agent "Mozilla/4.0" http://myip.incrediblepbx.com | awk 'NR==2'` $_PHONE"
    else
       _IP=""
       _PUBLIC=""
    fi
    version=`cat /etc/pbx/.version`
    astversion=`asterisk -rx "core show version" | grep -m 2 ^ | tail -1 | cut -f 2 -d " "`
    fpbxversion=`cat /var/www/html/admin/modules/core/module.xml | grep version | head -n 1 | cut -f 2 -d ">" | cut -f 1 -d "<"`
    OSrelease=`cat /etc/os-release | grep "PRETTY_NAME" | cut -f 2 -d "=" | sed "s|\"||g" | sed "s|(Core)|Core|"`
    #OSrelease=" `cat /etc/os-release | cut -f 1 -d "(" | sed 's|Scientific Linux release|Scientific Linux|'`"
    
    test=`cat /etc/os-release | grep "Scientific Linux"`
    if [[ -z $test ]]; then
     TITLE="Incredible PBX $version for Raspberry Pi 2/3"
    else
     TITLE="  Incredible PBX $version for Scientific Linux"
    fi
    
    test=`asterisk -rx "cdr show status" | grep Enabled`
    if [[ -z $test ]]; then
     asterisk="$DN"
    else
     asterisk="$UP"
    fi
    test=`service apache2 status | grep running`
    if [[ -z $test ]]; then
     apache="$DN"
    else
     apache="$UP"
    fi
    test=`ps aux | grep -c mysqld`
    if [ "$test" -lt "2" ]; then
     mysql="$DN"
    else
     mysql="$UP"
    fi
    test=`service webmin status | grep -c running`
    if [[ -z $test ]]; then
     webmin="$DN"
    else
     webmin="$UP"
    fi
    test=`service ssh status | grep -c running`
    if [[ -z $test ]]; then
     ssh="$DN"
    else
     ssh="$UP"
    fi
    test=`asterisk -rx "module show like sccp" | grep -c Running`
    if [[ -z $test ]]; then
     sccp="$DN"
    else
     sccp="$UP"
    fi
    test=`ps aux | grep -c sendmail`
    if [ "$test" -lt "2" ]; then
     sendmail="$DN"
    else
     sendmail="$UP"
    fi
    test=`ps aux | grep -c faxgetty`
    if [ "$test" -lt "2" ]; then
     faxgetty="$DN"
    else
     faxgetty="$UP"
    fi
    test=`ps aux | grep -c iaxmodem`
    if [ "$test" -lt "2" ]; then
     iaxmodem="$DN"
    else
     iaxmodem="$UP"
    fi
    test=`service fail2ban status | grep running`
    if [[ -z "$test" ]]; then
     fail2ban="$DN"
    else
     fail2ban="$UP"
    fi
    test=`ps aux | grep -c ntpd`
    if [ "$test" -lt "2" ]; then
     ntpd="$DN"
    else
     ntpd="$UP"
    fi
    test=`iptables -nL | grep DROP`
    if [[ -z $test ]]; then
     IPtables="$DN"
    else
     IPtables="$UP"
    fi
    #IPPORT=`ifconfig | head -1 | cut -f 1 -d ":"`
    IPPORT=`ifconfig | grep inet | head -1 | cut -f 2 -d ":" | cut -f 1 -d " "`
    #IPPORT='eth0'
    test=`/sbin/ifconfig | grep -c inet`
    if [ "$test" -lt "2" ]; then
     eth0="$DN"
    else
     eth0="$UP"
    fi
    
    test=`cat /etc/pbx/.version`
    if [[ "$test" < "13-12.17" ]]; then
     gvoauth="$UP"
    else
     gvoauth="$UP"
    fi
    test=`ps aux | grep -c hfaxd`
    if [ "$test" -lt "2" ]; then
     hfax="$DN"
    else
     hfax="$UP"
    fi
    test=`ps aux | grep -c nrservice`
    if [ "$test" -lt "2" ]; then
     nrclient="$DN"
    else
     nrclient="$UP"
    fi
    test=`asterisk -rx "module show like chan_dongle" | grep -c Running`
    if [[ -z $test ]]; then
     chan_dongle="$DN"
    else
     chan_dongle="$UP"
    fi
    
    revision=`cat /proc/cpuinfo | grep Revision | cut -f 2 -d ":"`
    if [ "$revision" = " a21041" ]; then
      model="2B"
    elif [ "$revision" = " a01041" ]; then
      model="2B"
    elif [ "$revision" = " a02082" ]; then
      model="3B"
    elif [ "$revision" = " a22042" ]; then
      model="2B"
    elif [ "$revision" = " a01040" ]; then
      model="2B"
    elif [ "$revision" = " a02082" ]; then
      model="3B"
    elif [ "$revision" = " a22082" ]; then
      model="3B"
    elif [ "$revision" = " a32082" ]; then
      model="3B"
    elif [ "$revision" = " 9000c1" ]; then
      model="ZeroW"
    elif [ "${revision:0:3}" = " 00" ]; then
      model="1"
    elif [ "$revision" = " 900092" ]; then
      model="0"
    else
      model="3"
    fi
    TITLE="Incredible PBX $version for Raspberry Pi $model"
    
    
    RAM=`free | tr -s " " | grep -m 2 ^ | tail -1 | cut -f 4 -d " "`
    if [ -z "$RAM" ]; then
     RAM="`free | grep -m 2 ^ | tail -1 | cut -f 18 -d " "`"
     if [ -z "$RAM" ]; then
      RAM=" `free | grep -m 2 ^ | tail -1 | cut -f 19 -d " "`"
     fi
    fi
    DISK=`df -h | tr -s ' ' |grep " /" | head -n 1 | cut -f 4 -d " "`
    #DISK=`df -h | grep -m 2 ^ | tail -1 | cut -f 15 -d " "`
    if [ -z "$DISK" ]; then
     DISK=" `df -h | grep -m 2 ^ | tail -1 | cut -f 9 -d " "`"
    fi
    if [ "${#DISK}" -eq "4" ]; then
     DISK=" $DISK"
    fi
    
    NOW=`date`
    
    #Temperature
    TEMP=`/opt/vc/bin/vcgencmd measure_temp | cut -d '=' -f2 | sed 's/..$//'`
    
    TEMPINT=`printf '%.*f\n' 0 $TEMP`
    
    if ((TEMPINT <= 40)); then
      TEMP="4\ZB$TEMP°C"
    elif ((TEMPINT >= 40 && TEMPINT <= 50)); then
      TEMP="2\ZB$TEMP°C"
    elif ((TEMPINT >= 50 && TEMPINT <= 60)); then
      TEMP="3$TEMP°C!"
    elif ((TEMPINT >= 60)); then
      TEMP="1$TEMP°C!!"
    fi
    
    #chan_dongle
    devs=0
    IFS=$'\n'
    dongles=`asterisk -rx "dongle show devices" | sed -n '1!p'`
    for don in $dongles
     do
     devs=$((devs+1))
     DEV=`echo $don | cut -c 1-13`
     RSTATE=`echo $don | cut -c 20-30 | sed 's/ //g'`
     PROV=`echo $don | cut -c 49-59 | sed 's/[^ ]\+/\L\u&/g'`
     RSSI=`echo $don | cut -c 31-32 | sed 's/ //g'`
     
    if ((RSSI <= 2)); then
      RSSI="\Z1OOOO"
    elif ((RSSI >= 2 && RSSI <= 9)); then
      RSSI="\Z1●OOO"
    elif ((RSSI >= 10 && RSSI <= 14)); then
      RSSI="\Z3●●OO"
    elif ((RSSI >= 15 && RSSI <= 19)); then
      RSSI="\Z6●●●O"
    elif ((RSSI >= 20)); then
      RSSI="\Z2●●●●"
    fi
    
    PROV="$PROV$RSSI "
     
      case "$RSTATE" in
       Free)
        state="\Z2Free";;
       Dialing)
        state="\Z4Dialing";;
       Outgoing)
        state="\Z6Outgoing call";;
       Notconnec)
        state="\Z1Not Connected";;
       Incoming)
        state="\Z5Incoming call";;
      esac
    
     cdmsg="$cdmsg$DEV$PROV\Zr$state\ZR\Z0\n"
     headers="\nDevice       Provider    Ɏ   State\n\ZB"
    done
    unset IFS
    #end of chan_dongle
    
    MSGLEN=`echo ${#TEMP}`
    
    TOP="\n\ZbAsterisk\ZB: $asterisk      \ZbApache\ZB: $apache \Zb MariaDB\ZB: $mysql\n\ZbSendMail\ZB: $sendmail    \ZbIPtables\ZB: $IPtables      \ZbSSH\ZB: $ssh\n\ZbLAN port\ZB: $eth0    \ZbFail2Ban\ZB: $fail2ban   \ZbWebmin\ZB: $webmin\n\ZbGV OAUTH\ZB: $gvoauth  \Zb Chan-SCCP\ZB: $sccp   \ZbNR VPN\ZB: $nrclient\n\ZbFaxGetty\ZB: $faxgetty  \Zb IAX Modem\ZB: $iaxmodem  \ZbHylaFax\ZB: $hfax\n"
    #DNG="\Z0\ZbChDongle\ZB: $chan_dongle     \ZbDevices:  $devs\n$cdmsg\Z$TEMP\n\Zr\Z4\Zb"
    if [[ $MSGLEN > 7 ]]; then
     DNG="\Z0\ZbTemp \Z$TEMP \Z0\ZbChan_Dongle\ZB: $chan_dongle  \ZbDevices:  $devs\n$cdmsg\n\Zr\Z4\Zb"
    else
     DNG="\Z0\ZbTemp: \Z$TEMP \Z0\ZbChan_Dongle\ZB: $chan_dongle  \ZbDevices:  $devs\n$cdmsg\n\Zr\Z4\Zb"
    fi
    MID="RAM\ZB:$RAM  Raspbian (Jessie)  \ZbDisk\ZB:$DISK\ZR\Z0\n\n\Z5\Zb"
    BOT="Asterisk $astversion  +  GUI ver. $fpbxversion\ZB\Z0\n\n\ZR\Zb$_IP\n\n$_PUBLIC\ZB\n\n\Zb\Z4System Time: $NOW"
    
    
    MSGLEN=`echo ${#MID}`
    
    if [ "$MSGLEN" -gt "95" ]; then
    # MID2=`echo $MID| sed -e 's/  / /g'`
     MID2=$MID
     MID=`echo $MID2| sed -e 's/Disk/ Disk/g'`
     MID2=`echo $MID| sed -e 's/: /:/g'`
    fi
    
    MSG="$TOP$DNG$MID$BOT"
    
    lines=$((22 + devs))
    
    dialog --no-lines --colors --title "$TITLE" --msgbox "$MSG" $lines 47
    
    clear
     
    ostridge likes this.
  3. TirsoJRP

    TirsoJRP Member

    Joined:
    Jan 8, 2015
    Messages:
    79
    Likes Received:
    27
    I am having an issue with chan_dongle IncrediblePBX and I am going nuts on this one.

    I have been able to replicate the issue. On the network where the RPi was configured it works flawlessly (dhcp, reserved, 10.0.1.4/24), If I try on another network (10.0.0.4/24) it is one way audio only.

    As soon as I troubleshoot the issue I will report back.

    Edit 1: It is not limited to chan_dongle.

    Edit 2: No audio on *43... did I miss something with the firewall configuration?
     
    #43 TirsoJRP, Feb 19, 2018
    Last edited: Feb 19, 2018
  4. geopeterwc

    geopeterwc Guru

    Joined:
    Aug 17, 2010
    Messages:
    204
    Likes Received:
    46
    Not the firewall, but the RPi needs to know what network it's on. When you moved the RPi to the new network, did you go back into the Asterisk SIP Settings and update the "Local Network Settings" to reflect the new network? Click the "Detect External IP" button and then "Submit" and "Apply Config"? (I don't know how many times I've been tripped up by failing to perform this very simple, but important step.)

    You can access the RPi GUI from a computer/browser on the same network, provided you know the IP address assigned to the RPi.

    /Pete./
     
    wardmundy likes this.
  5. michaelb

    michaelb New Member

    Joined:
    Feb 12, 2014
    Messages:
    18
    Likes Received:
    2
    Might have to chalk this up to me missing something obvious, but I can't get the 13-13 iso to boot on a rpi3. I've downloaded with different browsers, and used both Etcher and Rufus, but doesn't work.
    Raspbian Stretch can be flashed and booted successfully from this card ( and another one )

    I've tried all 3 cards in 2 different rpi3's as well. no change

    I've tried Lexar, SanDisk and Samsung cards . . .

    Any thoughts would be appreciated.

    Thanks
    Michael
     
  6. TirsoJRP

    TirsoJRP Member

    Joined:
    Jan 8, 2015
    Messages:
    79
    Likes Received:
    27
    Iso? you need the incrediblepbx raspbian image named: incrediblepbx13.13-raspbian8.zip

    Also, extract the image file and burn it to the sd card using Win32 Disk Imager. If that doesn't work try deleting all partitions on the sd card, create a fat32 partition and try again.
     
    wardmundy likes this.
  7. michaelb

    michaelb New Member

    Joined:
    Feb 12, 2014
    Messages:
    18
    Likes Received:
    2
    Yep that was the issue TirsoJRP. I downloaded the incorrect file from sourceforge.

    Thanks for the help
     
  8. atibs1

    atibs1 New Member

    Joined:
    May 20, 2010
    Messages:
    9
    Likes Received:
    0
    Hi,
    Im running incredpbx 02-05-2018 for Raspi on a Pi 3B and in my web gui on the dashboard it is showing me a warning that "No Swap" is found. Does this implimentation require a swap file or does it have enough memory to do without the swap file? Did miss something in the install? I expanded the card and pbxstatus shows 25gb.

    Thanks,
    Drew

    "The swap space of your system is too low (102396 KB). You should have at least 200000 KB of swap space. This should be fixed as soon as possible. Once fixed issue a reload to remove this message"
     
  9. grillovillegas

    Joined:
    Feb 13, 2011
    Messages:
    297
    Likes Received:
    6
    Is there a Stretch version of PIAF for Raspberry Pi 3B ?
     
  10. kyle95wm

    kyle95wm Phone Genius Owner

    Joined:
    Apr 16, 2016
    Messages:
    422
    Likes Received:
    76
    Not currently, and I don't expect to see one anytime soon, unless @wardmundy has been keeping it a secret.
     
  11. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,172
    Likes Received:
    2,391
    Haven't looked at this in a while, but Stretch suffers from the same VoIP issues as Ubuntu 16.04 last time I checked. We basically have to find a way to let PHP 5 coexist with PHP7 AND we have to have support for ODBC. There are workarounds for both on Ubuntu 18.04, and that's why we just released Incredible PBX 13-13 on that platform. Once those two pieces are available for Raspbian Stretch, we'll tackle it.
     
  12. grillovillegas

    Joined:
    Feb 13, 2011
    Messages:
    297
    Likes Received:
    6
    What about Kennonsoft menu for this version ?
     
  13. ostridge

    ostridge Guru

    Joined:
    Jan 22, 2015
    Messages:
    333
    Likes Received:
    56
    Webmin added to Rpi 13-13 but I had probs using IE11 webmin not rendering properly.
    With 13-12 webmin renders fine even with the Cert error in ie11. This is just a heads up as - I Haven't had time to look at it as I'v reverted to12 for now. Will do some migration stuff later. I assume no quick way to reduce the pain.

    Edit - that ie problem went away so OK
     
    #53 ostridge, Jun 27, 2018
    Last edited: Jul 2, 2018
  14. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,172
    Likes Received:
    2,391
    We're ready for the RasPi Pioneers that want to try out the Google Voice implementation with PJSIP. Just follow this week's Nerd Vittles tutorial and substitute the following installation components to get started. MAKE A BACKUP IMAGE BEFORE YOU BEGIN! Do NOT use a 4GB microSD card! Feedback welcomed!
    Code:
    cd /root
    wget http://incrediblepbx.com/gvsip-naf-raspi.tar.gz
    tar zxvf gvsip-naf-raspi.tar.gz
    rm -f gvsip-naf-raspi.tar.gz
    cd gvsip-naf-raspi
    ./install-gvsip.sh
    [​IMG]
     
  15. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,172
    Likes Received:
    2,391
    Minor tweak to the re-register script this morning. If you've already installed and are experiencing issues with failed incoming calls, download and untar the tarball to /tmp and
    Code:
    cp -p /tmp/gvsip-register /root/.
     
  16. Jebs2k

    Jebs2k New Member

    Joined:
    Jun 30, 2018
    Messages:
    6
    Likes Received:
    0
    i ran the gvsip update on a fresh install of 13-13 but after the asterisk and sql services don't start
    it errors saying it can't create an asterisk folder?
     
  17. Waffull

    Waffull New Member

    Joined:
    Jul 2, 2018
    Messages:
    26
    Likes Received:
    1
    Does this require 13.21.1? Because RASPBX Asterisk is currently 13.20.0.
    I've run the upgrade-raspbx and it doesn't have any updates.

    I went through the nerd vittles/raspi code setup and don't see any difference in the server config. Maybe I'm missing the part where we have to setup a trunk/inbound route/outbound route. But I don't see a specific trunk type for raspbx.

    Thanks,
    M

     
  18. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,172
    Likes Received:
    2,391
    When you run the install script above, it will upgrade Asterisk to 13.21.1 as part of the install. 13.21.1 is required.
     
    Waffull likes this.
  19. ostridge

    ostridge Guru

    Joined:
    Jan 22, 2015
    Messages:
    333
    Likes Received:
    56
    WiFi wasn't working so had to do some reading around
    https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md
    https://wiki.archlinux.org/index.php/dhcpcd#10-wpa_supplicant
    https://manpages.debian.org/jessie/wpasupplicant/wpa_supplicant.conf.5.en.html
    Then tried a few commands:
    Code:
     wpa_cli -i wlan0 reconfigure
    Failed to connect to non-global ctrl_ifname: wlan0  error: No such file or directory
    File /etc/wpa_supplicant/wpa_supplicant.conf was pointing to non existant ctrl_interface=DIR
    Code:
    File /etc/wpa_supplicant/wpa_supplicant.conf
    country=GB
    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    So to create the directory:
    Code:
    mkdir /var/run/wpa_supplicant
    chown root:netdev /var/run/wpa_supplicant
    chmod 775 /var/run/wpa_supplicant
    Tip (from the ArchLinux writeup), if wanting new IP for eth0 and/or wlan0 find the lease file here
    Code:
     ls -al /var/lib/dhcpcd5/dhcpcd*
    -rw-r--r-- 1 root root 278 Jul  3 00:30 /var/lib/dhcpcd5/dhcpcd-eth0.lease
    -rw-r--r-- 1 root root 278 Jul  3 00:25 /var/lib/dhcpcd5/dhcpcd-wlan0.lease
    then rename or delete the lease file
    mv /var/lib/dhcpcd5/dhcpcd-wlan0.lease /var/lib/dhcpcd5/dhcpcd-wlan0.lease.old
    mv /var/lib/dhcpcd5/dhcpcd-eth0.lease /var/lib/dhcpcd5/dhcpcd-eth0.lease.old

    Try invoke /sbin/wpa_supplicant directly with
    Code:
      /sbin/wpa_supplicant -P /var/run/wpa_supplicant.wlan0.pid -i wlan0 \
     -D nl80211,wext -c /etc/wpa_supplicant/wpa_supplicant.conf
    Successfully initialized wpa_supplicant
    wlan0: Trying to associate with 18:90:d8:ad:8a:87 (SSID='SKY355F7' freq=2462 MHz)
    wlan0: Associated with 18:90:d8:ad:8a:87
    wlan0: WPA: Key negotiation completed with 18:90:d8:ad:8a:87 [PTK=CCMP GTK=CCMP]
    wlan0: CTRL-EVENT-CONNECTED - Connection to 18:90:d8:ad:8a:87 completed [id=0 id_str=SKY355F7-PBX.A13.G12]
    wlan0: CTRL-EVENT-REGDOM-CHANGE init=COUNTRY_IE type=COUNTRY alpha2=GB
    ^C (did a ctrl+C on hang to terminate)
    wlan0: CTRL-EVENT-DISCONNECTED bssid=18:90:d8:ad:8a:87 reason=3 locally_generated=1
    wlan0: CTRL-EVENT-TERMINATING
    Code:
     ifup wlan0
    pbxstatus
    
    OK SOLVED
    @wardmundy please add the missing DIR
    Code:
     ls -al  /var/run/wpa_supplican*
    -rw-r--r-- 1 root root    6 Jul  3 00:25 /var/run/wpa_supplicant.wlan0.pid
    
    /var/run/wpa_supplicant:
    total 0
    drwxr-x---  2 root netdev  60 Jul  3 00:25 .
    drwxr-xr-x 24 root root   900 Jul  3 00:33 ..
    srwxrwx---  1 root netdev   0 Jul  3 00:25 wlan0
    
     ls -ald /var/run/wpa_supplicant
    drwxr-x--- 2 root netdev 60 Jul  3 01:30 /var/run/wpa_supplicant
     
    #59 ostridge, Jul 2, 2018
    Last edited: Jul 2, 2018
  20. Waffull

    Waffull New Member

    Joined:
    Jul 2, 2018
    Messages:
    26
    Likes Received:
    1
    Thanks. I ran the script, and similar to @Jebs2k above, it was a fresh incrediblepbx 13-13 install.. now asterisk/mysql won't start now. I'm on a RasPi 3B+. I decided to try another reboot and this is what it reported:

    root@incrediblepbx:~# reboot
    Exception: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)::SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in file /var/www/html/admin/libraries/utility.functions.php on line 204
    Stack trace:
    1. Exception->() /var/www/html/admin/libraries/utility.functions.php:204
    2. die_freepbx() /var/www/html/admin/libraries/BMO/Database.class.php:136
    3. PDOException->() /var/www/html/admin/libraries/BMO/Database.class.php:133
    4. PDO->__construct() /var/www/html/admin/libraries/BMO/Database.class.php:133
    5. FreePBX\Database->__construct() /var/www/html/admin/libraries/BMO/FreePBX.class.php:69
    6. FreePBX->__construct() /var/www/html/admin/bootstrap.php:139
    7. require_once() /etc/freepbx.conf:9
    8. include_once() /usr/local/sbin/fwconsole:12
    [ ok ] Stopping mysql (via systemctl): mysql.service.
    [....] Stopping apache2 (via systemctl): apache2.serviceWarning: Unit file of apache2.service changed on disk, 'systemctl daemon-reload' recommended.
    . ok


     

Share This Page