JSR180 SIP API for J2ME Version 1.0.1

This specification defines the JSR180, SIP API for J2ME.

See:
          Description

Packages
javax.microedition.sip This specification defines the JSR180, SIP API for J2ME.

 

This specification defines the JSR180, SIP API for J2ME. This javadoc documentation contains Proposed Final Draft according to the Java Community Process. This document and all associated documents are subject to the terms of the JCP (2.1) agreements (i.e. JSPA and/or IEPA).

Copyright Notice and Disclaimers

JSR-180 SIP API for J2ME Specification ("Specification")
Version: 1.0.1
Status: Final Release
Specification Lead: Nokia Corporation ("Specification Lead")
Release: 2004-12-17

Copyright 2004 Nokia Corporation
All rights reserved.

NOTICE; LIMITED LICENSE GRANTS

Specification Lead hereby grants You a fully-paid, non-exclusive, non-transferable, worldwide, limited license (without the right to sublicense), under the Specification Lead's applicable intellectual property rights to view, download, use and reproduce the Specification only for the purpose of internal evaluation, which shall be understood to include developing applications intended to run on an implementation of the Specification provided that such applications do not themselves implement any portion(s) of the Specification. The Specification contains proprietary information of the Specification Lead and may only be used in accordance with the license terms set forth herein.

Subject to the reciprocity requirement set forth below Specification Lead also grants You a perpetual, non-exclusive, worldwide, fully paid-up, royalty free, irrevocable limited license (without the right to sublicense) under any applicable copyrights or patent rights it may have in the Specification to create and/or distribute an Independent Implementation of the Specification that: (a) fully implements the Specification without modifying, subsetting or extending the public class or interface declarations whose names begin with �java� or �javax� or their equivalents in any subsequent naming convention adopted by Specification Lead through the Java Community Process, or any recognized successors or replacements thereof; (b) implement all required interfaces and functionality of the Specification; (c) only include as part of such Independent Implementation the packages, classes or methods specified by the Specification; (d) pass the technology compatibility kit ("TCK") for such Specification; and (e) are designed to operate on a Java platform which is certified to pass the complete TCK for such Java platform. For the purpose of this agreement the applicable patent rights shall mean any claims for which there is no technically feasible way of avoiding infringement in the course of implementing the Specification. Other than this limited license, You acquire no right, license, title or interest in or to the Specification or any other intellectual property rights of the Specification Lead.

You need not include limitations (a)-(e) from the previous paragraph or any other particular "pass through" requirements in any license You grant concerning the use of Your Independent Implementation or products derived from it. However, except with respect to implementations of the Specification (and products derived from them) by Your licensee that satisfy limitations (a)-(e) from the previous paragraph, You may neither: (i) grant or otherwise pass through to Your licensees any licenses under Specification Lead's applicable intellectual property rights; nor (ii) authorize Your licensees to make any claims concerning their implementation's compliance with the Specification in question.

The license provisions concerning the grant of licenses hereunder shall be subject to reciprocity requirement so that Specification Lead�s grant of licenses shall not be effective as to You if, with respect to the Specification licensed hereunder, You (on behalf of yourself and any party for which You are authorized to act with respect to this Agreement) do not make available, in fact and practice, to Specification Lead and to other licensees of Specification on fair, reasonable and non-discriminatory terms a perpetual, irrevocable, non-exclusive, non-transferable, worldwide license under such Your (and such party�s for which You are authorized to act with respect to this Agreement) patent rights which are or would be infringed by all technically feasible implementations of the Specification to develop, distribute and use an Independent Implementation of the Specification within the scope of the licenses granted above by Specification Lead. However, You shall not be required to grant a license:

  1. to a licensee not willing to grant a reciprocal license under its patent rights to You and to any other party seeking such a license with respect to the enforcement of such licensee�s patent claims where there is no technically feasible alternative that would avoid the infringement of such claims;
  2. with respect to any portion of any product and any combinations thereof the sole purpose or function of which is not required in order to be fully compliant with the Specification; or
  3. with respect to technology that is not required for developing, distributing and using an Independent Implementation.

