3CX and Twilio Setup
How 3CX phone setup is done with Twilio elastic trunking.
3CX is used for internal phones and to call outside world. We also resell this service. We have three 3CX servers:
- 3cx2.4goodhosting.com (162.244.239.157): on 4gh10xen.4goodhosting.com
- 3cx2.4goodhosting.com Failover (104.193.50.202): on 4gh2xen-to.4goodhosting.com
- Amazon Lightsail server (52.60.66.157)
Now, at any given time, only one of the server is actively routing calls if on any IP phone, we use the hostname 4gh3cx2.elastix.com instead of the IP. More on it later. You can configure your phone extension either using 3CX app or any compatible SIP phones. Other phones may work too, for example, the one configured by Mike Grandstream GXP2160 was not supported at the time when it was configured, but it is now.
Now, we need a trunk to communicate with the outside world and it is for that, we use Twilio elastic trunking. You can login and configure firewall rules, check the phone numbers available and set the username and password on this link:
Now, the settings are configured by logging into the active 3CX Management Console at any instant by using one of the below links:
https:4gh3cx2.elastix.com:5001 (if the 3CX server on our Xen VMs are active)
https:4gh3cx2.elastix.com (if 3CX server on Amazon Lightsail server is active)
To know which server is currently active by doing a DNS dig on 4gh3cx2.elastix.com
~$ dig +short 4gh3cx2.elastix.com
52.60.66.157
As you can see, at the time of writing this wiki, the Amazon Lightsail one is active. The mechanism of failover of 3CX server is setup under Backup and Restore once logged into 3CX Management Console, and by clicking Failover. This is the current active server setup :
[Image: screenshot_from_2019-05-22_08-44-17.png]
and this is the current passive serve setup:
[Image: screenshot_from_2019-05-22_08-47-16.png]
You can change the active and passive server and the criteria to failover here. But the settings won't be synced unless you backup on a schedule daily to a central backup location, for example Google Drive or FTP backup. You can set it up by clicking the Location tab under Backup and Restore.
[Image: screenshot_from_2019-05-22_08-51-02.png]
Make sure that you setup daily backup on all the servers, but you need to create a Restore Schedule on the failover servers to sync the backup on the active server to passive servers (failover servers). You can do this by creating a backup schedule on active server at a given time, and a restore schedule on passive servers after say 15 minutes and then a backup schedule of passive servers after say another 15 minutes.
How failover works.
All our servers are registerd with 3CX automatically when authenticated using the 3CX username and password. Once the active and failover setup is complete, 3CX will register the hostname 4gh3cx2.elastix.com for IP failover to the failover servers when the main IP goes down. So, it is a DNS switch and hence, even if the failover is instantly, it will take time for DNS propagation to complete.
Where Twilio settings are specified on 3CX Management Console.
[Image: screenshot_from_2019-05-22_09-00-08.png]
Where extensions are specified.
[Image: screenshot_from_2019-05-22_09-01-20.png]
How to configure your extension on 3CX app on android?
When you open the app for the first time, it will ask to scan the QR code of your extention. You need to open your extension from 3CX Management Console and will be able to see the QR code to scan. Alternatively, when you click on an extension and click Send Welcome Mail, it will be send to the mail registered with the extension.
What if you get Server Error when trying to login to 3CX Management Console?
If you are unable to login to 3CX using https:4gh3cx2.elastix.com or https:4gh3cx2.elastix.com:5001 and is getting a "Server Error", then it is most likely due to the service "3CXPhoneSystemMC01" in stopped status.You need to start it using "service 3CXPhoneSystemMC01 start" by accessing the server directly through SSH. Other services may be stopped on the server, which can be started directly from 3CX Management Console. (Dashboard > Services)
[Image: screenshot_from_2019-05-22_09-09-02.png]