10.07.2015 Views

Using repro, an new Open Source SIP Server - reSIProcate

Using repro, an new Open Source SIP Server - reSIProcate

Using repro, an new Open Source SIP Server - reSIProcate

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Using</strong> <strong>repro</strong>, <strong>an</strong> <strong>new</strong> <strong>Open</strong> <strong>Source</strong> <strong>SIP</strong> <strong>Server</strong>Derek MacDonaldderek@sipfoundry.orgderek@xten.com


ArchitectureApplication / DUMMessageapp eventaddtx eventSipStackFIFOrequestParsersTimerQueueFIFOTr<strong>an</strong>sactionDNSeventsaddTr<strong>an</strong>sportSelectorresponseFIFOUDPTr<strong>an</strong>sportFIFOTCPTr<strong>an</strong>sportFIFOTLSTr<strong>an</strong>sportMsgSc<strong>an</strong>ner2


“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.addTr<strong>an</strong>sport(TCP, 5060);NameAddr from(“”);auto_ptr reg(Helper::makeRegister(from, from);stack.send(*reg);3…


<strong>SIP</strong> Headers• http://www.sipfoundry.org/re<strong>SIP</strong>rocate/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()++;5NameAddrs routes = msg.header(h_Routes);NameAddrs reversed = routes.reverse();for (NameAddrs::iterator i=routes.begin();i != routes.end(); ++i){std::cerr


<strong>SIP</strong> ParametersSipMessage 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_br<strong>an</strong>ch).getTr<strong>an</strong>sactionId();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”;6


