Commit Graph

1099 Commits

Author SHA1 Message Date
Dragos Oancea 40982338a0 FS-11965: RTCP: fix on rtcp_report_block->fraction - "if X packets were expected and X was lost, we want 0xff to be reported, not 0"
(patch by Piotr Gregor <piotr@dataandsignal.com>)
2019-07-25 23:09:27 +00:00
Mike Jerris 3d53f7861e Merge pull request #1765 in FS/freeswitch from ~DRAGOS_OANCEA/freeswitch-dragos:FS-11957 to master
* commit '6a036e661c6d78c7f98388ff445a7df93fd286e3':
  FS-11957: destroy NACK table on SWITCH_RTP_FLAG_KILL_JB too
2019-07-25 12:53:51 -05:00
Dragos Oancea 6a036e661c FS-11957: destroy NACK table on SWITCH_RTP_FLAG_KILL_JB too 2019-07-25 16:01:59 +00:00
Dragos Oancea 1f4dbe50e6 FS-11955: JB: add stats for received packets that have been NACKed previously (video) 2019-07-25 14:28:38 +00:00
Dragos Oancea 49e6449bc5 FS-11809: scan-build: dead assignments 2019-07-24 13:47:02 +00:00
Dragos Oancea 385769344b FS-11549: RTCP: fix report block stats
(thanks Sergey Hripchenko)
2019-07-19 01:50:23 +04:00
Dragos Oancea 939b949da4 FS-11903: Fix errors reported by PVS-Studio Static Code Analyzer for switch_rtp.c 2019-07-18 20:55:16 +04:00
Brian West b23d887586 FS-11654: [core] add media_timeout, media_hold_timeout and video vs audio variants 2019-07-18 00:54:37 +04:00
Mike Jerris 7906a2054a FS-11919: [core] add api compatibility for switch_rtp_new 2019-07-17 16:43:34 -04:00
Liyang a13196c1c7 FS-11841 [core] The ts of received rtp packages for DTMF is same. so add SFF_RFC2833 flag check when write rtp package. 2019-07-18 00:29:32 +04:00
Mike Jerris 9050a08952 FS-11642: [core] add audio and video versions of the variables set for the rtp_retain_crypto_keys feature 2019-07-17 23:32:55 +04:00
Anthony Minessale f4d8631c09 FS-11446: [freeswitch-core] Improve video JB scaling and fix misreported rtp stats #resolve 2019-07-16 20:54:22 +04:00
Anthony Minessale 878565e4b3 FS-11446: [freeswitch-core] Improve video JB scaling and fix misreported rtp stats #resolve 2019-07-16 20:54:17 +04:00
Dragos Oancea 279b7994ef FS-11743: video RTCP counter (fix conflicts) 2019-06-06 17:38:04 +00:00
Dragos Oancea 32de076b18 FS-11751: process_rtcp_packet() bounds check 2019-06-06 16:59:08 +00:00
Dragos Oancea 99bd3b3c6e FS-11675: RTCP NACK at start of call too 2019-06-06 16:50:45 +00:00
Dragos Oancea 133b42b1e9 FS-11635: decrement RTCP counters on duplicate received NACKed packet which is dropped anyway
(affects cum_lost calculation)
2019-06-06 16:50:06 +00:00
Dragos Oancea bd90f82e6f FS-11635: RTCP: fix SSRC in FIR, cum_lost due to dup NACKs
(thanks Artem Karukov for finding these)

FS-11635: include received Nacked to the expected packet count.
2019-06-06 16:47:29 +00:00
Dragos Oancea 8185aadb5e FS-11631: [core] RTCP: set RTP timestamp for video in SR (sender info block)
FS-11631: [core] fix introduced by minor change of behavior, rtcp & ice (FS-11549) -keep rtcp disabled during ICE
2019-06-06 16:42:28 +00:00
Dragos Oancea f5a736f037 FS-11549: don't send the reception report block when we need to send fast feedback (do like Chrome does it, don't confuse peer's stats).
FS-11549: don't send RTCP RR unless we're receiver only.
2019-06-06 16:41:43 +00:00
Dragos Oancea d6169a3845 FS-11561: [core] RTCP: attempt to avoid race cond on calculating DLSR (stats->last_recv_lsr_local) 2019-06-06 16:38:58 +00:00
Piotr Gregor 9682d2c2c9 FS-11730 Add support for DTLSv1.2 and make default
Needed in Chrome version >= 74 as Chrome dropped support for v1.0:
https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/discuss-webrtc/yr6gbAgWsKo/9X5vQb8kGAAJ

