Commit Graph

350 Commits

Author SHA1 Message Date
Seven Du ef3bd2d8c3
[core] fix base64 decoded size when encoded string contains padding = 2024-10-09 22:53:00 +08:00
Andrey Volk 0974bd112c [Core] switch_simple_email: Coverity 1227612 Calling risky function 2024-07-30 18:32:01 +03:00
Andrey Volk 11e3cff7cb [Core] switch_find_local_ip: Coverity 1024290 Resource leak. 2024-07-30 02:48:59 +03:00
Andrey Volk a99ed5c46f [Core] Introduce SWITCH_RAND_MAX to switch_rand() 2024-07-29 22:26:27 +03:00
Andrey Volk 9f362ea315 [Core] Better handle error cases in switch_rand(). 2024-06-07 23:12:20 +03:00
Andrey Volk c7e793c345 [Core] Add new switch_rand() a compliant random number generator API. Add a unit-test.
* [Core] Add new switch_rand() a compliant random number generator API. Add a unit-test.

* Fall back to rand() on unsupported platforms compile time.
2024-06-06 21:14:36 +03:00
Andrey Volk d08424384b
[Core] Coverity: 1024552 Logically dead code 2023-10-05 18:03:32 +03:00
Andrey Volk c4115537e0
[Core] Coverity: Use of 32-bit time_t
* [Core] Coverity: 1500270 Use of 32-bit time_t

* [Core] Coverity: 1500229 Use of 32-bit time_t

* [Core] Coverity: 1500235 Use of 32-bit time_t

* [Core] Coverity: 1500244 Use of 32-bit time_t

* [Core] Coverity: 1500250 Use of 32-bit time_t

* [Core] Coverity: 1500245 Use of 32-bit time_t

* [Core] Coverity: 1500255 Use of 32-bit time_t

* [Core] Coverity: 1500370 Use of 32-bit time_t

