org.mobicents.mscontrol
Interface MsProvider

All Superinterfaces:
java.io.Serializable

public interface MsProvider
extends java.io.Serializable

This is the provider class which is used to create the MsSession. Through out the Application life cycle MsProvider remains the same. Application that are interested in listening MsSessionEvent, MsConnectionEvent, MsLinkEvent and MsNotifyEvent calls the respective addlistener methods passing instance of class that implements respective listeners. Use MsPeer.getProvider() to get the instance of MsProvider

Author:
Oleg Kulikov, amit bhayani

Method Summary
 void addConnectionListener(MsConnectionListener listener)
          Add a connection listener to all connections under this MsProvider.
 void addLinkListener(MsLinkListener listener)
          Add a link listener to all terminations.
 void addNotificationListener(MsNotificationListener listener)
          Add a notification listener to all (feature and current) within the domain of this provider.
 void addResourceListener(MsResourceListener listener)
          Deprecated.  
 void addSessionListener(MsSessionListener listener)
          Add a session listener to all (feature and current) within the domain of this provider.
 MsSession createSession()
          Creates a new instance of the session with no links.
 MsEventFactory getEventFactory()
          Get instance of MsEventFactory
 MsConnection getMsConnection(java.lang.String msConnectionId)
          Get the MsConnection for the msConnectionId passed.
 java.util.List<MsConnection> getMsConnections(java.lang.String endpointName)
          Gets List of MsConnection object for given endpointName
 MsSignalDetector getSignalDetector(java.lang.String endpointName)
          Deprecated.  
 MsSignalGenerator getSignalGenerator(java.lang.String endpointName)
          Deprecated.  
 void removeConnectionListener(MsConnectionListener listener)
          Removes connection listener
 void removeLinkListener(MsLinkListener listener)
          Removes link listener
 void removeNotificationListener(MsNotificationListener listener)
          Remove MsNotificationListener
 void removeSessionListener(MsSessionListener listener)
          Removes a listener that was previously registered.
 

Method Detail

addSessionListener

void addSessionListener(MsSessionListener listener)
Add a session listener to all (feature and current) within the domain of this provider.

Parameters:
listener - object that receives the specified events

removeSessionListener

void removeSessionListener(MsSessionListener listener)
Removes a listener that was previously registered.

Parameters:
listener - Listener object.

addNotificationListener

void addNotificationListener(MsNotificationListener listener)
Add a notification listener to all (feature and current) within the domain of this provider.

Parameters:
listener -

removeNotificationListener

void removeNotificationListener(MsNotificationListener listener)
Remove MsNotificationListener

Parameters:
listener -

addConnectionListener

void addConnectionListener(MsConnectionListener listener)
Add a connection listener to all connections under this MsProvider.

Parameters:
listener - object that receives the specified events.

removeConnectionListener

void removeConnectionListener(MsConnectionListener listener)
Removes connection listener

Parameters:
listener - this listener is removed

addResourceListener

void addResourceListener(MsResourceListener listener)
Deprecated. 

Add a resource listener to all resources under this MsProvider.

Parameters:
listener - object that receives the specified events.

addLinkListener

void addLinkListener(MsLinkListener listener)
Add a link listener to all terminations.

Parameters:
listener - object that receives the specified events.

removeLinkListener

void removeLinkListener(MsLinkListener listener)
Removes link listener

Parameters:
listener - object that receives the specified events.

createSession

MsSession createSession()
Creates a new instance of the session with no links.

Returns:
MsSession object.

getEventFactory

MsEventFactory getEventFactory()
Get instance of MsEventFactory

Returns:
instance of MsEventFactory

getSignalGenerator

MsSignalGenerator getSignalGenerator(java.lang.String endpointName)
Deprecated. 

Creates a new instance of MsSignalGenerator for given EndpointName. This is deprecated, rather use bellow example. The example applies MsRequestedSignal to play the announcement on endpoint and also request's for announcement complete or fail MsRequestedEvent
Use this

 
 MsEventFactory eventFactory = msProvider.getEventFactory();
 
 MsPlayRequestedSignal play = null;
 play = (MsPlayRequestedSignal) eventFactory.createRequestedSignal(MsAnnouncement.PLAY);
 play.setURL(url);
 
 MsRequestedEvent onCompleted = null;
 MsRequestedEvent onFailed = null;
 
 onCompleted = eventFactory.createRequestedEvent(MsAnnouncement.COMPLETED);
 onCompleted.setEventAction(MsEventAction.NOTIFY);
 
 onFailed = eventFactory.createRequestedEvent(MsAnnouncement.FAILED);
 onFailed.setEventAction(MsEventAction.NOTIFY);
 
 MsRequestedSignal[] requestedSignals = new MsRequestedSignal[] { play };
 MsRequestedEvent[] requestedEvents = new MsRequestedEvent[] { onCompleted, onFailed };
 
 msEndpoint.execute(requestedSignals, requestedEvents, connection);
 

Parameters:
endpointName -
Returns:
instance of MsSignalGenerator

getSignalDetector

MsSignalDetector getSignalDetector(java.lang.String endpointName)
Deprecated. 

Creates a new instance of SignalDetector for given EndpointName. This is deprectaed, rather use MsRequestedEvent to detect for events. For example to detect DTMF

 
 MsEventFactory factory = msProvider.getEventFactory();
 MsDtmfRequestedEvent dtmf = (MsDtmfRequestedEvent) factory.createRequestedEvent(DTMF.TONE);
 MsRequestedSignal[] signals = new MsRequestedSignal[] {};
 MsRequestedEvent[] events = new MsRequestedEvent[] { dtmf };
 
 msEndpoint.execute(signals, events, connection);
 


getMsConnection

MsConnection getMsConnection(java.lang.String msConnectionId)
Get the MsConnection for the msConnectionId passed.

Parameters:
msConnectionId -
Returns:
instance of MsConnection

getMsConnections

java.util.List<MsConnection> getMsConnections(java.lang.String endpointName)
Gets List of MsConnection object for given endpointName

Parameters:
endpointName -
Returns:
List of MsConnection


Copyright © 2008. All Rights Reserved.