org.mobicents.mscontrol
Interface MsConnection

All Superinterfaces:
java.io.Serializable

public interface MsConnection
extends java.io.Serializable

Represents the actual RTP connection. MsConnection is created as shown below

 MsSession msSession;
 ....
 MsConnection msConnection = msSession.createNetworkConnection("media/trunk/Announcement/$")
 

At this stage MsConnection is in IDLE state and CONNECTION_CREATED event is fired. Through out the lifetime of MsConnection, it maintains the reference to MsSession

Author:
Oleg Kulikov, amit.bhayani

Method Summary
 void addConnectionListener(MsConnectionListener listener)
          Adds connection listener at MsConnection level.
 void addNotificationListener(MsNotificationListener listener)
          Add the MsNotificationListener at MsConnection level.
 MsEndpoint getEndpoint()
          Returns the concrete endpoint which executes this connection.
 java.lang.String getId()
          Retrieves the MsConnection ID, basically a UUID
 java.lang.String getLocalDescriptor()
          Gets the session descriptor of the local end.
 MsConnectionMode getMode()
          Get the current mode of MsConnection
 java.lang.String getRemoteDescriptor()
          Gets the session descriptor of the remote end.
 MsSession getSession()
          Retrieves the MsSession that is associated with this MsConnection.
 MsConnectionState getState()
          Returns the state of MsConnection
 void modify(java.lang.String localDesc, java.lang.String remoteDesc)
          Creates or modify network connection on the media server side.
 void release()
          Deletes related connection from media server.
 void removeConnectionListener(MsConnectionListener listener)
          Removes connection listener.
 void removeNotificationListener(MsNotificationListener listener)
          Remove the instance of MsNotificationListener to no longer receive the events for state change of MsConnection
 void setMode(MsConnectionMode mode)
          By default the MsConnection starts in MsConnectionMode.SEND_RECV mode.
 

Method Detail

getId

java.lang.String getId()
Retrieves the MsConnection ID, basically a UUID

Returns:
returns the unique identifier of this MsConnection

getSession

MsSession getSession()
Retrieves the MsSession that is associated with this MsConnection. This MsSession reference remains valid throughout the lifetime of the MsConnection object despite the state of the MsConnection object. This MsSession reference does not change once the MsConnection object has been created.

Returns:
MsSession object holding this connection.

getState

MsConnectionState getState()
Returns the state of MsConnection

Returns:
MsConnectionState representing the state of MsConnection

getLocalDescriptor

java.lang.String getLocalDescriptor()
Gets the session descriptor of the local end.

Returns:
session descriptor as specified by SDP.

getRemoteDescriptor

java.lang.String getRemoteDescriptor()
Gets the session descriptor of the remote end.

Returns:
session descriptor as specified by SDP.

getEndpoint

MsEndpoint getEndpoint()
Returns the concrete endpoint which executes this connection.

Returns:
the name of the endpoint on the media server or null if connection is not created on media server yet.

addConnectionListener

void addConnectionListener(MsConnectionListener listener)
Adds connection listener at MsConnection level. The registered listener will be called for state change of this MsConnection only.
The order is such that MsConnectionListener registered at MsProvider will be called before MsConnectionListener at MsConnection level

Parameters:
listener - the listener object.

removeConnectionListener

void removeConnectionListener(MsConnectionListener listener)
Removes connection listener.

Parameters:
listener - the listener object was added previously.

addNotificationListener

void addNotificationListener(MsNotificationListener listener)
Add the MsNotificationListener at MsConnection level. The registered listener will be called for state change of this MsConnection only.
The order is such that MsNotificationListener registered at MsProvider will be called before MsNotificationListener at MsConnection level

Parameters:
listener - Instance of MsNotificationListener to be registered

removeNotificationListener

void removeNotificationListener(MsNotificationListener listener)
Remove the instance of MsNotificationListener to no longer receive the events for state change of MsConnection

Parameters:
listener - Instance of MsNotificationListener to be de-registered

modify

void modify(java.lang.String localDesc,
            java.lang.String remoteDesc)
Creates or modify network connection on the media server side.

Parameters:
remoteDesc - the session desriptor of the remote party.

setMode

void setMode(MsConnectionMode mode)
By default the MsConnection starts in MsConnectionMode.SEND_RECV mode.
Modes can be changed any time to SEND_ONLY or RECV_ONLY by calling this method

Parameters:
mode - The mode to set

getMode

MsConnectionMode getMode()
Get the current mode of MsConnection

Returns:
MsConnectionMode

release

void release()
Deletes related connection from media server. If the corresponding MsSession has only this MsConnection left then the state of MsSession becomes INVALID



Copyright © 2009. All Rights Reserved.