MT#55283 Add tests for `fixed egress SSRC`

Change-Id: I778013fcf1085d3d2de6713d649d549f00ff7e73
master
dnygate 1 day ago committed by Richard Fuchs
parent 7674d8529c
commit 23bb5401a8

@ -26,10 +26,15 @@ BEGIN {
our @EXPORT = qw(autotest_start new_call new_call_nc offer answer ft tt cid snd snd_no srtp_snd rtp rcv srtp_rcv rcv_no rcv_maybe
srtp_dec escape rtpm rtpmre reverse_tags new_ft new_tt crlf sdp_split rtpe_req offer_answer
autotest_init subscribe_request subscribe_answer publish create create_answer
use_json rtpe_raw_req);
use_json rtpe_raw_req last_resp);
};
my $last_response;
sub last_resp {
return $last_response;
}
my $rtpe_stdout;
my $rtpe_stderr;
my $rtpe_pid;
@ -183,6 +188,7 @@ sub offer_answer {
$req->{'from-tag'} //= $ft;
$req->{sdp} = $sdp_in;
my $resp = rtpe_req($cmd, $name, $req);
$last_response = $resp;
return sdp_match($cmd, $name, $resp->{sdp}, $exp_sdp_out);
}
sub offer {

@ -86,7 +86,7 @@ include ../lib/common.Makefile
daemon-tests-measure-rtp daemon-tests-mos-legacy daemon-tests-mos-fullband daemon-tests-config-file \
daemon-tests-templ-def daemon-tests-templ-def-offer daemon-tests-t38 daemon-tests-evs-dtx \
daemon-tests-transform daemon-tests-http daemon-tests-heuristic daemon-tests-asymmetric \
daemon-tests-dtx-no-shift daemon-tests-rtcp daemon-tests-redis-subscribe daemon-tests-rtp-ext \
daemon-tests-dtx-no-shift daemon-tests-rtcp daemon-tests-redis-subscribe daemon-tests-rtp-ext daemon-tests-ssrc \
daemon-tests-bundle daemon-tests-dtls daemon-tests-rollback \
daemon-tests-rollback-redis \
daemon-tests-recording daemon-tests-create daemon-tests-alias \
@ -139,7 +139,7 @@ daemon-tests: daemon-tests-main daemon-tests-jb daemon-tests-pubsub daemon-tests
daemon-tests-sdp-manipulations daemon-tests-sdes-manipulations \
daemon-tests-sdp-orig-replacements daemon-tests-moh daemon-tests-evs-dtx daemon-tests-transform \
daemon-tests-transcode-config daemon-tests-codec-prefs daemon-tests-http daemon-tests-heuristic \
daemon-tests-asymmetric daemon-tests-rtcp daemon-tests-redis-subscribe daemon-tests-rtp-ext \
daemon-tests-asymmetric daemon-tests-rtcp daemon-tests-redis-subscribe daemon-tests-rtp-ext daemon-tests-ssrc \
daemon-tests-bundle daemon-tests-dtls daemon-tests-rollback daemon-tests-rollback-redis \
daemon-tests-recording daemon-tests-create \
daemon-tests-dtx daemon-tests-dtx-cn daemon-tests-dtx-no-shift \
@ -295,6 +295,9 @@ daemon-tests-rtcp: daemon-test-deps
daemon-tests-rtp-ext: daemon-test-deps
./auto-test-helper "$@" perl -I../perl auto-daemon-tests-rtp-ext.pl
daemon-tests-ssrc: daemon-test-deps
./auto-test-helper "$@" perl -I../perl auto-daemon-tests-ssrc.pl
daemon-tests-bundle: daemon-test-deps
./auto-test-helper "$@" perl -I../perl auto-daemon-tests-bundle.pl

@ -0,0 +1,97 @@
#!/usr/bin/perl
use strict;
use warnings;
use NGCP::Rtpengine::Test;
use NGCP::Rtpengine::AutoTest;
use Test::More;
use POSIX;
autotest_start(qw(--config-file=none -t -1 -i 203.0.113.1 -n 2223 -f -L 7 -E --log-level-internals=7))
or die;
my ($sock_a, $sock_ax, $sock_b, $sock_bx, $port_a, $port_ax, $port_b, $port_bx, $resp, $ssrcs);
# the chosen egress SSRC is reported per media in the offer response
($sock_a, $sock_ax, $sock_b, $sock_bx) = new_call(
[qw(198.51.100.1 7000)],
[qw(198.51.100.1 7001)],
[qw(198.51.100.3 7002)],
[qw(198.51.100.3 7003)],
);
($port_a, $port_ax) = offer('egress SSRC reported', { flags => ['fixed egress SSRC'] }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio 7000 RTP/AVP 8
c=IN IP4 198.51.100.1
a=sendrecv
----------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio PORT RTP/AVP 8
c=IN IP4 203.0.113.1
a=rtpmap:8 PCMA/8000
a=sendrecv
a=rtcp:PORT
SDP
$resp = last_resp();
$ssrcs = $resp->{'egress SSRC'};
is ref($ssrcs), 'ARRAY', 'egress SSRC list present in offer response';
is scalar(@{$ssrcs // []}), 1, 'one egress SSRC entry per m= section';
is $ssrcs->[0]->{index}, 1, 'egress SSRC entry carries media index';
is $ssrcs->[0]->{type}, 'audio', 'egress SSRC entry carries media type';
ok(($ssrcs->[0]->{SSRC} // 0) > 0, 'egress SSRC entry carries a non-zero SSRC');
my $egress = $ssrcs->[0]->{SSRC};
($port_b, $port_bx) = answer('egress SSRC reported', { }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.3
s=tester
t=0 0
m=audio 7002 RTP/AVP 8
c=IN IP4 198.51.100.3
a=rtpmap:8 PCMA/8000
a=sendrecv
--------------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.3
s=tester
t=0 0
m=audio PORT RTP/AVP 8
c=IN IP4 203.0.113.1
a=rtpmap:8 PCMA/8000
a=sendrecv
a=rtcp:PORT
SDP
# RTP towards the answerer carries the reported SSRC, not the one the sender used
snd($sock_a, $port_b, rtp(8, 1000, 3000, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(8, 1000, 3000, $egress, "\x00" x 160));
# the egress SSRC and the sequence numbering survive a change of ingress SSRC
snd($sock_a, $port_b, rtp(8, 1001, 3160, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(8, 1001, 3160, $egress, "\x00" x 160));
snd($sock_a, $port_b, rtp(8, 5000, 90000, 0x4321, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(8, 1002, 90000, $egress, "\x00" x 160));
#done_testing;NGCP::Rtpengine::AutoTest::terminate('f00');exit;
done_testing();
Loading…
Cancel
Save