# Presentation: 803203

## Java Technology for Internet Communications

- Phelim O’Doherty
- Software ArchitectSun Microsystems

- Mudumbai Ranganathan
- Computer Scientist
- National Institute of Standards and Technology (NIST)

- |  JavaOne 2003  |  Session #1024

## Overall Presentation Goal

**B**
**E**
**G**
**I**
**N**
**N**
**I**
**N**
**G**

- Learn the technologies available for IP Communications networks that enable 3rd party application development.

- |  JavaOne 2003  |  Session #1024

## Speaker’s Qualifications

- Phelim O’Doherty is a Internet Communications Technology Evangelist at Sun Microsystems.
- Phelim O’Doherty is the specification lead for JSR 32 JAIN SIP and is an expert on JSR 116 SIP Servlet and JSR 180 SIP for J2ME.
- Mudumbai Ranganathan is a Computer Scientist at NIST.
- Mudumbai Ranganathan is the primary author of NIST-SIP a public domain implementation of JSR 32 JAIN SIP and serves as an expert on JSR 125 and JSR 141.

**B**
**E**
**G**
**I**
**N**
**N**
**I**
**N**
**G**

- |  JavaOne 2003  |  Session #1024

## Fact

**B**
**E**
**G**
**I**
**N**
**N**
**I**
**N**
**G**

**Fact**

- |  JavaOne 2003  |  Session #1024

## Presentation Agenda

- Overview of IP Communications
- Java SIP Containers
- SIP for J2ME
- Overview of JAIN SIP
- Conclusion

**B**
**E**
**G**
**I**
**N**
**N**
**I**
**N**
**G**

- |  JavaOne 2003  |  Session #1024

## IP Communications

- |  JavaOne 2003  |  Session #1024

## Evolution to IP Communications

**PROPR****I****ETARY**

**Solutions come from a single vendor that supplied everything in one proprietary box:  software, hardware and applications**** **
**Customers are locked-in to their vendor—no room for innovation, expensive to implement and maintain**

**Circuit-Switched**

**Transport****Hardware**

**Call Control & Switching**

**Services & Applications**

- |  JavaOne 2003  |  Session #1024

## Why Java and IP Communications?

**Culture**
**Open**
**Interoperable**
**Standard**
**Acceptance**
**Momentum**
**Flexible**
**Extensible**

-       **Developer**
**    ****Base**
** ****Platform**
** ****Indep.**
**    ****Vendor**
**      ****Indep.**

**Internet**
**     ****model**
**      ****Innovative**
**       ****Converged**
**      ****Services**
**    ****Scalable**
**      **
**      **

**JAVA**

**IP ****Comm’s**

- |  JavaOne 2003  |  Session #1024

## Sample Network Architecture

- S-CSCF

- MGCF

- MGW

- HSS

- ApplicationServer

**SIP for J2ME**

**JAIN SIP**

**SIP for J2ME**

**JAIN SIP**

**SIP for J2ME**

**SIP Servlet**

**JAIN SLEE**

**SIP Servlet**

**JAIN SLEE**

- I-CSCF

- Core Network

- Visited Network

- P-CSCF

**SIP Servlet**

- ApplicationServer

- Home Network

- ApplicationServer

**Sample Network Architecture**

- Untrusted Network

- OSA/OMA
- Node

- OSA/OMA
- Node

**J2EE**

**JAIN SLEE**

- |  JavaOne 2003  |  Session #1024

## Varieties of IP Communications Containers

**SLEE**

**SLEE App**

**EJB**

**JSP App**

**EJB App**

**HTTP**** Servlet**

**SIP ****Servlet**

**SIP, Content-based Charging, Call Control, User Interaction, Messaging, Mobility**

**SIP App**

**SLEE**

**INAP, TCAP, SIP**

**SLEE App**

**SLEE App**

**SIP ****Servlet**

**SIP**

**SIP App**

**SIP App**

***CORE NETWORK: Communications Services***
- Call Control Servers, Proxy Servers,
- Location, Presence and Messaging

