Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.neomedia.transform.dtmf
Class DtmfTransformEngine

java.lang.Object
  extended by net.java.sip.communicator.impl.neomedia.transform.dtmf.DtmfTransformEngine
All Implemented Interfaces:
PacketTransformer, TransformEngine

public class DtmfTransformEngine
extends Object
implements TransformEngine, PacketTransformer

The class is responsible for sending DTMF tones in an RTP audio stream as described by RFC4733.

Author:
Emil Ivov, Romain Philibert, Damian Minkov

Constructor Summary
DtmfTransformEngine(AudioMediaStreamImpl stream)
          Creates an engine instance that will be replacing audio packets with DTMF ones upon request.
 
Method Summary
 void close()
          Close the transformer and underlying transform engine.
 PacketTransformer getRTCPTransformer()
          Always returns null since this engine does not require any RTCP transformations.
 PacketTransformer getRTPTransformer()
          Returns a reference to this class since it is performing RTP transformations in here.
 RawPacket reverseTransform(RawPacket pkt)
          A stub meant to handle incoming DTMF packets.
 void startSending(DTMFRtpTone tone)
          DTMF sending stub: this is where we should set the transformer in the proper state so that it would start replacing packets with dtmf codes.
 void stop()
          Stops threads that this transform engine is using for even delivery.
 void stopSendingDTMF()
          Interrupts transmission of a DTMFRtpTone started with the startSendingDTMF() method.
 RawPacket transform(RawPacket pkt)
          Replaces pkt with a DTMF packet if this engine is in a DTMF transmission mode or returns it unchanged otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DtmfTransformEngine

public DtmfTransformEngine(AudioMediaStreamImpl stream)
Creates an engine instance that will be replacing audio packets with DTMF ones upon request.

Parameters:
stream - the AudioMediaStream whose RTP packets we are going to be replacing with DTMF.
Method Detail

close

public void close()
Close the transformer and underlying transform engine. Nothing to do here.

Specified by:
close in interface PacketTransformer

getRTCPTransformer

public PacketTransformer getRTCPTransformer()
Always returns null since this engine does not require any RTCP transformations.

Specified by:
getRTCPTransformer in interface TransformEngine
Returns:
null since this engine does not require any RTCP transformations.

getRTPTransformer

public PacketTransformer getRTPTransformer()
Returns a reference to this class since it is performing RTP transformations in here.

Specified by:
getRTPTransformer in interface TransformEngine
Returns:
a reference to this instance of the DtmfTransformEngine.

reverseTransform

public RawPacket reverseTransform(RawPacket pkt)
A stub meant to handle incoming DTMF packets.

Specified by:
reverseTransform in interface PacketTransformer
Parameters:
pkt - an incoming packet that we need to parse and handle in case we determine it to be DTMF.
Returns:
the pkt if it is not a DTMF tone and null otherwise since we will be handling the packet ourselves and their's no point in feeding it to the application.

transform

public RawPacket transform(RawPacket pkt)
Replaces pkt with a DTMF packet if this engine is in a DTMF transmission mode or returns it unchanged otherwise.

Specified by:
transform in interface PacketTransformer
Parameters:
pkt - the audio packet that we may want to replace with a DTMF one.
Returns:
pkt with a DTMF packet if this engine is in a DTMF transmission mode or returns it unchanged otherwise.

startSending

public void startSending(DTMFRtpTone tone)
DTMF sending stub: this is where we should set the transformer in the proper state so that it would start replacing packets with dtmf codes.

Parameters:
tone - the tone that we'd like to start sending.

stopSendingDTMF

public void stopSendingDTMF()
Interrupts transmission of a DTMFRtpTone started with the startSendingDTMF() method. Has no effect if no tone is currently being sent.

See Also:
AudioMediaStream.stopSendingDTMF(DTMFMethod dtmfMethod)

stop

public void stop()
Stops threads that this transform engine is using for even delivery.


Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.