[sip-comm-dev] GSoc 09 : Dtmf without Transformer but with BufferTransferHandler

Romain filirom1 at gmail.com
Tue Jul 21 14:15:33 CEST 2009


1 - In order to make DTMF injection work with correct value of SeqNum
and SSRC I needed to change few things :

I don't use Transformer anymore :-/
Instead  I created an BufferTransferHandler which allow injection :
This is the transferData() fuinction :
    public void transferData(PushBufferStream stream)

InjectStreamBufferTransferHandler is used as a wrapper around the
stream we want to inject in. We inject packets using the wrapped

In so doing the originalStream#read() and injectStream#read() are called.

In injectStream#read(), we can change RTP Header fields using the
Buffer class :
	buffer.setSequenceNumber(0); //Will use the SeqNum of the existing RTP stream

And create RTP data like this :
	data[1]= dtmfEndField ? (byte)0x80 : (byte)0;
	data[2]=(byte)(dtmfDurationField >> 8);
	data[3]=(byte) dtmfDurationField;

You can test it by applying the patch injection_new, dispatcher and
the previous configuration_GUI.

2 - There remains some extra things :

Timestamp value is not correct, so I will fix it.

Actually DTMF packets are sent each time an audio packet is sent. The
RFC recommend to send updates every 50ms.

If the user press and releas too fast, some DTMF packets are missing.

Long duration events is not implemented.

Timeout is not implemented.

Each time a DTMF packet is sent, the SeqNum of the next an audio
packet icrements very fast :

packet   /  SeqNum
audio		100
audio		101
audio		102
dtmf		103
audio		185
audio		186
dtmf		187
audio		256

I don't think I could correct this because this behaviour is hard
coded in J MF :
    public long getSequenceNumber(Buffer b)
        long seq = b.getSequenceNumber();
        if(lastSeq == -1L)
            lastSeq = (long)((double)System.currentTimeMillis() *
            lastBufSeq = seq;
            return lastSeq;
        if(seq - lastBufSeq > 1L)
            lastSeq += seq - lastBufSeq;
        } else
        lastBufSeq = seq;
        return lastSeq;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: injection_new.patch
Type: application/octet-stream
Size: 35440 bytes
Desc: not available
URL: <http://lists.jitsi.org/pipermail/dev/attachments/20090721/caad55c1/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dispatcher.patch
Type: application/octet-stream
Size: 28162 bytes
Desc: not available
URL: <http://lists.jitsi.org/pipermail/dev/attachments/20090721/caad55c1/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: injection.png
Type: image/png
Size: 191484 bytes
Desc: not available
URL: <http://lists.jitsi.org/pipermail/dev/attachments/20090721/caad55c1/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Configuration_GUI.patch
Type: application/octet-stream
Size: 8879 bytes
Desc: not available
URL: <http://lists.jitsi.org/pipermail/dev/attachments/20090721/caad55c1/attachment-0002.obj>
-------------- next part --------------
To unsubscribe, e-mail: dev-unsubscribe at sip-communicator.dev.java.net
For additional commands, e-mail: dev-help at sip-communicator.dev.java.net

More information about the dev mailing list