Setup trunk with Maxo Telecom

 

1/ Enter the following into PEER Details:

context=from-trunk
fromdomain=sip.maxo.com.au  => (or pbx.maxo.com.au)
fromuser=
ext
host=sip.maxo.com.au => (or pbx.maxo.com.au)
insecure=very
secret=
extpassword
type=peer
username=ext

2. Type your ext into “User Context”

3. Enter the following into USER Details:

context=from-trunk
insecure=very
secret=
extpassword
type=user

4. Enter this into your register string:

ext:secret@sip.maxo.com.au/ext =>(or ext:secret@sip.maxo.com.au/DID)

5. Example:

register=70001:12345@sip.maxo.com.au/70001 or (70001:12345@sip.maxo.com.au/17273456789)

[70001]
type=user
secret=12345
insecure=very
context=from-trunk

[maxo]
username=70001
type=peer
secret=12345
insecure=very
host=sip.maxo.com.au
fromuser=70001
fromdomain=sip.maxo.com.au

Installing Elastix 2.5 on CentOS 5.x VPS

Step 1: login to your VPS and update your CentOS

# yum -y update

Step 2: Download the required Elastix ISO

wget https://sourceforge.net/projects/elastix/files/Elastix%20PBX%20Appliance%20Software/2.5.0/Elastix-2.5.0-Stable-x86_64-bin-21oct2014.iso –no-check-certificate

Step 3. Mount the ISO

# mkdir /mnt/iso
# mount -o loop Elastix-2.5.0-Stable-x86_64-bin-21oct2014.iso /mnt/iso
# cd /mnt/iso

 

Step 4. Create the elastix repo file
# vi /etc/yum.repos.d/elastix-cd.repo

Copy and paste lines below:

[elastix-cd]
name=Elastix RPM Repo CD
baseurl=file:///mnt/iso/
gpgcheck=0
enabled=1

Step 5: Install Elastix
# yum install -y asterisk* elastix*

Step 6:  Reboot your vps. take note you will get disconnected. Log back in. 
# Reboot

Step 7: Start services

#service httpd start

#service mysqld start

#chkconfig –level 345 mysqld on
#chkconfig –level 345 httpd on

Step 8: type the following command to change elastix admin and mysql root password

# /etc/rc3.d/S66elastix-firstboot start

Step 9: secure mysql server

#mysql_secure_installation

Step 10: Reboot again and login

Reboot

 

Creating a Standby Freepbx Server for High Availability

Terminology used

HA = High Availability.  Does not necessarily imply automatic failover.  Just less potential unavailability.

Primary server = Live production server currently in use.

Secondary server = Standby server with periodically restored configuration/data of primary server.

SIP Trunk = Session Initated Protocol Trunk.  A Voice over Internet Protocol (VoIP) virtual phone line over an IP network.  The main difference between a SIP trunk and a traditional phone line is that a SIP trunk is a logical connection rather than a dedicated circuit.   You can have multiple simultaneous calls on one SIP trunk all sharing the same IP network connection.

DID = Direct Inward Dialing.  In the context of VoIP and SIP trunks, the SIP trunk provider supplies one or more trunks to the customer for connection to the customers PBX. They can also allocate a telephone number or range of numbers to this trunk (or trunks) and forward all calls to such numbers to the trunk(s).

DNS = Domain Name System.  A system for translating human-friendly computer hostnames into IP addresses.

Failover considerations

DNS
Using DNS names instead of IP’s for your extensions and configurations has advantages and disadvantages.  Some DNS providers have automatic failover of the DNS by monitoring the availability of your primary server.  So this could go a long way to providing automatic failover.  Otherwise you would have to make the change manually. A disadvantage of using DNS failover is that changes do not take effect immediately.  You could set a very low TTL (Time To Live) to try minimize the delay but it could still be awhile before changes take effect.  Anywhere from minutes to hours.

Extensions
If you do not use DNS or your phones do not support that you will have to change the IP address of the server that your extensions point to.   There may be a delay until the next time the phone re-registers with the server or you may have to reboot the phone after the change.