Contents• Flexible, extensible Content m<strong>an</strong>agement• Multi-part MIMESipMessage invite;const SdpContents* offer =dynamic_cast(invite.getContents);if (offer) {SipMessage ok; // make from invite requestSdpContents <strong>an</strong>swer; // make from the offerok.setContents(&<strong>an</strong>swer);delete offer;}7


Practicalities• Compilers– g++, VS.NET, VC++ 6– Intel compiler• Build environment– Windows– Linux/Unix– QNX– MAC OS X– Solaris• Namespaces– All code in resipnamespace• Exceptions– BaseException– Must catch• Assertions– C<strong>an</strong> be compiled out8


Logging#include “resiprocate/Logger.hxx”#define RE<strong>SIP</strong>ROCATE_SUBSYSTEM resip::Subsystem::TESTusing namespace resip;…// c<strong>an</strong> use Log::SYSLOG, Log::COUT or Log::FILELog::initialize(Log::COUT, Log::toLevel(“INFO”), argv[0]);SipMessage msg;InfoLog (


Contributors10Participating Comp<strong>an</strong>ies:Contributors:– Adam Roach, adam@dynamicsoft.com– Al<strong>an</strong> Hawrylyshen, al<strong>an</strong>@jasomi.com– Bob Bramwell bob@jasomi.com– Bry<strong>an</strong> Ogawa bko@cisco.com– Cullen Jennings, fluffy@cisco.com– David Bry<strong>an</strong>, dave@bry<strong>an</strong>.cx– David Butcher,david@purplecomm.com– Derek MacDonald, derek@xten.com– Jacob Butcher, resip@nowhen.com– Jason Fischl, jason@purplecomm.com– Ken Kittlitz – Kevin Chmilar, kevin@jasomi.com– Robert Sparks, rjsparks@nostrum.com– Roh<strong>an</strong> Mahy, rmahy@cisco.com– Ry<strong>an</strong> Kereliuk, ryker@ryker.org– Scott Godin, slgodin@icescape.com


Motivation• A very extensible open source proxy based onre<strong>SIP</strong>rocate– Leverage resip’s extensive tr<strong>an</strong>sport/ipv6 support• Easy out of box experience; the web based provisioningallows it to be used for basic authenticated calls inminutes• closely tracks the evolving st<strong>an</strong>dardization efforts– Identity(draft-ietf-sip-identity-05) is already implemented– Outbound connections (draft-ietf-sip-outbound) is in progress11


History• Idea started with <strong>an</strong> e-mail from Cullen Jenningsin Nov. 04• Initial development was right before <strong>SIP</strong>it in B<strong>an</strong>ff– Tested at <strong>SIP</strong>it in B<strong>an</strong>ff– Based on re<strong>SIP</strong>rocate <strong>an</strong>d the Dialog Usage M<strong>an</strong>ager12


Key Features• Correct <strong>an</strong>d comprehensive implementation of therelev<strong>an</strong>t st<strong>an</strong>dards from the <strong>SIP</strong> working groups• Support for multiple tr<strong>an</strong>sport protocols over both IPv4<strong>an</strong>d IPv6(UDP, TCP, TLS, DTLS)• Rigorous security mech<strong>an</strong>isms, including the <strong>new</strong>est <strong>SIP</strong>Security IETF efforts• Simple user m<strong>an</strong>agement through <strong>an</strong> embeddedconfiguration web server• In-memory location server13


Key Features (cont)• Use of readily available databases (currently BerkeleyDB <strong>an</strong>d MySQL) to store user data.– DB abstraction to allow easy extensibility• Extendable to support provider enh<strong>an</strong>ced features whileprocessing requests14


Architecture• The core of <strong>repro</strong> is two Tr<strong>an</strong>saction Users (TUs)– A DUM inst<strong>an</strong>ce for the Registrar– A Proxy TU• In-memory registration database shared by both• Web server for user <strong>an</strong>d fixed route configuration whichpersists to the DB abstraction– The default is Berkeley DB15


Extensibility• Repro is built on the chain of responsibility pattern• Currently have the RequestProcessor chain• Each RequestProcessor has a h<strong>an</strong>dleRequest method,which c<strong>an</strong> return:– Continue– WaitingForEvent– SkipThisChain– SkipAllChains• RequestProcessorChain is itself a RequestProcessor16


Different Chains of Responsibility• The <strong>repro</strong> design has three different feature chains– Features that h<strong>an</strong>dle requests; may send responses or add atarget to the Request Context. These are “monkeys”– Features that c<strong>an</strong> modify requests that are generated post targetselection, “baboons”– Features that modify responses <strong>an</strong>d the final response which issent back to the server tr<strong>an</strong>saction, “lemurs”• So far only monkeys have been implemented17


Existing Monkeys• AmIResponsible• Skips the rest of the current chain if Request is not in one of this<strong>repro</strong> inst<strong>an</strong>ces domain• Will have a relay list, generates a 403 if Request isn’t in the relaylist• Const<strong>an</strong>tLocationMonkey• For test only, good sample of a very simple monkey• StaticRoute• Applies configured routes from the RouteStore, which uses theabstract database• GruuMonkey• work in progress to implement GRUU <strong>an</strong>d sip-outbound18


Existing Monkeys (cont)• Location<strong>Server</strong>• Fetches locations from the RegistrationPersistenceM<strong>an</strong>agerinst<strong>an</strong>ce usually shared with the registrar• StrictRouteFixup• Follows route headers(skipping rest of chain) after route headerp<strong>repro</strong>cessing has occurred• DigestAuthenticator• Challenges requests as necessary, uses the same database asthe registrar to locate secrets19


Monkey FlowmonkeysbaboonsSTRequestContextlemursRequest flowResponse Flow20


Repro comm<strong>an</strong>d line Driver• Default monkey chain:– StrictRouteFixup --> IsTrustedNode --> DigestAuthenticator -->AmIResponsible --> StaticRoute --> Location<strong>Server</strong>• Defaults to BerkeleyDb if USE_MYSQL was not definedin the build• Authentication c<strong>an</strong> be turned off at the comm<strong>an</strong>d line• Record route uri c<strong>an</strong> be specified on the comm<strong>an</strong>d line21


<strong>SIP</strong> IdentityIdentity Service(<strong>repro</strong>)Request w/ Identityrequesthttp getAB22


<strong>SIP</strong> Identity• An Identity Service adds <strong>an</strong> Identity <strong>an</strong>d Identity-Infoheader to requests, if the request passes a challenge• Identity is a hash over particular headers(including Data&from) plus the body, signed by the private key of theservice• Identity-Info is target where the user c<strong>an</strong> fetch the cert ofthe identity service• An endpoint that receives the message uses this cert tovalidate the hash, <strong>an</strong>d the hash to validate the message23


Contributors• Adam Roach, adam@estacado.net• Cullen Jennings, fluffy@cisco.com• Derek MacDonald, derek@xten.com• Jason Fischl, jason@sipedge.com• Robert Sparks, rjs@estacado.net• Roh<strong>an</strong> Mahy, roh<strong>an</strong>@ekabal.com24

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!