Commit Graph

662 Commits

Author SHA1 Message Date
Andrey Volk a7477ed0e2 FS-11911: Fix build on Debian Buster 2019-07-15 22:23:25 +04:00
Mike Jerris 10a52ebe48 Merge pull request #1711 in FS/freeswitch from ~SEBASTIAN/freeswitch:bugfix/FS-11783-address-gcc8-warnings to master
* commit '3ca75eb8efa4e50ebe083a269b75fcb1762daa91':
  FS-11783: [mod_say_ja] quiet overflow warning
  FS-11783: [core] quiet gcc truncation warning
2019-06-24 09:29:12 -05: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
Liyang a095c83ecc FS-11832 [core] clear the old pmap when codec negotiated 2019-06-06 11:59:16 -04:00
Dragos Oancea c82f093419 FS-11711: fix overflow on reading ICE candidates (found with ASAN) 2019-06-06 11:47:13 -04:00
Brian West 60be42008c FS-11660 [mod_sofia] Not parsing sdp after first video reject. 2019-06-06 11:36:26 -04:00
Liyang 0c73aa82da FS-11822 [core] reset the codec_string when stream changed 2019-06-06 11:21:19 -04:00
Piotr Gregor 118dd796f3 FS-11421: [core,mod_sofia] Fix rtp_pass_codecs_on_stream_change to process all sdp settings in the re-invite -- add new filter_codecs app and fix some races and negotiation bugs #resolve 2019-06-06 11:08:52 -04:00
Anthony Minessale c47752c940 FS-11438: [freeswitch-core] recvonly channels left that way on blind transfer in some cases #resolve 2019-06-06 11:05:20 -04:00
Sebastian Kemper e114c6382e FS-11783: [core] quiet gcc truncation warning
With -Wstringop-truncation gcc warns about calls to bounded string
manipulation function "strncpy" that may either truncate the copied
string or leave the destination unchanged. To avoid the warning when the
result is not expected to be NUL-terminated, it is suggested to call
"memcpy" instead.

src/switch_core_media.c: In function 'switch_core_media_patch_sdp':
src/switch_core_media.c:11854:4: error: 'strncpy' output truncated before terminating nul copying 2 bytes from a string of the same length [-Werror=stringop-truncation]
    strncpy(q, strchr(a_engine->adv_sdp_ip, ':') ? "6 " : "4 ", 2);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This commit follows gcc's recommendation.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2019-04-14 19:12:03 +02:00
Mike Jerris fc7b0d2e6e Merge pull request #1659 in FS/freeswitch from ~LAZEDO/freeswitch:feature/FS-11313 to master
* commit 'f238e7b6126a916fb0f05105e4f16d52d6ee3df0':
  FS-11313 [core] set rtpc-mux if found in the sdp
2019-02-12 15:21:52 +00:00
lazedo f238e7b612 FS-11313 [core] set rtpc-mux if found in the sdp 2019-02-12 15:19:58 +00: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
Mike Jerris 968c76b29c Merge pull request #1597 in FS/freeswitch from ~DRAGOS_OANCEA_NX/freeswitch-dragos-nx:feat/FS-11409/ice-lite to master
* commit '3ed6d56dd3f05d6faf7d07cb2c08b4ee8c8c92a5':
  FS-11409: add "ice-lite" SDP attribute
2018-11-20 21:04:12 +00:00
Chris Rienzo c854466ed2 [core] Test commit- bump copyright date. 2018-11-06 12:03:07 -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
Dragos Oancea 3ed6d56dd3 FS-11409: add "ice-lite" SDP attribute 2018-09-25 17:58:59 +01: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 cc5dd29028 FS-11154: [freeswitch-core] Improve audio sync during loss #resolve 2018-08-13 18:57:19 +00:00
Anthony Minessale d88df785f1 FS-11211: [Verto-Communicator] Add turnServer and verto server fallback options -- FS side to only do relay as a last resort #resolve 2018-07-24 07:21:56 +00:00
Mike Jerris 84c97ea3ab FS-11223: [core] fix Crash when firefox sends only rtcp and not rtp candidates on video media 2018-07-24 07:21:55 +00:00
Mike Jerris dc95ee3d66 Revert "FS-11052: Allow alias for crypto suites"
This reverts commit 7cc6d5f99d16d2d63cb2548dd7b8345d579b7e9f.
2018-07-24 07:21:52 +00:00
Anthony Minessale 74f8ec7772 FS-11127: [freeswitch-core] Improvements to Video JB and audio jb sync #resolve 2018-07-24 07:21:51 +00:00
Anthony Minessale 9fcbf5d1c0 FS-10941: [mod_conference] Segfault SIGFPE, Arithmetic exception in mod_conference #resolve 2018-07-24 07:21:48 +00:00
Brian West 8084162d4d FS-11080: [freeswitch-core] Auto sync of jb can fail on extreme loss #resolve 2018-07-24 07:21:47 +00:00
Anthony Minessale 5272bbc83d FS-11057: [mod_conference] CPU race on personal canvas #resolve 2018-07-24 07:21:41 +00:00
ifox 8e362825de FS-11058: [core] Add RTT to RECV_RTCP_MESSAGE
Add the RTT field to the RECV_RTCP_MESSAGE event emission which allows external listeners to compute MOS RTCP from the event.
2018-07-24 07:21:41 +00:00
Piotr Gregor 3a502eaf6e 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.
2018-07-24 07:21:41 +00:00
Mike Jerris 76795ac2e2 FS-10853: Fix unitialzed var 2018-07-24 07:21:40 +00:00
Piotr Gregor 03d8aa4e9a FS-10853: Fix failed build for mod_dingaling
Fixes build but must be tested at runtime.
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 b0106ac17f FS-10778: Fix compilation and refactor code
Prefer break over indent.