Trunks
If you are using SIP trunks it will vary depending on the provider.  Using IP authentication on 2 subaccounts on the SIP trunk provider end is one possibility if supported.  That allows the trunk to be live for outgoing calls on both servers at all times.  If using username/password authentication you will also likely need 2 separate subaccounts that use different usernames/passwords.  Fortunately, the HA backup/restore feature in FreePBX accounts for that possibility. It allows you to optionally disable restored trunks on the secondary server if they include a registration string.

Inbound Calls
DID numbers allow inbound calls and are typically assigned to one trunk and one subaccount.  If you are using a single registration string you would have to enable the trunk(s) on the secondary server when the primary is not functioning.  The DID’s should become active on the secondary server as soon as the trunks register.  If using IP authentication, the DID number(s) will need to be switched over to the secondary server on the SIP trunk provider end. Some SIP trunk providers support automatic failover for this.

Extension Provisioning
If you provision extensions with TFTP you need to add the tftp folder to the backup schedule. If you do not use DNS, the TFTP IP address will need to be manually changed on the phone.  The IP addresses used in the TFTP configurations files on the standby server would need to be changed if you are not using DNS. However, this may not present a problem in the short term because the phones will keep their existing configuration if they cannot find a TFTP server.

Call Detail Records and Voicemail
This procedure is not a realtime mirrored solution so CDR and voicemail will not be current.  Since this HA solution is meant to be temporary until the primary server is up and running again, there isn’t much reason to restore CDR on the secondary server. If you do, keep in mind you will erase existing CDR information not present on the primary server each time you restore.

Setting up the SSH connection

I used user asterisk on primary and secondary server.  You could use root user but there are security implications.  This procedure assumes Apache/FreePBX  run as user asterisk in the home directory /var/lib/asterisk.  You can check all usernames, home directories, and shell settings by running cat /etc/passwd.

On primary server:
#chsh -s /bin/bash asterisk
#passwd asterisk
somepassword
#chmod 755 /var/lib/asterisk

On secondary server:
#chsh -s /bin/bash asterisk
#su asterisk
$ssh-keygen
Do NOT enter a passphrase when asked.

That last command will create the rsa 2048 bit key pair and save the 2 files in /var/lib/asterisk/.ssh/

Still running in a shell on the secondary server as user asterisk, create the remote directories, remote public key (authorized_keys) file, and set permissions for everything with this one command.

$ssh-copy-id -i asterisk@primaryServerIP
or if using ssh port other than 22
$ssh-copy-id -i '-p xxxx asterisk@PrimaryServerIP'

To test

$ssh asterisk@PrimaryServerIP
or if using ssh port other than 22
$ssh -p xxxx asterisk@PrimaryServerIP

If the secondary server logs into the primary server without asking for a password then the keys are working. First time it will ask to add host fingerprint.  It will not work on it’s own in the background until that is done.

Now that keys and fingerprint are added and working remove asterisk password on primary server.   SSH login using usernames is not possible by default if there is no password.

On primary server:
#passwd -d asterisk

——————————-
Fix for permission problems

The current version of ssh-copy-id sets permissions with group write which SSH StrictModes does not allow.  In addition to this, Freepbx currently resets /var/lib/asterisk folder permission to 775 after each reload. This also violates StrictModes permission limits and causes key authentication to fail.

The simplest solution is to disable SSH StrictModes on the primary server by editing /etc/ssh/sshd_config.
Uncomment and set to no.
StrictModes no

Alternatively you can change asterisk user home directory to /home on both servers and redo this procedure, substituting in the new directory.  Then on the primary server as root run the following to fix permissions.

#chmod 700 /home/asterisk
#chmod 700 /home/asterisk/.ssh
#chmod 600 /home/asterisk/.ssh/authorized_keys

——————————-

Create the SSH server

Now that we have an SSH connection to the primary server we can create the SSH server in the FreePBX Backup & Restore module on the secondary server.  Go to Admin>Backup & Restore>Servers>New SSH Server on the secondary server and enter the relevant information.  As shown in screenshot below, the private key file we generated when we ran ssh-keygen is /var/lib/asterisk/.ssh/id_rsa .