Using old v1.0 DTLS if 1.2 is not available or legacy DTLS
wanted explicitly. To request old DTLS set variable

	<action application="set" data="legacyDTLS=1"/>

Note: requires openssl 1.0.2 or later for DTLS v1.2 support
2019-06-06 12:05:11 -04:00
Andrey Volk 2192d5de3b FS-11644: [core] Fix send_dtmf containing w or W 2019-06-06 11:29:21 -04:00
Chris Ayoup a1cb008087 FS-11646: Improved support for ICE-lite
Specifically:
* Send the a=ice-lite SDP attribute as a session-level attribute
* Suppress sending STUN connectivity checks when enabled
* Make sure FS is the controlled entity if it is declaring ICE-lite
2019-02-05 13:17:35 -05:00
Dragos Oancea 2bf9878c2f FS-11599: [core] fix inter-arrival jitter (timer) 2019-01-18 18:17:59 -05:00
Mike Jerris 9927baa7d8 FS-11412: [core] Fix crash caused by missing or malformed ice candidates in sdp 2018-09-26 15:07:38 +00:00
Chris Rienzo 48aebd7365 FS-11377 [freeswitch-core] lock/unlock mutexes in consistent order. 2018-09-05 20:56:09 +00:00
Sergey Khripchenko 25682d619c FS-11201 Fix 'rtt_valid = 0;' was incorrectly placed rendering whole RTT thing void.
+ don't shoot in a leg and keep 'rtt_now' value correct (even if we clear it few lines after), because after some time it could be changed.
2018-08-30 22:58:20 +00:00
Sergey Khripchenko 2dcfc27963 FS-11360 Fix FS degradation over time in DTLS layer (especially if outdoing packets rate higher that incoming)
When we handle DTLS layer in do_dtls() and there are no incoming packets yet - we still call BIO_write() with NULL buffer and it is an error and BIO_write() will stuck for a long time in libssl/libcrypto error subsystem.
(that also possibly relates to fact that libssl/libcrypto init/deinit/error-handling is broken in general in FS, however that is another big issue)
2018-08-30 22:58:02 +00:00
Piotr Gregor 6cd17fd556 FS-11052: Allow alias for crypto suites
For outgoing calls send AES crypto in offer using corrected names
for keys of length 192 and 256, i.e. names containing _192_CM_
and _256_CM_ instead of _CM_192_ and CM_256_. For incoming calls
accept both naming conventions, decaying to same entry in SUITES.

+ fix after SRTP failed for 256 keys:

Tests showed loop removing '=' from keys in switch_core_media_build_crypto

 1190     if (!switch_channel_var_true(channel, "rtp_pad_srtp_keys")) {
 1191         p = strrchr((char *) b64_key, '=');
 1192
 1193         while (p && *p && *p == '=') {
 1194             *p-- = '\0';
 1195         }
 1196     }

shouldn't be executed for AES_CM_256_HMAC_SHA1_32 and AES_CM_256_HMAC_SHA1_80
keys and it is meaningless for AES_CM_128_HMAC_SHA1_32 AES_CM_128_HMAC_SHA1_80
keys. Tested calling from Bria.

Introduced switch_channel_var_false and changed this to:
	if (switch_channel_var_false(channel, "rtp_pad_srtp_keys"))
