org.mobicents.javax.servlet.sip
Interface SipSessionExt


public interface SipSessionExt

Interface Extension that adds extra features to the JSR 289 SipSession interface.
It adds the following capabilities :

Here is some sample code to show how the asynchronous work can be used :
 ((SipSessionExt)sipSession).scheduleAsynchronousWork(new SipSessionAsynchronousWork() {
                private static final long serialVersionUID = 1L;
 
                public void doAsynchronousWork(SipSession sipSession) {                         
                        
                        String textMessageToSend = (String) sipSession.getAttribute("textMessageToSend");                                       
                        
                        try {
                                SipServletRequest sipServletRequest = sipFactory.createRequest(
                                                sipSession.getSipApplicationSession(), 
                                                "MESSAGE", 
                                                "sip:sender@sip-servlets.com", 
                                                "sip:receiver@sip-servlets.com");
                                SipURI sipUri = sipFactory.createSipURI("receiver", "127.0.0.1:5060");
                                sipServletRequest.setRequestURI(sipUri);
                                sipServletRequest.setContentLength(content.length());
                                sipServletRequest.setContent(content, "text/plain;charset=UTF-8");
                                sipServletRequest.send();
                        } catch (ServletParseException e) {
                                logger.error("Exception occured while parsing the addresses",e);
                        } catch (IOException e) {
                                logger.error("Exception occured while sending the request",e);                  
                        }
                }
        });
 

Since:
1.4
Author:
jean.deruelle@gmail.com

Method Summary
 void scheduleAsynchronousWork(SipSessionAsynchronousWork work)
          This method allows an application to access a SipSession in an asynchronous manner.
 void setOutboundInterface(SipURI outboundInterface)
          In multi-homed environment this method can be used to select the outbound interface to use when sending requests for this SipSession.
 

Method Detail

setOutboundInterface

void setOutboundInterface(SipURI outboundInterface)
In multi-homed environment this method can be used to select the outbound interface to use when sending requests for this SipSession. The specified address must be the address of one of the configured outbound interfaces. The set of SipURI objects which represent the supported outbound interfaces can be obtained from the servlet context attribute named javax.servlet.sip.outboundInterfaces. Invocation of this method also impacts the system headers generated by the container for this message, such as the the Via and the Contact header. The supplied IP address, port and transport are used to construct these system headers.

Parameters:
outboundInterface - the sip uri representing the outbound interface to use when sending requests out
Throws:
NullPointerException - on null sip uri
IllegalArgumentException - if the sip uri is not understood by the container as one of its outbound interface

scheduleAsynchronousWork

void scheduleAsynchronousWork(SipSessionAsynchronousWork work)
This method allows an application to access a SipSession in an asynchronous manner. This method is useful for accessing the SipSession from Web or EJB modules in a converged application or from unmanaged threads started by the application itself. When this API is used in conjunction with the Mobicents Concurrency Control in SipSession mode, the container guarantees that the business logic contained within the SipSessionAsynchronousWork will be executed in a thread-safe manner. It has to be noted that the work may never execute if the session gets invalidated in the meantime and the work will be executed locally on the node on a cluster.

Parameters:
work - the work to be performed on this SipSession.


Copyright © 2010. All Rights Reserved.