From 46325d61fd2e6ac9030b82bc4649eb79fe71167d Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 14 May 2020 15:41:56 -0400 Subject: [PATCH] TT#81600 fix SRTP when transcoding/DTMF injection is in use Change-Id: I444c95e8dc14594571f7592f158805cbbe6e3c8d --- daemon/media_socket.c | 2 + t/auto-daemon-tests.pl | 119 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+) diff --git a/daemon/media_socket.c b/daemon/media_socket.c index 1cea7406c..0ad25d576 100644 --- a/daemon/media_socket.c +++ b/daemon/media_socket.c @@ -1294,6 +1294,8 @@ static void __determine_handler(struct packet_stream *in, const struct packet_st if (MEDIA_ISSET(in->media, DTLS) || MEDIA_ISSET(out->media, DTLS)) must_recrypt = 1; + else if (MEDIA_ISSET(in->media, TRANSCODE) || MEDIA_ISSET(out->media, TRANSCODE)) + must_recrypt = 1; else if (in->call->recording) must_recrypt = 1; else if (in_proto->srtp && out_proto->srtp diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index 7ed5fcf1c..4b570971f 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -35,6 +35,125 @@ my ($sock_a, $sock_b, $port_a, $port_b, $ssrc, $resp, +# SRTP w/ DTMF injection (TT#81600) + +($sock_a, $sock_b) = new_call([qw(198.51.100.1 4328)], [qw(198.51.100.3 4330)]); + +($port_a) = offer('SRTP w/ DTMF injection (TT#81600)', + { ICE => 'remove', replace => ['origin'], DTLS => 'off', + 'transport-protocol' => 'RTP/SAVP', flags => ['inject-DTMF'], + 'rtcp-mux' => ['demux'] }, < 'remove', replace => ['origin'], DTLS => 'off', ICE => 'remove', + flags => ['inject-DTMF'], 'rtcp-mux' => ['demux'] }, < $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 => 'cdDuBSOp/rX/7ikmU1Tnuu337gXUUMFAhkARhB/j', +}; + + +srtp_snd($sock_a, $port_b, rtp(0, 1000, 3000, 0x1234, "\x00" x 160), $srtp_ctx_a); +srtp_rcv($sock_b, $port_a, rtpm(0, 1000, 3000, -1, "\x00" x 160), $srtp_ctx_a); +srtp_snd($sock_b, $port_a, rtp(0, 2000, 4000, 0x6543, "\x00" x 160), $srtp_ctx_b); +srtp_rcv($sock_a, $port_b, rtpm(0, 2000, 4000, -1, "\x00" x 160), $srtp_ctx_b); + + + + # RTCP ($sock_a, $sock_ax, $sock_b, $sock_bx) = new_call(