asterisk 12 and pjsip - kamailio · asterisk 12 and pjsip. ... asterisk and pjsip asterisk’s...

38
Asterisk 12 and PJSIP

Upload: vunga

Post on 10-Nov-2018

350 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

Asterisk 12 and PJSIP

Page 2: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

2Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Asterisk and PJSIP

Asterisk’s PJSIP channel driver: a SIP architecture for the future

The future is now!

Page 3: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

3Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Asterisk and SIP: A History

Why write a new SIP stack?

RFC 3261 – SIP: Session Initiation Protocol– June 2002

chan_sip: – r472 | markster | 2002-06-28 15:34:46 -0500 (Fri, 28

Jun 2002) | 2 linesVersion 0.1.12 from FTP

That's 12 years ago!

Page 4: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

4Creative Innovation – Customer Satisfaction – Continual Quality Improvement

No Facebook, Twitter, or even MySpace

Social network: friendster– This is now a gaming site?

http://mediafactory.org.au http://www.friendster.com/

Page 5: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

5Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Linux landscape was changing

RedHat releases first version of RHEL– May 6 2002: RHEL 2.1 AS (Pensacola)

https://fedoraproject.org/wiki/History_of_Red_Hat_Linux

http://redhat.com

Page 6: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

6Creative Innovation – Customer Satisfaction – Continual Quality Improvement

We still cared about Blackberry

Blackberry 5810 (March 4, 2002)

http://www.techhive.com/article/172837/the_mobile_phone_a_history_in_pictures.html

Page 7: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

8Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Asterisk was very new

Two asterisk-users mailing list emails still exist

One is unsubscribe

Page 8: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

9Creative Innovation – Customer Satisfaction – Continual Quality Improvement

chan_sip: a long and venerable life

Architecture was never designed for its current size– 0.1.12 – 1950 lines– Trunk – 34570 lines

Current structure limits change– No stack– Large monolithic architecture

Venerable, yet time to retire

Page 9: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

10Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Asterisk 12 SIP Stack

PJSIP

APIs / Threading / Message distributionres_pjsip

TransportsNetwork /

Transaction

Sessionsres_pjsip_session

Registrarres_pjsip_registrar

Publish / Subscriberes_pjsip_pubsub

Messagingres_pjsip_messaging

SDP HandlersSession

Supplements

Channel Driverchan_pjsip

MWIres_pjsip_mwi

Device Stateres_pjsip_exten_state

Bodysupplements

Endpoint Identification / Authentication

Supplements

Page 10: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

14Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Transaction Layer

Application

Example: Inbound INVITE request

PJSIP

UA/Proxy Layer

Dialog

Page 11: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

15Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Transaction Layer

Application

Example: Inbound INVITE request

PJSIP

res_pjsip::distributor Put the request in a threadpool for processing

UA/Proxy Layer

Dialog

Page 12: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

16Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Transaction Layer

Application

Example: Inbound INVITE request

PJSIP

res_pjsip::distributor

res_pjsip =>res_pjsip_endpoint_identifier_user Identify the endpoint

UA/Proxy Layer

Dialog

Page 13: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

17Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Transaction Layer

Application

Example: Inbound INVITE request

PJSIP

res_pjsip::distributor

res_pjsip =>res_pjsip_endpoint_identifier_user

res_pjsip_nat See if we need to change anything due to NAT settings

UA/Proxy Layer

Dialog

Page 14: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

18Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Transaction Layer

Application

Example: Inbound INVITE request

PJSIP

res_pjsip::distributor

res_pjsip =>res_pjsip_endpoint_identifier_user

res_pjsip_nat

