34
NKSIP THE ERLANG SIP APPLICATION SERVER 1

NkSIP: The Erlang SIP application server

Embed Size (px)

DESCRIPTION

NkSIP: The Erlang SIP Application Server

Citation preview

Page 1: NkSIP: The Erlang SIP application server

NKSIPTHE ERLANG SIP APPLICATION SERVER

1

Page 2: NkSIP: The Erlang SIP application server

What is NkSIP?

An open-source, scalable, easy to use

and (soon) distributed

Erlang SIP application server

2

Page 3: NkSIP: The Erlang SIP application server

A bit of background

Emergency Coordination Centers

3

Page 4: NkSIP: The Erlang SIP application server

Our’s visionA communications product you can use as cloud-based, on-premises or any combination of local/remote sites and cloud providers.

The only operator’s interface for voice/data/video is the browser. The web application connects to any local cluster if available, or directly to the cloud if none is up.

Self-healing, peace of mind, dev-ops friendly. If a node goes down in any of the local clusters, there is no hurry in repairing it. Even if the full cluster goes down, operators connect automatically to another one or directly to the cloud.

The specific client application should be developed easily, in a few months, without special distributed programming abilities.

4

Page 5: NkSIP: The Erlang SIP application server

First approach

Distributed Erlang/OTP core

NoSQL Database (CouchDB -> Riak)

HTML5 client, websockets, WebRTC

Freeswitch

5

Page 6: NkSIP: The Erlang SIP application server

Erlang / OTPLanguage, environment and best practices developed by Ericsson from late 80s

Building critical, highly available systems

The secret sauce of WhatsApp, RabbitMQ, Ejabberd, Riak, CouchDB…

Incredible simple (BUT functional)

Building distributed applications is NOT, even with Erlang

6

Page 7: NkSIP: The Erlang SIP application server

Erlang / OTP

Lightweight concurrency

Asynchronous communication

Process isolation

Continuous evolution of the system

Errors will happen: ”Let it crash”

7

Page 8: NkSIP: The Erlang SIP application server

Erlang / OTPAPPLICATION

SUPERVISOR

WORKER

8

Page 9: NkSIP: The Erlang SIP application server

Erlang / OTP

APPLICATION

SUPERVISOR

WORKER

NODE1 NODE2

9

Page 10: NkSIP: The Erlang SIP application server

First approach

Distributed Erlang/OTP core

NoSQL Database (CouchDB -> Riak)

HTML5 client, websockets, WebRTC

Freeswitch

10

Page 11: NkSIP: The Erlang SIP application server

We need SIP

OpenSIPS, Kamailio, Mobicents…

… they don’t really fit.

Freeswitch was not enough

11

Page 12: NkSIP: The Erlang SIP application server

Another SIP product?Existing products are either too complex to integrate into a distributed application server (Kamailio, Mobicents) or too high-level to fully use all SIP’s potential (Freeswitch, Asterisk).

SIP is a very complex protocol, but most of this complexity has no added-value and should be hidden from the developer. On the other hand, SIP concepts are actually easy. No product clearly maps SIP concepts to the application.

Implementing new RFCs is currently a painful process.

SIP routing is at the very heart of any multimedia solution. Wouldn’t it be nice to have full control of it?

12

Page 13: NkSIP: The Erlang SIP application server

NkSIP’s visionAn open source tool to develop any kind of SIP application (NkAPPs), specially focused on highly available, distributed and scalable SIP applications.

Each NkAPP application decides what callback functions to implement. Very few for a simple, standard behavior. Many of them for fine-tuned or low level behaviors.

NkSIP takes care of all the details: retransmissions, transactions, authentication, dialogs, sessions, etc.

All SIP applications are similar from NkSIP’s point of view: UACs, UASs, proxy servers, B2BUAs, SBCs, load testers… why a different box for each one?

13

Page 14: NkSIP: The Erlang SIP application server

