Commit Graph

1070 Commits

Author SHA1 Message Date
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
Anthony Minessale 420c3ee10c Revert "FS-10770: [freeswitch-core] Make nack buffer bigger by default #resolve"
This reverts commit 5658e581fe.
2017-11-10 17:04:27 -06:00
Anthony Minessale 5658e581fe FS-10770: [freeswitch-core] Make nack buffer bigger by default #resolve 2017-11-02 14:06:13 -05:00
Anthony Minessale d60a1e95f7 FS-10667: [core] Segfault in crypto / srtp 2017-10-25 12:27:51 -05:00
Anthony Minessale a88bc6730e FS-10667: [core] Segfault in crypto / srtp #resolve 2017-09-14 18:09:35 -05:00
Anthony Minessale 85348331f3 FS-10667: [core] Segfault in crypto / srtp #resolve 2017-09-13 17:28:40 -05:00
Anthony Minessale 7cf6eb8e74 FS-10604: [core] Segfault in libcrypto / dtls #resolve 2017-09-06 12:29:02 -05:00
Anthony Minessale e2a186cb37 FS-10613: [core] freeswitch using the the wrong PT value (using the transmit PT instead of the receive PT) #resolve 2017-09-01 13:55:33 -05:00
Anthony Minessale f08a10e92d FS-10561: [freeswitch-core,mod_conference] Video concurrency improvements for 1.8 #resolve 2017-07-31 12:12:32 -05:00
Anthony Minessale 07d4d093b0 FS-10466: [freeswitch-core] Add session to some log lines #resolve 2017-07-03 17:37:05 -05:00
Mike Jerris d8fcb60155 FS-9785: changes to support newer openssl 2017-06-26 14:53:39 -05:00
Mike Jerris b1237ffef4 FS-10405: fix typo in timer destroy check 2017-06-26 14:17:17 -05:00
Mike Jerris 3bcf5b7ff8 FS-9785: upgrade libsrtp to 2.1 2017-06-26 14:14:36 -05:00
Anthony Minessale 19e8621682 FS-10417: [freeswitch-core] Reduce flicker in screen sharing -- minor tweak 2017-06-26 12:56:42 -05:00
Anthony Minessale 7c19615890 FS-10417: [freeswitch-core] Reduce flicker in screen sharing #resolve 2017-06-21 19:26:18 -05:00
Mike Jerris 752f46ece9 FS-10405: [core] Fix Timer destroy error on one legged calls 2017-06-19 13:57:31 -04:00
Brian West 5f5fb33ea9 FS-10356: [core] Do not blindly print error string from rtp/stun packets 2017-06-15 09:47:16 -05:00
Roman Sukhov feccf1e874 FS-10383 [freeswitch-core] Destroy RTP session write timer 2017-06-10 01:05:54 +03:00
Seven Du b79fd1f14f FS-10352 #resolve fix size doesn't match causing segs when casts to switch_rtp_packet_t 2017-05-29 17:48:57 +08:00
Mike Jerris 414f8085bb FS-10319: fix casting 2017-05-25 18:39:04 -04:00
Mike Jerris aa4aeb9fbe FS-10319: fix casting 2017-05-25 12:11:26 -05:00
Mike Jerris 442ba2d8fe FS-10319: fix build errors from rtp ts changes 2017-05-15 18:11:46 -05:00
Anthony Minessale 71514ca00d FS-10311: [core] RTP timestamp rollover calculation is incorrect 2017-05-15 18:00:40 -05:00
Anthony Minessale 7a46fd67cd FS-10311: [core] RTP timestamp rollover calculation is incorrect 2017-05-12 14:35:13 -05:00
Anthony Minessale fb47697c71 FS-10311: [core] RTP timestamp rollover calculation is incorrect #resolve 2017-05-12 14:05:24 -05:00
Brian West 521d74dae0 FS-10267: [freeswitch-core] zrtp_enrollment broken since 1.6.13 #resolve 2017-05-08 16:58:23 -05:00
Anthony Minessale fc2494cf32 FS-10295: [freeswitch-core] Remove debug log line #resolve 2017-05-08 16:44:15 -05:00
Anthony Minessale 5d4ac1cd3b FS-10284: [core] rtp session variable "ts" can wrap to zero for long running calls, causing incorrect logic to be executed #resolve 2017-05-05 11:19:17 -05:00
Anthony Minessale c6839a44f3 FS-10273: [freeswitch-core] Missing case stmt causing invalid stats #resolve 2017-04-27 14:54:45 -05:00
Anthony Minessale 945a3b2569 FS-10126: [freeswitch-core] General Video Improvements 2017-04-07 11:48:59 -05:00