Furthermore, You hereby grant a non-exclusive, worldwide, royalty-free, perpetual and irrevocable covenant to Specification Lead that You shall not bring a suit before any court or administrative agency or otherwise assert a claim that the Specification Lead has, in the course of performing its responsibilities as the Specification Lead under JCP process rules, induced any other entity to infringe Your patent rights.

For the purposes of this Agreement: "Independent Implementation" shall mean an implementation of the Specification that neither derives from the reference implementation to the Specification ("Reference Implementation") source code or binary code materials nor, except with an appropriate and separate license from licensor of the Reference Implementation, includes any of Reference Implementation's source code or binary code materials.

This Agreement will terminate immediately without notice from Specification Lead if You fail to comply with any material provision of or act outside the scope of the licenses granted above.

TRADEMARKS

Nokia is a registered trademark of Nokia Corporation. Nokia Corporation 's product names are either trademarks or registered trademarks of Nokia Corporation Your access to this Specification should not be construed as granting, by implication, estoppel or otherwise, any license or right to use any marks appearing in the Specification without the prior written consent of Nokia Corporation or Nokia's licensors .

No right, title, or interest in or to any trademarks, service marks, or trade names of Sun or Sun's licensors, is granted hereunder. Sun, Sun Microsystems, the Sun logo, Java, J2ME, and the Java Coffee Cup logo are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.

DISCLAIMER OF WARRANTIES

THE SPECIFICATION IS PROVIDED "AS IS". SPECIFICATION LEAD MAKES NO REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, THAT THE CONTENTS OF THE SPECIFICATION ARE SUITABLE FOR ANY PURPOSE OR THAT ANY PRACTICE OR IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADE SECRETS OR OTHER RIGHTS. This document does not represent any commitment to release or implement any portion of the Specification in any product.

THE SPECIFICATION COULD INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS. CHANGES ARE PERIODICALLY ADDED TO THE INFORMATION THEREIN; THESE CHANGES WILL BE INCORPORATED INTO NEW VERSIONS OF THE SPECIFICATION, IF ANY. SPECIFICATION LEAD MAY MAKE IMPROVEMENTS AND/OR CHANGES TO THE PRODUCT(S) AND/OR THE PROGRAM(S) DESCRIBED IN THE SPECIFICATION AT ANY TIME. Any use of such changes in the Specification will be governed by the then-current license for the applicable version of the Specification.

LIMITATION OF LIABILITY

TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL SPECIFICATION LEAD OR ITS LICENSORS BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SPECIFICATION, EVEN IF SPECIFICATION LEAD AND/OR ITS LICENSORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

You will indemnify, hold harmless, and defend Specification Lead and its licensors from any claims arising or resulting from: (i) Your use of the Specification; (ii) the use or distribution of Your Java application, applet and/or clean room implementation; and/or (iii) any claims that later versions or releases of any Specification furnished to You are incompatible with the Specification provided to You under this license.

RESTRICTED RIGHTS LEGEND

U.S. Government: If this Specification is being acquired by or on behalf of the U.S. Government or by a U.S. Government prime contractor or subcontractor (at any tier), then the Government's rights in the Software and accompanying documentation shall be only as set forth in this license; this is in accordance with 48 C.F.R. 227.7201 through 227.7202-4 (for Department of Defense (DoD) acquisitions) and with 48 C.F.R. 2.101 and 12.212 (for non-DoD acquisitions).

REPORT

You may wish to report any ambiguities, inconsistencies or inaccuracies You may find in connection with Your use of the Specification ("Feedback"). To the extent that You provide Specification Lead with any Feedback, You hereby: (i) agree that such Feedback is provided on a non-proprietary and non-confidential basis, and (ii) grant Specification Lead a perpetual, non-exclusive, worldwide, fully paid-up, irrevocable license, with the right to sublicense through multiple levels of sublicensees, to incorporate, disclose, and use without limitation the Feedback for any purpose related to the Specification and future versions, implementations, and test suites thereof.

