powerpoint presentation · title: powerpoint presentation author: jason fischl created date:...
TRANSCRIPT
Using The Dialog Usage Manager (DUM)Derek MacDonald
reSIProcate Core DeveloperSenior Software Engineer, Xten Networks
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
3
Agenda
• Part I– reSIPprocate Introduction
• Programming with reSIProcate
• Examples
• Part II– The DialogUsageManager (DUM)
4
Typical Applications
• Phones (e.g. embedded)
• Softphones (any platform)
• Gateways
• Proxies
• B2BUAs
• IM / Presence Servers or Clients
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
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
7
Supported Platforms
• Windows
• Linux
• MAC
• QNX
• Others
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)
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)
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
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);
…
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;
}
}
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
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();
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”;
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;
}
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
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);
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);
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
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
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
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
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();
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
}
26
Usage Creation
User DUM ClientSubscription SampleSubHandler
makeSubscription
send
Notify arrives
new
onNewSubscription
onUpdateActive
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
28
SIP Identity
A
Identity Service(repro)
B
request
Request w/ Identity
http get
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
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
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
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
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)
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
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
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
37
Usages
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]
39
How to Contribute
• Subscribe to SIPfoundry reSIProcate mailing list
• Get subversion access
• http://www.sipfoundry.org/resiprocate