Browse Source

MT#62735 add tests for heuristic learning mode

Change-Id: I0c3d67f4ee3f3350fcf0b350c39e475db948c6c8
(cherry picked from commit ee32e5ba5f)
mr12.5
Richard Fuchs 7 months ago
parent
commit
9e4f11b3b1
2 changed files with 589 additions and 2 deletions
  1. +5
    -2
      t/Makefile
  2. +584
    -0
      t/auto-daemon-tests-heuristic.pl

+ 5
- 2
t/Makefile View File

@ -105,7 +105,7 @@ include ../lib/common.Makefile
daemon-tests-main daemon-tests-jb daemon-tests-dtx daemon-tests-dtx-cn daemon-tests-pubsub \
daemon-tests-intfs daemon-tests-stats daemon-tests-delay-buffer daemon-tests-delay-timing \
daemon-tests-evs daemon-tests-player-cache daemon-tests-redis daemon-tests-t38 daemon-tests-evs-dtx \
daemon-tests-measure-rtp
daemon-tests-measure-rtp daemon-tests-heuristic
TESTS= test-bitstr aes-crypt aead-aes-crypt test-const_str_hash.strhash
ifeq ($(with_transcoding),yes)
@ -143,7 +143,7 @@ daemon-tests: daemon-tests-main daemon-tests-jb daemon-tests-pubsub daemon-tests
daemon-tests-evs daemon-tests-async-tc \
daemon-tests-audio-player daemon-tests-audio-player-play-media \
daemon-tests-intfs daemon-tests-stats daemon-tests-player-cache daemon-tests-redis \
daemon-tests-rtpp-flags daemon-tests-measure-rtp
daemon-tests-rtpp-flags daemon-tests-measure-rtp daemon-tests-heuristic
daemon-test-deps: tests-preload.so
$(MAKE) -C ../daemon
@ -154,6 +154,9 @@ daemon-tests-main: daemon-test-deps
daemon-tests-jb: daemon-test-deps
./auto-test-helper "$@" perl -I../perl auto-daemon-tests-jb.pl
daemon-tests-heuristic: daemon-test-deps
./auto-test-helper "$@" perl -I../perl auto-daemon-tests-heuristic.pl
daemon-tests-dtx: daemon-test-deps
./auto-test-helper "$@" perl -I../perl auto-daemon-tests-dtx.pl


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