***THIRD PARTY: Converged Services***

**Containers in **
**yellow boxes**

- |  JavaOne 2003  |  Session #1024

**Notes:**
1. 3 main application areas
   * the kinds of containers deployed
   * APIs that they use

2. OSS/BSS like traditional enterprise applications use J2EE

3. CORE network: typically embedded containers and applications

4. 3rd Party for building converged services
   *** just like web and web services are naturally integrated
          into today’s enterprise applications, communications
          capabilities using voice interaction, location, messaging,
          presence will also be naturally integrated into these
          enterprise applications

Will introduce SLEE and SIP Servlet in this presentation

## Why are Communications Applications Converging on Java Containers?

- Telco apps moving to component based architectures
- Desire to use Standard, Off-the-shelf container
- Write-once, run-anywhere
- Container provides important infrastructure services
- Higher level abstractions for State management, Transactions, Security, Resource pooling, ...
- Focus on core value-add application logic
- Leverage large community of Java developers
- Leverage enterprise development tools, test suites, ...
***Time to market and reduced development cost***

- |  JavaOne 2003  |  Session #1024

## Java SIP Containers

- |  JavaOne 2003  |  Session #1024

## SIP Execution Environments

**JAIN SIP**

**SIP ****Servlet**

**EJB**

**JVM**

**JAIN SLEE**

**SIP App**

**SIP App**

**SIP App**

**SIP App**

- |  JavaOne 2003  |  Session #1024

## Application development options

| Specification | Developer Community | Target Java Platform |
| --- | --- | --- |
| JAIN SIP | Desktop | J2SE |
| JAIN SIP & Connector | Enterprise | J2EE Business Tier |
| JAIN SIP & JAIN SLEE RA | Telecom | J2EE Business Tier |
| SIP Servlet | Enterprise | J2EE Web Tier |
| SIP for J2ME | Device | J2ME |

**Application development options**

- |  JavaOne 2003  |  Session #1024

## Realizing the SIP stack in Java

- SIP

**Message Layer**

**Transaction Layer**

**Dialog Layer**

**JCC**

**JAIN SLEE**

**Sipservlet**

**Industry ****Standard**
**Interfaces**

**Proprietary**
**Interfaces**

- |  JavaOne 2003  |  Session #1024

**Notes:**
See upcoming slides

## SIP in J2EE

**JCA Connector**

**SIP Servlet**

**SIP EJB**

**JAIN SIP**

**App Server**

**App Server**

**Application Server**

- |  JavaOne 2003  |  Session #1024

## JAIN SLEE

- JAIN SLEE is high performance event processing platform suitable for event driven applications.
- Supports simple and complex telecommunications applications.
- Applications deal with service logic only.
- System issues handled by container i.e. threading, transactions
- Standard robust application framework and programming model.
- Object Orientated, asynchronous and distributable
- Independent of underlying networks.
- Portable, robust and reusable applications.
- Asynchronous support
- Elaborate event distribution mechanism (with priority)
- Maps events to method invocations on components
- Creates component instances in response to initial events

- |  JavaOne 2003  |  Session #1024

## JAIN SLEE Architecture

- Management Application

- SIP based network

- SLEE

- Component
- Container

- component
- instance

- component
- instance

- component
- instance

- component
- instance

- component
- instance

- JMX Agent

- Trace Facility

- Timer Facility

- Alarm Facility

- Usage Facility

**JAIN SIP API**

- Event Dispatcher

- SLEE and Service
- Management
- Interfaces

- |  JavaOne 2003  |  Session #1024

## SLEE Application Characteristics

**SLEE Application Characteristics**

|  | Communications | Enterprise |
| --- | --- | --- |
| Invocations | Mostly asynchronous
Events, messages, protocol triggers 
Mapped to method invocations | Mostly synchronous invocations
 |
