build ha asterisk on microsoft azure using drbd/heartbeat

35
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]

Upload: astiostech-sdn-bhd

Post on 15-Jul-2015

198 views

Category:

Technology


8 download

TRANSCRIPT

Page 1: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

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]

Page 2: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

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

Page 3: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

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..)

Page 4: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

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!

Page 5: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

Introduction To Asterisk

Create voice apps#hackersPBX #AzureSpeaks

Page 6: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

It’s simple programming

exten => 2020,1,Answer

same => n,Playback(hello-world)

same => n,Hangup

Page 7: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

Demo – Writing a program (dialplan)

Let’s program hello world

Page 8: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

Azure as my PBX

Page 9: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

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

Page 10: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

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

Page 11: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

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%

Page 12: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

Azure Asterisk PBXHA Setup guide..

Page 13: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

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

Page 14: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

Azure Asterisk HA Demo Setup

Asterisk Master Asterisk Slave

Asterisk Configurator DB

Azure Cloud HA

Public Network

Telco A

Telco B

Page 15: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

Software in Demo Azure Asterisk

Asterisk 11 or higher

FreePBX 2.11 or higher

MySQL 5

PHP

Heartbeat

DRBD

Page 16: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

The Azure Asterisk Stack

LINUX OS

* ASTERISKAPACHE MYSQL

FreePBXFOP2 MonAST

ASTIOSTECH BTEL PBX

UI/Tools

Core

OS

Page 17: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

Steps to build Asterisk HA on Azure

• We use Ubuntu

Page 18: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

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

Page 19: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

Steps to build Asterisk HA on Azure

• Use the same Cloud Service on the Second and third VM

Page 20: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

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.

Page 21: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

Asterisk HA On Azure Demo Setup Opened Ports

Page 22: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

Steps to build Asterisk HA on Azure

• Create an empty disk on two of the Asterisk VMs and attach it once done.

Page 23: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

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

Page 24: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

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.

Page 25: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

Asterisk HA On AzureManagement UI

Page 26: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

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.

Page 27: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

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)

Page 28: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

Live Node = Master

SLAVE

heartbeat

Replication

Ext: 1000 Ext: 1001 Anthony s Cell Phone

TM

MASTER(ACTIVE)

astiosmaster.cloudapp.net

Page 29: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

Failover (Master -> Slave)

Master Slave

Page 30: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

Failback and quick test

Master Slave

Page 31: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

Live Node = Slave

SLAVE(ACTIVE)

heartbeat

Replication

Ext: 1000 Ext: 1001 Anthony s Cell Phone

TM

MASTER

astiosmaster.cloudapp.net

Page 32: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

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

Page 33: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

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

Page 34: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

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

Page 35: Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat

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.