to enter the loop if var is set to false (and not if it is _not_ set).
2018-08-13 20:57:50 +00:00
Anthony Minessale 9e09a8e8b5 FS-11322: [freeswitch-core] Change ice handling to work with FireFox when in turn mode #resolve 2018-08-13 19:01:37 +00:00
Mike Jerris 3e50947295 FS-11222: [core] NACK for multiple packets sends wrong packet after the first one 2018-07-24 07:21:55 +00:00
Piotr Gregor e66de38ba2 FS-11201 Filter out erroneous RTT values #fix
Erroneous DLSR in received RTCP report could
cause RTT to be negative (RTT = A - DLSR - LSR).
Add check for this and prevent corruption
of statistics and estimations (estimator code used
bad RTT values).
2018-07-24 07:21:54 +00:00
Anthony Minessale fef3711e31 FS-11164: [freeswitch-core] Improve audio JB in bad conditions #resolve 2018-07-24 07:21:53 +00:00
Mike Jerris 3e5938a540 FS-11162: [zrtp] Hangup race causing rare crash on zrtp calls 2018-07-24 07:21:53 +00:00
Mike Jerris e58ff3392f FS-10853: remove extern that is no longer needed 2018-07-24 07:21:42 +00:00
Piotr Gregor f5090ae96b FS-11063 Use compile time constants in dtls_state_setup 2018-07-24 07:21:41 +00:00
Sergey Khripchenko 94038f3c12 FS-11056: [core] fix RTCP lost calculation
RTCP/Receiver Report/lost field is a _signed_ 24bit integer and it could be negative (in case of UDP duplication)
+ any negatives now threated as huge uint32_t
+ set this field properly on __BIG_ENDIAN
+ correctly read this value in received RTCP on all arches
2018-07-24 07:21:41 +00:00
Brian West 228af00acb FS-10904: [core] DTMF only works from one phone during shared call (SCA) #resolve 2018-07-24 07:21:39 +00:00
Anthony Minessale 2e1f828363 remove hack for chrome we don't need anymore 2018-07-24 07:21:36 +00:00
Anthony Minessale 247ac09792 FS-10770: [freeswitch-core] Make nack buffer bigger by default 2018-07-24 07:21:35 +00:00
Anthony Minessale 5a6f4679cd FS-10770: [freeswitch-core] Make nack buffer bigger by default 2018-07-24 07:21:35 +00:00
Piotr Gregor 333516c471 FS-10778: Fix for MKI regression introduced in FS-10778 2018-07-24 07:21:35 +00:00
Anthony Minessale 63f3531cdd FS-10843: [freeswitch-core] Tweak RTP write timing #resolve 2018-07-24 07:21:34 +00:00
Piotr a17993a22e FS-10778: Evaluate rtp_secure_media_mki variable with switch_channel_var_true
Previously rtp_secure_media_mki channel variable was checked only
for existence, now it is checked if it's defined and evaluates
to true with switch_channel_var_true().
2018-07-24 07:21:34 +00:00
Piotr Gregor 1fdd58f533 FS-10778: Add support for MKI to SRTP
MKI support for SRTP has been tested on calls to/from
Telnyx's Skype for Business from/to local extension registered to FS
and between Skype for Business clients connected to FreeSWITCH.

SfB -> FreeSWITCH -> User 1004
   SRTP           RTP
   with
   MKI

SfB <- FreeSWITCH <- User 1004
   SRTP           RTP

SfB <-> FreeSWITCH <-> SfB
 SRTP/MKI      SRTP/MKI

Channel variable "rtp_secure_media_mki" was added to drive offering
of MKI on outbound SRTP from FS.

How to use rtp_secure_media_mki

Set rtp_secure_media_mki=true to offer MKI for outgoing SRTP (if SRTP is used) in inbound call.
Export rtp_secure_media=true to offer MKI for outgoing SRTP (if SRTP is used) on outbound call.
... or set it in the codec string for bridged calls

<action application="set" data="rtp_secure_media_mki=true"/>

<action application="export" data="rtp_secure_media_mki=true"/>

<action application="bridge" data="[absolute_codec_string=^^:PCMU:PCMA:G729,rtp_secure_media=true,rtp_secure_media_mki=true]sofia/external/+12404373253@169.55.36.24:5060;transport=tls"/>

EXAMPLES

1. Set example

 57     <extension name="telnyx_test_1_2">
 58         <condition field="destination_number" expression="^(0012404373253)$">
 59             <action application="set" data="rtp_secure_media=true"/>
 60             <action application="set" data="rtp_secure_media_mki=true"/>
 61             <action application="answer"/>
 62             <action application="bridge" data="user/1004@${domain_name}"/>
 63       </condition>
 64   </extension>

Description: SRTP will be used on outbound leg in incoming call due to rtp_secure_media=true
set and MKI will be offered in SDP. SRTP will not be used on a bridged call to extension 1004.

