SIP User Agent In JAVA

skatechildrenSoftware and s/w Development

Nov 3, 2013 (3 years and 5 months ago)

48 views

Cmpe 491 Special Project In

Computer Engineering

SIP User Agent In JAVA

Alp Eren YILMAZ

&

Serdar YALÇINKAYA

Our Agenda
-

I


Introduction to SIP


Alp Eren


A Sample of SIP Call


Alp Eren


Behaviors of SIP User Agents


Alp Eren


SIP Programming


Alp Eren


SIP Servers


Serdar


SIP Message Structure
-

Serdar




Our Agenda


II



Evaluation of Tested User Agents
-

Serdar


Proposed System
-

Serdar


Overview of the System


Development Steps


Typical GUI of the Sytem



Questions

Introduction to SIP:

Session Initiation Protocol (SIP)

is an
application


layer control (signaling) protocol
for creating, modifying and terminating
sessions with one or more participants.
These sessions includes Internet telephone
calls, multimedia distributions and multimedia
conferences.





Important Properties of SIP :


The
ability
of

establishing and modifying
peer


to


peer multimedia sessions
independently of underlying transport
protocols and characteristic of session



SIP supports the personal mobility by
assigning a single SIP Uniform Resource
Identifier (URI)




SIP Communication Messages:


REGISTRATION


Locate the user


INVITE


Initiate the session


ACK


Acknowledge of the INVITE


BYE


Termination of the session


CANCEL


Cancel pending request


OPTIONS


Capability check




Complementary IETF Protocols :


R
esources Reservation Protocol


RSVP



Real Time Protocol


RTP



Real Time Streaming Protocol


RTSP


Session Announcement Protocol


SAP


Session Description Protocol


SDP


Protocol Layers:


S
yntax and
E
ncoding

Layer


Transportation Layer


Transaction Layer


User Transaction Layer


Typical SIP Call :


The caller agent Alp @boun.edu.tr


PC user (Soft Phone)



The called party Serdar @ibm.com.tr


SIP Phone user



Two Proxy Servers



Alp ‘s PC
@boun.edu..tr


Serdar’s
SIP Phone

Typical SIP Call :

Message Sequence:

SIP User Agent Behaviors:

Three common characterisctic :



G
enerating the request



S
ending the request



P
rocessing the
r
esponses

SIP Programming:



SIP has texture encoding feature.
[1]



SIP allows third parties or user to program



SIP follows
HTTP

programming model






SIP Programming:

Programming Mechanisms:




In order to develop services programmers needs APIs


Three mechanisms suggested in IETF:
[2]



SIP Call Processing Language ( SIP


CPL )


SIP Common Gateway Interface ( SIP


CGI )


SIP Servlet



Other efforts


Parlay


JAIN™


Call Processing Language (CPL) :


Designed by the
IETF

to support sophisticated telephony services


May be used by both SIP or H.323.



XML

based scripting language for describing controlling call services
[3]


Simple

Syntax


Extendible


Easily edited by GUI tools



Scripts runs on network SIP signaling server to create end user services


Lightweight CPL interpreter is need to parser & validate scripts
.

CPL Example :


A

simple script that blocks anonymous callers

[4]
;


<?xml version="1.0" ?>

<!DOCTYPE cpl PUBLIC "
-
//IETF//DTD RFCxxxx CPL 1.0//EN" "cpl.dtd">

<cpl>



<incoming>





<address
-
switch field="origin" subfield="user">







<address is="anonymous">









<reject status="reject"











reason="I don't accept anonymous calls" />







</address>





</address
-
switch>



</incoming>

</cpl>


Common Gateway Interface (CGI) :


Almost identical to HTTP CGI
[
5
]



Language independent (
Perl, Tcl, C, C++
, ... )


Any binary may be executed as a separate program



Suitable for services that contains substantial web content



Passes message parameters through environmental variables to a
separate program.


More flexible but more risky



Feb. 1, 2001:
RFC 3050

(
Common Gateway Interface for SIP
)
published
[6]



Java Servlets :



Similar to HTTP servlets


I
nstead of using a separate process, messages are passed to
a class


The class runs within a JVM (Java Virtual Machine) on
server


Security provided by Java


Portable between OSs & servers



JAIN


SIP API:


Low level API that maps to IETF
-

RFC 2543


Interfaces for services across circuit switched and packet
networks


Three major objectives :



Service Portability


Write Once Run Anywhere


Network Converges


Any underlying network architecture





IP, ATM,Wireless,...


Service Provider Access by Anyone



Three SIP APIs under JAIN initiative;



JAIN


SIP API (JSR 32) :


Low level API for almost any signaling protocol ( SIP, H.323, ... )


Requires extensive knowledge of SIP.


Avaliable at Final Release,
http://jcp.org/jsr/stage/final.jsp



