|
|
|
@ -327,6 +327,7 @@ static void dtmf(const char *s) { |
|
|
|
|
|
|
|
#define PCMU_payload "\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00" |
|
|
|
#define PCMA_payload "\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a" |
|
|
|
#define PCMA_silence "\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5" |
|
|
|
#define G722_payload "\x23\x84\x20\x84\x20\x84\x04\x84\x04\x04\x84\x04\x84\x04\x84\x05\x85\x46\x87\x48\xc8\x48\x88\x48\xc8\x49\x8a\x4b\xcc\x4c\x8c\x4c\xcc\x4c\x8c\x4d\xce\x50\xcf\x51\x90\x50\xcf\x12\xd1\x52\xd2\x54\x91\x52\xd2\x54\x92\x54\xd3\x56\x93\xd6\x94\xd4\x93\xd7\xd5\x55\x94\x55\xd5\x55\xd4\x56\xd5\x17\xd7\x5a\x95\xd7\x97\xd9\xd4\x16\x58\x57\x98\xd5\xd7\x5b\x96\xda\xd6\x1b\x57\x5a\xd6\x1a\x57\x5b\x98\xd6\xd8\x56\x98\xd7\xd9\x5a\x95\xdb\xd6\x1c\x52\x5e\xd7\x5c\x93\xdf\x99\xd5\xd7\x5f\xd9\x14\x56\x7f\x92\xda\xd9\x5c\x92\xdd\xd7\x5d\x92\xff\xd6\x5a\x96\xdc\xd5\x18\x56\x7e\xd2\x5e\x96\xde\x94\xd8\xd8\x58\xd3\x79\x93\xfb\x90\xdc\xd6\x5b\xdd\x58\x96\xff" |
|
|
|
#define AMR_WB_payload "\xf0\x1c\xf3\x06\x08\x10\x77\x32\x23\x20\xd3\x50\x62\x12\xc7\x7c\xe2\xea\x84\x0e\x6e\xf4\x4d\xe4\x7f\xc9\x4c\xcc\x58\x5d\xed\xcc\x5d\x7c\x6c\x14\x7d\xc0" // octet aligned |
|
|
|
#define AMR_WB_payload_noe "\xf1\xfc\xc1\x82\x04\x1d\xcc\x88\xc8\x34\xd4\x18\x84\xb1\xdf\x38\xba\xa1\x03\x9b\xbd\x13\x79\x1f\xf2\x53\x33\x16\x17\x7b\x73\x17\x5f\x1b\x05\x1f\x70" // bandwidth efficient |
|
|
|
@ -1208,5 +1209,484 @@ int main(void) { |
|
|
|
packet_seq(A, 0, PCMU_payload, 1002240, 220, 0, PCMU_payload); |
|
|
|
end(); |
|
|
|
|
|
|
|
// codec-mask/accept/consume tests |
|
|
|
// control - plain in/out |
|
|
|
start(); |
|
|
|
sdp_pt(104, SILK, 16000); |
|
|
|
sdp_pt(9, G722, 8000); |
|
|
|
sdp_pt(0, PCMU, 8000); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
sdp_pt(13, CN, 8000); |
|
|
|
sdp_pt(118, CN, 16000); |
|
|
|
offer(); |
|
|
|
expect(A, recv, ""); |
|
|
|
expect(A, send, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, send, ""); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
answer(); |
|
|
|
expect(A, recv, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(A, send, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(B, recv, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(B, send, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
end(); |
|
|
|
// codec-mask only |
|
|
|
start(); |
|
|
|
sdp_pt(104, SILK, 16000); |
|
|
|
sdp_pt(9, G722, 8000); |
|
|
|
sdp_pt(0, PCMU, 8000); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
sdp_pt(13, CN, 8000); |
|
|
|
sdp_pt(118, CN, 16000); |
|
|
|
ht_set(codec_mask, PCMU); |
|
|
|
offer(); |
|
|
|
expect(A, recv, ""); |
|
|
|
expect(A, send, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "104/SILK/16000 9/G722/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, send, ""); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
answer(); |
|
|
|
expect(A, recv, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(A, send, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(B, recv, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(B, send, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
end(); |
|
|
|
// codec-mask + transcode + reject transcoded codec |
|
|
|
start(); |
|
|
|
sdp_pt(104, SILK, 16000); |
|
|
|
sdp_pt(9, G722, 8000); |
|
|
|
sdp_pt(0, PCMU, 8000); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
sdp_pt(13, CN, 8000); |
|
|
|
sdp_pt(118, CN, 16000); |
|
|
|
ht_set(codec_mask, PCMU); |
|
|
|
transcode(GSM); |
|
|
|
offer(); |
|
|
|
expect(A, recv, ""); |
|
|
|
expect(A, send, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "9/G722/8000 8/PCMA/8000 3/GSM/8000 101/telephone-event/8000 13/CN/8000"); |
|
|
|
expect(B, send, ""); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
answer(); |
|
|
|
expect(A, recv, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(A, send, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(B, recv, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(B, send, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
end(); |
|
|
|
// codec-mask + transcode + accept transcoded codec |
|
|
|
start(); |
|
|
|
sdp_pt(104, SILK, 16000); |
|
|
|
sdp_pt(9, G722, 8000); |
|
|
|
sdp_pt(0, PCMU, 8000); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
sdp_pt(13, CN, 8000); |
|
|
|
sdp_pt(118, CN, 16000); |
|
|
|
ht_set(codec_mask, PCMU); |
|
|
|
transcode(GSM); |
|
|
|
offer(); |
|
|
|
expect(A, recv, ""); |
|
|
|
expect(A, send, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "9/G722/8000 8/PCMA/8000 3/GSM/8000 101/telephone-event/8000 13/CN/8000"); |
|
|
|
expect(B, send, ""); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(3, GSM, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
answer(); |
|
|
|
expect(A, recv, "9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000"); |
|
|
|
expect(A, send, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "8/PCMA/8000 3/GSM/8000 101/telephone-event/8000"); |
|
|
|
expect(B, send, "8/PCMA/8000 3/GSM/8000 101/telephone-event/8000"); |
|
|
|
// G.722 > PCMA |
|
|
|
packet_seq(A, 9, G722_payload, 0, 0, -1, ""); // nothing due to resampling |
|
|
|
packet_seq_nf(A, 9, G722_payload, 160, 1, 8, PCMA_payload); |
|
|
|
packet_seq_ts(A, 9, G722_payload, 320, 2, 8, PCMA_payload, 160, 0); |
|
|
|
// asymmetric codec |
|
|
|
packet(B, 8, PCMA_payload, 8, PCMA_payload); // nothing due to resampling |
|
|
|
end(); |
|
|
|
// codec-mask + transcode + accept transcoded codec + symmetric codecs |
|
|
|
start(); |
|
|
|
sdp_pt(104, SILK, 16000); |
|
|
|
sdp_pt(9, G722, 8000); |
|
|
|
sdp_pt(0, PCMU, 8000); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
sdp_pt(13, CN, 8000); |
|
|
|
sdp_pt(118, CN, 16000); |
|
|
|
ht_set(codec_mask, PCMU); |
|
|
|
transcode(GSM); |
|
|
|
offer(); |
|
|
|
expect(A, recv, ""); |
|
|
|
expect(A, send, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "9/G722/8000 8/PCMA/8000 3/GSM/8000 101/telephone-event/8000 13/CN/8000"); |
|
|
|
expect(B, send, ""); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(3, GSM, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
flags.symmetric_codecs = 1; |
|
|
|
answer(); |
|
|
|
expect(A, recv, "8/PCMA/8000 9/G722/8000 0/PCMU/8000 13/CN/8000 101/telephone-event/8000"); |
|
|
|
expect(A, send, "8/PCMA/8000 101/telephone-event/8000 104/SILK/16000 9/G722/8000 0/PCMU/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "8/PCMA/8000 3/GSM/8000 101/telephone-event/8000"); |
|
|
|
expect(B, send, "8/PCMA/8000 3/GSM/8000 101/telephone-event/8000"); |
|
|
|
end(); |
|
|
|
// codec-consume only |
|
|
|
start(); |
|
|
|
sdp_pt(104, SILK, 16000); |
|
|
|
sdp_pt(9, G722, 8000); |
|
|
|
sdp_pt(0, PCMU, 8000); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
sdp_pt(13, CN, 8000); |
|
|
|
sdp_pt(118, CN, 16000); |
|
|
|
ht_set(codec_consume, PCMU); |
|
|
|
offer(); |
|
|
|
expect(A, recv, ""); |
|
|
|
expect(A, send, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "9/G722/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000"); |
|
|
|
expect(B, send, ""); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
answer(); |
|
|
|
expect(A, recv, "0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(A, send, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(B, send, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
end(); |
|
|
|
// codec-consume w symmetric codecs |
|
|
|
start(); |
|
|
|
sdp_pt(104, SILK, 16000); |
|
|
|
sdp_pt(9, G722, 8000); |
|
|
|
sdp_pt(0, PCMU, 8000); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
sdp_pt(13, CN, 8000); |
|
|
|
sdp_pt(118, CN, 16000); |
|
|
|
ht_set(codec_consume, PCMU); |
|
|
|
offer(); |
|
|
|
expect(A, recv, ""); |
|
|
|
expect(A, send, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "9/G722/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000"); |
|
|
|
expect(B, send, ""); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
flags.symmetric_codecs = 1; |
|
|
|
answer(); |
|
|
|
expect(A, recv, "0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(A, send, "0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 104/SILK/16000 9/G722/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(B, send, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
end(); |
|
|
|
// codec-consume + transcode + reject transcoded codec |
|
|
|
start(); |
|
|
|
sdp_pt(104, SILK, 16000); |
|
|
|
sdp_pt(9, G722, 8000); |
|
|
|
sdp_pt(0, PCMU, 8000); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
sdp_pt(13, CN, 8000); |
|
|
|
sdp_pt(118, CN, 16000); |
|
|
|
ht_set(codec_consume, PCMU); |
|
|
|
transcode(GSM); |
|
|
|
offer(); |
|
|
|
expect(A, recv, ""); |
|
|
|
expect(A, send, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "9/G722/8000 8/PCMA/8000 3/GSM/8000 101/telephone-event/8000 13/CN/8000"); |
|
|
|
expect(B, send, ""); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
answer(); |
|
|
|
expect(A, recv, "0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(A, send, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(B, send, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
end(); |
|
|
|
// codec-consume + transcode + accept transcoded codec |
|
|
|
start(); |
|
|
|
sdp_pt(104, SILK, 16000); |
|
|
|
sdp_pt(9, G722, 8000); |
|
|
|
sdp_pt(0, PCMU, 8000); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
sdp_pt(13, CN, 8000); |
|
|
|
sdp_pt(118, CN, 16000); |
|
|
|
ht_set(codec_consume, PCMU); |
|
|
|
transcode(GSM); |
|
|
|
offer(); |
|
|
|
expect(A, recv, ""); |
|
|
|
expect(A, send, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "9/G722/8000 8/PCMA/8000 3/GSM/8000 101/telephone-event/8000 13/CN/8000"); |
|
|
|
expect(B, send, ""); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(3, GSM, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
answer(); |
|
|
|
expect(A, recv, "0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(A, send, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "8/PCMA/8000 3/GSM/8000 101/telephone-event/8000"); |
|
|
|
expect(B, send, "8/PCMA/8000 3/GSM/8000 101/telephone-event/8000"); |
|
|
|
end(); |
|
|
|
// codec-consume + transcode + accept transcoded codec + symmetric codecs |
|
|
|
start(); |
|
|
|
sdp_pt(104, SILK, 16000); |
|
|
|
sdp_pt(9, G722, 8000); |
|
|
|
sdp_pt(0, PCMU, 8000); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
sdp_pt(13, CN, 8000); |
|
|
|
sdp_pt(118, CN, 16000); |
|
|
|
ht_set(codec_consume, PCMU); |
|
|
|
transcode(GSM); |
|
|
|
offer(); |
|
|
|
expect(A, recv, ""); |
|
|
|
expect(A, send, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "9/G722/8000 8/PCMA/8000 3/GSM/8000 101/telephone-event/8000 13/CN/8000"); |
|
|
|
expect(B, send, ""); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(3, GSM, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
flags.symmetric_codecs = 1; |
|
|
|
answer(); |
|
|
|
expect(A, recv, "0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(A, send, "0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 104/SILK/16000 9/G722/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "8/PCMA/8000 3/GSM/8000 101/telephone-event/8000"); |
|
|
|
expect(B, send, "8/PCMA/8000 3/GSM/8000 101/telephone-event/8000"); |
|
|
|
end(); |
|
|
|
// codec-accept only |
|
|
|
start(); |
|
|
|
sdp_pt(104, SILK, 16000); |
|
|
|
sdp_pt(9, G722, 8000); |
|
|
|
sdp_pt(0, PCMU, 8000); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
sdp_pt(13, CN, 8000); |
|
|
|
sdp_pt(118, CN, 16000); |
|
|
|
ht_set(codec_accept, PCMU); |
|
|
|
offer(); |
|
|
|
expect(A, recv, ""); |
|
|
|
expect(A, send, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000"); |
|
|
|
expect(B, send, ""); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
answer(); |
|
|
|
expect(A, recv, "0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(A, send, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(B, send, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
end(); |
|
|
|
// codec-accept w symmetric codecs |
|
|
|
start(); |
|
|
|
sdp_pt(104, SILK, 16000); |
|
|
|
sdp_pt(9, G722, 8000); |
|
|
|
sdp_pt(0, PCMU, 8000); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
sdp_pt(13, CN, 8000); |
|
|
|
sdp_pt(118, CN, 16000); |
|
|
|
ht_set(codec_accept, PCMU); |
|
|
|
offer(); |
|
|
|
expect(A, recv, ""); |
|
|
|
expect(A, send, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000"); |
|
|
|
expect(B, send, ""); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
flags.symmetric_codecs = 1; |
|
|
|
answer(); |
|
|
|
expect(A, recv, "0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(A, send, "0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 104/SILK/16000 9/G722/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(B, send, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
end(); |
|
|
|
// codec-accept + transcode + reject transcoded codec |
|
|
|
start(); |
|
|
|
sdp_pt(104, SILK, 16000); |
|
|
|
sdp_pt(9, G722, 8000); |
|
|
|
sdp_pt(0, PCMU, 8000); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
sdp_pt(13, CN, 8000); |
|
|
|
sdp_pt(118, CN, 16000); |
|
|
|
ht_set(codec_accept, PCMU); |
|
|
|
transcode(GSM); |
|
|
|
offer(); |
|
|
|
expect(A, recv, ""); |
|
|
|
expect(A, send, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "9/G722/8000 0/PCMU/8000 8/PCMA/8000 3/GSM/8000 101/telephone-event/8000 13/CN/8000"); |
|
|
|
expect(B, send, ""); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
answer(); |
|
|
|
expect(A, recv, "0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(A, send, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(B, send, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
end(); |
|
|
|
// codec-accept + transcode + accept transcoded codec |
|
|
|
start(); |
|
|
|
sdp_pt(104, SILK, 16000); |
|
|
|
sdp_pt(9, G722, 8000); |
|
|
|
sdp_pt(0, PCMU, 8000); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
sdp_pt(13, CN, 8000); |
|
|
|
sdp_pt(118, CN, 16000); |
|
|
|
ht_set(codec_accept, PCMU); |
|
|
|
transcode(GSM); |
|
|
|
offer(); |
|
|
|
expect(A, recv, ""); |
|
|
|
expect(A, send, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "9/G722/8000 0/PCMU/8000 8/PCMA/8000 3/GSM/8000 101/telephone-event/8000 13/CN/8000"); |
|
|
|
expect(B, send, ""); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(3, GSM, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
answer(); |
|
|
|
expect(A, recv, "0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(A, send, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "8/PCMA/8000 3/GSM/8000 101/telephone-event/8000"); |
|
|
|
expect(B, send, "8/PCMA/8000 3/GSM/8000 101/telephone-event/8000"); |
|
|
|
end(); |
|
|
|
// codec-accept + transcode + accept transcoded codec + symmetric codecs |
|
|
|
start(); |
|
|
|
sdp_pt(104, SILK, 16000); |
|
|
|
sdp_pt(9, G722, 8000); |
|
|
|
sdp_pt(0, PCMU, 8000); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
sdp_pt(13, CN, 8000); |
|
|
|
sdp_pt(118, CN, 16000); |
|
|
|
ht_set(codec_accept, PCMU); |
|
|
|
transcode(GSM); |
|
|
|
offer(); |
|
|
|
expect(A, recv, ""); |
|
|
|
expect(A, send, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "9/G722/8000 0/PCMU/8000 8/PCMA/8000 3/GSM/8000 101/telephone-event/8000 13/CN/8000"); |
|
|
|
expect(B, send, ""); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(3, GSM, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
flags.symmetric_codecs = 1; |
|
|
|
answer(); |
|
|
|
expect(A, recv, "0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(A, send, "0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 104/SILK/16000 9/G722/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "8/PCMA/8000 3/GSM/8000 101/telephone-event/8000"); |
|
|
|
expect(B, send, "8/PCMA/8000 3/GSM/8000 101/telephone-event/8000"); |
|
|
|
end(); |
|
|
|
// codec-accept first codec |
|
|
|
start(); |
|
|
|
sdp_pt(104, SILK, 16000); |
|
|
|
sdp_pt(9, G722, 8000); |
|
|
|
sdp_pt(0, PCMU, 8000); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
sdp_pt(13, CN, 8000); |
|
|
|
sdp_pt(118, CN, 16000); |
|
|
|
ht_set(codec_accept, G722); |
|
|
|
offer(); |
|
|
|
expect(A, recv, ""); |
|
|
|
expect(A, send, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000"); |
|
|
|
expect(B, send, ""); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
answer(); |
|
|
|
expect(A, recv, "9/G722/8000 8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(A, send, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); |
|
|
|
expect(B, recv, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
expect(B, send, "8/PCMA/8000 101/telephone-event/8000"); |
|
|
|
end(); |
|
|
|
// gh 664 codec masking a/t |
|
|
|
start(); |
|
|
|
sdp_pt(120, opus, 48000); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(0, PCMU, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
ht_set(codec_mask, opus); |
|
|
|
ht_set(codec_mask, G722); |
|
|
|
ht_set(codec_mask, G7221); |
|
|
|
ht_set(codec_accept, all); |
|
|
|
offer(); |
|
|
|
expect(B, recv, "8/PCMA/8000 0/PCMU/8000 101/telephone-event/8000"); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
answer(); |
|
|
|
expect(A, recv, "120/opus/48000 8/PCMA/8000 0/PCMU/8000 101/telephone-event/8000 96/telephone-event/48000/0-15"); |
|
|
|
// gh 664 codec masking accept=all |
|
|
|
start(); |
|
|
|
sdp_pt(120, opus, 48000); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(0, PCMU, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
ht_set(codec_mask, opus); |
|
|
|
ht_set(codec_mask, G722); |
|
|
|
ht_set(codec_mask, G7221); |
|
|
|
ht_set(codec_accept, all); |
|
|
|
offer(); |
|
|
|
expect(B, recv, "8/PCMA/8000 0/PCMU/8000 101/telephone-event/8000"); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(101, telephone-event, 8000); |
|
|
|
answer(); |
|
|
|
expect(A, recv, "120/opus/48000 8/PCMA/8000 0/PCMU/8000 101/telephone-event/8000 96/telephone-event/48000/0-15"); |
|
|
|
|
|
|
|
// CN transcoding |
|
|
|
rtpe_config.silence_detect_int = 10 << 16; |
|
|
|
str_init_len(&rtpe_config.cn_payload, "\x40", 1); |
|
|
|
// CN transcoding - forward |
|
|
|
start(); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(0, PCMU, 8000); |
|
|
|
transcode(CN); |
|
|
|
offer(); |
|
|
|
expect(B, recv, "8/PCMA/8000 0/PCMU/8000 13/CN/8000"); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(0, PCMU, 8000); |
|
|
|
sdp_pt(13, CN, 8000); |
|
|
|
answer(); |
|
|
|
expect(A, recv, "8/PCMA/8000 0/PCMU/8000"); |
|
|
|
packet_seq(A, 8, PCMA_payload, 160, 1, 8, PCMA_payload); |
|
|
|
packet_seq(B, 8, PCMA_payload, 160, 1, 8, PCMA_payload); |
|
|
|
packet_seq(B, 13, "\x20", 320, 2, 8, "\xf5\x5c\x4b\xc2\xde\xf4\x5e\xd4\x47\x70\x5d\x77\x45\x51\xc5\xcd\xd7\x77\x5a\xf5\xcf\x4a\x4c\x40\xc3\x47\x74\x49\x59\xc4\x76\x57\x71\x57\x40\xc5\xf4\x5a\x47\xd6\xc4\xf6\xc7\xf3\x40\x58\x74\x54\x4b\xd7\x5c\xc7\x41\x49\xf5\x5b\x53\xd9\x70\x44\xcd\xc4\xce\xcb\xc7\x58\xcd\x45\xc6\x71\xf5\x70\x43\xca\x43\xd5\x52\x5c\x75\x74\xc6\xc3\x4f\xda\x56\xc3\x46\xf5\x49\xdf\x56\x4f\x71\x5b\x52\xc6\x4e\xd0\x43\xc2\xcd\xd5\xdf\x40\x43\x4a\xf7\xf6\xd9\xdf\xde\x45\xc9\xd9\xc2\xf0\xc1\x4a\x40\x52\xd1\x5b\xd0\x54\xc9\x5e\xde\xd5\x74\x5c\x5d\x59\x71\xc1\xc1\x71\xd2\xcb\x50\x50\x54\x53\x75\xdc\x4b\xcf\xc2\xd7\x4a\xcc\x58\xc7\xdb\xd8\x48\x4a\xd6\x58\xf0\x46"); |
|
|
|
packet_seq(A, 8, PCMA_silence, 320, 2, 13, "\x40"); |
|
|
|
// CN transcoding - reverse 1 |
|
|
|
start(); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(0, PCMU, 8000); |
|
|
|
sdp_pt(13, CN, 8000); |
|
|
|
ht_set(codec_consume, CN); |
|
|
|
offer(); |
|
|
|
expect(B, recv, "8/PCMA/8000 0/PCMU/8000"); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(0, PCMU, 8000); |
|
|
|
answer(); |
|
|
|
expect(A, recv, "8/PCMA/8000 0/PCMU/8000 13/CN/8000"); |
|
|
|
packet_seq(A, 8, PCMA_payload, 160, 1, 8, PCMA_payload); |
|
|
|
packet_seq(B, 8, PCMA_payload, 160, 1, 8, PCMA_payload); |
|
|
|
packet_seq(A, 13, "\x20", 320, 2, 8, "\xf5\x5c\x4b\xc2\xde\xf4\x5e\xd4\x47\x70\x5d\x77\x45\x51\xc5\xcd\xd7\x77\x5a\xf5\xcf\x4a\x4c\x40\xc3\x47\x74\x49\x59\xc4\x76\x57\x71\x57\x40\xc5\xf4\x5a\x47\xd6\xc4\xf6\xc7\xf3\x40\x58\x74\x54\x4b\xd7\x5c\xc7\x41\x49\xf5\x5b\x53\xd9\x70\x44\xcd\xc4\xce\xcb\xc7\x58\xcd\x45\xc6\x71\xf5\x70\x43\xca\x43\xd5\x52\x5c\x75\x74\xc6\xc3\x4f\xda\x56\xc3\x46\xf5\x49\xdf\x56\x4f\x71\x5b\x52\xc6\x4e\xd0\x43\xc2\xcd\xd5\xdf\x40\x43\x4a\xf7\xf6\xd9\xdf\xde\x45\xc9\xd9\xc2\xf0\xc1\x4a\x40\x52\xd1\x5b\xd0\x54\xc9\x5e\xde\xd5\x74\x5c\x5d\x59\x71\xc1\xc1\x71\xd2\xcb\x50\x50\x54\x53\x75\xdc\x4b\xcf\xc2\xd7\x4a\xcc\x58\xc7\xdb\xd8\x48\x4a\xd6\x58\xf0\x46"); |
|
|
|
packet_seq(B, 8, PCMA_silence, 320, 2, 13, "\x40"); |
|
|
|
// CN transcoding - reverse 2 |
|
|
|
start(); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(0, PCMU, 8000); |
|
|
|
sdp_pt(13, CN, 8000); |
|
|
|
ht_set(codec_accept, CN); |
|
|
|
offer(); |
|
|
|
expect(B, recv, "8/PCMA/8000 0/PCMU/8000 13/CN/8000"); |
|
|
|
sdp_pt(8, PCMA, 8000); |
|
|
|
sdp_pt(0, PCMU, 8000); |
|
|
|
answer(); |
|
|
|
expect(A, recv, "8/PCMA/8000 0/PCMU/8000 13/CN/8000"); |
|
|
|
packet_seq(A, 8, PCMA_payload, 160, 1, 8, PCMA_payload); |
|
|
|
packet_seq(B, 8, PCMA_payload, 160, 1, 8, PCMA_payload); |
|
|
|
packet_seq(A, 13, "\x20", 320, 2, 8, "\xf5\x5c\x4b\xc2\xde\xf4\x5e\xd4\x47\x70\x5d\x77\x45\x51\xc5\xcd\xd7\x77\x5a\xf5\xcf\x4a\x4c\x40\xc3\x47\x74\x49\x59\xc4\x76\x57\x71\x57\x40\xc5\xf4\x5a\x47\xd6\xc4\xf6\xc7\xf3\x40\x58\x74\x54\x4b\xd7\x5c\xc7\x41\x49\xf5\x5b\x53\xd9\x70\x44\xcd\xc4\xce\xcb\xc7\x58\xcd\x45\xc6\x71\xf5\x70\x43\xca\x43\xd5\x52\x5c\x75\x74\xc6\xc3\x4f\xda\x56\xc3\x46\xf5\x49\xdf\x56\x4f\x71\x5b\x52\xc6\x4e\xd0\x43\xc2\xcd\xd5\xdf\x40\x43\x4a\xf7\xf6\xd9\xdf\xde\x45\xc9\xd9\xc2\xf0\xc1\x4a\x40\x52\xd1\x5b\xd0\x54\xc9\x5e\xde\xd5\x74\x5c\x5d\x59\x71\xc1\xc1\x71\xd2\xcb\x50\x50\x54\x53\x75\xdc\x4b\xcf\xc2\xd7\x4a\xcc\x58\xc7\xdb\xd8\x48\x4a\xd6\x58\xf0\x46"); |
|
|
|
packet_seq(B, 8, PCMA_silence, 320, 2, 13, "\x40"); |
|
|
|
|
|
|
|
return 0; |
|
|
|
} |