2. Export example

 75   <extension name="to_skype_for_business">
 76       <condition field="destination_number" expression="^(840531022)$">
 77           <action application="set" data="rtp_secure_media=optional"/>
 78           <action application="export" data="rtp_secure_media_mki=true"/>
 79           <action application="bridge" data="[absolute_codec_string=^^:PCMU:PCMA:G729,rtp_secure_media=true]sofia/external/+12404373728@169.55.36.24:5060;transport=tls"/>
 80       </condition>
 81   </extension>

Description: SRTP on inbound call has been set to optional therefore MKI will be used
on outbound SRTP in this call if SRTP is used at all. SRTP will be used on a bridged call
due to rtp_secure_media=true set in codec string and MKI will be used in offering SDP.

3. Bridging between Skype for Business clients: set

 97     <extension name="S4B_fs_S4B">
 98         <condition field="destination_number" expression="^(0012404373254)$">
 99             <action application="set" data="rtp_secure_media=true"/>
100             <action application="set" data="rtp_secure_media_mki=true"/>
101             <action application="bridge" data="[absolute_codec_string=^^:PCMU:PCMA:G729,rtp_secure_media=true]sofia/external/+12404373253@169.55.36.$
102       </condition>
103   </extension>

Result:
2017-11-27 19:00:26.977704 [NOTICE] switch_ivr_originate.c:527 Ring Ready sofia/external/+12404373728@telnyxlab.com!
2017-11-27 19:00:32.657687 [NOTICE] switch_core_media.c:1534 Skipping MKI due to empty index
2017-11-27 19:00:32.657687 [INFO] switch_rtp.c:4079 Activating audio Secure RTP SEND
2017-11-27 19:00:32.657687 [INFO] switch_rtp.c:4057 Activating audio Secure RTP RECV
2017-11-27 19:00:32.657687 [NOTICE] sofia.c:8419 Channel [sofia/external/%2B12404373253@169.55.36.24:5060] has been answered
2017-11-27 19:00:35.317702 [INFO] switch_rtp.c:4079 Activating audio Secure RTP SEND (with MKI)
2017-11-27 19:00:35.317702 [INFO] switch_rtp.c:4057 Activating audio Secure RTP RECV (with MKI)
2017-11-27 19:00:35.317702 [NOTICE] sofia_media.c:92 Pre-Answer sofia/external/+12404373728@telnyxlab.com!

Description: SRTP with MKI is used on outbound leg of inbound call (due to use on inbound leg of this call and "set").
Standard SRTP is used in both legs of outbound call, because rtp_secure_media_mki wasn't exported
or set in codec string for the outbound call.

4. Bridging between Skype for Business clients: Set and export

 97     <extension name="S4B_fs_S4B">
 98         <condition field="destination_number" expression="^(0012404373254)$">
 99             <action application="set" data="rtp_secure_media=true"/>
100             <action application="set" data="rtp_secure_media_mki=true"/>
101             <action application="export" data="rtp_secure_media_mki=true"/>
102             <action application="bridge" data="[absolute_codec_string=^^:PCMU:PCMA:G729,rtp_secure_media=true]sofia/external/+12404373253@169.55.36.24:5060;transport=tls"/>
103       </condition>
104   </extension>

Result:
2017-11-27 18:51:29.017689 [NOTICE] switch_ivr_originate.c:527 Ring Ready sofia/external/+12404373728@telnyxlab.com!
2017-11-27 18:51:35.097729 [INFO] switch_rtp.c:4079 Activating audio Secure RTP SEND (with MKI)
2017-11-27 18:51:35.097729 [INFO] switch_rtp.c:4057 Activating audio Secure RTP RECV (with MKI)
2017-11-27 18:51:35.097729 [NOTICE] sofia.c:8419 Channel [sofia/external/%2B12404373253@169.55.36.24:5060] has been answered
2017-11-27 18:51:37.797706 [INFO] switch_rtp.c:4079 Activating audio Secure RTP SEND (with MKI)
2017-11-27 18:51:37.797706 [INFO] switch_rtp.c:4057 Activating audio Secure RTP RECV (with MKI)