* Cleanup
2023-10-04 18:24:16 +03:00
Andrey Volk 9347c96712 [Core] check_ice: sanitize second field of the candidates. Add new switch_is_uint_in_range() API. 2023-08-13 15:49:58 +03:00
Andrey Volk 64f8ff03be [Core, mod_mariadb, mod_ilbc] Fix build on gcc 12. 2023-07-25 00:25:53 +03:00
Jakub Karolczyk 5656972bfe [core,miniupnpc,modules] Fix not used variables 2023-07-04 10:18:16 +01:00
Andrey Volk 56b6e954cf [Core] Fix dead nested assignments 2022-08-09 23:29:31 +03:00
Dragos Oancea c9def5990e [core, mod_sofia] add some extra checks when creating the digest. 2022-08-08 18:56:09 +03:00
Andrey Volk fbf2da44d9 [Core] Fix use of private headers. 2021-11-10 21:46:29 +03:00
Anthony Minessale 5111b6ef73 [core] don't decode strings with no encoding in them 2021-10-23 22:00:30 +03:00
Anthony Minessale dc4bef79ec [core]speed up call setup 2021-10-23 22:00:18 +03:00
Andrey Volk b8be418fb8 [Core, mod_commands] Implement memory allocation statistics by adding the "memory" API command. 2021-10-20 17:53:18 +03:00
Andrey Volk e14df00aa6 [Core] scan-build: Argument with 'nonnull' attribute passed null in switch_html_strip() 2021-10-19 20:35:11 +03:00
Andrey Volk 77c8557aa7 [mod_managed] Fix Windows build 2021-10-19 20:34:45 +03:00
Andrey Volk c35a3bb4db [Core] scan-build: fix false-positive memory leak in switch_xml_set_attr_d and switch_xml_set_attr_d_buf 2021-10-19 20:30:18 +03:00
Chris Rienzo 5a9eabca8e [core] Fix read of uninitialized buffer in switch_simple_email(). 2021-05-16 23:12:54 +00:00
Andrey Volk fd27504a7d [Core] Add switch_digest(), switch_digest_string() APIs. Add unit-tests. 2021-04-12 01:03:15 +03:00
Mike Jerris 8e4b418ee4 [core] fix leak in http request parser 2021-03-17 00:55:08 +03:00
windy-wang 1d2a1057f8
[Core] Fix the null char in truncated value returned by switch_b64_decode 2020-09-01 21:04:49 +04:00
Andrey Volk 8dd27183f8 [Core] Fix possible leak of the subclass variable in CUSTOM_HASH'es switch_event_reserve_subclass_detailed(). 2020-02-16 00:29:38 +04:00
Andrey Volk c39a2b11ce [Core] Fix regression in switch_utils after implementing unit-tests parallel. 2020-01-23 18:08:08 +00:00
Andrey Volk 893a3cdc1f [Unit-test] Run tests in parallel 2020-01-23 02:29:57 +04:00
Anthony Minessale 4926eac49d FS-11918: [core] add function to see frame buffer len switch_frame_buffer_size 2019-07-18 00:35:56 +04:00
Sergey Khripchenko 24c3b8d91f FS-11669 Fix timeout in switch_wait_sock() and switch_wait_socklist() 2019-07-17 19:51:56 +04:00
Andrey Volk 292d0b2ec6 FS-11903: Fix errors reported by PVS-Studio Static Code Analyzer for switch_utils.c 2019-07-15 23:46:00 +04:00
Luis Azedo 60956d7f85 FS-11025 [core] allow/check ports in network lists 2019-03-06 11:56:03 +00:00
Mike Jerris 0367b3b023 FS-11382: [core] add switch_pool_strip_whitespace function to strip whitespace using pool allocation 2018-09-06 17:49:46 +00:00
Seven Du 868e92649e FS-11183 improve strip to save out buffer size 2018-07-24 07:21:56 +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
Sergey Safarov df1ab07ca4 FS-9924: Removed extra space in source files 2017-02-09 23:59:49 -05:00
Anthony Minessale eee5abcc0c FS-10008: [mod_say_en] Add military time to say_en #resolve 2017-02-03 16:24:53 -06:00
Mike Jerris ad183fdea4 FS-9809: [mod_sofia] url encode caller id number before sticking it in the from header in case we have non url safe chars in the cid number in the caller profile 2017-01-06 16:16:16 -06:00
Anthony Minessale c701ce6173 FS-9708 #resolve [RTP timing when doing repacketization] 2016-11-10 17:34:48 -06:00
Mike Jerris 30c84b4bbc FS-9638: fix build without gumbo 2016-11-10 16:34:16 -05:00
Anthony Minessale 9b8a5edd3d FS-9638 2016-11-10 12:09:00 -06:00
François 7f017fd1d8 FS-9693 fix free issue in fulldate comparison 2016-11-08 17:07:28 +01:00
François 92b8996eea FS-9693 use existing date parsing functions in fulldate comparison that take timezone into account 2016-11-07 13:01:49 -06:00
Anthony Minessale 707502ff24 FS-9597 #resolve [host_lookup does not resolve v6 addrs] %backport=1.6 2016-09-30 12:12:04 -05:00
Ken Rice e18c12b609 FS-8953 [core] white space clean up. 2016-03-17 08:55:00 -05:00
Mark Lipscombe 4e9977507d FS-8537: Passing nil to various lua functions causes segfault
Various functions exposed via lua do not check their parameters for null
causing freeswitch to segfault.

This change adds checking for null parameters and returns an error
instead of segfaulting.
2015-11-15 10:43:09 +11:00
Mike Jerris 1968453e32 FS-8378: refactor a bit to clarify code and get better debug in gdb 2015-10-22 12:57:42 -05:00
Anthony Minessale f8592ab539 FS-8069 #resolve [ipv6 support missing in stun code] 2015-08-27 13:46:26 -05:00
Michael Giagnocavo ba9c44bbd0 FS-7885 Add getcputime command 2015-07-24 02:34:00 -06:00
François 48b44832b2 FS-7198 add coma separated values and reverse ranges for time-of-day and day-of-week matches 2015-07-09 10:43:13 +02:00
Brian 2815994647 FS-7638 properly match ACL with IPv4 mapped IPv6 addresses 2015-06-11 10:41:33 -05:00