| Components | Light-weight fine-grained objects
Short transient lifetimes
Rapid creation, deletion | Heavy weight data access objects
Long persistent lifetimes |
| Data Sources | Multiple data sources 
location, context information 
Provisioned data, cached from master copy | Database servers
Definitive master copy
Back-end systems |
| Transactions | Light-weight transactions
For state replication demarcation
Faster completion and more frequent | Database transactions
Slower completion and less frequent |
| Computation | Compute-intensive
Main input and output are resource invocations, messages, events | Database access intensive |

- |  JavaOne 2003  |  Session #1024

**Notes:**
Additional notes:
1. Transactions:
    * Communications:  Simple transactions
       + no complex joins, projections, more localized data access
    * Enterprise: More complex transactions 
       + may involve large data sets, benefit from large memory caches

## JAIN SLEE with JAIN SIP Resource

- JAIN SLEE represents network resources as resource adaptors and each resource adaptor has a type
- Resource adaptor type for JAIN SIP is ‘javax.sip’
- JAIN SLEE identifies Event by Event types
- JAIN SIP Events are classified RequestEvents, ResponseEvents and TimeoutEvents, each of these classifications contains numerous types
- For example the event type of a Request message of type ‘INVITE’ is ‘javax.sip.RequestEvent.Request.INVITE’
- JAIN SLEE represents the flow of events as activities
- Activity Objects in JAIN SIP are ClientTransactions (locally initiated) and ServerTransactions (remotely initiated)

- |  JavaOne 2003  |  Session #1024

## SIP Servlet

- SIP servlets typically reside on network servers where they will be responsible for making routing decisions.
- Supports RFC3261, RFC3262, RFC3265, RFC3428, and RFC2976
- Utilizes http servlet model as foundation, builds on http generic part for essential SIP request and response functionality
- Allow applications to perform a fairly complete set of SIP signaling actions
- User agent client (UAC)
- User agent server (UAS)
- Proxy server

- |  JavaOne 2003  |  Session #1024

## SIP Servlet Goals

- Simplicity for the application developer
- Containers handle “non-essential” complexity such as managing network listening points, CSeq, Call-ID and Via headers, routes, etc.
- Containers support converged applications
- Applications that span multiple protocols and media types, for example, Web, telephony, and presence.
- Third party application development:
- An XML DD* *is used to communicate application information from the application developer to deployers.
- Application composition:
- Several applications can execute on the same incoming or outgoing request or response. Each application has its own set of rules and executes independently.

- |  JavaOne 2003  |  Session #1024

## Extension to HTTP Servlet Model

- HTTP is not a peer-to-peer protocol like SIP therefore SIP Servlet extensions include:
- Initiate requests
- Receive responses as well as requests
- Generate multiple Responses
- one or more 1xx followed by a final response
- Proxying requests, possibly to multiple destinations

- |  JavaOne 2003  |  Session #1024

## Protocol and Application Sessions

- Sipservlet defines two types of sessions:
- SipSession (Protocol Session)
- Equivalent to HTTP Session and represents a Dialog in SIP
- SipApplicationSession
- Provides storage for application data
- Enable different protocol sessions to share state i.e. HTTP and SIP
- Defined by SIPServlet but is expected to be adopted by the Servlet specification in a future release.

- |  JavaOne 2003  |  Session #1024

## Message Hierarchy

- SipServletResponse

- SipServletRequest

- SipServletMessage

- ServletRequest

- ServletResponse

- javax.servlet

- javax.servlet.sip

- |  JavaOne 2003  |  Session #1024

## SIP for J2ME

- |  JavaOne 2003  |  Session #1024

## Overview: SIP for J2ME

- SIP for J2ME is the standardised SIP interface for mobile handsets to communicate with core network functionality.
- SIP for J2ME is an optional package for the J2ME platform that enable resource limited devices to send and receive SIP messages
- The specific is designed for the CLDC profile, however it can also be used on to the CDC profile also.
- The specification gives the developer transactional control over the SIP protocol
- Client devices must support SIP for Rel5.0 of the UMTS architecture. SIP for J2ME is the perfect platform for these client devices.

- |  JavaOne 2003  |  Session #1024

