SIP Servlet Engine© Documentations
 
  Top >   SIP Servlet Programming >    Basic Components >   SIP Signaling Component >   Utility Function
 
 

Utility Functions

The utility function of SIP Servlet Engine provides a class that defines convenient methods to develop your SIP servlet as a SIP servlet. You can use this class (BasicSipServlet) as the base class of your SIP servlet. BasicSipServlet provides small utility functions.

SIP Servlet Engine also provides a package that contains utility classes. For more information, see this page.

List 1: BasicSipServlet Class

package com.oki.sip.equips.signal;

abstract public class BasicSipServlet extends SipServlet {

    public SipFactory getSipFactory();

    public LocationEditor getLocationEditor();

    public SubscriberEditor getSubscriberEditor();

    public PresenceACLEditor getPresenceACLEditor();

    protected SipServletRequest initiateRequest(SipApplicationSession appSession,
                                                String method,
                                                Address from,
                                                Address to)
        throws ServletException;

    public SipServletRequest initiateRequest(SipApplicationSession appSession,
                                             String method,
                                             URI from,
                                             URI to)
        throws ServletException;

    public SipServletRequest initiateRequest(SipApplicationSession appSession,
                                             String method,
                                             String from,
                                             String to)
        throws ServletParseException, ServletException;

    public SipURI getPlainURI(SipURI uri); 
 
    public static int getCSeqNumber(SipServletMessage msg);

    public static String getCSeqMethod(SipServletMessage msg);

    public static void copyContent(SipServletMessage msrc, SipServletMessage mdst)
        throws IOException;

    public static String getShortInfo(SipServletMessage msg);

    public static String getFullInfo(SipServletMessage msg);
}

getSipFactory is a method that returns the SIP factory stored in the attribute of the servlet context.

getLocationEditor, getSubscriberEditor, getPresenceACLEditor are methods that return the corresponding SPI. If your system does not have any of the SPI., UnsupportedOperationException is thrown.

initiateRequest is a utility used for SIP servlets to create requests. SIP Servlet defines the SipFactory.createRequest used for a servlet to create requests. In order for the servlet to receive responses to these requests, it must explicitly specify itself with the SipSession.setHandler method. initiateRequest automatically performs this task.

getPlainURI is a method that removes all attribute information from the specified SIP URI and returns the SIP URI consisting of only the user name, host name, and port number. Use this method if your application requires a normalized SIP URI. The SIP URI itself is not changed.

getCSeqNumber and getCSeqMethod is utility methods about the CSeq header. getCSeqNumber extracts the number portion of the CSeq header, and getCSeqMethod extracts the method portion of the header.

copyContent is a method that copies a message to the body. It copies information such as the message body and Content-Type from the source (msrc) to the destination (mdst).

getShortInfo is a method that stores and returns simple information about a SIP message on a single string. It is mainly used for debugging and with a trace log.

getFullInfo is a method that returns a string containing all the headers of the specified SIP message. Use this method when you need more detailed information than you can get with getShortInfo.

Last Modified:Wed Jan 12 19:32:06 PM JST 2005