JAIN


SIP Lite :


High Level API for rapid application development


Especially User Agent development


Under development ,
http://jcp.org/jsr/detail/125.jsp




SIP Servlets :
[7]


API for SIP servlets


U
nder development,
http://jcp.org/jsr/detail/116.jsp




JAIN


SIP API: ( Cont.)

Conclusion:



The proposed user agent client will be
implemented by using the JAIN SIP API
[9]

that is released in December 2001.




GUI is designed by using Java Swing


SIP Servers

Three types of servers:


Registrars


Proxy


Redirect

Registrars


Registrars keep track of users within their
assigned network domain



Registrars take register requests and stores
the information in the SIP message in a
location service

Registrars

R
egistrar first looks at the Request
-
URI



if

it has access to a location service
responsible for the domain


if

not,
act like a proxy server and
forward the message

Registrar


When

gets a register message,
it should
authenticate the user agent client.


R
egistrar takes the address in the TO field


C
hecks this address in its location service
for the set of bindings


C
ompares the contact addresses


If exists overwrite, else create new binding

Registrar


Checks
expiration interval
of
binding


if it is not refreshed then
re
move



The registrar must send a 200
(OK)
response back

if everything Ok



If it fails then a 404
(not found)
response is sent
.



Proxy

P
roxy servers are application
-
layer routers

that forward the SIP requests and responses to

the proper destinations.


Proxy


P
roxies will make routing decisions and
modify

messages


Responses will route the same proxies in
reverse order



Proxy

Two kinds of proxy:


Stateless


Stateful

Stateless Proxy


A
cts as a simple forwarding element



D
ecides the route for the request
&
forwards
it


Then f
orget all information about the
message


Stateful Proxy


R
emembers
in
formation
(
transaction state)
a
bout each incoming and outgoing
(processed incoming request) request



This information is used to process future
messages related to that particular request



P
roxy can decide to fork an incoming
request, which must be handled statefully



Stateful Proxy


C
reates new server transactions for requests



Check validity of message


Decide route


Redirect


R
edirect servers
are

useful for reducing the load of
the proxy servers that are responsible for routing
requests by relying on redirection




S
ervers

push r
edirect

information in

the

response



C
lient got the redirection
&
will send a new
request based on the new routing information

SIP Messages

SIP messages are text based


generic message = start line




message

header




CRLF




[message

body]


SIP Messages

Two groups of messages:



Requests


Responses

Requests


Register


Invite


Ack


Cancel


Bye


Options

Requests
-
Register


Register provides a new binding between an


address and one or more contact addresses



Can r
emove previous bindings



Q
uery
whi
ch bindings are currently in place


Requests
-
Invite


Invite indicates
that

the user is being invited
to participate in a session



The message body contains a description of
the session to which the callee is being
invited



SDP

is used generally

Requests
-
Ack


I
ndicate
s

that the caller

has received a final
response to the Invite


Ack may contain
a

body with the final
session description


E
mpty

body
indicates the session
description in the Invite will be used

Requests
-
Cancel & Bye


The Cancel request cancels a pending
request
with given Call
-
ID, To,
From and
CSeq



Bye i
ndicate
s

to the server that the call will
be ended

Requests
-
Options


O
ptions allows a client to query a

client or
server for their capabilities




C
lient discover
s

information about methods,
content types, extensions, codecs etc.
supported without actually ”ringing” the
other party



Responses


SIP Version


Status Code


Reason Phrase


3
-
digit Status Code


The first digit describes the class of the
response

Responses
-
Status Code


1
xx
:

Informational



2
xx
:

Success



3
xx
:

Redirection



4
xx
:

Client

Error



5
xx
:

Server

Error



6
xx
:

Global

Failure


Responses
-
Examples


100



Trying


180



Ringing


200



OK


300



Multiple

Choices


301



Moved

Temporarily


400



Bad

Request


401



Unauthorized


500



Internal

Server

Error


504



Gateway

Time
-
out


600



Busy

Everywhere

SDP


SDP

is

intended for describing multimedia

sessions

for

the purposes of

session

announcement, session invitation, and other

forms of

multimedia session initiation.


SDP


The purpose of SDP is to convey

information

about media streams in

multimedia sessions to allow the
recipients of

a session description

to
participate in the session

SDP includes description of


Media to use (codec, sampling rate)


Media destination (IP address and port
number)


Session name and purpose


Times the session is active


Contact information

User Agents
-

EZ
-
Phone

User Agents
-

Ubiquity

User Agents
-

Ubiquity

Proposed User Agent

Implementing a JAVA based User Agent

providing functions:


Registering


Making, canceling, forwarding, ending a call


Address book


Debugging Window


(Optional) Video Conferencing



Proposed User Agent

Proposed User Agent

Proposed User Agent