## Enables terminals supporting CLDC to run SIP enabled MIDlets
Builds upon CLDC Generic Connection framework
Specifically targeted at mobile phone handsets
Keep the “look and feel” of the HTTP API
Keep the API size small - keep the number of created objects low
Provide developers with helper functions
RefreshHelper for Register and Subscribe

- Builds upon CLDC Generic Connection framework
- Specifically targeted at mobile phone handsets
- Keep the “look and feel” of the HTTP API
- Keep the API size small - keep the number of created objects low
- Provide developers with helper functions
- RefreshHelper for Register and Subscribe

**SIP for J2ME Goals**

- |  JavaOne 2003  |  Session #1024

## SIP and the Generic Connection Framework

- |  JavaOne 2003  |  Session #1024

## SIP for J2ME Architecture

- |  JavaOne 2003  |  Session #1024

## Other SIP and IM Interfaces & J2ME

**CLDC**

**JAIN ****SIMPLE**

**KVM**

**Other SIP and IM Interfaces & J2ME**

**SIP for****J2ME**

- |  JavaOne 2003  |  Session #1024

## JAIN SIP

- |  JavaOne 2003  |  Session #1024

## Java-standard interface to a SIP signaling stack.
Standardized the interface to the stack.
Standardized the events and event semantics.
Application portability - verified via the TCK. 
Designed for the developer who requires powerful access to the SIP protocol.
JAIN SIP can be utilized in a user agent, proxy, or imbedded into a service container.
Supported RFCs:
RFC 3261, 2976, 3262,
RFC 3265, 3311, 3428

- Standardized the interface to the stack.
- Standardized the events and event semantics.
- Application portability - verified via the TCK.
- Designed for the developer who requires powerful access to the SIP protocol.
- JAIN SIP can be utilized in a user agent, proxy, or imbedded into a service container.
- Supported RFCs:
- RFC 3261, 2976, 3262,
- RFC 3265, 3311, 3428

**Overview: JAIN SIP**

- |  JavaOne 2003  |  Session #1024

## JAIN SIP Architecture

- Listener

- Provider

- Provider

**Stack**

**Stack**

- Listener

- Network

- SIP Events

- SIP Events

- SIP Messages

- SIP Messages

- Application

- Listening Point

- Listening Point

- |  JavaOne 2003  |  Session #1024

## Responsibilities of the Application

- Application registers an implementation of the SipListener interface to interact with the SIP Stack
- Application MUST go via the SipProvider for all messaging with the stack
- Application Sends messages and access stack objects via the SipProvider.
- Application receives messages from the stack as Events via the SipListener interface.

- |  JavaOne 2003  |  Session #1024

## Services provided by JAIN SIP

- Provide methods to format and send SIP messages
- Parse incoming messages and enable application to access to fields via a standardized JAVA interface.
- Invoke appropriate application handlers when protocol significant (message arrivals, Transaction time-outs)
- Provide Transaction support and manage Transaction state and lifetime on behalf of a user application.
- Provide Dialog support and manage Dialog state and  lifetime on behalf on a user application.

- |  JavaOne 2003  |  Session #1024

## SIP Transactions 

**Server transaction**

**Client transaction **

**Client transaction**

**Server transaction**

**Stateful proxy**

**UAC**

**UAS**

- SIP transaction consists of a single request and any responses to that request.

- |  JavaOne 2003  |  Session #1024

## Transaction Support

- Transaction is created on incoming Request or may be created to send outgoing request.
- When a Request is sent out statefully, application must request a ClientTransaction for the outgoing Request.
- When a new Request arrives, Stack associates a ServerTransaction with Request and passes up to application.
- When a response arrives, the Stack possibly associates a previously created ClientTransaction with the response and passes up to the Application.
- The JAIN SIP implementation manages the association between Transactions and Dialogs.

- |  JavaOne 2003  |  Session #1024

## Support for Dialogs

