Browse Source

allow protocol=RTP/AVP plus OSRTP-offer

closes #976

Change-Id: Id409d08a5a89b0ca9dbaf8cc457cc8ea89a433f1
changes/08/39708/1
Richard Fuchs 6 years ago
parent
commit
cca6ba70c7
2 changed files with 77 additions and 8 deletions
  1. +6
    -8
      daemon/call.c
  2. +71
    -0
      t/auto-daemon-tests.pl

+ 6
- 8
daemon/call.c View File

@ -1873,6 +1873,12 @@ static void __update_media_protocol(struct call_media *media, struct call_media
if (!flags)
return;
/* allow override of outgoing protocol even if we know it already */
/* but only if this is an RTP-based protocol */
if (flags->transport_protocol
&& proto_is_rtp(other_media->protocol))
media->protocol = flags->transport_protocol;
// OSRTP offer requested?
if (media->protocol && media->protocol->rtp && !media->protocol->srtp
&& media->protocol->osrtp_proto && flags->osrtp_offer && flags->opmode == OP_OFFER)
@ -1915,14 +1921,6 @@ static void __update_media_protocol(struct call_media *media, struct call_media
__t38_reset(media, other_media);
// drop through for protocol override
}
/* allow override of outgoing protocol even if we know it already */
/* but only if this is an RTP-based protocol */
if (flags->transport_protocol
&& proto_is_rtp(other_media->protocol)) {
media->protocol = flags->transport_protocol;
return;
}
}
/* called with call->master_lock held in W */


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

@ -630,6 +630,77 @@ rcv($sock_a, $port_b, rtpm(0, 2000, 4000, 0x3456, "\x00" x 160));
($sock_a, $sock_b) = new_call([qw(198.51.100.1 3356)], [qw(198.51.100.3 3358)]);
($port_a, undef, $srtp_key_a) = offer('non-OSRTP offer with offer flag and protocol, accept',
{ ICE => 'remove', replace => ['origin'], DTLS => 'off', OSRTP => ['offer'],
'transport protocol' => 'RTP/AVP'}, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio 3356 RTP/AVP 0
c=IN IP4 198.51.100.1
a=sendrecv
----------------------------------
v=0
o=- 1545997027 1 IN IP4 203.0.113.1
s=tester
t=0 0
m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtcp:PORT
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:CRYPTO128
a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:CRYPTO128
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
SDP
($port_b) = answer('non-OSRTP offer with offer flag and protocol, accept',
{ ICE => 'remove', replace => ['origin'], DTLS => 'off', }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio 3358 RTP/AVP 0
c=IN IP4 198.51.100.3
a=sendrecv
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:Kl3GFJ5Gqz5x07xYkoyHODkVkSpiplZnXsQIw+Q7
----------------------------------
v=0
o=- 1545997027 1 IN IP4 203.0.113.1
s=tester
t=0 0
m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtcp:PORT
SDP
$srtp_ctx_a = {
cs => $NGCP::Rtpclient::SRTP::crypto_suites{AES_CM_128_HMAC_SHA1_80},
key => 'Kl3GFJ5Gqz5x07xYkoyHODkVkSpiplZnXsQIw+Q7',
};
$srtp_ctx_b = {
cs => $NGCP::Rtpclient::SRTP::crypto_suites{AES_CM_128_HMAC_SHA1_80},
key => $srtp_key_a,
};
snd($sock_a, $port_b, rtp(0, 1000, 3000, 0x1234, "\x00" x 160));
srtp_rcv($sock_b, $port_a, rtpm(0, 1000, 3000, 0x1234, "\x00" x 160), $srtp_ctx_b);
srtp_snd($sock_b, $port_a, rtp(0, 2000, 4000, 0x3456, "\x00" x 160), $srtp_ctx_a);
rcv($sock_a, $port_b, rtpm(0, 2000, 4000, 0x3456, "\x00" x 160));


Loading…
Cancel
Save