JSR180 Overview

This specification defines a J2ME Optional Package that enables resource limited devices (referred to as 'terminals' in the following) to send and receive SIP messages. The API is designed to be a compact and generic SIP API, which provides SIP functionality in transaction level. The API is integrated into the Generic Connection Framework defined in Connected, Limited Device Configuration (CLDC).

The SIP API for J2ME is designed as an Optional Package that can be used with many J2ME Profiles. The minimum platform required by this API is the J2ME CLDC v1.0. The API can also be used with the J2ME Connected Device Configuration (CDC).

The picture below shows the simplified class diagram of the API, relations between classes, inheritance from javax.microedition.Connection and relation to javax.microedition.Connector.

How to use the SIP API for J2ME

The SIP API is used by the applications to implement SIP User Agent (UA) functionality. The following picture shows what interfaces terminals A and B are using to implement SIP User Agent Client (UAC) and User Agent Server (UAS) functionality respectively. See Glossary for explanation of UAC and UAS functionality.

In reality applications will use both SIP client and server connections in the same terminal (terminal A in picture below) and thus implementing both UAC and UAS functionality.

The following code examples shows how to open SIP connections and the usage of the main classes SipClientConnection, SipServerConnection and SipConnectionNotifier. Examples of helper classes: SipDialog, SipAddress, SipHeader and RefreshHelper are shown in the API documentation.
The example below shows how to open a SIP client connection, send one request and receive a response. The interface used in this simple client connection example is SipClientConnection.
 public void sendTextMessage(String msg) {
    SipClientConnection sc = null;
    try {
       // open SIP connection
       sc = (SipClientConnection) Connector.open("sip:[email protected]:5060");
       
       // initialize SIP request MESSAGE
       sc.initRequest("MESSAGE", null);
       
       // set some headers
       sc.setHeader("From", "sip:[email protected]");
       sc.setHeader("Subject", "testing...");

       // write message body
       sc.setHeader("Content-Type", "text/plain");
       sc.setHeader("Content-Length", Integer.toString(msg.length()));
       OutputStream os = sc.openContentOutputStream();
       os.write(msg.getBytes());
       os.close(); // close stream and send the message to the network

       // wait max 15 seconds for response
       sc.receive(15000);

       // response received
       if(sc.getStatusCode() == 200) {
          // handle 200 OK response
       } else {
          // handle other responses
       }
       sc.close();    
     } catch(Exception ex)
       // handle Exceptions
     } 
 }
   
The following code example shows how to open a SIP server connection, receive one request and send a response. The interfaces used in the simple server connection example are SipConnectionNotifier and SipServerConnection.
 public receiveMessage() {
    SipConnectionNotifier scn = null;
    SipServerConnection ssc = null;
    String method = null;
    
    try {
       // Open SIP server connection and listen to incoming requests
       scn = (SipConnectionNotifier) Connector.open("sip:");
       
       // block and wait for incoming request.
       // SipServerConnection is established and returned
       // when a new request is received.
       ssc = scn.acceptAndOpen();

       // what was the SIP method
       method = ssc.getMethod();
       if(method.equals("MESSAGE")) {
          // read the content of the MESSAGE
          String contentType = ssc.getHeader("Content-Type");
          if((contentType != null) && contentType.equals("text/plain")) {
             InputStream is = ssc.openContentInputStream();
             int ch;
             // read content
             while ((ch = is.read()) != -1) {
                 ...
             }
          }
          // initialize SIP 200 OK and send it back
          ssc.initResponse(200);
          ssc.send();
       }
       ssc.close();
    } catch(Exception ex) {
      // handle IOException, InterruptedIOException, SecurityException
      // or SipException
    }
 }
   

SIP (Session Initiation Protocol) Overview

SIP is an application-layer control protocol that can establish, modify, and terminate multimedia sessions. SIP can also invite participants to already existing sessions. SIP transparently supports name mapping and redirection services, which supports personal mobility - users can maintain a single externally visible identifier regardless of their network location (see RFC 3261 [1]). SIP can also be used to implement non-real-time services like Instant Messaging and Presence [2][3].