NkSIP’s visionNkSIP does NOT try to emulate a PBX. No dial plans. No extensions. Only pure SIP. You need to now what INVITE and BYE means to use NkSIP, but don't need a deep understanding of the details.

Implementing new RFCs should be easy and natural. NkSIP offers a rock solid core, written from scratch core to develop distributed, highly available and scalable systems. It has a hierarchical plug-in system to develop new functionality without having to modify the core or other base plugins.

The Erlang ecosystem is the perfect fit for this kind of product. You can run any number of SIP applications on a NkSIP cluster, using Erlang but (soon) also using Javascript, Lua, Java, or any other language capable of receiving a JSON over a socket connection.

14

Page 15: NkSIP: The Erlang SIP application server

Current featuresFull support for all defined SIP methods: PRACK, INFO, UPDATE, SUBSCRIBE, NOTIFY, REFER, PUBLISH and MESSAGE, as UAC, UAS and Proxy.

Registrar and Event State Compositor (using the RAM built-in store or any other external database).

Stateful proxy servers with serial and parallel forking. Stateless proxy servers, even using TCP/TLS.

IPv6 support. NkSIP can connect IPv4-only with IPv6-only hosts.

Support for NAPTR and SRV location, including priority and weights.

Support for events, reliable provisional responses (100rel), session timers, path, service route, outbound and GRUU.

15

Page 16: NkSIP: The Erlang SIP application server

Current featuresAutomatic outbound registrations and timed pings.

Dialog and SDP media start and stop detection. SDP processing utilities.

UDP, TCP, TLS, SCTP and WEBSOCKETS transports, capable of handling thousands of simultaneous sessions.

Robust and highly scalable, using all available processor cores. Currently is able to process 10.000 registrations/sec or 4.000 call setups/sec (INVITE+ACK+BYE) on a 4-core i7 machine.

A written from scratch, fully typed Erlang code easy to understand and extend. Unit tests cover nearly all of the functionality. Few external dependencies.

Hot, on the fly core and application code upgrade. 16

Page 17: NkSIP: The Erlang SIP application server

17

Page 18: NkSIP: The Erlang SIP application server

18

Page 19: NkSIP: The Erlang SIP application server

Plugin systemMost complex functionality have been extracted into plugins: Registrar, PRACK, Outbound, etc.

Rich set of callbacks available.

The core remains simple.

Each plugin adds API functions and callbacks for your application (and other, higher level plugins).

Each NkAPP can implement a different set of plugins. Can even change them on the fly.

Zero added latency, even with many plugins.19

Page 20: NkSIP: The Erlang SIP application server

Pending features

Distribution based on the Dynamo model.

Other languages for NkAPPs (Node.js, Lua, Python…)

More RFCs and Event Packages

IMS

20

Page 21: NkSIP: The Erlang SIP application server

1 2 3 4 5

6 7 8 9 10

11 12 13 14 15

Node1

16 17 18 19 20

21

Ip1 Ip2 Ip3 Ip4

Router / Gateway

Page 22: NkSIP: The Erlang SIP application server

Node1

Router / Gateway

Node2 Node3

22

1 2 3 4 5

6 7 8 9 10

11 12 13 14 15

16 17 18 19 20

Ip1 Ip2 Ip3 Ip4

Page 23: NkSIP: The Erlang SIP application server

Node1

Router / Gateway

Node2 Node3

23

1 2 3 4 5

6 7 8 9 10

11 12 13 14 15

16 17 18 19 20

Ip1 Ip2 Ip3 Ip4

node2> nksip_admin -join node1node3> nksip_admin -join node1

Page 24: NkSIP: The Erlang SIP application server

1 4 7 10 13

16 19

Node1

Router / Gateway

2 5 8 11 14

17 20

Node2

3 6 9 12 15

18

Node3

24

Ip1 Ip4 Ip2 Ip3

Page 25: NkSIP: The Erlang SIP application server

1 4 7 10 13

16 19

Node1

Router / Gateway

2 5 8 11 14

17 20

Node2

3 6 9 12 15

18

Node3