if (!p) {
    break;
}

// the code...

over

if (p) {
    // the
    // code
    // ...
}
2018-07-24 07:21:34 +00:00
Mike Jerris 477f3bc549 FS-10778: fix MKI compile error 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
antonio a0ae014dc1 FS-10775 #resolve segfault switch_frame_buffer_push 2018-04-13 18:49:13 +02: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 2362cb4e58 FS-10622: [core] Auto-fixing audio codec from G722 to PCMU although PCMU was not negotiated #resolve 2017-09-08 13:38:44 -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
Brian West ccb32525d6 [core] FS-10587 502 response sent on codec mismatch 2017-08-24 15:04:02 -05:00
Anthony Minessale 4c29e4d630 FS-10562: [core] Crashes referencing cannot access memory #comment Firefox sending only candidates for RTCP and not RTP causing funky code path #resolve 2017-07-31 15:00:18 -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
Mike Jerris 571bff4def Merge pull request #1328 in FS/freeswitch from ~ETHANATKINS/freeswitch:ice-reinvite to master
* commit '999a6dd0b7f37e99c53cea3bc79d92c3ffab1822':
  FS-10485: Re-activate ICE on all attribute changes
2017-07-11 19:59:02 +00:00
Anthony Minessale 2ee8d58d72 FS-10472: [mod_conference] Invalid free in personal canvas mode 2017-07-10 19:48:14 -05:00
Ethan Atkins 999a6dd0b7 FS-10485: Re-activate ICE on all attribute changes
I ran into some ice failures when testing reinvites using
bypass_media_after_bridge. Every ice session has ice-ufrag and ice-pwd
attributes. When leg A sends those attributes to leg B, leg B is
supposed to send stun packets to leg A using the credentials provided in
those attributes. Freeswitch was not updating the session credentials
when the phone sent a new invite containing new ufrag and pwd
attributes. This caused ICE to fail on the client side (PJSIP in this
case).

The new_ice flag is set to true when freeswitch detects a change in
those attributes. For whatever reason, the reinvite flows that I was
testing did not set the CF_REINVITE flag on the channel, but new_ice was
true. It seems to me that freeswitch should always reactivate ice when
the ufrag and pwd credentials change.
2017-07-10 10:57:35 -07:00
Anthony Minessale db47792558 FS-10447: [freeswitch-core] Manual video refresh mode #resolve 2017-06-29 16:57:18 -05:00
Anthony Minessale 7c19615890 FS-10417: [freeswitch-core] Reduce flicker in screen sharing #resolve 2017-06-21 19:26:18 -05:00
Trevor Alpeter 09174819a9 FS-10370: Enable SRTP Key Padding
Some clients rely on Base64 padding characters (i.e., '=') to be present
in encoded SRTP key/salt strings to determine the length of the encoded
data. However, FreeSWITCH removes these characters before including the
encoded strings in the SDP. This causes those clients that rely on the
padding to truncate the encoded data and be unable to properly set up an
encrypted SRTP session.

This change introduces a channel flag named 'rtp_pad_srtp_keys'. When
this flag is enabled, FreeSWITCH includes the Base64 padding characters
in the SDP. This allows clients that rely on the padding to retrieve the
full key and salt values and successfully negotiate an SRTP stream with
FreeSWITCH.

FS-103070 #resolve
2017-06-13 09:39:07 -04:00
Anthony Minessale 84ec92048a FS-10249: [mod_av] Audio gradually falls behind video in recordings 2017-05-26 17:41:07 -05:00
Anthony Minessale 21f250f115 FS-10249: [mod_av] Audio gradually falls behind video in recordings 2017-05-25 12:01:23 -05:00
Anthony Minessale db2486919d FS-10307: [freeswitch-core] Repetitive verto re-attach with video only channels can cause a buffer overflow #resolve 2017-05-11 13:22:45 -05:00