org.mobicents.mscontrol
Interface MsSession

All Superinterfaces:
java.io.Serializable

public interface MsSession
extends java.io.Serializable

A MsSession is a transient association of (zero or more) connection for the purposes of engaging in a real-time communications interchange. The session and its associated connection objects describe the control and media flows taking place in a communication network. The MsProvider adjusts the session, connection and link objects to reflect the results of the combined command actions. Applications create instances of a MsSession object with the MsProvider.createSession() method, which returns a MsSession object that has zero connections and is in the IDLE state. The MsSession maintains a reference to its MsProvider for the life of that MsSession object. The MsProvider object instance does not change throughout the lifetime of the MsSession object. The MsProvider associated with a MsSession is obtained via the getProvider() method.

Author:
Oleg Kulikov

Method Summary
 void addSessionListener(MsSessionListener listener)
          Add a listener to this session.
 MsLink createLink(org.mobicents.media.msc.common.MsLinkMode mode)
          Creates local link that joines two endpoints and attach it to this session.
 MsConnection createNetworkConnection(java.lang.String endpointName)
          Creates a new network connection and attaches it to this session.
 void disassociateLink(MsLink link)
          Removes the instance of MsLink from list of MsLink's managed by this MsSession If there are no more MsConnection or MsLink's associated with this MsSession, it transitions to INVALID state
 void disassociateNetworkConnection(MsConnection connection)
          Removes the instance of MsConnection from list of MsConnection's managed by this MsSession If there are no more MsConnection or MsLink's associated with this MsSession, it transitions to INVALID state
 java.util.List<MsConnection> getConnections()
          Returns the list of MsConnection associated with this MsSession
 java.lang.String getId()
          Get the unique id of this session
 MsProvider getProvider()
          Retrieves the provider handling this session object.
 java.util.List<MsSessionListener> getSessionListeners()
          Returns the list of MsSessionListener
 org.mobicents.media.msc.common.MsSessionState getState()
          Retrieves the state of the session.
 void removeSessionListener(MsSessionListener listener)
          Removes a listener from this session.
 void setSessionStateIdle()
          Explicitly sets the MsSession state to MsSessionState.IDLE and fires MsSessionEventID.SESSION_CREATED event for MsSessionListener
 

Method Detail

getId

java.lang.String getId()
Get the unique id of this session

Returns:

getProvider

MsProvider getProvider()
Retrieves the provider handling this session object. The Provider reference does not change once the MsSession object has been created, despite the state of the MsSession object.

Returns:
MsProvider object managing this call.

getState

org.mobicents.media.msc.common.MsSessionState getState()
Retrieves the state of the session. The state will be either IDLE, ACTIVE or INVALID.

Returns:
enum representing the state of the session.

createNetworkConnection

MsConnection createNetworkConnection(java.lang.String endpointName)
Creates a new network connection and attaches it to this session. The MsConnection object is associated with an endpoint name corresponding to the string given as an input parameter. Note that following this operation the returned MsConnection object must still be "modified" which can be accomplished using the MsConnection.modify(...)

Parameters:
endpointName - specifies the identifier of the media server endpoint.

createLink

MsLink createLink(org.mobicents.media.msc.common.MsLinkMode mode)
Creates local link that joines two endpoints and attach it to this session. In some networks, we may often have to set-up connections between endpoints that are located within the same media server. Examples of such connections may be:
  • Connecting a call to an Interactive Voice-Response unit,
  • Connecting a call to a Conferencing unit,
  • Routing a call from one endpoint to another,something often described as a "hairpin" connection.
Local connections are much simpler to establish than network connections. In most cases, the connection will be established through some local interconnecting device, such as for example a TDM bus. When two endpoints are managed by the same media server, it is possible to specify the link in a single command that conveys the names of the two endpoints that will be connected.

Parameters:
mode - specifies the mode of the link. Valid modes are
  • MsLinkMode.HALF_DUPLEX
  • MsLinkMode.DUPLEX
Returns:
MsLink object managing this link.

addSessionListener

void addSessionListener(MsSessionListener listener)
Add a listener to this session. This also reports all state changes in the state of the session. The listener added with this method will report events on the session for as long as the listener receive INVALID event.

Parameters:
listener - object that receives the specified events

removeSessionListener

void removeSessionListener(MsSessionListener listener)
Removes a listener from this session.

Parameters:
listener - Listener object.

getSessionListeners

java.util.List<MsSessionListener> getSessionListeners()
Returns the list of MsSessionListener

Returns:

getConnections

java.util.List<MsConnection> getConnections()
Returns the list of MsConnection associated with this MsSession

Returns:

setSessionStateIdle

void setSessionStateIdle()
Explicitly sets the MsSession state to MsSessionState.IDLE and fires MsSessionEventID.SESSION_CREATED event for MsSessionListener


disassociateNetworkConnection

void disassociateNetworkConnection(MsConnection connection)
Removes the instance of MsConnection from list of MsConnection's managed by this MsSession If there are no more MsConnection or MsLink's associated with this MsSession, it transitions to INVALID state

Parameters:
connection -

disassociateLink

void disassociateLink(MsLink link)
Removes the instance of MsLink from list of MsLink's managed by this MsSession If there are no more MsConnection or MsLink's associated with this MsSession, it transitions to INVALID state

Parameters:
link -


Copyright © 2008. All Rights Reserved.