diff --git a/t/auto-daemon-tests-redis.pl b/t/auto-daemon-tests-redis.pl index 1074baa1d..b95392c40 100755 --- a/t/auto-daemon-tests-redis.pl +++ b/t/auto-daemon-tests-redis.pl @@ -347,6 +347,8 @@ a=rtcp:PORT SDP $json_exp = { + 'tag_aliases-0' => [], + 'tag_aliases-1' => [], 'associated_tags-0' => [ '1' ], @@ -604,6 +606,271 @@ a=sendrecv a=rtcp:PORT SDP +my $old_tt = tt(); +new_tt(); + +$json_exp = { + 'tag_aliases-0' => [], + 'tag_aliases-1' => [ + $old_tt + ], + 'associated_tags-0' => [ + '1' + ], + 'associated_tags-1' => [ + '0' + ], + 'json' => { + 'block_dtmf' => '0', + 'call_flags' => 1376256, + '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' + ], + 'media-subscriptions-0' => [ + '1/1/0/0' + ], + 'media-subscriptions-1' => [ + '0/1/0/0' + ], + 'tag-0' => { + 'block_dtmf' => '0', + 'created' => qr/^\d+$/, + 'deleted' => '0', + 'desired_family' => 'IP4', + 'logical_intf' => 'foo', + 'ml_flags' => 0, + 'tag' => ft() + }, + 'tag-1' => { + 'block_dtmf' => '0', + 'created' => qr/^\d+$/, + 'deleted' => '0', + 'desired_family' => 'IP4', + 'logical_intf' => 'foo', + 'ml_flags' => 0, + 'tag' => tt() + } +}; + +answer('alias to-tag', + { }, < 'ok', + 'last redis update' => '0', + 'SSRC' => {}, + 'last signal' => qr//, + 'tags' => { + ft() => { + 'tag' => ft(), + 'subscriptions' => [ + { + 'type' => 'offer/answer', + 'tag' => tt() + } + ], + 'medias' => [ + { + 'index' => '1', + 'streams' => [ + { + 'last user packet' => qr//, + 'egress SSRCs' => [], + 'advertised endpoint' => { + 'address' => '198.51.100.1', + 'family' => 'IPv4', + 'port' => '3000' + }, + 'ingress SSRCs' => [], + 'flags' => [ + 'RTP', + 'filled' + ], + 'stats_out' => { + 'packets' => '0', + 'errors' => '0', + 'bytes' => '0' + }, + 'last kernel packet' => '0', + 'stats' => { + 'packets' => '0', + 'errors' => '0', + 'bytes' => '0' + }, + 'family' => 'IPv4', + 'local address' => '203.0.113.1', + 'local port' => qr/^\d*$/, + 'endpoint' => { + 'port' => '3000', + 'family' => 'IPv4', + 'address' => '198.51.100.1' + }, + 'last packet' => qr// + }, + { + 'egress SSRCs' => [], + 'advertised endpoint' => { + 'address' => '198.51.100.1', + 'family' => 'IPv4', + 'port' => '3001' + }, + 'ingress SSRCs' => [], + 'flags' => [ + 'RTCP', + 'filled' + ], + 'last user packet' => qr//, + 'stats_out' => { + 'packets' => '0', + 'errors' => '0', + 'bytes' => '0' + }, + 'last kernel packet' => '0', + 'stats' => { + 'errors' => '0', + 'packets' => '0', + 'bytes' => '0' + }, + 'local address' => '203.0.113.1', + 'family' => 'IPv4', + 'endpoint' => { + 'address' => '198.51.100.1', + 'family' => 'IPv4', + 'port' => '3001' + }, + 'last packet' => qr//, + 'local port' => qr/^\d*$/ + } + ], + 'protocol' => 'RTP/AVP', + 'type' => 'audio', + 'flags' => [ + 'initialized', + 'send', + 'recv' + ] + } + ], + 'VSC' => [], + 'subscribers' => [ + { + 'tag' => tt(), + 'type' => 'offer/answer' + } + ], + 'created' => qr// + }, + tt() => { + 'tag' => tt(), + 'medias' => [ + { + 'streams' => [ + { + 'stats_out' => { + 'bytes' => '0', + 'packets' => '0', + 'errors' => '0' + }, + 'egress SSRCs' => [], + 'ingress SSRCs' => [], + 'advertised endpoint' => { + 'port' => '4000', + 'family' => 'IPv4', + 'address' => '198.51.100.1' + }, + 'flags' => [ + 'RTP', + 'filled' + ], + 'last user packet' => qr//, + 'endpoint' => { + 'port' => '4000', + 'address' => '198.51.100.1', + 'family' => 'IPv4' + }, + 'last packet' => qr//, + 'local port' => qr/^\d*$/, + 'stats' => { + 'bytes' => '0', + 'packets' => '0', + 'errors' => '0' + }, + 'last kernel packet' => '0', + 'family' => 'IPv4', + 'local address' => '203.0.113.1' + }, + { + 'family' => 'IPv4', + 'local address' => '203.0.113.1', + 'last kernel packet' => '0', + 'stats' => { + 'bytes' => '0', + 'packets' => '0', + 'errors' => '0' + }, + 'last packet' => qr//, + 'endpoint' => { + 'port' => '4001', + 'family' => 'IPv4', + 'address' => '198.51.100.1' + }, + 'local port' => qr/^\d*$/, + 'flags' => [ + 'RTCP', + 'filled' + ], + 'ingress SSRCs' => [], + 'advertised endpoint' => { + 'port' => '4001', + 'address' => '198.51.100.1', + 'family' => 'IPv4' + }, + 'egress SSRCs' => [], + 'last user packet' => qr//, + 'stats_out' => { + 'bytes' => '0', + 'packets' => '0', + 'errors' => '0' + } + } + ], + 'protocol' => 'RTP/AVP', + 'index' => '1', + 'flags' => [ + 'initialized', + 'send', + 'recv', + 'ICE controlling' + ], + 'type' => 'audio' + } + ], + 'created' => qr//, + 'tag-aliases' => [ + $old_tt, + ], + 'VSC' => [], + 'subscriptions' => [ + { + 'type' => 'offer/answer', + 'tag' => ft() + } + ], + 'subscribers' => [ + { + 'tag' => ft(), + 'type' => 'offer/answer' + } + ] + } + }, + 'totals' => { + 'RTCP' => { + 'errors' => '0', + 'packets' => '0', + 'bytes' => '0' + }, + 'RTP' => { + 'bytes' => '0', + 'errors' => '0', + 'packets' => '0' + } + }, + 'created_us' => qr//, + 'created' => qr// + }, "query result matches"); + + + +new_call; + +offer('unsolicited to-tag w/ via-branch', { 'via-branch' => 'foobar' }, < 'foobar' }, < 'foobar' }, < 'ok', + 'last redis update' => '0', + 'SSRC' => {}, + 'last signal' => qr//, + 'tags' => { + ft() => { + 'tag' => ft(), + 'subscriptions' => [ + { + 'type' => 'offer/answer', + 'tag' => tt() + } + ], + 'medias' => [ + { + 'index' => '1', + 'streams' => [ + { + 'last user packet' => qr//, + 'egress SSRCs' => [], + 'advertised endpoint' => { + 'address' => '198.51.100.1', + 'family' => 'IPv4', + 'port' => '3000' + }, + 'ingress SSRCs' => [], + 'flags' => [ + 'RTP', + 'filled' + ], + 'stats_out' => { + 'packets' => '0', + 'errors' => '0', + 'bytes' => '0' + }, + 'last kernel packet' => '0', + 'stats' => { + 'packets' => '0', + 'errors' => '0', + 'bytes' => '0' + }, + 'family' => 'IPv4', + 'local address' => '203.0.113.1', + 'local port' => qr/^\d*$/, + 'endpoint' => { + 'port' => '3000', + 'family' => 'IPv4', + 'address' => '198.51.100.1' + }, + 'last packet' => qr// + }, + { + 'egress SSRCs' => [], + 'advertised endpoint' => { + 'address' => '198.51.100.1', + 'family' => 'IPv4', + 'port' => '3001' + }, + 'ingress SSRCs' => [], + 'flags' => [ + 'RTCP', + 'filled' + ], + 'last user packet' => qr//, + 'stats_out' => { + 'packets' => '0', + 'errors' => '0', + 'bytes' => '0' + }, + 'last kernel packet' => '0', + 'stats' => { + 'errors' => '0', + 'packets' => '0', + 'bytes' => '0' + }, + 'local address' => '203.0.113.1', + 'family' => 'IPv4', + 'endpoint' => { + 'address' => '198.51.100.1', + 'family' => 'IPv4', + 'port' => '3001' + }, + 'last packet' => qr//, + 'local port' => qr/^\d*$/ + } + ], + 'protocol' => 'RTP/AVP', + 'type' => 'audio', + 'flags' => [ + 'initialized', + 'send', + 'recv' + ] + } + ], + 'VSC' => [], + 'subscribers' => [ + { + 'tag' => tt(), + 'type' => 'offer/answer' + } + ], + 'created' => qr// + }, + tt() => { + 'tag' => tt(), + 'medias' => [ + { + 'streams' => [ + { + 'stats_out' => { + 'bytes' => '0', + 'packets' => '0', + 'errors' => '0' + }, + 'egress SSRCs' => [], + 'ingress SSRCs' => [], + 'advertised endpoint' => { + 'port' => '4000', + 'family' => 'IPv4', + 'address' => '198.51.100.1' + }, + 'flags' => [ + 'RTP', + 'filled' + ], + 'last user packet' => qr//, + 'endpoint' => { + 'port' => '4000', + 'address' => '198.51.100.1', + 'family' => 'IPv4' + }, + 'last packet' => qr//, + 'local port' => qr/^\d*$/, + 'stats' => { + 'bytes' => '0', + 'packets' => '0', + 'errors' => '0' + }, + 'last kernel packet' => '0', + 'family' => 'IPv4', + 'local address' => '203.0.113.1' + }, + { + 'family' => 'IPv4', + 'local address' => '203.0.113.1', + 'last kernel packet' => '0', + 'stats' => { + 'bytes' => '0', + 'packets' => '0', + 'errors' => '0' + }, + 'last packet' => qr//, + 'endpoint' => { + 'port' => '4001', + 'family' => 'IPv4', + 'address' => '198.51.100.1' + }, + 'local port' => qr/^\d*$/, + 'flags' => [ + 'RTCP', + 'filled' + ], + 'ingress SSRCs' => [], + 'advertised endpoint' => { + 'port' => '4001', + 'address' => '198.51.100.1', + 'family' => 'IPv4' + }, + 'egress SSRCs' => [], + 'last user packet' => qr//, + 'stats_out' => { + 'bytes' => '0', + 'packets' => '0', + 'errors' => '0' + } + } + ], + 'protocol' => 'RTP/AVP', + 'index' => '1', + 'flags' => [ + 'initialized', + 'send', + 'recv', + 'ICE controlling' + ], + 'type' => 'audio' + } + ], + 'created' => qr//, + 'tag-aliases' => [ + $old_tt, + ], + 'VSC' => [], + 'subscriptions' => [ + { + 'type' => 'offer/answer', + 'tag' => ft() + } + ], + 'subscribers' => [ + { + 'tag' => ft(), + 'type' => 'offer/answer' + } + ] + } + }, + 'totals' => { + 'RTCP' => { + 'errors' => '0', + 'packets' => '0', + 'bytes' => '0' + }, + 'RTP' => { + 'bytes' => '0', + 'errors' => '0', + 'packets' => '0' + } + }, + 'created_us' => qr//, + 'created' => qr// + }, "query result matches"); + + + if ($ENV{RTPENGINE_MOS_TESTS}) { ($sock_a, $sock_ax, $sock_b, $sock_bx) = new_call([qw(198.51.100.23 3000)], [qw(198.51.100.23 3001)],