Browse Source

TT#81600 fix SRTP when transcoding/DTMF injection is in use

Change-Id: I444c95e8dc14594571f7592f158805cbbe6e3c8d
changes/82/40082/1
Richard Fuchs 6 years ago
parent
commit
46325d61fd
2 changed files with 121 additions and 0 deletions
  1. +2
    -0
      daemon/media_socket.c
  2. +119
    -0
      t/auto-daemon-tests.pl

+ 2
- 0
daemon/media_socket.c View File

@ -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


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

@ -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'] }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
c=IN IP4 198.51.100.1
t=0 0
a=sendrecv
m=audio 4328 RTP/SAVP 0 8 18 9 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=rtpmap:9 G722/8000
a=rtpmap:101 telephone-event/8000
a=silenceSupp:off - - - -
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:QjnnaukLn7iwASAs0YLzPUplJkjOhTZK2dvOwo6c
a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:1YiOLFFcF/OlCpW7u3fmSx1YllphIgh2cER3DWU3
a=fmtp:18 annexb=no
a=fmtp:101 0-15
a=ptime:20
a=mptime:20 20 20 20 -
a=rtcp:4328 IN IP4 198.51.100.1
a=sendrecv
----------------------------------
v=0
o=- 1545997027 1 IN IP4 203.0.113.1
s=tester
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/SAVP 0 8 18 9 101
a=silenceSupp:off - - - -
a=mptime:20 20 20 20 -
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=rtpmap:9 G722/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:18 annexb=no
a=fmtp:101 0-15
a=sendrecv
a=rtcp:PORT
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:QjnnaukLn7iwASAs0YLzPUplJkjOhTZK2dvOwo6c
a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:1YiOLFFcF/OlCpW7u3fmSx1YllphIgh2cER3DWU3
a=crypto:3 AES_192_CM_HMAC_SHA1_80 inline:CRYPTO192
a=crypto:4 AES_192_CM_HMAC_SHA1_32 inline:CRYPTO192
a=crypto:5 AES_256_CM_HMAC_SHA1_80 inline:CRYPTO256
a=crypto:6 AES_256_CM_HMAC_SHA1_32 inline:CRYPTO256
a=crypto:7 F8_128_HMAC_SHA1_80 inline:CRYPTO128
a=crypto:8 F8_128_HMAC_SHA1_32 inline:CRYPTO128
a=crypto:9 NULL_HMAC_SHA1_80 inline:CRYPTO128
a=crypto:10 NULL_HMAC_SHA1_32 inline:CRYPTO128
a=ptime:20
SDP
($port_b) = answer('SRTP w/ DTMF injection (TT#81600)',
{ ICE => 'remove', replace => ['origin'], DTLS => 'off', ICE => 'remove',
flags => ['inject-DTMF'], 'rtcp-mux' => ['demux'] }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
c=IN IP4 198.51.100.3
t=0 0
a=sendrecv
m=audio 4330 RTP/SAVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=silenceSupp:off - - - -
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:cdDuBSOp/rX/7ikmU1Tnuu337gXUUMFAhkARhB/j
a=fmtp:101 0-15
a=ptime:20
a=mptime:20 20 20 20 -
a=sendrecv
----------------------------------
v=0
o=- 1545997027 1 IN IP4 203.0.113.1
s=tester
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/SAVP 0 8 18 9 101
a=silenceSupp:off - - - -
a=mptime:20 20 20 20 -
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=rtpmap:9 G722/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:18 annexb=no
a=fmtp:101 0-15
a=sendrecv
a=rtcp:PORT
a=rtcp-mux
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:cdDuBSOp/rX/7ikmU1Tnuu337gXUUMFAhkARhB/j
a=ptime:20
SDP
$srtp_ctx_a = {
cs => $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(


Loading…
Cancel
Save