From e65805268863ba26a1fd06f6ce84f755c7c9a729 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 25 Jan 2023 15:08:30 -0500 Subject: [PATCH] MT#55283 add test for Redis data The test script already existed but was a dummy and wasn't used. Change-Id: I18caeccd34054550688db38cd2e5262d681a3a58 --- debian/control | 1 + t/Makefile | 12 +- t/auto-daemon-tests-redis.pl | 2598 +++++++++++++++++++++++++++++++++- 3 files changed, 2567 insertions(+), 44 deletions(-) diff --git a/debian/control b/debian/control index 35c0e6c7b..8e2ca82ca 100644 --- a/debian/control +++ b/debian/control @@ -38,6 +38,7 @@ Build-Depends: libssl-dev (>= 1.0.1), libswresample-dev (>= 6:10), libsystemd-dev, + libtest2-suite-perl, libwebsockets-dev, libxmlrpc-core-c3-dev (>= 1.16.07), libxtables-dev (>= 1.4) | iptables-dev (>= 1.4), diff --git a/t/Makefile b/t/Makefile index eca0cc961..ab258e154 100644 --- a/t/Makefile +++ b/t/Makefile @@ -91,7 +91,7 @@ include ../lib/common.Makefile .PHONY: all-tests unit-tests daemon-tests daemon-tests \ 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-evs daemon-tests-player-cache daemon-tests-redis TESTS= test-bitstr aes-crypt aead-aes-crypt test-const_str_hash.strhash ifeq ($(with_transcoding),yes) @@ -127,7 +127,7 @@ unit-tests: $(TESTS) daemon-tests: daemon-tests-main daemon-tests-jb daemon-tests-pubsub daemon-tests-websocket \ daemon-tests-evs \ - daemon-tests-intfs daemon-tests-stats daemon-tests-player-cache + daemon-tests-intfs daemon-tests-stats daemon-tests-player-cache daemon-tests-redis daemon-test-deps: tests-preload.so $(MAKE) -C ../daemon @@ -228,6 +228,14 @@ daemon-tests-player-cache: daemon-test-deps test "$$(ls fake-$@-sockets)" = "" rmdir fake-$@-sockets +daemon-tests-redis: daemon-test-deps + rm -rf fake-$@-sockets + mkdir fake-$@-sockets + LD_PRELOAD=../t/tests-preload.so RTPE_BIN=../daemon/rtpengine TEST_SOCKET_PATH=./fake-$@-sockets \ + perl -I../perl auto-daemon-tests-redis.pl + test "$$(ls fake-$@-sockets)" = "" + rmdir fake-$@-sockets + test-bitstr: test-bitstr.o spandsp_send_fax_pcm: spandsp_send_fax_pcm.o diff --git a/t/auto-daemon-tests-redis.pl b/t/auto-daemon-tests-redis.pl index 297c26f47..0a9ea9e95 100755 --- a/t/auto-daemon-tests-redis.pl +++ b/t/auto-daemon-tests-redis.pl @@ -6,93 +6,2607 @@ use NGCP::Rtpengine::Test; use NGCP::Rtpclient::SRTP; use NGCP::Rtpengine::AutoTest; use Test::More; +use Test2::Tools::Compare qw(like); +use Socket qw(AF_INET SOCK_STREAM sockaddr_in pack_sockaddr_in inet_aton); +use JSON; +use Data::Dumper; +$Data::Dumper::Sortkeys = 1; -autotest_init() or die; +# fake Redis listener +my $redis_listener; +socket($redis_listener, AF_INET, SOCK_STREAM, 0) or die; +bind($redis_listener, sockaddr_in(6379, inet_aton('203.0.113.42'))) or die; +listen($redis_listener, 10) or die; -my ($sock_a, $sock_b, $port_a, $port_b, $ssrc, $resp, $srtp_ctx_a, $srtp_ctx_b, $crypto); +my $redis_fd; +sub redis_i { + my ($i, $n) = @_; + my $buf; + alarm(1); + recv($redis_fd, $buf, length($i), 0) or die; + alarm(0); + is($buf, $i, $n); +} +sub redis_io { + my ($i, $o, $n) = @_; + redis_i($i, $n); + send($redis_fd, $o, 0) or die; +}; + + +$NGCP::Rtpengine::AutoTest::launch_cb = sub { + # accept Redis connection and read preamble + + accept($redis_fd, $redis_listener) or die; + + redis_io("*2\r\n\$4\r\nAUTH\r\n\$4\r\nauth\r\n", "+OK\r\n", "AUTH"); + redis_io("*2\r\n\$6\r\nSELECT\r\n\$1\r\n2\r\n", "+OK\r\n", "SELECT 1"); + redis_io("*1\r\n\$4\r\nINFO\r\n", "\$13\r\nrole:master\r\n\r\n", "INFO"); + redis_io("*2\r\n\$4\r\nTYPE\r\n\$5\r\ncalls\r\n", "+none\r\n", "TYPE"); + + redis_io("*1\r\n\$4\r\nPING\r\n", "+PONG\r\n", "PING"); + redis_io("*2\r\n\$4\r\nKEYS\r\n\$1\r\n*\r\n", "*0\r\n", "KEYS"); +}; + +autotest_start(qw(--config-file=none -t -1 -i foo/203.0.113.1 -i foo/2001:db8:4321::1 + -i bar/203.0.113.2 -i bar/2001:db8:4321::2 + -n 2223 -f -L 7 -E --redis=auth@203.0.113.42:6379/2)) + or die; -# SDES in -($sock_a, $sock_b) = new_call([qw(192.168.1.149 20010)], [qw(192.168.1.149 20012)]); -($port_a) = offer('SDES in', { ICE => 'remove', - replace => ['origin'], - 'transport-protocol' => 'RTP/AVP', - }, < [ + '1' + ], + 'associated_tags-1' => [ + '0' + ], + 'json' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr/^\d+$/, + 'created_from' => qr//, + 'created_from_addr' => qr//, + 'deleted' => '0', + 'destroyed' => '0', + 'last_signal' => qr/^\d+$/, + 'ml_deleted' => '0', + 'num_maps' => '2', + 'num_medias' => '2', + 'num_sfds' => '4', + 'num_streams' => '4', + 'num_tags' => '2', + 'recording_metadata' => '', + 'redis_hosted_db' => '2', + 'tos' => '0' + }, + 'map-0' => { + 'endpoint' => '198.51.100.1:3000', + 'intf_preferred_family' => 'IP4', + 'logical_intf' => 'foo', + 'num_ports' => '2', + 'wildcard' => '0' + }, + 'map-1' => { + 'endpoint' => '', + 'intf_preferred_family' => 'IP4', + 'logical_intf' => 'foo', + 'num_ports' => '2', + 'wildcard' => '1' + }, + 'map_sfds-0' => [ + 'loc-0', + '0', + '1' + ], + 'map_sfds-1' => [ + 'loc-0', + '2', + '3' + ], + 'maps-0' => [ + '0' + ], + 'maps-1' => [ + '1' + ], + 'media-0' => { + 'desired_family' => 'IP4', + 'format_str' => '0 8', + 'index' => '1', + 'logical_intf' => 'foo', + 'media_flags' => '2228236', + 'protocol' => 'RTP/AVP', + 'ptime' => '0', + 'tag' => '1', + 'type' => 'audio' + }, + 'media-1' => { + 'desired_family' => 'IP4', + 'format_str' => '0 8', + 'index' => '1', + 'logical_intf' => 'foo', + 'media_flags' => '65548', + 'protocol' => 'RTP/AVP', + 'ptime' => '0', + 'tag' => '0', + 'type' => 'audio' + }, + 'medias-0' => [ + '1' + ], + 'medias-1' => [ + '0' + ], + 'payload_types-0' => [ + '0/PCMU/8000///0/20', + '8/PCMA/8000///0/20' + ], + 'payload_types-1' => [ + '0/PCMU/8000///0/20', + '8/PCMA/8000///0/20' + ], + 'rtcp_sinks-0' => [], + 'rtcp_sinks-1' => [ + '3' + ], + 'rtcp_sinks-2' => [], + 'rtcp_sinks-3' => [ + '1' + ], + 'rtp_sinks-0' => [ + '2' + ], + 'rtp_sinks-1' => [], + 'rtp_sinks-2' => [ + '0' + ], + 'rtp_sinks-3' => [], + 'sfd-0' => { + 'fd' => qr/^\d+$/, + 'local_intf_uid' => '0', + 'localport' => qr/^\d+$/, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '0' + }, + 'sfd-1' => { + 'fd' => qr/^\d+$/, + 'local_intf_uid' => '0', + 'localport' => qr/^\d+$/, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '1' + }, + 'sfd-2' => { + 'fd' => qr/^\d+$/, + 'local_intf_uid' => '0', + 'localport' => qr/^\d+$/, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '2' + }, + 'sfd-3' => { + 'fd' => qr/^\d+$/, + 'local_intf_uid' => '0', + 'localport' => qr/^\d+$/, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '3' + }, + 'ssrc_table-0' => [], + 'ssrc_table-1' => [], + 'stream-0' => { + 'advertised_endpoint' => '', + 'component' => '1', + 'endpoint' => '', + 'last_packet' => qr/^\d+$/, + 'media' => '0', + 'ps_flags' => '65536', + 'rtcp_sibling' => '1', + 'sfd' => '0', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-1' => { + 'advertised_endpoint' => '', + 'component' => '2', + 'endpoint' => '', + 'last_packet' => qr/^\d+$/, + 'media' => '0', + 'ps_flags' => '131072', + 'rtcp_sibling' => '4294967295', + 'sfd' => '1', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-2' => { + 'advertised_endpoint' => '198.51.100.1:3000', + 'component' => '1', + 'endpoint' => '198.51.100.1:3000', + 'last_packet' => qr/^\d+$/, + 'media' => '1', + 'ps_flags' => '68222976', + 'rtcp_sibling' => '3', + 'sfd' => '2', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-3' => { + 'advertised_endpoint' => '198.51.100.1:3001', + 'component' => '2', + 'endpoint' => '198.51.100.1:3001', + 'last_packet' => qr/^\d+$/, + 'media' => '1', + 'ps_flags' => '68288513', + 'rtcp_sibling' => '4294967295', + 'sfd' => '3', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream_sfds-0' => [ + '0' + ], + 'stream_sfds-1' => [ + '1' + ], + 'stream_sfds-2' => [ + '2' + ], + 'stream_sfds-3' => [ + '3' + ], + 'streams-0' => [ + '0', + '1' + ], + 'streams-1' => [ + '2', + '3' + ], + 'subscriptions-0' => [ + '1/0/1/0/0' + ], + 'subscriptions-1' => [ + '0/0/1/0/0' + ], + 'tag-0' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr/^\d+$/, + 'deleted' => '0', + 'logical_intf' => 'foo', + 'tag' => ft() + }, + 'tag-1' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr/^\d+$/, + 'deleted' => '0', + 'logical_intf' => 'foo' + } +}; + +offer('simple call', + { }, < [ + '1' + ], + 'associated_tags-1' => [ + '0' + ], + 'json' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr/^\d+$/, + 'created_from' => qr//, + 'created_from_addr' => qr//, + 'deleted' => '0', + 'destroyed' => '0', + 'last_signal' => qr/^\d+$/, + 'ml_deleted' => '0', + 'num_maps' => '2', + 'num_medias' => '2', + 'num_sfds' => '4', + 'num_streams' => '4', + 'num_tags' => '2', + 'recording_metadata' => '', + 'redis_hosted_db' => '2', + 'tos' => '0' + }, + 'map-0' => { + 'endpoint' => '198.51.100.1:3000', + 'intf_preferred_family' => 'IP4', + 'logical_intf' => 'foo', + 'num_ports' => '2', + 'wildcard' => '0' + }, + 'map-1' => { + 'endpoint' => '198.51.100.4:3000', + 'intf_preferred_family' => 'IP4', + 'logical_intf' => 'foo', + 'num_ports' => '2', + 'wildcard' => '0' + }, + 'map_sfds-0' => [ + 'loc-0', + '0', + '1' + ], + 'map_sfds-1' => [ + 'loc-0', + '2', + '3' + ], + 'maps-0' => [ + '0' + ], + 'maps-1' => [ + '1' + ], + 'media-0' => { + 'desired_family' => 'IP4', + 'format_str' => '8', + 'index' => '1', + 'logical_intf' => 'foo', + 'media_flags' => '2293772', + 'protocol' => 'RTP/AVP', + 'ptime' => '0', + 'tag' => '1', + 'type' => 'audio' + }, + 'media-1' => { + 'desired_family' => 'IP4', + 'format_str' => '8', + 'index' => '1', + 'logical_intf' => 'foo', + 'media_flags' => '65548', + 'protocol' => 'RTP/AVP', + 'ptime' => '0', + 'tag' => '0', + 'type' => 'audio' + }, + 'medias-0' => [ + '1' + ], + 'medias-1' => [ + '0' + ], + 'payload_types-0' => [ + '8/PCMA/8000///0/20' + ], + 'payload_types-1' => [ + '8/PCMA/8000///0/20' + ], + 'rtcp_sinks-0' => [], + 'rtcp_sinks-1' => [ + '3' + ], + 'rtcp_sinks-2' => [], + 'rtcp_sinks-3' => [ + '1' + ], + 'rtp_sinks-0' => [ + '2' + ], + 'rtp_sinks-1' => [], + 'rtp_sinks-2' => [ + '0' + ], + 'rtp_sinks-3' => [], + 'sfd-0' => { + 'fd' => qr/^\d+$/, + 'local_intf_uid' => '0', + 'localport' => qr/^\d+$/, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '0' + }, + 'sfd-1' => { + 'fd' => qr/^\d+$/, + 'local_intf_uid' => '0', + 'localport' => qr/^\d+$/, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '1' + }, + 'sfd-2' => { + 'fd' => qr/^\d+$/, + 'local_intf_uid' => '0', + 'localport' => qr/^\d+$/, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '2' + }, + 'sfd-3' => { + 'fd' => qr/^\d+$/, + 'local_intf_uid' => '0', + 'localport' => qr/^\d+$/, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '3' + }, + 'ssrc_table-0' => [], + 'ssrc_table-1' => [], + 'stream-0' => { + 'advertised_endpoint' => '198.51.100.4:3000', + 'component' => '1', + 'endpoint' => '198.51.100.4:3000', + 'last_packet' => qr/^\d+$/, + 'media' => '0', + 'ps_flags' => '1114112', + 'rtcp_sibling' => '1', + 'sfd' => '0', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-1' => { + 'advertised_endpoint' => '198.51.100.4:3001', + 'component' => '2', + 'endpoint' => '198.51.100.4:3001', + 'last_packet' => qr/^\d+$/, + 'media' => '0', + 'ps_flags' => '1179649', + 'rtcp_sibling' => '4294967295', + 'sfd' => '1', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-2' => { + 'advertised_endpoint' => '198.51.100.1:3000', + 'component' => '1', + 'endpoint' => '198.51.100.1:3000', + 'last_packet' => qr/^\d+$/, + 'media' => '1', + 'ps_flags' => '1114112', + 'rtcp_sibling' => '3', + 'sfd' => '2', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-3' => { + 'advertised_endpoint' => '198.51.100.1:3001', + 'component' => '2', + 'endpoint' => '198.51.100.1:3001', + 'last_packet' => qr/^\d+$/, + 'media' => '1', + 'ps_flags' => '1179649', + 'rtcp_sibling' => '4294967295', + 'sfd' => '3', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream_sfds-0' => [ + '0' + ], + 'stream_sfds-1' => [ + '1' + ], + 'stream_sfds-2' => [ + '2' + ], + 'stream_sfds-3' => [ + '3' + ], + 'streams-0' => [ + '0', + '1' + ], + 'streams-1' => [ + '2', + '3' + ], + 'subscriptions-0' => [ + '1/0/1/0/0' + ], + 'subscriptions-1' => [ + '0/0/1/0/0' + ], + 'tag-0' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr/^\d+$/, + 'deleted' => '0', + 'logical_intf' => 'foo', + 'tag' => ft() + }, + 'tag-1' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr/^\d+$/, + 'deleted' => '0', + 'logical_intf' => 'foo', + 'tag' => tt() + } +}; + +answer('simple call', + { }, < [ + '1' + ], + 'associated_tags-1' => [ + '0' + ], + 'json' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr/^\d+$/, + 'created_from' => qr//, + 'created_from_addr' => qr//, + 'deleted' => '0', + 'destroyed' => '0', + 'last_signal' => qr/^\d+$/, + 'ml_deleted' => '0', + 'num_maps' => '2', + 'num_medias' => '2', + 'num_sfds' => '4', + 'num_streams' => '4', + 'num_tags' => '2', + 'recording_metadata' => '', + 'redis_hosted_db' => '2', + 'tos' => '0' + }, + 'map-0' => { + 'endpoint' => '198.51.100.14:6088', + 'intf_preferred_family' => 'IP4', + 'logical_intf' => 'foo', + 'num_ports' => '2', + 'wildcard' => '0' + }, + 'map-1' => { + 'endpoint' => '', + 'intf_preferred_family' => 'IP4', + 'logical_intf' => 'foo', + 'num_ports' => '2', + 'wildcard' => '1' + }, + 'map_sfds-0' => [ + 'loc-0', + '0', + '1' + ], + 'map_sfds-1' => [ + 'loc-0', + '2', + '3' + ], + 'maps-0' => [ + '0' + ], + 'maps-1' => [ + '1' + ], + 'media-0' => { + 'desired_family' => 'IP4', + 'format_str' => '0 8', + 'index' => '1', + 'logical_intf' => 'foo', + 'media_flags' => '2228236', + 'protocol' => 'RTP/AVP', + 'ptime' => '0', + 'tag' => '1', + 'type' => 'audio' + }, + 'media-1' => { + 'desired_family' => 'IP4', + 'format_str' => '0 8', + 'index' => '1', + 'logical_intf' => 'foo', + 'media_flags' => '65548', + 'protocol' => 'RTP/AVP', + 'ptime' => '0', + 'tag' => '0', + 'type' => 'audio' + }, + 'medias-0' => [ + '1' + ], + 'medias-1' => [ + '0' + ], + 'payload_types-0' => [ + '0/PCMU/8000///0/20', + '8/PCMA/8000///0/20' + ], + 'payload_types-1' => [ + '0/PCMU/8000///0/20', + '8/PCMA/8000///0/20' + ], + 'rtcp_sinks-0' => [], + 'rtcp_sinks-1' => [ + '3' + ], + 'rtcp_sinks-2' => [], + 'rtcp_sinks-3' => [ + '1' + ], + 'rtp_sinks-0' => [ + '2' + ], + 'rtp_sinks-1' => [], + 'rtp_sinks-2' => [ + '0' + ], + 'rtp_sinks-3' => [], + 'sfd-0' => { + 'fd' => qr/^\d+$/, + 'local_intf_uid' => '0', + 'localport' => qr/^\d+$/, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '0' + }, + 'sfd-1' => { + 'fd' => qr/^\d+$/, + 'local_intf_uid' => '0', + 'localport' => qr/^\d+$/, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '1' + }, + 'sfd-2' => { + 'fd' => qr/^\d+$/, + 'local_intf_uid' => '0', + 'localport' => qr/^\d+$/, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '2' + }, + 'sfd-3' => { + 'fd' => qr/^\d+$/, + 'local_intf_uid' => '0', + 'localport' => qr/^\d+$/, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '3' + }, + 'ssrc_table-0' => [], + 'ssrc_table-1' => [], + 'stream-0' => { + 'advertised_endpoint' => '', + 'component' => '1', + 'endpoint' => '', + 'last_packet' => qr/^\d+$/, + 'media' => '0', + 'ps_flags' => '65536', + 'rtcp_sibling' => '1', + 'sfd' => '0', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-1' => { + 'advertised_endpoint' => '', + 'component' => '2', + 'endpoint' => '', + 'last_packet' => qr/^\d+$/, + 'media' => '0', + 'ps_flags' => '131072', + 'rtcp_sibling' => '4294967295', + 'sfd' => '1', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-2' => { + 'advertised_endpoint' => '198.51.100.14:6088', + 'component' => '1', + 'endpoint' => '198.51.100.14:6088', + 'last_packet' => qr/^\d+$/, + 'media' => '1', + 'ps_flags' => '68222976', + 'rtcp_sibling' => '3', + 'sfd' => '2', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-3' => { + 'advertised_endpoint' => '198.51.100.14:6089', + 'component' => '2', + 'endpoint' => '198.51.100.14:6089', + 'last_packet' => qr/^\d+$/, + 'media' => '1', + 'ps_flags' => '68288513', + 'rtcp_sibling' => '4294967295', + 'sfd' => '3', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream_sfds-0' => [ + '0' + ], + 'stream_sfds-1' => [ + '1' + ], + 'stream_sfds-2' => [ + '2' + ], + 'stream_sfds-3' => [ + '3' + ], + 'streams-0' => [ + '0', + '1' + ], + 'streams-1' => [ + '2', + '3' + ], + 'subscriptions-0' => [ + '1/0/1/0/0' + ], + 'subscriptions-1' => [ + '0/0/1/0/0' + ], + 'tag-0' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr/^\d+$/, + 'deleted' => '0', + 'logical_intf' => 'foo', + 'tag' => ft() + }, + 'tag-1' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr/^\d+$/, + 'deleted' => '0', + 'logical_intf' => 'foo' + } +}; + +offer('sub to multiple tags', + { }, < 'remove', - replace => ['origin'], - DTLS => 'off', - }, < [ + '1' + ], + 'associated_tags-1' => [ + '0' + ], + 'json' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr/^\d+$/, + 'created_from' => qr//, + 'created_from_addr' => qr//, + 'deleted' => '0', + 'destroyed' => '0', + 'last_signal' => qr/^\d+$/, + 'ml_deleted' => '0', + 'num_maps' => '2', + 'num_medias' => '2', + 'num_sfds' => '4', + 'num_streams' => '4', + 'num_tags' => '2', + 'recording_metadata' => '', + 'redis_hosted_db' => '2', + 'tos' => '0' + }, + 'map-0' => { + 'endpoint' => '198.51.100.14:6088', + 'intf_preferred_family' => 'IP4', + 'logical_intf' => 'foo', + 'num_ports' => '2', + 'wildcard' => '0' + }, + 'map-1' => { + 'endpoint' => '198.51.100.14:6090', + 'intf_preferred_family' => 'IP4', + 'logical_intf' => 'foo', + 'num_ports' => '2', + 'wildcard' => '0' + }, + 'map_sfds-0' => [ + 'loc-0', + '0', + '1' + ], + 'map_sfds-1' => [ + 'loc-0', + '2', + '3' + ], + 'maps-0' => [ + '0' + ], + 'maps-1' => [ + '1' + ], + 'media-0' => { + 'desired_family' => 'IP4', + 'format_str' => '0 8', + 'index' => '1', + 'logical_intf' => 'foo', + 'media_flags' => '2293772', + 'protocol' => 'RTP/AVP', + 'ptime' => '0', + 'tag' => '1', + 'type' => 'audio' + }, + 'media-1' => { + 'desired_family' => 'IP4', + 'format_str' => '0 8', + 'index' => '1', + 'logical_intf' => 'foo', + 'media_flags' => '65548', + 'protocol' => 'RTP/AVP', + 'ptime' => '0', + 'tag' => '0', + 'type' => 'audio' + }, + 'medias-0' => [ + '1' + ], + 'medias-1' => [ + '0' + ], + 'payload_types-0' => [ + '0/PCMU/8000///0/20', + '8/PCMA/8000///0/20' + ], + 'payload_types-1' => [ + '0/PCMU/8000///0/20', + '8/PCMA/8000///0/20' + ], + 'rtcp_sinks-0' => [], + 'rtcp_sinks-1' => [ + '3' + ], + 'rtcp_sinks-2' => [], + 'rtcp_sinks-3' => [ + '1' + ], + 'rtp_sinks-0' => [ + '2' + ], + 'rtp_sinks-1' => [], + 'rtp_sinks-2' => [ + '0' + ], + 'rtp_sinks-3' => [], + 'sfd-0' => { + 'fd' => qr/^\d+$/, + 'local_intf_uid' => '0', + 'localport' => qr/^\d+$/, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '0' + }, + 'sfd-1' => { + 'fd' => qr/^\d+$/, + 'local_intf_uid' => '0', + 'localport' => qr/^\d+$/, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '1' + }, + 'sfd-2' => { + 'fd' => qr/^\d+$/, + 'local_intf_uid' => '0', + 'localport' => qr/^\d+$/, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '2' + }, + 'sfd-3' => { + 'fd' => qr/^\d+$/, + 'local_intf_uid' => '0', + 'localport' => qr/^\d+$/, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '3' + }, + 'ssrc_table-0' => [], + 'ssrc_table-1' => [], + 'stream-0' => { + 'advertised_endpoint' => '198.51.100.14:6090', + 'component' => '1', + 'endpoint' => '198.51.100.14:6090', + 'last_packet' => qr/^\d+$/, + 'media' => '0', + 'ps_flags' => '1114112', + 'rtcp_sibling' => '1', + 'sfd' => '0', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-1' => { + 'advertised_endpoint' => '198.51.100.14:6091', + 'component' => '2', + 'endpoint' => '198.51.100.14:6091', + 'last_packet' => qr/^\d+$/, + 'media' => '0', + 'ps_flags' => '1179649', + 'rtcp_sibling' => '4294967295', + 'sfd' => '1', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-2' => { + 'advertised_endpoint' => '198.51.100.14:6088', + 'component' => '1', + 'endpoint' => '198.51.100.14:6088', + 'last_packet' => qr/^\d+$/, + 'media' => '1', + 'ps_flags' => '1114112', + 'rtcp_sibling' => '3', + 'sfd' => '2', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-3' => { + 'advertised_endpoint' => '198.51.100.14:6089', + 'component' => '2', + 'endpoint' => '198.51.100.14:6089', + 'last_packet' => qr/^\d+$/, + 'media' => '1', + 'ps_flags' => '1179649', + 'rtcp_sibling' => '4294967295', + 'sfd' => '3', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream_sfds-0' => [ + '0' + ], + 'stream_sfds-1' => [ + '1' + ], + 'stream_sfds-2' => [ + '2' + ], + 'stream_sfds-3' => [ + '3' + ], + 'streams-0' => [ + '0', + '1' + ], + 'streams-1' => [ + '2', + '3' + ], + 'subscriptions-0' => [ + '1/0/1/0/0' + ], + 'subscriptions-1' => [ + '0/0/1/0/0' + ], + 'tag-0' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr/^\d+$/, + 'deleted' => '0', + 'logical_intf' => 'foo', + 'tag' => ft() + }, + 'tag-1' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr/^\d+$/, + 'deleted' => '0', + 'logical_intf' => 'foo', + 'tag' => tt() + } +}; + +answer('sub to multiple tags', + { }, < [ + '1' + ], + 'associated_tags-1' => [ + '0' + ], + 'associated_tags-2' => [], + 'json' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr/^\d+$/, + 'created_from' => qr//, + 'created_from_addr' => qr//, + 'deleted' => '0', + 'destroyed' => '0', + 'last_signal' => qr/^\d+$/, + 'ml_deleted' => '0', + 'num_maps' => '4', + 'num_medias' => '4', + 'num_sfds' => '8', + 'num_streams' => '8', + 'num_tags' => '3', + 'recording_metadata' => '', + 'redis_hosted_db' => '2', + 'tos' => '0' + }, + 'map-0' => { + 'endpoint' => '198.51.100.14:6088', + 'intf_preferred_family' => 'IP4', + 'logical_intf' => 'foo', + 'num_ports' => '2', + 'wildcard' => '0' + }, + 'map-1' => { + 'endpoint' => '198.51.100.14:6090', + 'intf_preferred_family' => 'IP4', + 'logical_intf' => 'foo', + 'num_ports' => '2', + 'wildcard' => '0' + }, + 'map-2' => { + 'endpoint' => '', + 'intf_preferred_family' => 'IP4', + 'logical_intf' => 'foo', + 'num_ports' => '2', + 'wildcard' => '1' + }, + 'map-3' => { + 'endpoint' => '', + 'intf_preferred_family' => 'IP4', + 'logical_intf' => 'foo', + 'num_ports' => '2', + 'wildcard' => '1' + }, + 'map_sfds-0' => [ + 'loc-0', + '0', + '1' + ], + 'map_sfds-1' => [ + 'loc-0', + '2', + '3' + ], + 'map_sfds-2' => [ + 'loc-0', + '4', + '5' + ], + 'map_sfds-3' => [ + 'loc-0', + '6', + '7' + ], + 'maps-0' => [ + '0' + ], + 'maps-1' => [ + '1' + ], + 'maps-2' => [ + '2' + ], + 'maps-3' => [ + '3' + ], + 'media-0' => { + 'desired_family' => 'IP4', + 'format_str' => '0 8', + 'index' => '1', + 'logical_intf' => 'foo', + 'media_flags' => '2293772', + 'protocol' => 'RTP/AVP', + 'ptime' => '0', + 'tag' => '1', + 'type' => 'audio' + }, + 'media-1' => { + 'desired_family' => 'IP4', + 'format_str' => '0 8', + 'index' => '1', + 'logical_intf' => 'foo', + 'media_flags' => '65548', + 'protocol' => 'RTP/AVP', + 'ptime' => '0', + 'tag' => '0', + 'type' => 'audio' + }, + 'media-2' => { + 'desired_family' => 'IP4', + 'format_str' => '0 8', + 'index' => '1', + 'logical_intf' => 'foo', + 'media_flags' => '4', + 'protocol' => 'RTP/AVP', + 'ptime' => '0', + 'tag' => '2', + 'type' => 'audio' + }, + 'media-3' => { + 'desired_family' => 'IP4', + 'format_str' => '0 8', + 'index' => '2', + 'logical_intf' => 'foo', + 'media_flags' => '4', + 'protocol' => 'RTP/AVP', + 'ptime' => '0', + 'tag' => '2', + 'type' => 'audio' + }, + 'medias-0' => [ + '1' + ], + 'medias-1' => [ + '0' + ], + 'medias-2' => [ + '2', + '3' + ], + 'payload_types-0' => [ + '0/PCMU/8000///0/20', + '8/PCMA/8000///0/20' + ], + 'payload_types-1' => [ + '0/PCMU/8000///0/20', + '8/PCMA/8000///0/20' + ], + 'payload_types-2' => [ + '0/PCMU/8000///0/20', + '8/PCMA/8000///0/20' + ], + 'payload_types-3' => [ + '0/PCMU/8000///0/20', + '8/PCMA/8000///0/20' + ], + 'rtcp_sinks-0' => [], + 'rtcp_sinks-1' => [ + '3', + '7' + ], + 'rtcp_sinks-2' => [], + 'rtcp_sinks-3' => [ + '1', + '5' + ], + 'rtcp_sinks-4' => [], + 'rtcp_sinks-5' => [], + 'rtcp_sinks-6' => [], + 'rtcp_sinks-7' => [], + 'rtp_sinks-0' => [ + '2', + '6' + ], + 'rtp_sinks-1' => [], + 'rtp_sinks-2' => [ + '0', + '4' + ], + 'rtp_sinks-3' => [], + 'rtp_sinks-4' => [], + 'rtp_sinks-5' => [], + 'rtp_sinks-6' => [], + 'rtp_sinks-7' => [], + 'sfd-0' => { + 'fd' => qr/^\d+$/, + 'local_intf_uid' => '0', + 'localport' => qr/^\d+$/, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '0' + }, + 'sfd-1' => { + 'fd' => qr/^\d+$/, + 'local_intf_uid' => '0', + 'localport' => qr/^\d+$/, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '1' + }, + 'sfd-2' => { + 'fd' => qr/^\d+$/, + 'local_intf_uid' => '0', + 'localport' => qr/^\d+$/, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '2' + }, + 'sfd-3' => { + 'fd' => qr/^\d+$/, + 'local_intf_uid' => '0', + 'localport' => qr/^\d+$/, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '3' + }, + 'sfd-4' => { + 'fd' => qr/^\d+$/, + 'local_intf_uid' => '0', + 'localport' => qr/^\d+$/, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '4' + }, + 'sfd-5' => { + 'fd' => qr/^\d+$/, + 'local_intf_uid' => '0', + 'localport' => qr/^\d+$/, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '5' + }, + 'sfd-6' => { + 'fd' => qr/^\d+$/, + 'local_intf_uid' => '0', + 'localport' => qr/^\d+$/, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '6' + }, + 'sfd-7' => { + 'fd' => qr/^\d+$/, + 'local_intf_uid' => '0', + 'localport' => qr/^\d+$/, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '7' + }, + 'ssrc_table-0' => [], + 'ssrc_table-1' => [], + 'ssrc_table-2' => [], + 'stream-0' => { + 'advertised_endpoint' => '198.51.100.14:6090', + 'component' => '1', + 'endpoint' => '198.51.100.14:6090', + 'last_packet' => qr/^\d+$/, + 'media' => '0', + 'ps_flags' => '1114112', + 'rtcp_sibling' => '1', + 'sfd' => '0', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-1' => { + 'advertised_endpoint' => '198.51.100.14:6091', + 'component' => '2', + 'endpoint' => '198.51.100.14:6091', + 'last_packet' => qr/^\d+$/, + 'media' => '0', + 'ps_flags' => '68288513', + 'rtcp_sibling' => '4294967295', + 'sfd' => '1', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-2' => { + 'advertised_endpoint' => '198.51.100.14:6088', + 'component' => '1', + 'endpoint' => '198.51.100.14:6088', + 'last_packet' => qr/^\d+$/, + 'media' => '1', + 'ps_flags' => '1114112', + 'rtcp_sibling' => '3', + 'sfd' => '2', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-3' => { + 'advertised_endpoint' => '198.51.100.14:6089', + 'component' => '2', + 'endpoint' => '198.51.100.14:6089', + 'last_packet' => qr/^\d+$/, + 'media' => '1', + 'ps_flags' => '68288513', + 'rtcp_sibling' => '4294967295', + 'sfd' => '3', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-4' => { + 'advertised_endpoint' => '', + 'component' => '1', + 'endpoint' => '', + 'last_packet' => qr/^\d+$/, + 'media' => '2', + 'ps_flags' => '65536', + 'rtcp_sibling' => '5', + 'sfd' => '4', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-5' => { + 'advertised_endpoint' => '', + 'component' => '2', + 'endpoint' => '', + 'last_packet' => qr/^\d+$/, + 'media' => '2', + 'ps_flags' => '131072', + 'rtcp_sibling' => '4294967295', + 'sfd' => '5', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-6' => { + 'advertised_endpoint' => '', + 'component' => '1', + 'endpoint' => '', + 'last_packet' => qr/^\d+$/, + 'media' => '3', + 'ps_flags' => '65536', + 'rtcp_sibling' => '7', + 'sfd' => '6', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-7' => { + 'advertised_endpoint' => '', + 'component' => '2', + 'endpoint' => '', + 'last_packet' => qr/^\d+$/, + 'media' => '3', + 'ps_flags' => '131072', + 'rtcp_sibling' => '4294967295', + 'sfd' => '7', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream_sfds-0' => [ + '0' + ], + 'stream_sfds-1' => [ + '1' + ], + 'stream_sfds-2' => [ + '2' + ], + 'stream_sfds-3' => [ + '3' + ], + 'stream_sfds-4' => [ + '4' + ], + 'stream_sfds-5' => [ + '5' + ], + 'stream_sfds-6' => [ + '6' + ], + 'stream_sfds-7' => [ + '7' + ], + 'streams-0' => [ + '0', + '1' + ], + 'streams-1' => [ + '2', + '3' + ], + 'streams-2' => [ + '4', + '5' + ], + 'streams-3' => [ + '6', + '7' + ], + 'subscriptions-0' => [ + '1/0/1/0/0' + ], + 'subscriptions-1' => [ + '0/0/1/0/0' + ], + 'subscriptions-2' => [ + '0/0/0/0/0', + '1/1/0/0/0' + ], + 'tag-0' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr/^\d+$/, + 'deleted' => '0', + 'logical_intf' => 'foo', + 'tag' => ft() + }, + 'tag-1' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr/^\d+$/, + 'deleted' => '0', + 'logical_intf' => 'foo', + 'tag' => tt() + }, + 'tag-2' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr/^\d+$/, + 'deleted' => '0', + 'logical_intf' => 'foo', + 'tag' => qr// + } + }; + +my ($ftr, $ttr, $fts) = subscribe_request('sub to multiple tags', + { 'from-tags' => [ft(), tt()] }, <{'media-0'}{media_flags} = '10682380'; +$json_exp->{'media-1'}{media_flags} = '8454156'; +$json_exp->{'media-2'}{format_str} = '8'; +$json_exp->{'media-2'}{media_flags} = '65540'; +$json_exp->{'media-3'}{format_str} = '8'; +$json_exp->{'media-3'}{media_flags} = '65540'; +$json_exp->{'payload_types-2'}[0] = '8/PCMA/8000///0/20'; +$#{$json_exp->{'payload_types-2'}} = 0; +$json_exp->{'payload_types-3'}[0] = '8/PCMA/8000///0/20'; +$#{$json_exp->{'payload_types-3'}} = 0; +$json_exp->{'stream-1'}{ps_flags} = '1179649'; +$json_exp->{'stream-3'}{ps_flags} = '1179649'; +$json_exp->{'stream-4'}{advertised_endpoint} = '198.51.100.14:6092'; +$json_exp->{'stream-4'}{endpoint} = '198.51.100.14:6092'; +$json_exp->{'stream-4'}{ps_flags} = '1114112'; +$json_exp->{'stream-5'}{advertised_endpoint} = '198.51.100.14:6093'; +$json_exp->{'stream-5'}{endpoint} = '198.51.100.14:6093'; +$json_exp->{'stream-5'}{ps_flags} = '1179649'; +$json_exp->{'stream-6'}{advertised_endpoint} = '198.51.100.14:6094'; +$json_exp->{'stream-6'}{endpoint} = '198.51.100.14:6094'; +$json_exp->{'stream-6'}{ps_flags} = '1114112'; +$json_exp->{'stream-7'}{advertised_endpoint} = '198.51.100.14:6095'; +$json_exp->{'stream-7'}{endpoint} = '198.51.100.14:6095'; +$json_exp->{'stream-7'}{ps_flags} = '1179649'; + +subscribe_answer('sub to multiple tags', + { 'to-tag' => $ttr, flags => ['allow transcoding'] }, < $NGCP::Rtpclient::SRTP::crypto_suites{AES_CM_128_HMAC_SHA1_80}, - key => 'zC6Ea9EK/7YmDM79CK+TAnNXTI1pVmZuCMjUPMph', + +new_call; + +$json_exp = { + 'associated_tags-0' => [], + 'json' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr//, + 'created_from' => qr//, + 'created_from_addr' => qr//, + 'deleted' => '0', + 'destroyed' => '0', + 'last_signal' => qr//, + 'ml_deleted' => '0', + 'num_maps' => '1', + 'num_medias' => '1', + 'num_sfds' => '2', + 'num_streams' => '2', + 'num_tags' => '1', + 'recording_metadata' => '', + 'redis_hosted_db' => '2', + 'tos' => '0' + }, + 'map-0' => { + 'endpoint' => '', + 'intf_preferred_family' => 'IP4', + 'logical_intf' => 'foo', + 'num_ports' => '2', + 'wildcard' => '1' + }, + 'map_sfds-0' => [ + 'loc-0', + '0', + '1' + ], + 'maps-0' => [ + '0' + ], + 'media-0' => { + 'desired_family' => 'IP4', + 'format_str' => '0 8 9', + 'index' => '1', + 'logical_intf' => 'foo', + 'media_flags' => '65544', + 'protocol' => 'RTP/AVP', + 'ptime' => '0', + 'tag' => '0', + 'type' => 'audio' + }, + 'medias-0' => [ + '0' + ], + 'payload_types-0' => [ + '0/PCMU/8000///0/20' + ], + 'rtcp_sinks-0' => [], + 'rtcp_sinks-1' => [], + 'rtp_sinks-0' => [], + 'rtp_sinks-1' => [], + 'sfd-0' => { + 'fd' => '19', + 'local_intf_uid' => '0', + 'localport' => qr//, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '0' + }, + 'sfd-1' => { + 'fd' => '20', + 'local_intf_uid' => '0', + 'localport' => qr//, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '1' + }, + 'ssrc_table-0' => [], + 'stream-0' => { + 'advertised_endpoint' => '198.51.100.14:6042', + 'component' => '1', + 'endpoint' => '198.51.100.14:6042', + 'last_packet' => qr//, + 'media' => '0', + 'ps_flags' => '1114112', + 'rtcp_sibling' => '1', + 'sfd' => '0', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-1' => { + 'advertised_endpoint' => '198.51.100.14:6043', + 'component' => '2', + 'endpoint' => '198.51.100.14:6043', + 'last_packet' => qr//, + 'media' => '0', + 'ps_flags' => '1179649', + 'rtcp_sibling' => '4294967295', + 'sfd' => '1', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream_sfds-0' => [ + '0' + ], + 'stream_sfds-1' => [ + '1' + ], + 'streams-0' => [ + '0', + '1' + ], + 'subscriptions-0' => [], + 'tag-0' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr//, + 'deleted' => '0', + 'logical_intf' => 'foo', + 'tag' => ft() + } }; -$srtp_ctx_b = { - cs => $NGCP::Rtpclient::SRTP::crypto_suites{AES_CM_128_HMAC_SHA1_80}, - key => $crypto, + +publish('publish/subscribe', + { }, < [], + 'associated_tags-1' => [], + 'json' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr//, + 'created_from' => qr//, + 'created_from_addr' => qr//, + 'deleted' => '0', + 'destroyed' => '0', + 'last_signal' => qr//, + 'ml_deleted' => '0', + 'num_maps' => '2', + 'num_medias' => '2', + 'num_sfds' => '4', + 'num_streams' => '4', + 'num_tags' => '2', + 'recording_metadata' => '', + 'redis_hosted_db' => '2', + 'tos' => '0' + }, + 'map-0' => { + 'endpoint' => '', + 'intf_preferred_family' => 'IP4', + 'logical_intf' => 'foo', + 'num_ports' => '2', + 'wildcard' => '1' + }, + 'map-1' => { + 'endpoint' => '', + 'intf_preferred_family' => 'IP4', + 'logical_intf' => 'foo', + 'num_ports' => '2', + 'wildcard' => '1' + }, + 'map_sfds-0' => [ + 'loc-0', + '0', + '1' + ], + 'map_sfds-1' => [ + 'loc-0', + '2', + '3' + ], + 'maps-0' => [ + '0' + ], + 'maps-1' => [ + '1' + ], + 'media-0' => { + 'desired_family' => 'IP4', + 'format_str' => '0 8 9', + 'index' => '1', + 'logical_intf' => 'foo', + 'media_flags' => '65544', + 'protocol' => 'RTP/AVP', + 'ptime' => '0', + 'tag' => '0', + 'type' => 'audio' + }, + 'media-1' => { + 'desired_family' => 'IP4', + 'format_str' => '0 8 9', + 'index' => '1', + 'logical_intf' => 'foo', + 'media_flags' => '4', + 'protocol' => 'RTP/AVP', + 'ptime' => '0', + 'tag' => '1', + 'type' => 'audio' + }, + 'medias-0' => [ + '0' + ], + 'medias-1' => [ + '1' + ], + 'payload_types-0' => [ + '0/PCMU/8000///0/20' + ], + 'payload_types-1' => [ + '0/PCMU/8000///0/20' + ], + 'rtcp_sinks-0' => [], + 'rtcp_sinks-1' => [ + '3' + ], + 'rtcp_sinks-2' => [], + 'rtcp_sinks-3' => [], + 'rtp_sinks-0' => [ + '2' + ], + 'rtp_sinks-1' => [], + 'rtp_sinks-2' => [], + 'rtp_sinks-3' => [], + 'sfd-0' => { + 'fd' => '19', + 'local_intf_uid' => '0', + 'localport' => qr//, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '0' + }, + 'sfd-1' => { + 'fd' => '20', + 'local_intf_uid' => '0', + 'localport' => qr//, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '1' + }, + 'sfd-2' => { + 'fd' => '21', + 'local_intf_uid' => '0', + 'localport' => qr//, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '2' + }, + 'sfd-3' => { + 'fd' => '22', + 'local_intf_uid' => '0', + 'localport' => qr//, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '3' + }, + 'ssrc_table-0' => [], + 'ssrc_table-1' => [], + 'stream-0' => { + 'advertised_endpoint' => '198.51.100.14:6042', + 'component' => '1', + 'endpoint' => '198.51.100.14:6042', + 'last_packet' => qr//, + 'media' => '0', + 'ps_flags' => '1114112', + 'rtcp_sibling' => '1', + 'sfd' => '0', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-1' => { + 'advertised_endpoint' => '198.51.100.14:6043', + 'component' => '2', + 'endpoint' => '198.51.100.14:6043', + 'last_packet' => qr//, + 'media' => '0', + 'ps_flags' => '68288513', + 'rtcp_sibling' => '4294967295', + 'sfd' => '1', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-2' => { + 'advertised_endpoint' => '', + 'component' => '1', + 'endpoint' => '', + 'last_packet' => qr//, + 'media' => '1', + 'ps_flags' => '65536', + 'rtcp_sibling' => '3', + 'sfd' => '2', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-3' => { + 'advertised_endpoint' => '', + 'component' => '2', + 'endpoint' => '', + 'last_packet' => qr//, + 'media' => '1', + 'ps_flags' => '131072', + 'rtcp_sibling' => '4294967295', + 'sfd' => '3', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream_sfds-0' => [ + '0' + ], + 'stream_sfds-1' => [ + '1' + ], + 'stream_sfds-2' => [ + '2' + ], + 'stream_sfds-3' => [ + '3' + ], + 'streams-0' => [ + '0', + '1' + ], + 'streams-1' => [ + '2', + '3' + ], + 'subscriptions-0' => [], + 'subscriptions-1' => [ + '0/0/0/0/0' + ], + 'tag-0' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr//, + 'deleted' => '0', + 'logical_intf' => 'foo', + 'tag' => ft() + }, + 'tag-1' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr//, + 'deleted' => '0', + 'logical_intf' => 'foo', + 'tag' => qr//, + } }; +($ftr, $ttr, undef) = subscribe_request('publish/subscribe', + { 'from-tag' => ft() }, < [], + 'associated_tags-1' => [], + 'json' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr//, + 'created_from' => qr//, + 'created_from_addr' => qr//, + 'deleted' => '0', + 'destroyed' => '0', + 'last_signal' => qr//, + 'ml_deleted' => '0', + 'num_maps' => '2', + 'num_medias' => '2', + 'num_sfds' => '4', + 'num_streams' => '4', + 'num_tags' => '2', + 'recording_metadata' => '', + 'redis_hosted_db' => '2', + 'tos' => '0' + }, + 'map-0' => { + 'endpoint' => '', + 'intf_preferred_family' => 'IP4', + 'logical_intf' => 'foo', + 'num_ports' => '2', + 'wildcard' => '1' + }, + 'map-1' => { + 'endpoint' => '', + 'intf_preferred_family' => 'IP4', + 'logical_intf' => 'foo', + 'num_ports' => '2', + 'wildcard' => '1' + }, + 'map_sfds-0' => [ + 'loc-0', + '0', + '1' + ], + 'map_sfds-1' => [ + 'loc-0', + '2', + '3' + ], + 'maps-0' => [ + '0' + ], + 'maps-1' => [ + '1' + ], + 'media-0' => { + 'desired_family' => 'IP4', + 'format_str' => '0 8 9', + 'index' => '1', + 'logical_intf' => 'foo', + 'media_flags' => '65544', + 'protocol' => 'RTP/AVP', + 'ptime' => '0', + 'tag' => '0', + 'type' => 'audio' + }, + 'media-1' => { + 'desired_family' => 'IP4', + 'format_str' => '0', + 'index' => '1', + 'logical_intf' => 'foo', + 'media_flags' => '65540', + 'protocol' => 'RTP/AVP', + 'ptime' => '0', + 'tag' => '1', + 'type' => 'audio' + }, + 'medias-0' => [ + '0' + ], + 'medias-1' => [ + '1' + ], + 'payload_types-0' => [ + '0/PCMU/8000///0/20' + ], + 'payload_types-1' => [ + '0/PCMU/8000///0/20' + ], + 'rtcp_sinks-0' => [], + 'rtcp_sinks-1' => [ + '3' + ], + 'rtcp_sinks-2' => [], + 'rtcp_sinks-3' => [], + 'rtp_sinks-0' => [ + '2' + ], + 'rtp_sinks-1' => [], + 'rtp_sinks-2' => [], + 'rtp_sinks-3' => [], + 'sfd-0' => { + 'fd' => '19', + 'local_intf_uid' => '0', + 'localport' => qr//, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '0' + }, + 'sfd-1' => { + 'fd' => '20', + 'local_intf_uid' => '0', + 'localport' => qr//, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '1' + }, + 'sfd-2' => { + 'fd' => '21', + 'local_intf_uid' => '0', + 'localport' => qr//, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '2' + }, + 'sfd-3' => { + 'fd' => '22', + 'local_intf_uid' => '0', + 'localport' => qr//, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '3' + }, + 'ssrc_table-0' => [], + 'ssrc_table-1' => [], + 'stream-0' => { + 'advertised_endpoint' => '198.51.100.14:6042', + 'component' => '1', + 'endpoint' => '198.51.100.14:6042', + 'last_packet' => qr//, + 'media' => '0', + 'ps_flags' => '1114112', + 'rtcp_sibling' => '1', + 'sfd' => '0', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-1' => { + 'advertised_endpoint' => '198.51.100.14:6043', + 'component' => '2', + 'endpoint' => '198.51.100.14:6043', + 'last_packet' => qr//, + 'media' => '0', + 'ps_flags' => '1179649', + 'rtcp_sibling' => '4294967295', + 'sfd' => '1', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-2' => { + 'advertised_endpoint' => '198.51.100.14:6044', + 'component' => '1', + 'endpoint' => '198.51.100.14:6044', + 'last_packet' => qr//, + 'media' => '1', + 'ps_flags' => '1114112', + 'rtcp_sibling' => '3', + 'sfd' => '2', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-3' => { + 'advertised_endpoint' => '198.51.100.14:6045', + 'component' => '2', + 'endpoint' => '198.51.100.14:6045', + 'last_packet' => qr//, + 'media' => '1', + 'ps_flags' => '1179649', + 'rtcp_sibling' => '4294967295', + 'sfd' => '3', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream_sfds-0' => [ + '0' + ], + 'stream_sfds-1' => [ + '1' + ], + 'stream_sfds-2' => [ + '2' + ], + 'stream_sfds-3' => [ + '3' + ], + 'streams-0' => [ + '0', + '1' + ], + 'streams-1' => [ + '2', + '3' + ], + 'subscriptions-0' => [], + 'subscriptions-1' => [ + '0/0/0/0/0' + ], + 'tag-0' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr//, + 'deleted' => '0', + 'logical_intf' => 'foo', + 'tag' => ft() + }, + 'tag-1' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr//, + 'deleted' => '0', + 'logical_intf' => 'foo', + 'tag' => qr//, + } +}; + +subscribe_answer('publish/subscribe', + { 'to-tag' => $ttr }, < [], + 'associated_tags-1' => [], + 'associated_tags-2' => [], + 'json' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr//, + 'created_from' => qr//, + 'created_from_addr' => qr//, + 'deleted' => '0', + 'destroyed' => '0', + 'last_signal' => qr//, + 'ml_deleted' => '0', + 'num_maps' => '3', + 'num_medias' => '3', + 'num_sfds' => '6', + 'num_streams' => '6', + 'num_tags' => '3', + 'recording_metadata' => '', + 'redis_hosted_db' => '2', + 'tos' => '0' + }, + 'map-0' => { + 'endpoint' => '', + 'intf_preferred_family' => 'IP4', + 'logical_intf' => 'foo', + 'num_ports' => '2', + 'wildcard' => '1' + }, + 'map-1' => { + 'endpoint' => '', + 'intf_preferred_family' => 'IP4', + 'logical_intf' => 'foo', + 'num_ports' => '2', + 'wildcard' => '1' + }, + 'map-2' => { + 'endpoint' => '', + 'intf_preferred_family' => 'IP4', + 'logical_intf' => 'foo', + 'num_ports' => '2', + 'wildcard' => '1' + }, + 'map_sfds-0' => [ + 'loc-0', + '0', + '1' + ], + 'map_sfds-1' => [ + 'loc-0', + '2', + '3' + ], + 'map_sfds-2' => [ + 'loc-0', + '4', + '5' + ], + 'maps-0' => [ + '0' + ], + 'maps-1' => [ + '1' + ], + 'maps-2' => [ + '2' + ], + 'media-0' => { + 'desired_family' => 'IP4', + 'format_str' => '0 8 9', + 'index' => '1', + 'logical_intf' => 'foo', + 'media_flags' => '65544', + 'protocol' => 'RTP/AVP', + 'ptime' => '0', + 'tag' => '0', + 'type' => 'audio' + }, + 'media-1' => { + 'desired_family' => 'IP4', + 'format_str' => '0', + 'index' => '1', + 'logical_intf' => 'foo', + 'media_flags' => '65540', + 'protocol' => 'RTP/AVP', + 'ptime' => '0', + 'tag' => '1', + 'type' => 'audio' + }, + 'media-2' => { + 'desired_family' => 'IP4', + 'format_str' => '0 8 9', + 'index' => '1', + 'logical_intf' => 'foo', + 'media_flags' => '4', + 'protocol' => 'RTP/AVP', + 'ptime' => '0', + 'tag' => '2', + 'type' => 'audio' + }, + 'medias-0' => [ + '0' + ], + 'medias-1' => [ + '1' + ], + 'medias-2' => [ + '2' + ], + 'payload_types-0' => [ + '0/PCMU/8000///0/20' + ], + 'payload_types-1' => [ + '0/PCMU/8000///0/20' + ], + 'payload_types-2' => [ + '0/PCMU/8000///0/20' + ], + 'rtcp_sinks-0' => [], + 'rtcp_sinks-1' => [ + '3', + '5' + ], + 'rtcp_sinks-2' => [], + 'rtcp_sinks-3' => [], + 'rtcp_sinks-4' => [], + 'rtcp_sinks-5' => [], + 'rtp_sinks-0' => [ + '2', + '4' + ], + 'rtp_sinks-1' => [], + 'rtp_sinks-2' => [], + 'rtp_sinks-3' => [], + 'rtp_sinks-4' => [], + 'rtp_sinks-5' => [], + 'sfd-0' => { + 'fd' => '19', + 'local_intf_uid' => '0', + 'localport' => qr//, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '0' + }, + 'sfd-1' => { + 'fd' => '20', + 'local_intf_uid' => '0', + 'localport' => qr//, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '1' + }, + 'sfd-2' => { + 'fd' => '21', + 'local_intf_uid' => '0', + 'localport' => qr//, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '2' + }, + 'sfd-3' => { + 'fd' => '22', + 'local_intf_uid' => '0', + 'localport' => qr//, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '3' + }, + 'sfd-4' => { + 'fd' => '23', + 'local_intf_uid' => '0', + 'localport' => qr//, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '4' + }, + 'sfd-5' => { + 'fd' => '24', + 'local_intf_uid' => '0', + 'localport' => qr//, + 'logical_intf' => 'foo', + 'pref_family' => 'IP4', + 'stream' => '5' + }, + 'ssrc_table-0' => [], + 'ssrc_table-1' => [], + 'ssrc_table-2' => [], + 'stream-0' => { + 'advertised_endpoint' => '198.51.100.14:6042', + 'component' => '1', + 'endpoint' => '198.51.100.14:6042', + 'last_packet' => qr//, + 'media' => '0', + 'ps_flags' => '1114112', + 'rtcp_sibling' => '1', + 'sfd' => '0', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-1' => { + 'advertised_endpoint' => '198.51.100.14:6043', + 'component' => '2', + 'endpoint' => '198.51.100.14:6043', + 'last_packet' => qr//, + 'media' => '0', + 'ps_flags' => '68288513', + 'rtcp_sibling' => '4294967295', + 'sfd' => '1', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-2' => { + 'advertised_endpoint' => '198.51.100.14:6044', + 'component' => '1', + 'endpoint' => '198.51.100.14:6044', + 'last_packet' => qr//, + 'media' => '1', + 'ps_flags' => '1114112', + 'rtcp_sibling' => '3', + 'sfd' => '2', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-3' => { + 'advertised_endpoint' => '198.51.100.14:6045', + 'component' => '2', + 'endpoint' => '198.51.100.14:6045', + 'last_packet' => qr//, + 'media' => '1', + 'ps_flags' => '1179649', + 'rtcp_sibling' => '4294967295', + 'sfd' => '3', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-4' => { + 'advertised_endpoint' => '', + 'component' => '1', + 'endpoint' => '', + 'last_packet' => qr//, + 'media' => '2', + 'ps_flags' => '65536', + 'rtcp_sibling' => '5', + 'sfd' => '4', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream-5' => { + 'advertised_endpoint' => '', + 'component' => '2', + 'endpoint' => '', + 'last_packet' => qr//, + 'media' => '2', + 'ps_flags' => '131072', + 'rtcp_sibling' => '4294967295', + 'sfd' => '5', + 'stats-bytes' => '0', + 'stats-errors' => '0', + 'stats-packets' => '0' + }, + 'stream_sfds-0' => [ + '0' + ], + 'stream_sfds-1' => [ + '1' + ], + 'stream_sfds-2' => [ + '2' + ], + 'stream_sfds-3' => [ + '3' + ], + 'stream_sfds-4' => [ + '4' + ], + 'stream_sfds-5' => [ + '5' + ], + 'streams-0' => [ + '0', + '1' + ], + 'streams-1' => [ + '2', + '3' + ], + 'streams-2' => [ + '4', + '5' + ], + 'subscriptions-0' => [], + 'subscriptions-1' => [ + '0/0/0/0/0' + ], + 'subscriptions-2' => [ + '0/0/0/0/0' + ], + 'tag-0' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr//, + 'deleted' => '0', + 'logical_intf' => 'foo', + 'tag' => ft() + }, + 'tag-1' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr//, + 'deleted' => '0', + 'logical_intf' => 'foo', + 'tag' => qr//, + }, + 'tag-2' => { + 'block_dtmf' => '0', + 'block_media' => '0', + 'created' => qr//, + 'deleted' => '0', + 'logical_intf' => 'foo', + 'tag' => qr//, + } +}; + +($ftr, $ttr, undef) = subscribe_request('publish/subscribe', + { 'from-tag' => ft() }, <{'media-2'}{format_str} = '0'; +$json_exp->{'media-2'}{media_flags} = '65540'; +$json_exp->{'stream-1'}{ps_flags} = '1179649'; +$json_exp->{'stream-4'}{advertised_endpoint} = '198.51.100.14:6046'; +$json_exp->{'stream-4'}{endpoint} = '198.51.100.14:6046'; +$json_exp->{'stream-4'}{ps_flags} = '1114112'; +$json_exp->{'stream-5'}{advertised_endpoint} = '198.51.100.14:6047'; +$json_exp->{'stream-5'}{endpoint} = '198.51.100.14:6047'; +$json_exp->{'stream-5'}{ps_flags} = '1179649'; + +subscribe_answer('publish/subscribe', + { 'to-tag' => $ttr }, <