- A Dialog is a peer to peer association between communicating SIP endpoints.
- Maintains Route Sets and Sequence Numbers.
- Dialogs are never directly created by the Application..
- Dialogs are established by Dialog creating Transactions (INVITE, MESSAGE, SUBSCRIBE...), however are managed by the stack.
- Dialog deletion may be under application control.
- Transactions may belong to a Dialog
- Dialog state changes as a result of changes in Transaction State

- |  JavaOne 2003  |  Session #1024

## Addresses, Messaging and Headers

- Defines support for Address/Header/Message Factories.
- Address package contains a URI wrapper and defines URIs for SIP and Tel URIs.
- Header package defines interfaces for all the supported headers.
- Accessor (set/get) methods for SIP Header parameters.
- Deep copy requirement for cloning Addresses, Headers and Messages for the benefit of proxies.

- |  JavaOne 2003  |  Session #1024

## SipStack Interface

- Manages Listening Points and Providers.
- SipStack associated with an IP address.
- Can Have multiple Listening points.
- Application can have multiple SipStacks.
- Cannot be deleted once created.
- Instantiated by the SipFactory and initialized with a Property set.
- javax.sip.* properties are reserved and names defined for stack configuration properties.

- |  JavaOne 2003  |  Session #1024

## SipProvider Interface

- Send Request's either statefully via client transactions or statelessly.
- Send Response's to a recently received Requests either statefully via server transactions or statelessly.
- Register a SipListener to the SipProvider.
- Notifies Registered Listener of Events (Request/Response/Timeout).
- De-register a SipListener from the SipProvider.
- Once de-registered, no longer receive Events from SipProvider.
- New Client and Server Transaction methods.
- Listening Point manipulation methods.
- Only one provider per listening point.

- |  JavaOne 2003  |  Session #1024

## SipListener Interface

- A single SipListener per SipStack which implies a single Listener in the architecture
- all SipProviders associated to a Sipstack have the same SipListener.
- Process Request's either statefully or statelessly dependent on application.
- Process Response's to a recently sent Requests statefully.
- Process Transaction timeouts and retransmits Timer events.

- |  JavaOne 2003  |  Session #1024

## Application  - Stack Creation

**try {**
**   ****Properties properties = new Properties();**
**   ****properties.setProperty("javax.sip.IP_ADDRESS",   ****	****	****	****	****  ****	****  "129.6.55.181");**
**   ****properties.setProperty("javax.sip.OUTBOUND_PROXY", ****	****	****	****	**** "129.6.55.182:5070/UDP");**
**   ......****// Other initialization properties.**
**   ****try {**
**	****sipStack =**** ****sipFactory.createSipStack(properties);**
**   ****} catch(SipException e) {**
**	****	****System.exit(-1);**
**   ****}**
**} **

- Initialize Stack using SipFactory:

- |  JavaOne 2003  |  Session #1024

## Application – Request Creation

**try {**
**  ****SipURI requestURI = addressFactory.createSipURI**
**            ****	****    ****(toUser, toSipAddress);**
**  ****// ... Create other headers**
**  ****Request request = messageFactory.createRequest**
**  ****	****	****(requestURI, Request.INVITE, callIdHeader, ****	****cSeqHeader, fromHeader, toHeader, ****	****viaHeaders, maxForwards);**
**}**

- Initialize Request using Factories:

- |  JavaOne 2003  |  Session #1024

## Application  - Sending Requests

**try {**
** ****	****// Create the client transaction**
**	****ClientTransaction inviteTid = ****	****sipProvider.getNewClientTransaction(request);**
**	****// send the request**
**  ****sipProvider.sendRequest(inviteTid,request);**
**}**

- Send outgoing messages:

- |  JavaOne 2003  |  Session #1024

## Application – Processing Requests 

**try {**
**	****public void  processRequest(RequestEvent ****	****	****requestEvent) {**
**      ****Request request = ****	****	****	****	****	****	****requestReceivedEvent.getRequest();**
**      ****ServerTransaction st = ****	****	****	****	****	****	****requestEvent.getTransaction();**
**      ****// do request specific processing here                **
**   ****}**
**}**

- Handle incoming messages as Events:

- |  JavaOne 2003  |  Session #1024

