class RTPAudioFormat extends AudioFormat implements RTPFormat {

    public Collection<Attribute> encode() {
        Vector<Attribute> list = new Vector();
        list.add(sdpFactory.createAttribute("rtpmap", toSdp()));
        if (getEncoding().equalsIgnoreCase("telephone-event")) {
            list.add(sdpFactory.createAttribute("fmtp", payloadType + " 0-15"));
        } else if (getEncoding().equalsIgnoreCase("g729")) {
            list.add(sdpFactory.createAttribute("fmtp", payloadType + " annex=b"));
        }
        return list;
    }

}

class RTPAudioFormatTest {

    @Test
    public void testEncodeSpeex() throws Exception {

        Collection<Attribute> attributes = AVProfile.SPEEX.encode();
        assertEquals(1, attributes.size());
        Attribute rtpmap = getAttribute(attributes, 0);
        assertEquals("rtpmap",rtpmap.getName());
        assertEquals("97 speex/8000",rtpmap.getValue());
    }

}