UA/Proxy Layerres_pjsip_sessionIf this is a re-INVITE, update media state(it's not, move on)

Dialog

Page 15: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

19Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Transaction Layer

Application

Example: Inbound INVITE request

PJSIP

res_pjsip::distributor

res_pjsip =>res_pjsip_endpoint_identifier_user

res_pjsip_nat

UA/Proxy Layerres_pjsip_session

Dialog

res_pjsip =>res_pjsip_authenticator_digest Authenticate the request

Page 16: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

20Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Transaction Layer

Application

Example: Inbound INVITE request

PJSIP

res_pjsip::distributor

res_pjsip =>res_pjsip_endpoint_identifier_user

res_pjsip_nat

UA/Proxy Layerres_pjsip_session

Dialog

res_pjsip =>res_pjsip_authenticator_digest

res_pjsip_session Make a new session

Page 17: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

21Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Transaction Layer

Application

Example: Inbound INVITE request

PJSIP

res_pjsip::distributor

res_pjsip =>res_pjsip_endpoint_identifier_user

res_pjsip_nat

UA/Proxy Layerres_pjsip_session

Dialog

res_pjsip =>res_pjsip_authenticator_digest

res_pjsip_session

res_pjsip_sdp_rtpProcess the offer(if we have one)

Page 18: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

22Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Transaction Layer

Application

Example: Inbound INVITE request

PJSIP

res_pjsip::distributor

res_pjsip =>res_pjsip_endpoint_identifier_user

res_pjsip_nat

UA/Proxy Layerres_pjsip_session

Dialog

res_pjsip =>res_pjsip_authenticator_digest

res_pjsip_session

res_pjsip_sdp_rtp

res_pjsip_caller_id Extract caller ID and store it

Page 19: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

23Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Transaction Layer

Application

Example: Inbound INVITE request

PJSIP

res_pjsip::distributor

res_pjsip =>res_pjsip_endpoint_identifier_user

res_pjsip_nat

UA/Proxy Layerres_pjsip_session

Dialog

res_pjsip =>res_pjsip_authenticator_digest

res_pjsip_session

res_pjsip_sdp_rtp

res_pjsip_caller_id

chan_pjsip Make the ast_channel object

Page 20: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

24Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Transaction Layer

Application

Example: Inbound INVITE request

PJSIP

res_pjsip::distributor

res_pjsip =>res_pjsip_endpoint_identifier_user

res_pjsip_nat

UA/Proxy Layerres_pjsip_session

Dialog

res_pjsip =>res_pjsip_authenticator_digest

res_pjsip_session

res_pjsip_sdp_rtp

res_pjsip_caller_id

chan_pjsip

res_pjsip_t38See if we need to do anything with T.38 fax state (nope!)

Page 21: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

25Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Transaction Layer

Application

Example: Inbound INVITE request

PJSIP

res_pjsip::distributor

res_pjsip =>res_pjsip_endpoint_identifier_user

res_pjsip_nat

UA/Proxy Layerres_pjsip_session

Dialog

res_pjsip =>res_pjsip_authenticator_digest

res_pjsip_session

res_pjsip_sdp_rtp

res_pjsip_caller_id

chan_pjsip

res_pjsip_t38

chan_pjsip Start the PBX!

Page 22: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

29Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Configuration

Sorcery: Data Abstraction Layer– ORM (for some values of O and R)– Supports CRUD operations– Well defined lifetime, thread-safe, reload-safe– Prune realtime peers/reloads

Smaller objects– Takes advantage of templating/databases– Can change storage location of each object

Example: Configuration data in database; contacts in AstDB

– Simple mapping to in-memory representation Defer higher level concepts to systems on top of

Asterisk

Page 23: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

30Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Configuration Relationships

EndpointRegistration

AoRAuth

Identify

Transport

Contact

Page 24: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

31Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Configuration Example

[alice]type=endpointcontext=internalallow=!all,g722,alawauth=alice_authaors=alice_aors

[alice_auth]type=authauth_type=userpassusername=alicepassword=as8918hd!@8hs19a1m

[alice_aors]type=aormax_contacts=10

Page 25: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

32Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Asterisk and Kamailio

http://www.markthalle-in-hannover.de/p_73_bistrohttp://shop.brewforia.com/browse-by/style/german-pilsner

Page 26: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

33Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Asterisk 12 and Kamailio

Kamailio 1

Kamailio 2

Alice

Bob

Asterisk (IVR)

Asterisk (Queues)

Asterisk (VM)Database

Internet

Page 27: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

34Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Asterisk 12 and Kamailio

Kamailio 1

Kamailio 2

Alice

Bob

Asterisk (IVR)

Asterisk (Queues)

Asterisk (VM)Database

Internet

; sorcery.conf[res_pjsip]endpoint=realtime,ps_endpointsaor=realtime,ps_aors

Page 28: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

35Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Asterisk 12 and Kamailio

Kamailio 1

Kamailio 2

Alice

Bob

Asterisk (IVR)

Asterisk (Queues)

Asterisk (VM)Database

Internet

; extconfig.confps_endpoints => odbc,asteriskps_aors => odbc,asterisk

Page 29: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

36Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Asterisk 12 and Kamailio

Kamailio 1

Kamailio 2

Alice

Bob

Asterisk (IVR)

Asterisk (Queues)

Asterisk (VM)Database

Internet

noload => res_pjsip_authenticator_digest.sonoload => res_pjsip_registrar.so

Page 30: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

37Creative Innovation – Customer Satisfaction – Continual Quality Improvement

What's Next?

Distributing Presence

Page 31: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

38Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Asterisk 12 and Kamailio: Next Steps

Kamailio 1

Kamailio 2

Alice

Bob

Asterisk (IVR)

Asterisk (Queues)

Asterisk (VM)Database

Internet

MWI State

Page 32: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

39Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Asterisk 12 and Kamailio: Next Steps

Kamailio 1

Kamailio 2

Alice

Bob

Asterisk (IVR)

Asterisk (Queues)

Asterisk (VM)Database

Internet

MWI State

Presence State

Page 33: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

40Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Asterisk 12 and Kamailio: Next Steps

Kamailio 1

Kamailio 2

Alice

Bob

Asterisk (IVR)

Asterisk (Queues)

Asterisk (VM)Database

Internet

MWI State

Presence State

Page 34: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

41Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Asterisk 12 and Kamailio: Next Steps

Kamailio 1

Kamailio 2

Alice

Bob

Asterisk (IVR)

Asterisk (Queues)

Asterisk (VM)Database

Internet

MWI State

Presence State

Page 35: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

42Creative Innovation – Customer Satisfaction – Continual Quality Improvement

What's Next?

What happens if we need more of some resource?– Not always easy to change purpose of an Asterisk

server– Major constraining point: dialplan

Alternative: ARI– Treat Asterisk as an application engine– Push all dialplan logic out of the Asterisk instances

Page 36: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

43Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Asterisk 12 and Kamailio: Next Steps

Kamailio 1

Kamailio 2

Alice

Bob

Asterisk

Asterisk

AsteriskDatabase

Internet

ApplicationLogicServer

ARI

ARI

Page 37: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

44Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Asterisk: Things on the horizon

Testing– 390 Unit Tests– 433 Functional Tests– 2.1x more tests than Asterisk 11– Lots more to go

PJSIP: Enhance and Extend

Publish/Subscribe– Highly desired– RLS

ARI: enable application logic outside of Asterisk

Page 38: Asterisk 12 and PJSIP - Kamailio · Asterisk 12 and PJSIP. ... Asterisk and PJSIP Asterisk’s PJSIP channel driver: a SIP architecture for the future The future is now! Creative

45Creative Innovation – Customer Satisfaction – Continual Quality Improvement

Questions

?