## JAIN SIP for Instant Messaging

- JAIN SIP can be used for building Instant Messaging and Presence Clients and Servers.
- API supports the required methods and Headers.
- JAIN creates and manages Dialogs for SUBSCRIBE and MESSAGE methods.
- NIST-SIP JAIN IM Client SipListener is about 1100 LOC.
- Interoperates with Microsoft IM and packaged with RI as example.

- |  JavaOne 2003  |  Session #1024

## JAIN-SIP in Proxy Servers

- JAIN SIP facilities construction of Proxy Servers:
- Stateless, Transaction-stateful, and Dialog-stateful operation.
- Application has access to Dialog/Transaction state and route tables.
- Support for extensibility and application- controlled Routing.
- Deep copy semantics for cloning.
- Example Proxy (including presence server) is about 3500 LOC and is included with RI.

- |  JavaOne 2003  |  Session #1024

## JAIN SIP Extensibility

- SIP Extensions Typically Define:
- New Methods
- New Headers
- New Dialog Creating Methods
- JAIN SIP Supports these by:
- Architected ExtensionHeader that can be created/accessed by name.
- New Dialog Creating methods specified at Stack configuration via configuration property.

- |  JavaOne 2003  |  Session #1024

## JAIN SIP Updates

- RFC2543 Supported.
- J2SE 1.3 and above.
- Transactions referenced by long.
- Transaction state is not visible to application.
- No explicit Dialog Support.
- Stack Configuration not defined.

- RFC3261 Supported.
- J2SE 1.4 and above.
- Transaction interfaces defined.
- Transaction/Dialog state can be read by application.
- Dialog interface defined and managed by stack.
- Stack Configured with defined properties.

- JAIN SIP v1.0

- JAIN SIP v1.1

- |  JavaOne 2003  |  Session #1024

## JAIN SIP Reference Implementation

- In the public domain.
- Includes example IM client and proxy.
- Includes trace visualization tools.
- Footprint
- About 46000 LOC.
- Jar file about 355 Kb (not counting JAIN API).
- About 3 Megabytes of memory after class loading and running a few requests.

- http://www-x.antd.nist.gov/proj/iptel

- |  JavaOne 2003  |  Session #1024

## Useful URLs

- JAIN SIP Specification: http://jcp.org/jsr/detail/032.jsp
- NIST IP-Telephony Project Page: http://www-x.antd.nist.gov/proj/iptel/index.html
- JAIN SIP Discussion List: http://archives.java.sun.com/jain-sip-interest.html
- JAIN Homepage:http://java.sun.com/products/jain

- |  JavaOne 2003  |  Session #1024

## Conclusion

- |  JavaOne 2003  |  Session #1024

## Other Java API’s for IP Communications

- JAIN SIMPLE – Panasonic
- JAIN SIP Lite - Ubiquity
- JAIN Enum – NetNumber
- JAIN MGCP – Telcordia
- JAIN Megaco – Hughes Software Systems
- JAIN SDP – dynamicsoft

**Other Java API’s for IP Communications**

- http://jcp.org/en/jsr/tech?listBy=2&listByType=tech

- |  JavaOne 2003  |  Session #1024

## Summary

- IP Communications is the crux of NGN’s, investment and converged applications.
- Java and IP Communications together enable a developers working environment.
- You can develop services today with an open source SIP stack supporting standardized Java API’s.
- The Internet and communications networks will converge, Java developers will capitalize.

**E**
**N**
**D**

- |  JavaOne 2003  |  Session #1024

## If You Only Remember One Thing...

- Communications is the ‘Killer App’.
- IP Communications & Java lets you ‘play’!
-  The Internet – EMail – IM
-  The Mobile Phone – SMS - MMS
-  ........ What’s next?
-  The possibilities are endless!

**E**
**N**
**D**

- |  JavaOne 2003  |  Session #1024

## Q&A

**Q&A**

- |  JavaOne 2003  |  Session #1024

## Slide 59

- |  JavaOne 2003  |  Session #1024