Description: Connecting Skype For Business client to Skype for Business client.
Send SRTP with MKI in both outbound streams:
	- for inbound call: MKI was offered in incoming call and enabled for outbound leg with "set"
	- for outbound call: MKI was enabled with "export"

5. Other examples

Setup to use SRTP with MKI only on the inbound SRTP on incoming call from Telnyx SfB
Tested dialing 0012404373253 from SfB to FS, leg SfB <-> FS uses SRTP with MKI
on inbound SRTP only

57     <extension name="telnyx_test_1_2">
58         <condition field="destination_number" expression="^(0012404373253)$">
59              <action application="set" data="rtp_secure_media=true"/>
61              <action application="answer"/>
62              <action application="bridge" data="user/1004@${domain_name}"/>
63       </condition>
64   </extension>

Result:
2017-11-23 20:44:35.406026 [INFO] mod_dialplan_xml.c:637 Processing Test02 <+12404373728>->0012404373253 in context public
2017-11-23 20:44:38.566022 [INFO] switch_rtp.c:4107 Activating audio Secure RTP SEND
2017-11-23 20:44:38.566022 [INFO] switch_rtp.c:4085 Activating audio Secure RTP RECV (with MKI)

Setup to send and receive SRTP with MKI on incoming call from Telnyx SfB
Tested dialing 0012404373253 from SfB to FS, leg SfB <-> FS uses SRTP with MKI
in both directions

57     <extension name="telnyx_test_1_2">
58         <condition field="destination_number" expression="^(0012404373253)$">
59     		<action application="set" data="rtp_secure_media=true"/>
60     		<action application="set" data="rtp_secure_media_mki"/>
61     		<action application="answer"/>
62     		<action application="bridge" data="user/1004@${domain_name}"/>
63       </condition>
64   </extension>

Result:
2017-11-23 20:42:06.026034 [INFO] mod_dialplan_xml.c:637 Processing Test02 <+12404373728>->0012404373253 in context public
2017-11-23 20:42:09.526034 [INFO] switch_rtp.c:4107 Activating audio Secure RTP SEND (with MKI)
2017-11-23 20:42:09.526034 [INFO] switch_rtp.c:4085 Activating audio Secure RTP RECV (with MKI)

Setup to offer MKI on outbound call to extension 1001 (X-Lite -> FS -> linphone)
Tested dialing 0012404373253 from user 1004, leg FS <-> 1001 uses SRTP with MKI

782     <extension name="telnyx_test_1_2">
783         <condition field="destination_number" expression="^(0012404373253)$">
784             <action application="export" data="rtp_secure_media_outbound=true"/>
785             <action application="export" data="rtp_secure_media_mki"/>
786             <action application="answer"/>
797             <action application="bridge" data="user/1001@${domain_name}"/>
798       </condition>
799   </extension>

Result:
2017-11-23 20:23:26.266034 [INFO] mod_dialplan_xml.c:637 Processing 1000 windows <1000>->0012404373253 in context default
2017-11-23 20:23:26.366035 [INFO] switch_rtp.c:4107 Activating audio Secure RTP SEND (with MKI)
2017-11-23 20:23:26.366035 [INFO] switch_rtp.c:4085 Activating audio Secure RTP RECV

SfB sometimes offers crypto with LIFETIME but no MKI index, e.g.:
a=crypto:5 AES_CM_128_HMAC_SHA1_80 inline:9OtFWi17H9E8ywlm0iazemjAqXu2RhJ3DZyo+VLJ|2^31

Defaulting to no-mki SRTP in case key material doesn't contain MKI index.
2018-07-24 07:21:34 +00:00
Mike Jerris 9e3da931e5 FS-11230: [core] Fix bad rtp timestamps triggered by cng/missed packet detection 2018-07-13 15:14:00 -04:00
Andrey Volk e380b41a8e FS-10876: [Build-System] Fix build in Visual Studio 2017 and Windows SDK 10. 2018-01-10 23:30:24 +03:00
Seven Du 48fbcccd14 FS-10815 #resove 2017-11-29 20:45:37 +08:00
Anthony Minessale efcc6c4e93 FS-10622: [core] Auto-fixing audio codec from G722 to PCMU although PCMU was not negotiated #resolve 2017-11-16 15:38:13 -06:00