build ha asterisk on microsoft azure using drbd/heartbeat
TRANSCRIPT
The Cloud Has Spoken
Real-time Communications on Microsoft Azure
Copyright 2015 © Astiostech Sdn Bhd. For informational purposes only. No warranties of any kind are made and you have to verify all information before relying on it. You can re-use this presentation as long as you read, agree, and follow the guidelines described in the “Comments” field in File/Properties.
#AzureSpeaks | [email protected]
Bragging rights
Microsoft MVP in Enterprise Security
Some 15 years experience with security
Communications as well, since 8 years
One of the first VaaS in Malaysia
Passionate dev. & can play some badminton
Introduction To Asterisk
Enterprise PBX functionalities
Interconnects to almost any telco (TM, TIME, Maxis, etc)
Integration with computers
Relatively large scalability
Connects with anything compatible (phones, etc..)
Introduction To Asterisk
Become a call center
Enable IP features (e.g. SIP to cost saving gateways)
Bridge using IP between remote offices (free calls)
Voicemail/VMtoEmail services
Integrate to CRM/Database/Software
Build as needed!
Introduction To Asterisk
Create voice apps#hackersPBX #AzureSpeaks
It’s simple programming
exten => 2020,1,Answer
same => n,Playback(hello-world)
same => n,Hangup
Demo – Writing a program (dialplan)
Let’s program hello world
Azure as my PBX
Asterisk as my PBX• Features
Easy deploymentFast scalabilitySecure by implementationCan be deployed across multi geo locationsPlug and play for customers/usersNumber follows you anywhere you go
• EnablersCurrent telcos providing VoIP PSTN in and outExtremely high broadband penetration rate Cheaper calls, competition with call trafficMulti route for resilience Location independentObvious TCONegligible latency
Azure as my PBX
Designed for noobs (like me)
Proven reliability
Supports many big Linux distros
Ubuntu
CentOS
CoreOS
Oracle Linux
Suse Enterprise and OpenSue
Has its own HA/LB method (explained later)
Extremely Fast
Geographically suitable APAC Singapore, Hong Kong
Azure as my PBX
Latency is negligible (using SIP with uLaw, no compression, no encapsulation, no encryption)
Singapore was around 40ms-60ms
Hong Kong was around 70ms-80ms
ITU-T recommendation latency is 150ms for voice traffic (and 250ms roundtrip)
Low packet loss rateApproximately 0.09 - 0.1%
Azure Asterisk PBXHA Setup guide..
What did we setup on our demo?
Redundant Asterisk on AzureTwo SIP servers (Active / Passive)
One DB server (could also be HA if required)
Uses Azure Cloud HA for targetingTypically we use another method (explained later)
Uses common and easy HA methods on Linux
Azure Asterisk HA Demo Setup
Asterisk Master Asterisk Slave
Asterisk Configurator DB
Azure Cloud HA
Public Network
Telco A
Telco B
Software in Demo Azure Asterisk
Asterisk 11 or higher
FreePBX 2.11 or higher
MySQL 5
PHP
Heartbeat
DRBD
The Azure Asterisk Stack
LINUX OS
* ASTERISKAPACHE MYSQL
FreePBXFOP2 MonAST
ASTIOSTECH BTEL PBX
UI/Tools
Core
OS
Steps to build Asterisk HA on Azure
• We use Ubuntu
Azure Active Server Targeting
Enable HTTP/TCP Ports for Azure Cloud monitoring.Since Azure monitors HTTP or TCP ports onlyEnable a daemon service [demo] to monitor Asterisk
In case Asterisk goes down, initiate failover/failback
For WebRTC simply “check” 443 or 80
Ensure client side has sufficient bandwidthUse compression codecs, but don’t compress too much
All other ports should then be “relayed and instructed” by the HTTP/TCP via Azure, esp. when there’s RTPSIP ports
You might want to enable individual ports for SSHBut you cannot use the same public facing port twice
AZURE CLOUD LAYER TCP PROBE
WHICH ACTIVE SERVER RUNNING TCP 5060
ACTIIVE SERVER CONNECTS TO CONFIG DB
PUBLIC LAYER
WHICH ACTIVE SERVER RUNNING TCP 5060
SIP USER
Steps to build Asterisk HA on Azure
• Use the same Cloud Service on the Second and third VM
Steps to build Asterisk HA on Azure
• Create end points and check “CREATE A LOAD-BALANCED SET” to failover the necessary ports else leave it to run normally.
Asterisk HA On Azure Demo Setup Opened Ports
Steps to build Asterisk HA on Azure
• Create an empty disk on two of the Asterisk VMs and attach it once done.
Steps to build Asterisk HA on Azure
There are 2 major components in our HA package
1. Heartbeat Heartbeat is a daemon that provides cluster infrastructure (communication and membership) services to its clients.
2. DRBD
Steps to build Asterisk HA on Azure
DRBD refers to block devices designed as a building block to form high availability (HA) clusters. This is done by mirroring a whole block device via an assigned network.
DRBD can be understood as network based raid-1.
Asterisk HA On AzureManagement UI
Summary: Steps to build a HA Asterisk on Azure
Setup (min 2#) machines on Azure
Assign the VMs with the same cloud service.
Attach same sized empty disks
Install Asterisk (and other software)
Build HA – Heartbeat / DRBD
Open the necessary end points.
Demo – Calls (In,out,peers)
DISCLAIMER: Bandwidth is something we can’t guarantee at this venue
Scenarios
1) Calls from desktop to another IP Phone
2) Calls from desktop to Pizzahut Malaysia
3) Auto attendant (XXXXXXXXX)
Live Node = Master
SLAVE
heartbeat
Replication
Ext: 1000 Ext: 1001 Anthony s Cell Phone
TM
MASTER(ACTIVE)
astiosmaster.cloudapp.net
Failover (Master -> Slave)
Master Slave
Failback and quick test
Master Slave
Live Node = Slave
SLAVE(ACTIVE)
heartbeat
Replication
Ext: 1000 Ext: 1001 Anthony s Cell Phone
TM
MASTER
astiosmaster.cloudapp.net
Demo: Application Gateways and Asterisk
•Dial XX.XXXXXXXX• Enter GST number
• Web scraping (customs dept website using phanthom.js)..
If exist -> Read company
If not -> Complain on the phone
The GST checker dialplan
Demos: Video calls, etc..
DISCLAIMER: Bandwidth is something we can’t guarantee at this venue
Scenarios
1) Calls from desktop to Win tablet
2) Calls from desktop to iPad (moving target, literally :P)
3) Other stuff
Start building you first Asterisk@Azure
It takes 45 minutes to get Asterisk runningUse TELCO can supply numbers via SIP (voip)Get decent connectionsLoad test voice then videoLimit exposure, use strong passwords, etc..
#AzureSpeaks
The Cloud Has Indeed Spoken #AzureSpeaksCopyright 2015 © Astiostech Sdn Bhd. For informational purposes only. No warranties of any kind are made and you have to verify all information before relying on it. You can re-use this presentation as long as you read, agree, and follow the guidelines described in the “Comments” field in File/Properties.