voip in the cloud - scaling massively through the magic of erlang

24
VoIP in the Cloud Mahesh Paolini-Subramanya CTO, Vocalocity

Upload: mahesh-paolini-subramanya

Post on 03-Jul-2015

958 views

Category:

Technology


1 download

DESCRIPTION

Building the infrastructure for delivering complex cloud-based services is remarkably difficult, what with having to deal with concurrency, deadlocks, state-management, etc. in a scalable manner.  When one adds VoIP - with its combination of short (SIP) and long (RTP) transactions, this becomes near impossible.  At Aptela, we have cracked the code and now provide a true telephony cloud with highly complex applications developed using simple web APIs, and with all calling handled in a truly distributed fashion.  Our platform includes complex call routing, messaging, web-portals, mobile apps, PSTN/SIP access, and a coffee-grinder attachment, currently handling dozens of calls - and an infinity of HTTP requests - per second. In this presentation, we will describe the architecture and process model, with an emphasis on the specific challenges associated with manipulating extremely large amounts of data in a near-real-time manner.  In addition, we will also elaborate on the benefits of the erlang/OTP environment in developing a truly scalable, concurrent and fault-tolerant environment.

TRANSCRIPT

VoIP in the Cloud

Mahesh Paolini-Subramanya

CTO, Vocalocity

© Vocalocity 2011. Confidential. 2

Hosted PBX Taxonomy

►Named Box

• Pure hosting

• Clustering/Virtual or Big Honking Box

• Load/Scaling issues same as „one box‟ application

►High Level Application Server

• Calls generate high level events

• Events interact with application server

• Predefined spaces/features

• Load/Scaling issues same as „one box‟ application

2

© Vocalocity 2011. Confidential. 3

Hosted PBX Taxonomy

►Granular Application Server

• Calls generate granular events

• Events interact with application server

• Easy to create simple applications

Point features: FML, notifications, transcriptions

Call Switch: Routing, voicemail

► Difficult to build complex applications

• Updates and deployments

• Testing and Debugging

• Concurrency

• Scaling and Partitioning

• Persistence

3

© Vocalocity 2011. Confidential. 4

4

Cloud Computing

►Wikipedia

“a style of computing in which typically real-time scalable

resources are provided as a service over the Internet to end-

users who need not have knowledge of, expertise in, or control

over the technology infrastructure”

►Vocalocity

• Horizontal Scaling and/or Clustering

• Abstraction of application layer

• SOA and/or fine-grained API

• Redundancy irrelevance

© Vocalocity 2011. Confidential. 5

5

Cloud Computing

► Telephony makes it harder

• Simple and distributed actions? Done

• High Level Applications? Done

• Both at the same time? Well, Maybe Not…

► Vocalocity

• Distributed application infrastructure (erlang)

• Distributed persistence infrastructure

• Distributed telephony infrastructure

Simple, atomic events!!

© Vocalocity 2011. Confidential. 6

6

Issues - Updates and Deployment

Smooth, Seamless, and

Efficient

© Vocalocity 2011. Confidential. 7

7

Issues - Updates and Deployment

“Hey guys!

I dropped my

wrench!”

© Vocalocity 2011. Confidential. 8

8

Issues – Testing and Debugging

© Vocalocity 2011. Confidential. 9

9

Issues – Testing and Debugging

© Vocalocity 2011. Confidential. 10

Issues – Testing and Debugging

► Arrrggh

► Arrrggh

► Arrrggh

► Arrrggh

► Arrrggh

► Arrrggh

1

© Vocalocity 2011. Confidential. 11

Issues – Concurrency

► Live displays of calls

► Interactivity with calls

• Transfers

• Conferences

• Recording

• Monitoring

• Notifications

1

© Vocalocity 2011. Confidential. 12

1

Issues - Scaling

• v - VS -

© Vocalocity 2011. Confidential. 13

Issues - Persistence

► Voicemails and faxes in the

file system

► Databases

• Telco =:= Reporting

• We‟ve become Database

gurus

► Replication hell

1

© Vocalocity 2011. Confidential. 14

Issues – Testing and Debugging

► Arrrggh

► Arrrggh

► Arrrggh

► Arrrggh

► Arrrggh

► Arrrggh

1

© Vocalocity 2011. Confidential. 15

Why erlang?

► Testing

► Code deployment

► Concurrency

► Complexity

► Predictable Performance

► Fault tolerance

► Error Containment

► Testing

► Code Deployment

1

© Vocalocity 2011. Confidential. 16

Clean APIs

►Only interface into System

►Handlers for different modalities

• HTTP for Public

• STOMP for Private

1

Business Rules

STOMP

Workflow

HTTP

Vocalocity Call Server

Event

System

© Vocalocity 2011. Confidential. 17

Clean APIs

► Administrative

• CRUD – Users, Depts, …

• Regulatory – E911, TRS, …

• OSS

► Informative

• Notifications

• High Level Events

• Messages – History, Reporting

► Interactive

• Communications – Calls, Contacts, …

• Profile – Blacklist, FML, Media, …

• Messages – History, Reporting, …

1

Business Rules

STOMP

Workflow

HTTP

Vocalocity Call Server

Event

System

© Vocalocity 2011. Confidential. 18

Processes

► All request goes to any available

application node as a message

►Nodes have processes

• Basic unit of concurrency

• Extremely light weight (~300

bytes)

• Not a kernel process

• No shared memory

► Processes are supervised

► They restart themselves

► Processes synchronize activities

► They perform tasks

1

© Vocalocity 2011. Confidential. 19

Event Handlers

► They get information to endpoints

• GUI

• API callbacks

1

© Vocalocity 2011. Confidential. 20

Event Handlers

► The perform asynchronous application

activities

• Logging

• notifications

► They bridge between the FSMs and the

calls

• Check blacklist

• Play error message

• Hangup

• Go offhook

2

© Vocalocity 2011. Confidential. 21

Finite State Machines

► System has a limited set

of states

► States transition based

on conditions

► Transitions are atomic

► Events and actions at

entry and exit

2

* Diagrams from http://learnyousomeerlang.com/finite-state-machines

A Dog

A Cat

© Vocalocity 2011. Confidential. 22

Finite State Machines

►Many many many FSMs (25 at last count)

• auto_attendant

• bridge

• check_voicemail

• conference

• dial_in

• dial_in_fml

• dial_out

• dial_out_fax

• dial_out_video

• originate

• originate_fax_back

2

© Vocalocity 2011. Confidential. 23

Persistence

► Schema free document database

► Stores documents as JSON Key-Value pairs

► Incremental replication

• Conflict management and resolution

► “Lazy” indexes and views

• Erlang

► BigCouch = couchdb + Dynamo

• http://www.allthingsdistributed.com/2008/12/eventually_cons

istent.html

2

© Vocalocity 2011. Confidential. 24

Calling

► Event interface for requests and responses

► erlang, xml for event processing

► fine-grained events which are merged to

• make/break calls

• record audio and dtmf

• play audio and dtmf

• file operations

2

Call Server Call Server

erlang / xml / events

Call Server

System SystemSystem