powerpoint presentation · title: powerpoint presentation author: jason fischl created date:...

40
Using The Dialog Usage Manager (DUM) Derek MacDonald reSIProcate Core Developer Senior Software Engineer, Xten Networks

Upload: others

Post on 26-Sep-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

Using The Dialog Usage Manager (DUM)Derek MacDonald

reSIProcate Core DeveloperSenior Software Engineer, Xten Networks

Page 2: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

2

Background

• reSIProcate project started out of VOCAL / Vovida.org in Summer 2002

• http://www.sipfoundry.org/resiprocate• Became part of SIPfoundry early in 2004• Informal project organization• Many core developers participate or lead SIP standards

effort in the IETF• Attended SIPit 12, 13 and 14, 15, 16• DUM component added Summer 2004• Vovida (BSD) License

Page 3: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

3

Agenda

• Part I– reSIPprocate Introduction

• Programming with reSIProcate

• Examples

• Part II– The DialogUsageManager (DUM)

Page 4: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

4

Typical Applications

• Phones (e.g. embedded)

• Softphones (any platform)

• Gateways

• Proxies

• B2BUAs

• IM / Presence Servers or Clients

Page 5: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

5

Current Features

• Multi-homed hosts

• Platforms: Windows, Linux, BSD, Solaris, QNX, OS/X

• MIME & S/MIME

• Extendable contents

• User Agent Library (DUM)

• UDP, TCP, TLS

• Object-oriented interface

• Lazy Parser

• RFC 3261 compliant

• Asynchronous DNS

• Single or multi-threaded

• DNS support (NAPTR/SRV)

• IPv6

Page 6: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

6

Supported RFCs

• Supported RFCs:– 2327: SDP– 2617: HTTP Digest– 2782: DNS SRV – 2915: DNS NAPTR– 2976: sip INFO– 3261: sip– 3263: Locating sip servers– 3265: subscribe/notify– 3420: sipfrag– 3325: network asserted id– 3428: sip MESSAGE– 3326: reason header– 3515: sip REFER– 3581: symmetric response

– 3323: Privacy mechanism– 3262: Reliable provisional– 3264: Offer/Answer– 3266: IPv6 in SDP– 3311: UPDATE– 3903: PUBLISH– 3857: Winfo

• In Development– draft-sip-session-timer– draft-sip-caller-prefs

• Drafts: (partial list)– draft-impp-srv, draft-simple-presence– draft-sip-replaces, draft-sip-referredby– Draft-sip-connect-reuse– draft-sip-join, sip-gruu– sipping-mwi

Page 7: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

7

Supported Platforms

• Windows

• Linux

• MAC

• QNX

• Others

Page 8: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

8

Licensing

• The Vovida Software License, Version 1.0

• BSD-like (one line difference)

• Free

• Can use it in commercial products

• Re-contribution not required (no forced reciprocity)

Page 9: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

9

Some Example Deployments

