PIONEERS RasPi3: Incredible PBX for XiVO

Discussion in 'Developers' Corner' started by wardmundy, Aug 24, 2016.

  1. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,701
    Likes Received:
    2,512
    We've put up the final release image of Incredible PBX for XiVO. It works only on the Raspberry Pi 3. Don't even attempt it on a RasPi 2. XiVO requires a lot of resources, and the RasPi 2 simply does not have the necessary horsepower. The 1.3GB image and a Mac script to create a microSD card from the image are both available on SourceForge. Be sure to use at least an 8GB microSD card, preferably 16GB or larger. Don't even waste your time without a Class 10 card!

    Special thanks to Iris-Network for the original Raspivo - XiVO build. XiVO 16.10 with Asterisk 13.10.0 now available Newer build with WiFi and Bluetooth support available after 4:30 p.m. EDT, Sunday, 08/28/2016.


    [​IMG]


    1. Download and unzip image to your desktop
    2. Burn image to microSD card
    3. Boot RasPi 3 from microSD card
    4. Log in as root with password of password
    5. Initial config will place you in raspi-config to resize the image to your SD card's dimensions
    6. After reboot, login from desktop PC using SSH or Putty at the IP address shown in step #5 to set up passwords
    7. After install completes, add trunks and inbound and outbound routes as desired (see below).

    NOTE: Google Voice scripts to add-gvtrunk and del-gvtrunk are preconfigured and ready to run in /root.

    To get started with other trunks, point a web browser to the IP address of your PBX. Login as root with the XiVO GUI password you set up above. If you ever forget your password, you can run /root/admin-pw-change to reconfigure it.

    XIVO Trunk Implementation Tutorials
    Once you’ve added one or more trunks, you’ll need to tell XiVO how to route outgoing and incoming calls. Here are our step-by-step tutorials on setting up Outbound Calling Routes and Incoming Call Routes:

    XIVO Call Routing Tutorials

    Basically, this install is the same setup as the one for VirtualBox in this week's Nerd Vittles article.

    The original Incredible PBX for XiVO tutorial is here.

    Feedback appreciated!
     
    #1 wardmundy, Aug 24, 2016
    Last edited: Aug 28, 2016
  2. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,701
    Likes Received:
    2,512
    #2 wardmundy, Aug 26, 2016
    Last edited: Aug 26, 2016
  3. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,701
    Likes Received:
    2,512
    For security reasons, we've chosen not to load phpPgAdmin on the RasPi platform. If you'd like to add it (look, but don't touch), here's how:

    Installation:

    Code:
    apt-get update
    apt-get install phppgadmin -y
    mv /usr/share/phppgadmin /var/www/html/.
    
    Browser Access: http://raspi-ipaddress/phppgadmin

    Login to PostgreSQL:

    u: asterisk
    p: proformatique
     
  4. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,701
    Likes Received:
    2,512
    show-extensions (now included in 20160828 build)

    Here's a quick and dirty script you can use to display all of your extension and SIP trunk credentials from the Linux CLI:

    Code:
    #!/bin/bash
    
    export PGPASSWORD='proformatique'; psql -P pager=off -U asterisk -d asterisk -c "SELECT host,callerid,name,secret FROM usersip order by callerid"
     
    #4 wardmundy, Aug 26, 2016
    Last edited: Aug 29, 2016
  5. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,701
    Likes Received:
    2,512
    Final build before official release should be available on SourceForge after 4 p.m. EDT, Sunday. This build adds WiFi and Bluetooth support.
     
  6. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,701
    Likes Received:
    2,512
    Turn off the logs to preserve your microSD card. Tutorial here.
     
    #6 wardmundy, Aug 29, 2016
    Last edited: Sep 2, 2016
  7. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,701
    Likes Received:
    2,512
    Installing the Google Voice Command Line Interface and SMS Message Blasting

    Special thanks to Nick Pettazzoni for the latest fixes!! Complete pygooglevoice documentation here.

    For those that want the Google Voice command line interface as well as SMS messaging for Incredible PBX for XiVO, here's how to update your build. NOTE: This software already is installed with Raspberry Pi builds on or after 20160828.

    Code:
    cd /root
    wget http://incrediblepbx.com/install-gv-cli
    chmod +x install-gv-cli
    ./install-gv-cli
    
    Enabling a GMail Account for Use with gvoice and SMS Message Blasting

    Be advised that the Google Voice CLI interface (gvoice) uses plain-text Google Voice passwords, not OAuth. Before most Google Voice accounts will work with gvoice and smsblast, you'll need to do the following and then immediately login with gvoice at least once to mark your account as safe for access from this location. Here are the steps:
    1. Log in to the Gmail account you plan to use with gvoice
    2. While logged in, open a new browser tab to this site and enable Less Secure Apps
    3. Open another browser tab and enable the Google Reset procedure here
    4. Return immediately to your RasPi's Linux CLI, and login to gvoice
    Creating an SMS Message Blast with Incredible PBX for XiVO
    1. Edit /root/smsmsg.txt and insert the text message to be sent
    2. Edit /root/smslist.txt and create a list of the phone numbers to receive the SMS message
    3. Edit /root/smsblast and insert your gvoice username and password
    4. Run /root/smsblast to kick off the SMS Blast
     
    #7 wardmundy, Aug 29, 2016
    Last edited: Sep 1, 2016
  8. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,701
    Likes Received:
    2,512
    New Incredible PBX for XiVO build for Raspberry Pi 3 now available on SourceForge.

    Lots of new features including WiFI and Bluetooth support, Time of Day (*61 or 8463), Tell Me My Extension (*65), Google Voice CLI (gvoice), SMS Messaging with Google, most logs disabled to improve microSD longevity, zero out SD card script to prep for backups, and more...

    Complete tutorial here: http://nerdvittles.com/?p=19286
     
    #8 wardmundy, Sep 2, 2016
    Last edited: Sep 2, 2016
  9. SMTC

    SMTC Member

    Joined:
    Jan 22, 2009
    Messages:
    162
    Likes Received:
    8
    Hi Ward,
    Exciting times! Xivo = happy, Pi3 = nice performing platform.

    But where can I get on the train? Seems there are new and desirables coming out almost daily.

    How easy or difficult are updates to apply as script patches afterwards or during the automagic update during the boot?

    ie. I have the version with the logs on and now want to turn them off. And, now would like to add some of the above in the 9 am release.

    BTW, the Sourceforge downloads seem super-slow, 1.3 G at a time, even on my Broadband connect back in the office, so don't want to keep downloading and downloading...

    Waiting with bated breath...

    J
    :-D
     
    wardmundy likes this.
  10. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,701
    Likes Received:
    2,512
    Most of the updates are referenced in this thread or this one, and we'll add the missing ones shortly.
     
  11. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,701
    Likes Received:
    2,512
    Deploying an External USB Drive on the Raspberry Pi 3 Platform

    [​IMG]

    If you're worried about wear and tear on your microSD card running Incredible PBX for XiVO, the simple solution is to install a USB drive. A hard drive or thumb drive will work but thumb drives also wear out quicker than hard drives. Keep in mind that a RasPi always has to boot from a microSD card so keep this card in the Raspberry Pi at all times!

    Preliminary steps:

    1. Buy a USB 2.0 (not USB 3.0!) drive
    2. Format at least a 4GB microSD card AND your USB drive as FAT32 DOS
    3. Copy the latest Incredible PBX for XiVO image to both drives
    4. Boot the Raspberry Pi 3 from the microSD card. Don't plug in the USB drive just yet.
    5. Log in as root and press Ctrl-C to kill the Incredible PBX installer
    6. Plug in your USB drive
    7. Issue the following commands while logged in as root:
    Code:
    sed -i 's|mmcblk0p2|sda2|' /boot/cmdline.txt
    reboot
    Initial Setup of Incredible PBX for XiVO:

    When the reboot completes, you should be running from your USB drive if all went well. Wait a full minute after the reboot finishes before logging in as root. Complete Phase I of the Incredible PBX install, skip the expand image step (since it won't work), and reboot. Wait a full minute after the reboot finishes before logging in as root. Complete Phase II of the Incredible PBX install. Then exit from pbxstatus to the CLI.

    Expanding the Incredible PBX Image to Fill Your USB Drive:

    Now let's expand the Incredible PBX image to fill the entire drive. Issue the following commands:

    Code:
    sed -i 's|xivo|xivo-HD|' /etc/hostname
    sed -i 's|xivo|xivo-HD|g' /etc/hosts
    fdisk /dev/sda
    p
    ### write down starting sector for /dev/sda2 (e.g. 137216 on our 1GB drive)
    d
    2
    n
    p
    2
    # enter sector number you wrote down above
    # press ENTER at last sector prompt
    w
    reboot
    # type xivo at hostname prompt
    # wait a full minute after reboot completes for all services to come on line
    # login as root again
    resize2fs /dev/sda2
    reboot
    # type xivo-HD at hostname prompt
    # fsck may automatically clean up your hard disk during the reboot process
    # be patient
    
    ALWAYS wait a full minute after a reboot completes before logging back in as root!

    Credits: Ste Wright
     
    #11 wardmundy, Sep 2, 2016
    Last edited: Sep 2, 2016
  12. jerrm

    jerrm Guru

    Joined:
    Sep 23, 2015
    Messages:
    449
    Likes Received:
    176
    Why the "not USB 3.0!" warning?

    I don't know of any issues with USB3 drives on a Pi. I haven't bought USB2 anything for quite a while. Even WD's "PiDrive" is a USB3 drive. With virtually no price difference better to future-proof.

    Of course, the Pi will only be capable of USB2 speeds.
     
  13. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,701
    Likes Received:
    2,512
    #13 wardmundy, Sep 2, 2016
    Last edited: Sep 2, 2016
  14. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,701
    Likes Received:
    2,512
    Setting Up SAMBA on Raspberry Pi 3

    Code:
    apt-get update
    apt-get install samba samba-common-bin -y
    smbpasswd -a pi
    
    Edit /etc/samba/smb.conf and make it look like this using whatever Windows workgroup you happen to use:

    Code:
    [global]
    security = user
    workgroup = WORKGROUP
    
    [RasPi3]
    path = /
    available = yes
    valid users = @users
    read only = no
    browsable = yes
    public = yes
    writable = yes
    
    Restart SAMBA: /etc/init.d/samba restart

    Login to the SAMBA share RasPi3 as pi with the password you assigned.
     
    #14 wardmundy, Sep 2, 2016
    Last edited: Sep 2, 2016
  15. jerrm

    jerrm Guru

    Joined:
    Sep 23, 2015
    Messages:
    449
    Likes Received:
    176
  16. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,701
    Likes Received:
    2,512
    Buy what you think is best. The RasPi 3 has four "outdated" USB 2.0 ports. If you're going to use an external drive with it, I'd use a USB 2.0 drive because many USB 3.0 drives cost more and you only get USB 2.0 speeds, but to each his own. Some USB 3.0 drives only come with a 3.0 cable which won't work in a 2.0 port. I would also expect 3.0 drives to draw more current since they have better processors to support faster performance, but I haven't researched whether that is the case and, if so, whether you would also need a powered USB hub in addition to the drive.
    :beatdeadhorse5:
     
    #16 wardmundy, Sep 2, 2016
    Last edited: Sep 2, 2016
  17. lrosenman

    lrosenman Guru

    Joined:
    Oct 17, 2014
    Messages:
    222
    Likes Received:
    30
    Is there a way to upgrade in place from 20160828 to current or do we need to burn a new image?
     
  18. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,701
    Likes Received:
    2,512
    You can manually add the new components following the tutorials here.
     
  19. restamp

    restamp Member

    Joined:
    Apr 24, 2016
    Messages:
    97
    Likes Received:
    52
    Actually, as fate would have it, I purchased a USB3.0 external hard drive last week and have been using it on a SheevaPlug on an outdated USB2.0 port using the supplied cable. Aside from the fact that it is noticeably slower, it works fine: The end of the cable that connects to the
    drive is of course not compatible with the 2.0 mini-USB receptacle, but the other end (I think it is called an A-connector, it's the one with the rectangular plug) fits into the 2.0 receptacle on the SheevaPlug fine. I'm not sure if a standard USB2.0 cable would work -- it looks like it might, but I haven't tried it.

    YMMV.
     
  20. Stephen Harrington

    Stephen Harrington New Member

    Joined:
    May 25, 2013
    Messages:
    11
    Likes Received:
    2
    How worried should I be in practice about the MicroSD cards "wearing out" with XiVO in 24/7 Ward?
    For me personally the idea of using "spinning rust" with the Pi 3 goes against the simplicity, reliability and low power consumption of the Pi concept, but each to his own of course!
    My own habit with the Pi's is to buy cards in pairs and being mainly Mac-based for my day to day stuff I do full image backups and copies using the ApplePi-Baker utility.
    Maybe I've been lucky so far and should be more concerned about SD cards failing?

    StephenH

    P.S. Googling SD card wear issues I see references to using something called "tmpfs" and tweaking various parameters to reduce writes of various logs and so on for on Linux-based systems to extend life of SD cards ... would this be a feasible approach to get XiVO on Pi optimally "tuned" for longish card life?
     
    #20 Stephen Harrington, Sep 2, 2016
    Last edited: Sep 2, 2016