SIP Servlets - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

SIP Servlets

Description:

throws ServletException, IOException. ArrayList dest = new ArrayList ... throws ServletException, IOException. SipServletRequest req = resp.getProxy ... – PowerPoint PPT presentation

Number of Views:209
Avg rating:3.0/5.0
Slides: 17
Provided by: Laur332
Category:

less

Transcript and Presenter's Notes

Title: SIP Servlets


1
SIP Servlets
  • DynamicSoft Technology Compatibility Kit

2
  • Brief overview of SIP
  • What is SIP?
  • SIP Concepts
  • SIP Typical Architecture and Call Flow
  • SIP Servlet Description
  • Specification
  • Components
  • Examples
  • SIP Servlets CallC

3
What is SIP?
  • SIP Session Initiation Protocol
  • Application-layer protocol approved by the IETF
    (Internet Engineering Task Force)
  • Creation and management of communication sessions
    between devices
  • No concern about nature or content of calls
  • Any type of media can be exchanged
  • Other protocols used with SIP
  • SDP (Session Description Protocol)
  • RTP (Real Time Protocol)

4
SIP Concepts
  • User Agent end point to create and manage a
    communication session (either SIP phone or
    software application)
  • SIP Proxy Server primary task is to ensure a
    request is sent to another entity closer to the
    target user.
  • SIP Registrar and Redirect Servers usually
    combined with Proxy Server
  • SIP Message either a request or a response
  • SIP Address uniquely identifies a user looks
    like an email address with sip prefix

5
SIP Messages
  • Requests
  • REGISTER ? BYE
  • INVITE ? CANCEL
  • ACK ? OPTIONS
  • Responses
  • 1xx progress ? 4xx request failure
  • 2xx success ? 5xx server failure
  • 3xx redirect ? 6xx global failure
  • Format
  • Request or status line headers body
  • Mandatory headers To, From, Cseq, Call-Id, Via,
    Contact

6
SIP Typical architecture
7
SIP Basic Proxy Call Flow
Proxy
UA Caller
UA Callee
(1) INVITE
(2) INVITE
(3) 200 OK
(4) 200 OK
(5) ACK
(6) BYE
(7) 200 OK
8
SIP Servlet Specification
  • SIP Servlet API developed under the JCP (Java
    Community Process) as JSR 116 (Java Specification
    Request), as a set of neutral interfaces
  • Goal to deliver a consistent, open platform on
    which to develop and deploy portable services

9
SIP Servlets vs. HTTP Servlets
  • Common concepts
  • Service method
  • JAR based deployment file
  • Deployment descriptors
  • Differences
  • SIP has proxy concept that can initiate new
    requests
  • SIP is asynchronous
  • SIP supports composition

10
SIP Servlet Components
  • Servlet Container
  • Environment in which a servlet can exist
  • Loads and initializes a servlet
  • Invokes the appropriate methods when SIP messages
    arrive
  • Servlets
  • Class with a service method, compiled into a
    Servlet Archive File (SAR)
  • Deployment descriptors
  • XML based file with configuration information and
    message matching rules

11
DynamicSoft implementation
  • Compliant with the JCP specification
  • Provided with a testing framework
  • Specification Restriction
  • The SIP Servlet API does not currently let you
    create an initial request in response to a
    non-SIP event (need to obtain the
    SipApplicationSession from an existing request to
    create a new request)
  • Implementation Restrictions
  • Application composition is not implmented
  • Transport is only TCP (not UDP)

12
Example 1 Simple Servlet
  • Servlet listens to INVITE requests, and forwards
    the INVITE to the desctination UA
  • public class SampleServlet extends SipServlet
  • public void doInvite(SipServletRequest
    a_Request)
  • throws ServletException, java.io.IOException
  • try
  • a_Request.send()
  • catch (IOException e)
  • throw new ServletException("Could not send
    request", e)

13
Example 2 Proxy behavior
  • Servlet acts as a proxy and sends the request
    downstream
  • Supervised mode will allow it to see responses
  • RecordRoute will allow it to see ACK and BYE
  • public void doInvite(SipServletRequest a_Request)
  • throws ServletException, IOException
  • Proxy p a_Request.getProxy(true)
  • p.setSupervised(true)
  • p.setRecordRoute(true)
  • System.out.println("Proxying request "
    a_Request.getRequestURI())
  • p.proxyTo(a_Request.getRequestURI())

14
SIP Servlets CallC
  • Initial background work
  • Validate through a set of examples that we can
    implement all the CallC features in the SIP
    Servlet platform
  • Identify issues related to deployment, robustness
    and security
  • Goal
  • Modify the CallC compiler to generate java code
    for the SIP Servlet Platform

15
Example CallC Code
  • To redirect a call towards several addresses
  • sip Adr 'siplatry_at_enseirb.fr',
  • 'sipfabien.latry_at_wanadoo.fr',
  • 'siplatry_at_inria.fr',
  • 'siplatry_at_compose.fr'
  • sip THIRD_PART 'sipPHILISTIN_at_enseirb.fr'
  • response incoming(call c)
  • response x
  • c.subject "call redirection "
  • foreach(sip s in Adr)
  • x forward(c,s)
  • if (x.code 200)
  • response y
  • c.subject "successfull redirection "
    ((string)s)
  • y forward(c,THIRD_PART)
  • return x
  • return x

16
Example Servlet Code
  • private void doInvite(SipServletRequest req)
  • throws ServletException, IOException
  • ArrayList dest new ArrayList()
  • dest.add(sipFactory.createAddress("siplatry_at_ense
    irb.fr").getURI())
  • dest.add(sipFactory.createAddress("sipfabien.lat
    ry_at_wanadoo.fr").getURI())
  • dest.add(sipFactory.createAddress("siplatry_at_inri
    a.fr").getURI())
  • dest.add(sipFactory.createAddress("siplatry_at_comp
    ose.fr").getURI())
  • req.setHeader("Subject", "call redirection")
  • Proxy p req.getProxy(true)
  • p.setSupervised(true)
  • p.setRecordRoute(true)
  • log("proxying to " dest)
  • p.proxyTo(dest)
Write a Comment
User Comments (0)
About PowerShow.com