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, amit.bhayani

Method Summary
 void addSessionListener(MsSessionListener listener)
          Add a listener to this session.
 MsLink createLink(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.
 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.
 MsSessionState getState()
          Retrieves the state of the session.
 void removeSessionListener(MsSessionListener listener)
          Removes a listener from this session.
 

Method Detail

getId

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

Returns:
the unique identifier of this session

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

MsSessionState getState()
Retrieves the state of the session. The state will be either IDLE, ACTIVE or INVALID. Look at MsSessionState

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. If you want connection to be created on new Endpoint then pass wildcard '$' with endpointName. For example 'media/trunk/Announcement/$'. Once connection is created, calling connection.getEndpoint() will return instance of MsEndpoint and calling getLocalName() on this returned MsEndpoint will give the actual endpoint name, for example 'media/trunk/Announcement/enp-1'

It's also possible to create connection on already known endpoint for example

 MsSession session;
 ...
 MsConnection msConnection = session.createNetworkConnection("media/trunk/Conference/enp-3");
 


createLink

MsLink createLink(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: 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
Look at MsLinkMode
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.

getConnections

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

Returns:
List of MsConnection contained in this session


Copyright © 2008. All Rights Reserved.