SSH server setup

Select Backup Items

Go to Backups>New Backup and give it a name.  Select what you want to backup/restore from the primary server by dragging and dropping the templates.  Assuming you want everything you would select the following templates.  Full Backup, Exclude Backup Settings, System Audio, Voicemail.  You would also go to the bottom and add /tftpboot directory if you are using that.

Adding the “Exclude Backup Settings” template is very important otherwise you will lose all the backup settings we just created when you do the backup/restore from the primary server.

Backup path settings

Select the Backup Server, Restore here, local storage, and run schedule.  The screen shot below should be self explanatory for that.  After selecting ‘Save’ at the bottom you can select ‘Run’ to test.  If you are using a registration string for your trunks the ‘Disable Registered Trunks’ box should be checked because you generally cannot have the same registration string for a trunk on two different live PBX servers at the same time.  The idea is that you would manually enable it on the secondary server when your primary server is down and you need to switch over.

Consider whether you want to backup/restore Mysql CDR.  If you were to make calls on the secondary server they would be logged only on the secondary server CDR.  The next time the backup/restore runs it will overwrite those call logs.

Note (Standby Server):

-Exclude NAT Settings.

-Exclude Backup Settings.

-Asterisk Sip Settings: Check If External address and Local Networks are correct?

screenhunter_02-nov-25-10-25

screenhunter_01-nov-25-10-24

Configure DNSmadeeasy:

http://help.dnsmadeeasy.com/dns-failover/configure-dns-failover/configure-dns-failover/

dnsfailover

Incredible PBX GUI for Raspberry Pi

http://nerdvittles.com/?p=17094

http://nerdvittles.com/?p=14787

INCREDIBLE PBX 13 WITH RASPBIAN 8 “JESSIE” FOR RASPBERRY PI 2 & 3 1.

https://sourceforge.net/projects/pbxinaflash/files/IncrediblePBX13-Raspbian8%20for%20Raspberry%20Pi%202%2B3/

https://www.raspberrypi.org/documentation/installation/installing-images/windows.md

1. Download incrediblepbx13-raspbian8.zip (now includes Incredible Fax) OR Download incrediblepbx13-raspbian8-oauth.zip (with GV OAuth and Fax)

2. unzip incrediblepbx13-raspbian8.zip OR incrediblepbx13-raspbian8-oauth.zip

3. Burn .img file of your choice to a microSD card (Tutorial for Mac, Linux, Windows here: http://nerd.bz/1Qptgb8)

4. Boot new SDcard image from Raspberry Pi 2 or 3

5. From display/keyboard/network connected to Raspberry Pi, login as pi with password: raspberry (DO NOT USE SSH)

6. Go through the automatic setup procedure and resize SD card

7. After reboot, use SSH/Putty to login to RasPi, login as root with default password: password

8. Complete setup steps by resetting your passwords when prompted

9. Run “raspi-config” and then select “Expand file system

10. Optionally, install Incredible Fax: /root/incrediblefax13_raspi3.sh

=> Run 2 commands below before executing  /root/incrediblefax13_raspi3.sh

#apt-get install apt-transport-https

#apt-get update && apt-get upgrade -y

 

TUTORIAL PLUS BUG FIXES AND ENHANCEMENTS: http://nerdvittles.com/?p=17094

GOOGLE VOICE OAUTH TUTORIAL: http://nerdvittles.com/?p=14787 (Steps 8-10)

FREE SUPPORT AVAILABLE AT http://incrediblepbx.com/community/forums/

FOR WIFI CONNECTIVITY, edit /etc/wpa_supplicant/wpa_supplicant.conf:

1. Insert your WiFi credentials in the following section:

network={

ssid=”YourSSID”

psk=”YourSSIDpassword”

key_mgmt=WPA-PSK scan_ssid=1

}

2. Stop and restart the wireless network adapter: ifdown wlan0 ifup wlan0

3. Wait 15 seconds or more. Then decipher your wlan0 network address: ifconfig OR pbxstatus