@ -0,0 +1,584 @@
#!/usr/bin/perl
use strict;
use warnings;
use NGCP::Rtpengine::Test;
use NGCP::Rtpclient::SRTP;
use NGCP::Rtpengine::AutoTest;
use Test::More;
autotest_start(qw(--config-file=none -t -1 -i 203.0.113.1
-n 2223 -f -L 7 -E --endpoint-learning=heuristic))
or die;
my ($sock_a, $sock_b, $sock_c, $sock_d, $sock_e, $port_a, $port_b);
($sock_a, $sock_b, $sock_c, $sock_d, $sock_e) = new_call(
[qw(198.51.100.1 2010)], # caller
[qw(198.51.100.3 2012)], # callee - from SDP
[qw(198.51.100.3 2032)], # callee - different port
[qw(198.51.100.6 2012)], # callee - different address
[qw(198.51.100.6 2032)], # callee - all different
);
($port_a) = offer('basic, forward', { }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio 2010 RTP/AVP 0 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 0 8
c=IN IP4 203.0.113.1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=sendrecv
a=rtcp:PORT
SDP
($port_b) = answer('basic, forward', { }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.3
s=tester
t=0 0
m=audio 2012 RTP/AVP 0 8
c=IN IP4 198.51.100.3
a=sendrecv
--------------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.3
s=tester
t=0 0
m=audio PORT RTP/AVP 0 8
c=IN IP4 203.0.113.1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=sendrecv
a=rtcp:PORT
SDP
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1000, 3000, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1000, 3000, 0x1234, "\x00" x 160));
# callee send from expected
snd($sock_b, $port_a, rtp(0, 2000, 4000, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2000, 4000, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1001, 3160, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1001, 3160, 0x1234, "\x00" x 160));
# callee send from different port
snd($sock_c, $port_a, rtp(0, 2001, 4160, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2001, 4160, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1002, 3320, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1002, 3320, 0x1234, "\x00" x 160));
# callee send from different address
snd($sock_d, $port_a, rtp(0, 2002, 4320, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2002, 4320, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1003, 3480, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1003, 3480, 0x1234, "\x00" x 160));
# callee send from different everything
snd($sock_e, $port_a, rtp(0, 2003, 4480, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2003, 4480, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1004, 3640, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1004, 3640, 0x1234, "\x00" x 160));
# callee send from expected
snd($sock_b, $port_a, rtp(0, 2004, 4640, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2004, 4640, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1005, 3800, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1005, 3800, 0x1234, "\x00" x 160));
# callee send from different port
snd($sock_c, $port_a, rtp(0, 2005, 4800, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2005, 4800, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1006, 3960, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1006, 3960, 0x1234, "\x00" x 160));
# callee send from different address
snd($sock_d, $port_a, rtp(0, 2006, 4960, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2006, 4960, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1007, 4120, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1007, 4120, 0x1234, "\x00" x 160));
# callee send from different everything
snd($sock_e, $port_a, rtp(0, 2007, 5120, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2007, 5120, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1008, 4280, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1008, 4280, 0x1234, "\x00" x 160));
# wait for fix
sleep(4);
# callee send from expected
snd($sock_b, $port_a, rtp(0, 2008, 5280, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2008, 5280, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1009, 4440, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1009, 4440, 0x1234, "\x00" x 160));
# callee send from different port
snd($sock_c, $port_a, rtp(0, 2009, 5440, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2009, 5440, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1010, 4600, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1010, 4600, 0x1234, "\x00" x 160));
# callee send from different address
snd($sock_d, $port_a, rtp(0, 2010, 5600, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2010, 5600, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1011, 4760, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1011, 4760, 0x1234, "\x00" x 160));
# callee send from different everything
snd($sock_e, $port_a, rtp(0, 2011, 5760, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2011, 5760, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1012, 4920, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1012, 4920, 0x1234, "\x00" x 160));
rcv_no($sock_a);
rcv_no($sock_b);
rcv_no($sock_c);
rcv_no($sock_d);
rcv_no($sock_e);
($sock_a, $sock_b, $sock_c, $sock_d, $sock_e) = new_call(
[qw(198.51.100.1 2050)], # caller
[qw(198.51.100.3 2052)], # callee - from SDP
[qw(198.51.100.3 2072)], # callee - different port
[qw(198.51.100.6 2052)], # callee - different address
[qw(198.51.100.6 2072)], # callee - all different
);
($port_a) = offer('basic, reverse', { }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio 2050 RTP/AVP 0 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 0 8
c=IN IP4 203.0.113.1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=sendrecv
a=rtcp:PORT
SDP
($port_b) = answer('basic, reverse', { }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.3
s=tester
t=0 0
m=audio 2052 RTP/AVP 0 8
c=IN IP4 198.51.100.3
a=sendrecv
--------------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.3
s=tester
t=0 0
m=audio PORT RTP/AVP 0 8
c=IN IP4 203.0.113.1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=sendrecv
a=rtcp:PORT
SDP
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1000, 3000, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1000, 3000, 0x1234, "\x00" x 160));
# callee send from different everything
snd($sock_e, $port_a, rtp(0, 2000, 4000, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2000, 4000, 0x1234, "\x00" x 160));
# caller send, forward to worst candidate
snd($sock_a, $port_b, rtp(0, 1001, 3160, 0x1234, "\x00" x 160));
rcv($sock_e, $port_a, rtpm(0, 1001, 3160, 0x1234, "\x00" x 160));
# callee send from different port
snd($sock_c, $port_a, rtp(0, 2001, 4160, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2001, 4160, 0x1234, "\x00" x 160));
# caller send, forward to almost good candidate
snd($sock_a, $port_b, rtp(0, 1002, 3320, 0x1234, "\x00" x 160));
rcv($sock_c, $port_a, rtpm(0, 1002, 3320, 0x1234, "\x00" x 160));
# callee send from different address
snd($sock_d, $port_a, rtp(0, 2002, 4320, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2002, 4320, 0x1234, "\x00" x 160));
# caller send, forward to almost good candidate (different address ignored)
snd($sock_a, $port_b, rtp(0, 1003, 3480, 0x1234, "\x00" x 160));
rcv($sock_c, $port_a, rtpm(0, 1003, 3480, 0x1234, "\x00" x 160));
# callee send from expected
snd($sock_b, $port_a, rtp(0, 2003, 4480, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2003, 4480, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1004, 3640, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1004, 3640, 0x1234, "\x00" x 160));
# callee send from different everything
snd($sock_e, $port_a, rtp(0, 2004, 4640, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2004, 4640, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1005, 3800, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1005, 3800, 0x1234, "\x00" x 160));
# callee send from different port
snd($sock_c, $port_a, rtp(0, 2005, 4800, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2005, 4800, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1006, 3960, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1006, 3960, 0x1234, "\x00" x 160));
# callee send from different address
snd($sock_d, $port_a, rtp(0, 2006, 4960, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2006, 4960, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1007, 4120, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1007, 4120, 0x1234, "\x00" x 160));
# callee send from expected
snd($sock_b, $port_a, rtp(0, 2007, 5120, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2007, 5120, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1008, 4280, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1008, 4280, 0x1234, "\x00" x 160));
# wait for fix
sleep(4);
# callee send from different everything
snd($sock_e, $port_a, rtp(0, 2008, 5280, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2008, 5280, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1009, 4440, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1009, 4440, 0x1234, "\x00" x 160));
# callee send from different port
snd($sock_c, $port_a, rtp(0, 2009, 5440, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2009, 5440, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1010, 4600, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1010, 4600, 0x1234, "\x00" x 160));
# callee send from different address
snd($sock_d, $port_a, rtp(0, 2010, 5600, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2010, 5600, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1011, 4760, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1011, 4760, 0x1234, "\x00" x 160));
# callee send from expected
snd($sock_b, $port_a, rtp(0, 2011, 5760, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2011, 5760, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1012, 4920, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1012, 4920, 0x1234, "\x00" x 160));
rcv_no($sock_a);
rcv_no($sock_b);
rcv_no($sock_c);
rcv_no($sock_d);
rcv_no($sock_e);
($sock_a, $sock_b, $sock_c, $sock_d, $sock_e) = new_call(
[qw(198.51.100.1 2080)], # caller
[qw(198.51.100.3 2082)], # callee - from SDP
[qw(198.51.100.3 2102)], # callee - different port
[qw(198.51.100.6 2082)], # callee - different address
[qw(198.51.100.6 2102)], # callee - all different
);
($port_a) = offer('strict source, forward', { flags => ['strict source'] }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio 2080 RTP/AVP 0 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 0 8
c=IN IP4 203.0.113.1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=sendrecv
a=rtcp:PORT
SDP
($port_b) = answer('strict source, forward', { flags => ['strict source'] }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.3
s=tester
t=0 0
m=audio 2082 RTP/AVP 0 8
c=IN IP4 198.51.100.3
a=sendrecv
--------------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.3
s=tester
t=0 0
m=audio PORT RTP/AVP 0 8
c=IN IP4 203.0.113.1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=sendrecv
a=rtcp:PORT
SDP
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1000, 3000, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1000, 3000, 0x1234, "\x00" x 160));
# callee send from expected
snd($sock_b, $port_a, rtp(0, 2000, 4000, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2000, 4000, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1001, 3160, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1001, 3160, 0x1234, "\x00" x 160));
# callee send from different port
snd($sock_c, $port_a, rtp(0, 2001, 4160, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2001, 4160, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1002, 3320, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1002, 3320, 0x1234, "\x00" x 160));
# callee send from different address
snd($sock_d, $port_a, rtp(0, 2002, 4320, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2002, 4320, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1003, 3480, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1003, 3480, 0x1234, "\x00" x 160));
# callee send from different everything
snd($sock_e, $port_a, rtp(0, 2003, 4480, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2003, 4480, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1004, 3640, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1004, 3640, 0x1234, "\x00" x 160));
# callee send from expected
snd($sock_b, $port_a, rtp(0, 2004, 4640, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2004, 4640, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1005, 3800, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1005, 3800, 0x1234, "\x00" x 160));
# callee send from different port
snd($sock_c, $port_a, rtp(0, 2005, 4800, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2005, 4800, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1006, 3960, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1006, 3960, 0x1234, "\x00" x 160));
# callee send from different address
snd($sock_d, $port_a, rtp(0, 2006, 4960, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2006, 4960, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1007, 4120, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1007, 4120, 0x1234, "\x00" x 160));
# callee send from different everything
snd($sock_e, $port_a, rtp(0, 2007, 5120, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2007, 5120, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1008, 4280, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1008, 4280, 0x1234, "\x00" x 160));
# wait for fix
sleep(4);
# callee send from expected
snd($sock_b, $port_a, rtp(0, 2008, 5280, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2008, 5280, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1009, 4440, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1009, 4440, 0x1234, "\x00" x 160));
# callee send from different port
snd($sock_c, $port_a, rtp(0, 2009, 5440, 0x1234, "\x00" x 160));
rcv_no($sock_a); # dropped
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1010, 4600, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1010, 4600, 0x1234, "\x00" x 160));
# callee send from different address
snd($sock_d, $port_a, rtp(0, 2010, 5600, 0x1234, "\x00" x 160));
rcv_no($sock_a); # dropped
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1011, 4760, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1011, 4760, 0x1234, "\x00" x 160));
# callee send from different everything
snd($sock_e, $port_a, rtp(0, 2011, 5760, 0x1234, "\x00" x 160));
rcv_no($sock_a); # dropped
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1012, 4920, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1012, 4920, 0x1234, "\x00" x 160));
rcv_no($sock_a);
rcv_no($sock_b);
rcv_no($sock_c);
rcv_no($sock_d);
rcv_no($sock_e);
($sock_a, $sock_b, $sock_c, $sock_d, $sock_e) = new_call(
[qw(198.51.100.1 2140)], # caller
[qw(198.51.100.3 2142)], # callee - from SDP
[qw(198.51.100.3 2162)], # callee - different port
[qw(198.51.100.6 2142)], # callee - different address
[qw(198.51.100.6 2162)], # callee - all different
);
($port_a) = offer('strict source, reverse', { flags => ['strict source'] }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio 2140 RTP/AVP 0 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 0 8
c=IN IP4 203.0.113.1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=sendrecv
a=rtcp:PORT
SDP
($port_b) = answer('strict source, reverse', { flags => ['strict source'] }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.3
s=tester
t=0 0
m=audio 2142 RTP/AVP 0 8
c=IN IP4 198.51.100.3
a=sendrecv
--------------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.3
s=tester
t=0 0
m=audio PORT RTP/AVP 0 8
c=IN IP4 203.0.113.1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=sendrecv
a=rtcp:PORT
SDP
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1000, 3000, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1000, 3000, 0x1234, "\x00" x 160));
# callee send from different everything
snd($sock_e, $port_a, rtp(0, 2000, 4000, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2000, 4000, 0x1234, "\x00" x 160));
# caller send, forward to worst candidate
snd($sock_a, $port_b, rtp(0, 1001, 3160, 0x1234, "\x00" x 160));
rcv($sock_e, $port_a, rtpm(0, 1001, 3160, 0x1234, "\x00" x 160));
# callee send from different port
snd($sock_c, $port_a, rtp(0, 2001, 4160, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2001, 4160, 0x1234, "\x00" x 160));
# caller send, forward to almost good candidate
snd($sock_a, $port_b, rtp(0, 1002, 3320, 0x1234, "\x00" x 160));
rcv($sock_c, $port_a, rtpm(0, 1002, 3320, 0x1234, "\x00" x 160));
# callee send from different address
snd($sock_d, $port_a, rtp(0, 2002, 4320, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2002, 4320, 0x1234, "\x00" x 160));
# caller send, forward to almost good candidate (different address ignored)
snd($sock_a, $port_b, rtp(0, 1003, 3480, 0x1234, "\x00" x 160));
rcv($sock_c, $port_a, rtpm(0, 1003, 3480, 0x1234, "\x00" x 160));
# callee send from expected
snd($sock_b, $port_a, rtp(0, 2003, 4480, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2003, 4480, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1004, 3640, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1004, 3640, 0x1234, "\x00" x 160));
# callee send from different everything
snd($sock_e, $port_a, rtp(0, 2004, 4640, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2004, 4640, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1005, 3800, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1005, 3800, 0x1234, "\x00" x 160));
# callee send from different port
snd($sock_c, $port_a, rtp(0, 2005, 4800, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2005, 4800, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1006, 3960, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1006, 3960, 0x1234, "\x00" x 160));
# callee send from different address
snd($sock_d, $port_a, rtp(0, 2006, 4960, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2006, 4960, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1007, 4120, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1007, 4120, 0x1234, "\x00" x 160));
# callee send from expected
snd($sock_b, $port_a, rtp(0, 2007, 5120, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2007, 5120, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1008, 4280, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1008, 4280, 0x1234, "\x00" x 160));
# wait for fix
sleep(4);
# callee send from different everything
snd($sock_e, $port_a, rtp(0, 2008, 5280, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2008, 5280, 0x1234, "\x00" x 160)); # first packet that confirms the address still gets through
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1009, 4440, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1009, 4440, 0x1234, "\x00" x 160));
# callee send from different port
snd($sock_c, $port_a, rtp(0, 2009, 5440, 0x1234, "\x00" x 160));
rcv_no($sock_a); # dropped
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1010, 4600, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1010, 4600, 0x1234, "\x00" x 160));
# callee send from different address
snd($sock_d, $port_a, rtp(0, 2010, 5600, 0x1234, "\x00" x 160));
rcv_no($sock_a); # dropped
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1011, 4760, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1011, 4760, 0x1234, "\x00" x 160));
# callee send from expected
snd($sock_b, $port_a, rtp(0, 2011, 5760, 0x1234, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 2011, 5760, 0x1234, "\x00" x 160));
# caller send, forward to expected
snd($sock_a, $port_b, rtp(0, 1012, 4920, 0x1234, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(0, 1012, 4920, 0x1234, "\x00" x 160));
rcv_no($sock_a);
rcv_no($sock_b);
rcv_no($sock_c);
rcv_no($sock_d);
rcv_no($sock_e);
#done_testing;NGCP::Rtpengine::AutoTest::terminate('f00');exit;
done_testing();

Loading…
Cancel
Save