node2> nksip_admin -remove node1

25

Ip1 Ip4 Ip2 Ip3

Page 26: NkSIP: The Erlang SIP application server

1 47 1013 16 19

Node1

Router / Gateway

2 5 8 11 14

17 20

Node2

3 6 9 12 15

18

Node3

node1> poweroff

26

Ip1 Ip2 Ip3 Ip4

Page 27: NkSIP: The Erlang SIP application server

NKCOREERLANG DISTRIBUTED SDN/NFV APPLICATION SERVER

27

Page 28: NkSIP: The Erlang SIP application server

Another application server?NkSIP offers a fresh approach to the development of applications, and it has very powerful tools, but is focused on SIP.

However, NkSIP could behave as a generic high-capacity, low-latency message processing engine.

Many concepts and technology solutions from NkSIP are applicable to many other protocols: REST, Diameter, MSRP, XMPP, DNS, DHCP, Mail, OpenFlow…

There is no easy to use, fully distributed, heavy-load open source application server out there.

This looks a lot like an SDN/NFV framework!

28

Page 29: NkSIP: The Erlang SIP application server

NkCORE’s visionYou start any number of control nodes, and install any number of user applications (NkAPPs) on the cluster.

Incoming messages (in a broad sense: SIP, REST request…) are sent to a specific control node and triggers the call of specific application callbacks. Applications are written using Javascript, Lua, Java, etc.

Many modules are available, offering tools and semi automatic processing of messages: SIP (NkSIP), Web (NkREST), DNS, DHCP, Diameter, OpenFlow,etc. Each one adds new callbacks and APIs available to the application. Some of them offer additional optional plugins (i.e. event support packages for SIP).

Many common functionality is available: configuration, cluster management, distributed database, network transport management, storage, dns, logging, authentication, roles, etc.

29

Page 30: NkSIP: The Erlang SIP application server

NkCORE’s visionYou also start any number of worker nodes. They don’t need to have Erlang, only Docker.

The NkAPP can program the scheduling of tasks (i.e, 10 instances of Freeswitch, 5 instances of a node.js application, etc.), and NkCORE selects the worker nodes and downloads and starts and monitors the Docker processes in selected ones.

Control nodes route specific traffic to any of the workers nodes, and offers network functionalities to the application: firewall, load balancer, VPNs, VLANs… (using Openvswitch).

NkCORE offers easy-to-use APIs for each type of task, and can act as a proxy or B2BUA, transparent or not. The application doesn’t even need to know that it is speaking to several different instances of the processes.

We plan to support many common used packages:

Media servers (Asterisk, Freeswitch…) and XMPP (Ejabberd…)

NoSQL (Redis, Riak, CouchDB…) and SQL databases (MySQL, PostgreSQL)

Distributed Storage (Ceph)

Mail Servers

30

Page 31: NkSIP: The Erlang SIP application server

Cont

rol N

odes

Router / Gateway

Node.JS Node.JS

Python

Node.JS Python

Freeswitch Asterisk

Node.JS Node.JS

Python

Node.JS Node.JS

Python

Wor

ker N

odes

Storage Storage

Erlang Erlang Erlang

Routing Routing Routing

Docker instances

Erlang code

Native code

31

NkAPPs

NkCORE NkCORE NkCORE

Page 32: NkSIP: The Erlang SIP application server

32

Page 33: NkSIP: The Erlang SIP application server

Expected featuresThe applications are in full control not only of the business logic, but also of the network, the storage and the related processes (data bases, media servers…)

Hot code loading (NkCORE itself, modules and user applications). Hot relocation of external processes.

NkCORE offers a everything-as-a-service model to the applications (Freeswitch, DNS, Riak, …), even in local. Hybrid or hierarchical cloud model. Multi-cluster management.

Allows applications to become highly available and scalable very easily.

33

Page 34: NkSIP: The Erlang SIP application server

Thank you

Carlos González Florido

https://github.com/kalta/nksip

[email protected]

@carlosjgf34