diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index a990f39a7..40fa4798c 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -1669,6 +1669,117 @@ rcv($sock_b, $port_a, rtpm(8, 1010, 4280, 0x1234, "\x00" x 160)); +# inject DTMF to SRTP with passthrough + +($sock_a, $sock_b) = new_call([qw(198.51.100.50 3056)], [qw(198.51.100.50 3058)]); + +($port_a) = offer('inject passthrough', + { flags => [qw(inject-DTMF)], DTLS => 'off' }, < [qw(inject-DTMF)] }, < $NGCP::Rtpclient::SRTP::crypto_suites{AES_CM_128_HMAC_SHA1_80}, + key => 'QjnnaukLn7iwASAs0YLzPUplJkjOhTZK2dvOwo6c', +}; +$srtp_ctx_b = { + cs => $NGCP::Rtpclient::SRTP::crypto_suites{AES_CM_128_HMAC_SHA1_80}, + key => 'Opr7g+J9VgQnRkCFNmL/0LP/dcF1Exu43qwiE0So', +}; + +srtp_snd($sock_a, $port_b, rtp(8, 1000, 3000, 0x1234, "\x00" x 160), $srtp_ctx_a); +srtp_rcv($sock_b, $port_a, rtpm(8, 1000, 3000, 0x1234, "\x00" x 160), $srtp_ctx_a); +srtp_snd($sock_a, $port_b, rtp(8, 1001, 3160, 0x1234, "\x00" x 160), $srtp_ctx_a); +srtp_rcv($sock_b, $port_a, rtpm(8, 1001, 3160, 0x1234, "\x00" x 160), $srtp_ctx_a); +srtp_snd($sock_a, $port_b, rtp(8, 1002, 3320, 0x1234, "\x00" x 160), $srtp_ctx_a); +srtp_rcv($sock_b, $port_a, rtpm(8, 1002, 3320, 0x1234, "\x00" x 160), $srtp_ctx_a); + +srtp_snd($sock_b, $port_a, rtp(8, 5000, 7000, 0x5432, "\x00" x 160), $srtp_ctx_b); +srtp_rcv($sock_a, $port_b, rtpm(8, 5000, 7000, 0x5432, "\x00" x 160), $srtp_ctx_b); +srtp_snd($sock_b, $port_a, rtp(8, 5001, 7160, 0x5432, "\x00" x 160), $srtp_ctx_b); +srtp_rcv($sock_a, $port_b, rtpm(8, 5001, 7160, 0x5432, "\x00" x 160), $srtp_ctx_b); +srtp_snd($sock_b, $port_a, rtp(8, 5002, 7320, 0x5432, "\x00" x 160), $srtp_ctx_b); +srtp_rcv($sock_a, $port_b, rtpm(8, 5002, 7320, 0x5432, "\x00" x 160), $srtp_ctx_b); + +$resp = rtpe_req('play DTMF', 'inject DTMF towards B', + { 'from-tag' => ft(), code => '0', volume => 10, duration => 100 }); + +srtp_snd($sock_a, $port_b, rtp(8, 1003, 3480, 0x1234, "\x00" x 160), $srtp_ctx_a); +srtp_rcv($sock_b, $port_a, rtpm(101 | 0x80, 1003, 3480, 0x1234, "\x00\x0a\x00\xa0"), $srtp_ctx_a); +srtp_snd($sock_a, $port_b, rtp(8, 1004, 3640, 0x1234, "\x00" x 160), $srtp_ctx_a); +srtp_rcv($sock_b, $port_a, rtpm(101, 1004, 3480, 0x1234, "\x00\x0a\x01\x40"), $srtp_ctx_a); +srtp_snd($sock_a, $port_b, rtp(8, 1005, 3800, 0x1234, "\x00" x 160), $srtp_ctx_a); +srtp_rcv($sock_b, $port_a, rtpm(101, 1005, 3480, 0x1234, "\x00\x0a\x01\xe0"), $srtp_ctx_a); +srtp_snd($sock_a, $port_b, rtp(8, 1006, 3960, 0x1234, "\x00" x 160), $srtp_ctx_a); +srtp_rcv($sock_b, $port_a, rtpm(101, 1006, 3480, 0x1234, "\x00\x0a\x02\x80"), $srtp_ctx_a); +srtp_snd($sock_a, $port_b, rtp(8, 1007, 4120, 0x1234, "\x00" x 160), $srtp_ctx_a); +# end event +srtp_rcv($sock_b, $port_a, rtpm(101, 1007, 3480, 0x1234, "\x00\x8a\x03\x20"), $srtp_ctx_a); +srtp_rcv($sock_b, $port_a, rtpm(101, 1008, 3480, 0x1234, "\x00\x8a\x03\x20"), $srtp_ctx_a); +srtp_rcv($sock_b, $port_a, rtpm(101, 1009, 3480, 0x1234, "\x00\x8a\x03\x20"), $srtp_ctx_a); + +srtp_snd($sock_a, $port_b, rtp(8, 1008, 4280, 0x1234, "\x00" x 160), $srtp_ctx_a); +srtp_rcv($sock_b, $port_a, rtpm(8, 1010, 4280, 0x1234, "\x00" x 160), $srtp_ctx_a); + + + + # inject DTMF with passthrough and blocking ($sock_a, $sock_b) = new_call([qw(198.51.100.50 3002)], [qw(198.51.100.50 3004)]);