SIP supports five facets of establishing and terminating multimedia communications:

User location
- determination of the end system to be used for communication
User availability
- determination of the willingness of the called party to engage in communications
User capabilities
- determination of the media and media parameters to be used
Session setup
- establishment of session parameters at both called and calling party
Session management
- including transfer and termination of sessions, modifying session parameters, and invoking services

Glossary

This section defines some terms used in the specification. Please also refer to the RFC 3261 [1].

Client Connection

The SIP API's client connection (class SipClientConnection) is an interface to SIP client transaction, which sends original request and receives responses until final response. See also, SIP Transaction and Server Connection.

Server Connection

The SIP API's server connection (class SipServerConnection) is an interface to SIP server transaction, which receives the original request and sends response(s) until final response. Also see, SIP Transaction and Client Connection.

SIP Transaction

A SIP transaction occurs between a client and a server and comprises all messages from the first request sent from the client to the server up to a final (non-1xx) response sent from the server to the client. If the request is INVITE and the final response is a non-2xx, the transaction also includes an ACK to the response. The ACK for a 2xx response to an INVITE request is a separate transaction.

SIP Dialog

The SIP API's class SipDialog keeps the information about one SIP dialog. Using that interface the user is able to send subsequent requests within that dialog. A dialog is a peer-to-peer SIP relationship between two UAs that persists for some time. A dialog is established by SIP messages, such as a 2xx response to an INVITE request. A dialog is identified by a call identifier, local tag, and a remote tag.

User Agent (UA)

A logical entity that can act as both a user agent client and user agent server. Typically an application (e.g. MIDlet) will implement the User Agent functionality using the SIP API for J2ME. See also, UAC and UAS.

User Agent Client (UAC)

A user agent client is a logical entity that creates a new request, and then uses the client transaction state machinery to send it. The role of the UAC lasts only for the duration of that transaction. In other words, if a piece of software initiates a request, it acts as a UAC for the duration of that transaction. If it receives a request later, it assumes the role of a user agent server for the processing of that transaction.

User Agent Server (UAS)

A user agent server is a logical entity that generates a response to a SIP request. The response accepts, rejects, or redirects the request. This role lasts only for the duration of that transaction. In other words, if a piece of software responds to a request, it acts as a UAS for the duration of that transaction. If it generates a request later, it assumes the role of a user agent client for the processing of that transaction.

Method

The method is the primary function that a request is meant to invoke on a server. The method is carried in the request message itself. Example methods are INVITE and BYE.

Provisional Response

A response used by the server to indicate progress, but that does not terminate a SIP transaction. 1xx responses are provisional, other responses are considered final.

Final Response

A response that terminates a SIP transaction, as opposed to a provisional response that does not. All 2xx, 3xx, 4xx, 5xx and 6xx responses are final.

Notation used

This specification uses the following terms as they are defined in the table below:

Term

Definition

MUST

The associated definition is an absolute requirement of this specification.

MUST NOT

The definition is an absolute prohibition of this specification.

SHOULD

Indicates a recommended practice. There may exist valid reasons in particular circumstances to ignore this recommendation, but the full implications must be understood and carefully weighed before choosing a different course.

SHOULD NOT

Indicates a non-recommended practice. There may exist valid reasons in particular circumstances when the particular behavior is acceptable or even useful, but the full implications should be understood and the case carefully weighed before implementing any behavior described with this label.

MAY

Indicates that an item is truly optional.

References

[1] SIP: Session Initiation Protocol, RFC 3261, June 2002
[2] Session Initiation Protocol (SIP)-Specific Event Notification, RFC 3265, June 2002
[3] Session Initiation Protocol (SIP) Extension for Instant Messaging, RFC 3428, December 2002
[4] Indicating User Agent Capabilities in the Session Initiation Protocol (SIP), RFC 3840, August 2004
[5] Caller Preferences for the Session Initiation Protocol (SIP), RFC 3841, August 2004




Copyright © 2004 Nokia Corporation. All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.