Browse Source

TT#101653 add tests for codec-consume/accept

Change-Id: I054584d338645ebe59ed0803aa3262f81c2e7401
pull/1163/head
Richard Fuchs 5 years ago
parent
commit
6e519047df
2 changed files with 729 additions and 0 deletions
  1. +249
    -0
      t/auto-daemon-tests.pl
  2. +480
    -0
      t/transcode-test.c

+ 249
- 0
t/auto-daemon-tests.pl View File

@ -753,6 +753,182 @@ a=sendrecv
a=rtcp:PORT
SDP
##
offer('strip-all w consume and offer',
{ codec => {
strip => ['all'],
consume => ['CN'],
offer => ['PCMA', 'PCMU', 'telephone-event'],
} }, <<SDP);
v=0
o=testlab 949032 0 IN IP4 127.0.0.1
s=session
c=IN IP4 52.115.185.219
b=CT:10000000
t=0 0
m=audio 52152 RTP/AVP 104 9 103 111 18 0 8 97 101 13 118
c=IN IP4 52.115.185.219
a=rtcp:52153
a=mid:1
a=sendrecv
a=rtpmap:104 SILK/16000
a=rtpmap:9 G722/8000
a=rtpmap:103 SILK/8000
a=rtpmap:111 SIREN/16000
a=fmtp:111 bitrate=16000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:97 RED/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=rtpmap:13 CN/8000
a=rtpmap:118 CN/16000
a=ptime:20
----------------------------------
v=0
o=testlab 949032 0 IN IP4 127.0.0.1
s=session
c=IN IP4 52.115.185.219
b=CT:10000000
t=0 0
m=audio PORT RTP/AVP 8 0 101
c=IN IP4 203.0.113.1
a=mid:1
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
answer('strip-all w consume and offer',
{ }, <<SDP);
v=0
o=testlab 3815920663 3815920664 IN IP4 89.250.11.190
s=pjmedia
c=IN IP4 89.250.11.190
t=0 0
m=audio 4002 RTP/AVP 8 101
c=IN IP4 89.250.11.190
a=rtcp:4003 IN IP4 172.31.250.201
a=sendrecv
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
----------------------------------
v=0
o=testlab 3815920663 3815920664 IN IP4 89.250.11.190
s=pjmedia
c=IN IP4 89.250.11.190
t=0 0
m=audio PORT RTP/AVP 8 0 101 13
c=IN IP4 203.0.113.1
a=mid:1
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=rtpmap:13 CN/8000
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
offer('strip-all w consume and offer and s/c',
{ codec => {
strip => ['all'],
consume => ['CN'],
offer => ['PCMA', 'PCMU', 'telephone-event'],
},
flags => ['symmetric codecs'],
}, <<SDP);
v=0
o=testlab 949032 0 IN IP4 127.0.0.1
s=session
c=IN IP4 52.115.185.219
b=CT:10000000
t=0 0
m=audio 52152 RTP/AVP 104 9 103 111 18 0 8 97 101 13 118
c=IN IP4 52.115.185.219
a=rtcp:52153
a=mid:1
a=sendrecv
a=rtpmap:104 SILK/16000
a=rtpmap:9 G722/8000
a=rtpmap:103 SILK/8000
a=rtpmap:111 SIREN/16000
a=fmtp:111 bitrate=16000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:97 RED/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=rtpmap:13 CN/8000
a=rtpmap:118 CN/16000
a=ptime:20
----------------------------------
v=0
o=testlab 949032 0 IN IP4 127.0.0.1
s=session
c=IN IP4 52.115.185.219
b=CT:10000000
t=0 0
m=audio PORT RTP/AVP 8 0 101
c=IN IP4 203.0.113.1
a=mid:1
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
answer('strip-all w consume and offer and s/c',
{
flags => ['symmetric codecs'],
}, <<SDP);
v=0
o=testlab 3815920663 3815920664 IN IP4 89.250.11.190
s=pjmedia
c=IN IP4 89.250.11.190
t=0 0
m=audio 4002 RTP/AVP 8 101
c=IN IP4 89.250.11.190
a=rtcp:4003 IN IP4 172.31.250.201
a=sendrecv
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
----------------------------------
v=0
o=testlab 3815920663 3815920664 IN IP4 89.250.11.190
s=pjmedia
c=IN IP4 89.250.11.190
t=0 0
m=audio PORT RTP/AVP 8 0 101 13
c=IN IP4 203.0.113.1
a=mid:1
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=rtpmap:13 CN/8000
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
@ -883,6 +1059,79 @@ snd($sock_a, $port_b, rtp(0, 1001, 3160, 0x1234, "\x00" x 160));
snd($sock_a, $port_b, rtp(0, 1002, 3320, 0x1234, "\xff" x 160));
rcv($sock_b, $port_a, rtpm(13, 1002, 3320, $ssrc, "\x20"));
# consume CN
($sock_b, $sock_a) = new_call([qw(198.51.101.1 6006)], [qw(198.51.101.3 7006)]);
($port_b) = offer('consume CN',
{ ICE => 'remove', replace => ['origin'],
codec => {
strip => ['all'],
consume => ['CN'],
offer => ['PCMA','PCMU','telephone-event'],
} }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.101.1
s=tester
t=0 0
m=audio 6006 RTP/AVP 8 0 13 101
c=IN IP4 198.51.101.1
a=sendrecv
a=rtpmap:101 telephone-event/8000
----------------------------------
v=0
o=- 1545997027 1 IN IP4 203.0.113.1
s=tester
t=0 0
m=audio PORT RTP/AVP 8 0 101
c=IN IP4 203.0.113.1
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=sendrecv
a=rtcp:PORT
SDP
($port_a) = answer('consume CN',
{ ICE => 'remove', replace => ['origin'] }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.101.1
s=tester
t=0 0
m=audio 7006 RTP/AVP 8 101
c=IN IP4 198.51.101.3
a=sendrecv
a=rtpmap:101 telephone-event/8000
----------------------------------
v=0
o=- 1545997027 1 IN IP4 203.0.113.1
s=tester
t=0 0
m=audio PORT RTP/AVP 8 0 101 13
c=IN IP4 203.0.113.1
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=rtpmap:13 CN/8000
a=sendrecv
a=rtcp:PORT
SDP
snd($sock_a, $port_b, rtp(8, 1000, 3000, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(8, 1000, 3000, -1, "\x00" x 160));
snd($sock_b, $port_a, rtp(8, 2000, 4000, 0x3456, "\x00" x 160));
($ssrc) = rcv($sock_a, $port_b, rtpm(8, 2000, 4000, -1, "\x00" x 160));
snd($sock_b, $port_a, rtp(13, 2001, 4160, 0x3456, "\x12\x23\x23\x34\x56"));
rcv($sock_a, $port_b, rtpm(8, 2001, 4160, $ssrc, "\xfb\x70\x58\xe4\x43\xe6\x41\xfc\x44\x71\xc0\x63\x44\x77\x58\x50\x49\x66\x5a\xd8\x42\x66\x41\x67\xd0\x6f\x67\x60\x60\x7c\x10\x71\x12\x64\x10\x65\x60\x16\x6c\x63\x6c\x76\x60\xd1\x15\x74\x15\x7c\x16\x7d\x14\x7d\x16\x69\x4a\x13\x66\x67\x1c\x60\x66\x15\x7c\x7e\x67\x62\xd5\x15\xd2\x11\xf0\x1c\x72\x49\x11\x76\x6d\x6e\x14\x15\x64\x6e\x11\x76\x17\x7e\x16\x5c\x1d\x42\x15\x14\x16\x69\x11\x63\x1c\x60\x1d\x67\x6a\x15\x63\x11\x14\x10\x79\x68\x6e\x66\x60\x14\x59\x6e\x74\x50\x7d\x6d\x74\x67\x79\x60\x77\x60\x56\x6f\x56\x64\x6e\x77\x63\x62\x15\x45\x6c\x11\x45\x67\x6a\x7c\x60\x6c\x6a\x72\x12\x5f\x6d\x6d\x6a\x5d\x11\x5b\x61\x7b\x6a\x63\x67\x15\xd0\x10"));
snd($sock_b, $port_a, rtp(8, 2002, 4320, 0x3456, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(8, 2002, 4320, $ssrc, "\x00" x 160));
# test silence detection
snd($sock_a, $port_b, rtp(8, 1001, 3160, 0x1234, "\x00" x 160));
($ssrc) = rcv($sock_b, $port_a, rtpm(8, 1001, 3160, -1, "\x00" x 160));
snd($sock_a, $port_b, rtp(8, 1002, 3320, 0x1234, "\xd5" x 160));
rcv($sock_b, $port_a, rtpm(13, 1002, 3320, $ssrc, "\x20"));


+ 480
- 0
t/transcode-test.c View File

@ -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;
}

Loading…
Cancel
Save