Class MrcpChannel

java.lang.Object
com.bytedesk.call.mrcp4j.client.MrcpChannel
All Implemented Interfaces:
MrcpMessageHandler

public class MrcpChannel extends Object implements MrcpMessageHandler
Provides all primary functionality required for an MRCPv2 client to interact with an MRCPv2 resource. Through an instance of this class clients can construct and send MRCP requests, receive responses and be notified of events triggered by the MRCP resource.

To construct a MrcpChannel instance use MrcpProvider.createChannel(java.lang.String, java.net.InetAddress, int, java.lang.String).

Author:
Niels Godfredsen <ngodfredsen@users.sourceforge.net>
  • Field Details

  • Constructor Details

  • Method Details

    • getChannelID

      public ChannelIdentifier getChannelID()
      Retrieves the channel ID associated with this channel.
      Returns:
      the channel ID associated with this channel.
    • createRequest

      public MrcpRequest createRequest(MrcpMethodName methodName)
      Creates a request object associated with this channel. The request object can then be passed to sendRequest(com.bytedesk.call.mrcp4j.message.request.MrcpRequest) (after setting content or other parameters) in order to actually invoke the request on the MRCP resource accessed by this channel.
      Parameters:
      methodName - name of the method the desired request object should represent.
      Returns:
      request object representing the specified method call.
    • createVendorSpecificRequest

      public MrcpRequest createVendorSpecificRequest(String methodName)
    • sendRequest

      Invokes a request on the MRCP resource associated with this channel.
      Parameters:
      request - specification of the request to be invoked.
      Returns:
      the response provided by the MRCP resource to the specified request.
      Throws:
      IOException - if an I/O error occurs.
      MrcpInvocationException - if the MRCP resource returned a response error code
      InterruptedException - if another thread interrupted the current thread while the current thread was waiting for a response from the MRCP resource.
    • addEventListener

      public void addEventListener(MrcpEventListener listener)
      Registers an event listener that will be notified of any MRCP events received on this channel.
      Parameters:
      listener - instance to be notified of MRCP events received on this channel.
    • removeEventListener

      public void removeEventListener(MrcpEventListener listener)
      Unregisters an event listener that may have been registered to receive MRCP events from this channel.
      Parameters:
      listener - instance to be removed from listeners to events received on this channel.
    • handleMessage

      public void handleMessage(MrcpMessage message)
      Description copied from interface: MrcpMessageHandler
      Called when an MRCP message is received from an MRCP resource.
      Specified by:
      handleMessage in interface MrcpMessageHandler
      Parameters:
      message - the message received from the MRCP resource