org.mobicents.slee.util
Interface SipUtils

All Known Implementing Classes:
SipUtilsImpl

public interface SipUtils


Method Summary
 javax.sip.message.Request buildAck(javax.sip.Dialog dialog, java.lang.Object content)
          Build an ACK request based on a dialog and an optional content.
 javax.sip.message.Request buildInvite(javax.sip.address.Address fromAddress, javax.sip.address.Address toAddress, byte[] content, int cSeq)
          Sends an SIP invite request from caller to callee
 javax.sip.message.Request buildRequestWithAuthorizationHeader(javax.sip.ResponseEvent event, java.lang.String password)
          Build the request associated with the event again but this time include an authorization header or proxy authorization header based on the Digest Scheme presented in RFC 2069.
 javax.sip.address.SipURI convertAddressToSipURI(javax.sip.address.Address address)
           
 javax.sip.address.Address convertURIToAddress(java.lang.String uri)
           
 javax.sip.address.SipURI convertURIToSipURI(java.lang.String uri)
           
 javax.sip.header.ContactHeader createLocalContactHeader(java.lang.String user)
          Add a contact header (which is mandatory for INVITE's).
 javax.sip.header.ViaHeader createLocalViaHeader()
          Create a ViaHeader based on the local ip of the sip stack, the port and transport based on the sip providers first listening point.
 java.lang.String generateTag()
          Generates a tag to be used e.g.
 javax.sip.Dialog getDialog(javax.sip.RequestEvent event)
          Returns the Dialog for a RequestEvent.
 javax.sip.Dialog getDialog(javax.sip.ResponseEvent event)
          Returns the Dialog for a ResponseEvent.
 java.lang.String[] parseSipUri(java.lang.String sipURI)
          Parses a String in the format "sip:user@host" and returns a String array containing user in index 0 and host in index 1.
 void sendCancel(javax.sip.ClientTransaction ct)
          Sends a sip CANCEL request in the context of the transaction that is to be cancelled.
 void sendOk(javax.sip.message.Request request)
          Sends a sip OK request
 void sendStatefulOk(javax.sip.RequestEvent event)
           
 

Method Detail

generateTag

java.lang.String generateTag()
Generates a tag to be used e.g. as a from header tag parameter making up a part of the dialog id.

Returns:
Returns a generated tag as a String

convertURIToAddress

javax.sip.address.Address convertURIToAddress(java.lang.String uri)

convertURIToSipURI

javax.sip.address.SipURI convertURIToSipURI(java.lang.String uri)

getDialog

javax.sip.Dialog getDialog(javax.sip.RequestEvent event)
                           throws javax.sip.SipException
Returns the Dialog for a RequestEvent. Use this method e.g. if automatic dialog support is disabled in the sip stack that is used.

Parameters:
event -
Returns:
Throws:
javax.sip.SipException

getDialog

javax.sip.Dialog getDialog(javax.sip.ResponseEvent event)
                           throws javax.sip.SipException
Returns the Dialog for a ResponseEvent. Use this method e.g. if automatic dialog support is disabled in the sip stack that is used.

Parameters:
event -
Returns:
Throws:
javax.sip.SipException

parseSipUri

java.lang.String[] parseSipUri(java.lang.String sipURI)
                               throws java.net.URISyntaxException
Parses a String in the format "sip:user@host" and returns a String array containing user in index 0 and host in index 1.

Parameters:
SipURI - The URI to parse
Returns:
A String array containing the user (index 0) and host (index 1)
Throws:
java.net.URISyntaxException - If the URI is malformed

convertAddressToSipURI

javax.sip.address.SipURI convertAddressToSipURI(javax.sip.address.Address address)
                                                throws java.text.ParseException
Throws:
java.text.ParseException

sendCancel

void sendCancel(javax.sip.ClientTransaction ct)
                throws javax.sip.SipException
Sends a sip CANCEL request in the context of the transaction that is to be cancelled.

Parameters:
ct - The client transaction that was used to send e.g. the initial INVITE that is to be cancelled.
Throws:
javax.sip.SipException

buildInvite

javax.sip.message.Request buildInvite(javax.sip.address.Address fromAddress,
                                      javax.sip.address.Address toAddress,
                                      byte[] content,
                                      int cSeq)
                                      throws java.text.ParseException,
                                             javax.sip.InvalidArgumentException
Sends an SIP invite request from caller to callee

Parameters:
fromAddress - The originator address
toAddress - The destination address
content - The SDP content (use null if not present)
cSeq - The sequence number of the INVITE
Returns:
The INVITE request
Throws:
java.text.ParseException - If illegal address format
javax.sip.InvalidArgumentException - If cSeq invalid number

buildRequestWithAuthorizationHeader

javax.sip.message.Request buildRequestWithAuthorizationHeader(javax.sip.ResponseEvent event,
                                                              java.lang.String password)
                                                              throws javax.sip.TransactionUnavailableException
Build the request associated with the event again but this time include an authorization header or proxy authorization header based on the Digest Scheme presented in RFC 2069.

Parameters:
event - The event containing the 401 Unauthorized or 407 Proxy Authentication Required response and the request that generated this response.
password - The password used to authenticate the user
Returns:
The request including authentication.
Throws:
javax.sip.TransactionUnavailableException

buildAck

javax.sip.message.Request buildAck(javax.sip.Dialog dialog,
                                   java.lang.Object content)
                                   throws javax.sip.SipException
Build an ACK request based on a dialog and an optional content.

Parameters:
dialog - The dialog to which this ACK should be connected
content - The content to append to the ACK Request (use null if no content)
Returns:
The generated ACK Request
Throws:
javax.sip.SipException

createLocalContactHeader

javax.sip.header.ContactHeader createLocalContactHeader(java.lang.String user)
                                                        throws java.text.ParseException
Add a contact header (which is mandatory for INVITE's). The Contact header field value contains the URI at which the User Agent would like to receive requests, and this URI MUST be valid even if used in subsequent requests outside of any dialogs.

Returns:
A Contact Header based on the local ip of the sip stack, the port and transport based on the sip providers first listening point.
Throws:
java.text.ParseException

createLocalViaHeader

javax.sip.header.ViaHeader createLocalViaHeader()
                                                throws java.text.ParseException,
                                                       javax.sip.InvalidArgumentException
Create a ViaHeader based on the local ip of the sip stack, the port and transport based on the sip providers first listening point. The Via header field indicates the transport used for the transaction and identifies the location where the response is to be sent.

Returns:
A new via header
Throws:
javax.sip.InvalidArgumentException
java.text.ParseException

sendOk

void sendOk(javax.sip.message.Request request)
            throws java.text.ParseException,
                   javax.sip.SipException
Sends a sip OK request

Parameters:
request - The request to which the OK is sent
Throws:
java.text.ParseException
javax.sip.SipException

sendStatefulOk

void sendStatefulOk(javax.sip.RequestEvent event)
                    throws java.text.ParseException,
                           javax.sip.SipException,
                           javax.sip.InvalidArgumentException
Throws:
java.text.ParseException
javax.sip.SipException
javax.sip.InvalidArgumentException


Copyright © 2010. All Rights Reserved.