• PurpleComm (http://www.purplecomm.com)– Proxy, Registrar, Voicemail, Presence Server– Windows Softphone (http://teltel.com)

• Jasomi Networks (http://www.jasomi.com)– PeerPoint – Session Border Controller

• Xten Networks (http://www.xten.com)– eyeBeam(DUM)

• CSP – Italy (http://www.csp.it)– IM/Audio/Video UA for Windows– Conference Server and h.323 gateway in development

• Computer Talk Technology (http://www.computer-talk.com)– Contact Center product(DUM)

Page 10: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

10

Architecture

TimerQueue

UDPTransport

FIFO

TLSTransport

FIFO

TCPTransport

FIFO

TransportSelector

tx event

add

DNS

request

response

SipStack

FIFO

Transaction

FIFO

add

app event

even

ts

Application / DUM

MsgScanner

Parsers

Message

Page 11: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

11

“hello world”

• Use Helper class to help construct messages#include “resiprocate/SipStack.hxx”

#include “resiprocate/Helper.hxx”

#include “resiprocate/SipMessage.hxx”

#include “resiprocate/NameAddr.hxx”

using namespace resip;

SipStack stack;

stack.addTransport(TCP, 5060);

NameAddr from(“<sip:[email protected]>”);

auto_ptr<SipMessage> reg(Helper::makeRegister(from, from);

stack.send(*reg);

Page 12: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

12

SIP Messages

• Let the stack manage its own thread and select callSipStack stack;

StackThread stackThread(stack);

stackThread.run();

While(usleep(10)) {

SipMessage* msg = stack.receive();

if (msg) {

// process the incoming sip message

delete msg;

}

}

Page 13: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

13

Threading Model

• Single Threaded Mode– One thread for the entire application

– Manage file descriptors at the app level

• Multi-Threaded Mode– Optional thread per transport

– Optional StackThread

– DUM + DUM client must be one thread or provide sync

Page 14: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

14

SIP Headers

• http://www.sipfoundry.org/reSIProcate/using.txtSipMessage msg;NameAddr to;to.uri().user() = “jason”;to.uri().host() = “teltel.com”;msg.header(h_To) = to;msg.header(h_To).displayName() = “Jason Fischl”;assert(msg.exists(h_To));msg.header(h_CSeq).sequence()++;

NameAddrs routes = msg.header(h_Routes);NameAddrs reversed = routes.reverse();for (NameAddrs::iterator i=routes.begin();

i != routes.end(); ++i){

std::cerr << *i << endl;}NameAddr firstRoute = routes.back();routes.pop_back();

Page 15: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

15

SIP Parameters

SipMessage request;assert(request.header(h_To).exists(p_tag)); // existsrequest.header(h_To).param(p_tag) = “jason”; // assignrequest.header(h_To).remove(p_tag); // removerequest.header(h_To).uri().param(p_q) = 1.0; // FloatParamrequest.header(h_Vias).front().param(p_branch).getTransactionId();

Auth auth;auth.scheme() = “Digest”;auth.param(p_nonce) = “blah”; // QuotedDataParamauth.param(p_algorithm) = “MD5”;

UnknownParameterType p_myparam(“myparam”);request.header(h_RequestLine).param(p_myparam) = “myvalue”;

Page 16: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

16

Contents

• Flexible, extensible Content management

• Multi-part MIME

SipMessage invite;

const SdpContents* offer =

dynamic_cast<const SdpContents*>(invite.getContents);

if (offer) {

SipMessage ok; // make from invite request

SdpContents answer; // make from the offer

ok.setContents(&answer);

delete offer;

}

Page 17: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

17

Practicalities

• Compilers– g++, VS.NET, VC++ 6

– Intel compiler

• Build environment– Windows

– Linux/Unix

– QNX

– MAC OS X

– Solaris

• Namespaces– All code in resip namespace

• Exceptions– BaseException

– Must catch

• Assertions– Can be compiled out

Page 18: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

18

Logging

#include “resiprocate/Logger.hxx”

#define RESIPROCATE_SUBSYSTEM resip::Subsystem::TEST

using namespace resip;

// can use Log::SYSLOG, Log::COUT or Log::FILE

Log::initialize(Log::COUT, Log::toLevel(“INFO”), argv[0]);

SipMessage msg;

InfoLog (<< “The message is “ << msg.brief());

DebugLog (<< “detail: “ << msg);

Log::setLevel(Log::Debug);

Page 19: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

19

Contact / Via

• By default, Contact and Via IP address, port and transport will be filled in by the TransportSelector

• Application can specify it and avoid stack population

• E.g.

SipMessage request;

request.header(h_Contacts).clear();

NameAddr contact; // default nothing filled in

request.header(h_Contacts).push_back(contact);

stack.send(request);

Page 20: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

20

DUM

• Introduction– DUM makes writing user agents easy– Hides the complex sip specific stuff

• Usages– Usage based rather than Dialog Based– ClientRegistration, InviteSession, ClientPublication,etc.

• Handlers– InviteSessionHandler, ClientRegistrationHandler, etc.

• What can you do with DUM?– Softphone– B2BUA– Load generator

Page 21: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

21

DUM Benefits

• Manage refreshes for you– Just set up registration binding and keep it active– Set up a subscription and keep it active. DUM will let you know when

new updates come in via NOTIFY requests– Keep an INVITE session active– Handles forking for you– Merged requests– GRUU(in progress)

• Implements Offer/Answer (rfc 3264)• Implements PRACK (rfc 3262)(in progress)• Manage Profile information such as authorization• Implements UAC and UAS

Page 22: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

22

Usages

• There is a DUM Usage and Handler class for every type of SIP Usage

• Dialog Usages are created when responses to a usage creating request are received

• Usages are given to the User(through a Handler call) by a Handle which has weak reference semantics

• DUM also has NonDialogUsages for persistent associations not in a dialog; PUBLISH and REGISTER

Page 23: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

23

A DUM Instance

• Created against an existing SipStack

• Create a MasterProfile(required), a UserProfile(fordigest), a ClientAuthManager(for digest)

• Different DUM & Stack threads used in this example

SipStack stack;

DialogUsageManager* dum = new DialogUsageManager(stack);

dum->addTransport(UDP, 12005);

dum->addTransport(TCP, 12005);

dum->addTransport(TLS, 12006); //client only

Page 24: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

24

A DUM Instance

SharedPtr<MasterProfile> uacMasterProfile(new MasterProfile);

auto_ptr<ClientAuthManager> uacAuth(new ClientAuthManager);

dum->setMasterProfile(uacMasterProfile);

dum->setClientAuthManager(uacAuth);

dum->getMasterProfile()-addSupportedMimeType(NOTIFY,

Mime(“application”, “pidf+xml”);SharedPtr<UserProfile> bob(new UserProfile(dum->getMasterProfile());…(set password & from for bob)

SampleSubHandler subHandler;

dum->addClientSubscriptionHandler(“presence”, &subHandler);

StackThread stackThread(stack); stackThread.run();

DumThread dumThread(dum); dumThread.run();

Page 25: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

25

Sample Handler

• SampleSubHander : public ClientSubscriptionHandler

• ClientSubscriptionHandle passed SampleSubHandler in each callback

• onNewSubscription/onTerminated called for each fork

virtual void onUpdateActive(ClientSubscriptionHandle h,

const SipMessage& notify){

myApp->updateDocument(notify);h->end(); //unsubscribe

}

Page 26: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

26

Usage Creation

User DUM ClientSubscription SampleSubHandler

makeSubscription

send

Notify arrives

new

onNewSubscription

onUpdateActive

Page 27: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

27

As a UAS

• DUM will call the appropriate onNewSession of an installed handler when a usage creating request is received

• Will send a 405/489 if no appropriate handler is installed

• ServerPagerMessage and ServerOutOfDialogRequestusages only exist until a response is set

Page 28: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

28

SIP Identity

A

Identity Service(repro)

B

request

Request w/ Identity

http get

Page 29: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

29

SIP Identity

• An Identity Service adds an Identity and Identity-Info header to requests, if the request passes a challenge

• Identity is a hash over particular headers(includingData& from) plus the body, signed by the private key of the service

• Identity-Info is target where the user can fetch the cert of the identity service

• An endpoint that receives the message uses this cert to validate the hash, and the hash to validate the message

Page 30: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

30

SIP Identity

• If DUM has an HttpProvider it will fetch from Identity-Info targets and validate the Identity of a Message– sample implementation based on CURL

• The SecurityAttributes class on a SipMessage details the Identity Strength and Encryption level of an incoming request

Page 31: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

31

Encrypted Traffic

• A DialogUsageManager::EncryptionLevel is an optional parameter to make* calls, such as makeInviteSession

• EncryptionLevel can be None(default), Sign, Encrypt, SignAndEncrypt

• makeInviteSession can take two Sdp bodies to use multipart-alternative

Page 32: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

32

S/MIME

• Mime type support– Multipart Signed

– Encrypted(pkcs7-mime)

– Multipart Alternative

• DUM will use the most encrypted body it can understand

• Key Management– Keys are looked up by AOR in the Security Object

Page 33: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

33

Profile

• Holds settings for an instance of DUM– default registration interval

– User agent header

• The UserProfile subclass has information which is specific to an AOR(shared secret and InstanceID)

Page 34: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

34

Invite Sessions

• Has two subclasses, ServerInviteSession and ClientInviteSession, but one handler

• ClientInviteSession and ServerInviteSession are only used explicitly until the Invite usage is fully established, then InviteSession is used

• Abstracts away the messages used to drive the offer/answer model

• Easy hold and transfer

Page 35: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

35

User Data

• As UAC– Optional AppDialogSet can be affiliated with any usage

• Passed into make* calls

– AppDialog created for each instance of a fork

• As UAS– AppDialogSetFactory can be installed into a DUM instance

• All usages have getAppDialogSet

• Dialog usages have getAppDialog

Page 36: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

36

Pager Mode IM

• ClientPagerMessage– not in a dialog, but has a client controlled lifespan

– Can queue messages

• ServerPagerMessage– Created for each incoming message, destroyed when a

response is sent

Page 37: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

37

Usages

Page 38: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

38

Contributors

• Companies:

• Organizations– Vovida.org

– SIPfoundry

• Contributors:– Adam Roach, [email protected]– Alan Hawrylyshen, [email protected]– Bob Bramwell [email protected]– Bryan Ogawa [email protected]– Cullen Jennings, [email protected]– David Bryan, [email protected]– David Butcher, [email protected]– Derek MacDonald, [email protected]– Daniel Shi, [email protected]– Jacob Butcher, [email protected]– Jason Fischl, [email protected]– Ken Kittlitz <[email protected]>– Kevin Chmilar, [email protected]– Robert Sparks, [email protected]– Rohan Mahy, [email protected]– Ryan Kereliuk, [email protected]– Scott Godin, [email protected]

Page 39: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

39

How to Contribute

• Subscribe to SIPfoundry reSIProcate mailing list

• Get subversion access

• http://www.sipfoundry.org/resiprocate

Page 40: PowerPoint Presentation · Title: PowerPoint Presentation Author: Jason Fischl Created Date: 8/8/2005 10:53:24 AM

40

Contact

• Derek MacDonald– [email protected], [email protected]

– http://www.sipfoundry.org