Commit Graph

323 Commits

Author SHA1 Message Date
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
Michael Jerris 49778c34e5 FS-7258, FS-7571: [mod_xml_cdr] properly encode xml cdr for post to web server 2015-06-02 18:54:15 -05:00
Anthony Minessale 3b2d00f3e6 FS-7587 Add ipv6 support to Verto / Websockets 2015-06-01 13:39:47 -05:00
Anthony Minessale d5e48302e6 FS-7501: improve linked list algorithm in a few places to help performance 2015-05-28 12:47:17 -05:00
Anthony Minessale 0d34e8ac77 FS-7500: add a framebuffer to reuse memory and use it to offload frame writing from video muxing thread to a dedicated write thread 2015-05-28 12:47:08 -05:00
Anthony Minessale 0c56081975 FS-7499: copy port to where apr keeps it too 2015-05-28 12:46:54 -05:00
Anthony Minessale 0d626bc715 FS-7501: more factoring on vid buffer 2015-05-28 12:46:52 -05:00
Artur Zaprzała 2d07448822 FS-7304: Multiple and reversed ranges for XML dialplan date and time conditions 2015-02-20 20:00:18 +01:00
Anthony Minessale 76370f4d17 auto urlencode user portion of sip uri 2015-01-23 21:06:02 -06:00
Anthony Minessale 5ce5199be9 FS-6969 #resolve #comment This patch should accomplish the same and handle other platforms, please test 2014-11-07 08:38:01 -06:00
Anthony Minessale 24084adf77 %FEATURE Add new feature to filter the SDP on bypass_media calls to remove or limit codecs.
VARIABLE: bypass_media_sdp_filter

Can be set globally or per leg on the inbound side of a bypass_media bridge.

VALID FILTERS:

remove(): Removes the specified codec if it exists in the SDP.
only():   Removes all codecs besides the one specified (providing that it exists in the sdp) (will not remove telephone-event))

EXAMPLE 1 (remove everything leaving only g729):

  <action application="set" data="bypass_media_sdp_filter=only(g729)"/>
  <action application="set" data="bypass_media=true"/>
  <action application="bridge" data="sofia/internal/1238@conference.freeswitch.org"/>

EXAMPLE 2 (remove everything leaving only g729 and also remove dtmf):

  <action application="set" data="bypass_media_sdp_filter=only(g729)|remove(telephone-event)"/>
  <action application="set" data="bypass_media=true"/>
  <action application="bridge" data="sofia/internal/1238@conference.freeswitch.org"/>

EXAMPLE 3 (remove alaw and speex):

  <action application="set" data="bypass_media_sdp_filter=remove(pcma)|remove(speex)"/>
  <action application="set" data="bypass_media=true"/>
  <action application="bridge" data="sofia/internal/1238@conference.freeswitch.org"/>
2014-10-01 01:28:10 +05:00
Brian West 80542e20f0 FS-5142 don't multipart/mixed if body has content-type present 2014-09-11 14:18:42 -05:00
Seven Du 590382f4a6 fix url parsing 2014-09-09 11:51:53 +08:00
Seven Du 2eed5ecf07 clean the uri to protect us from uri vulnerability attack like request /../../../../etc/passwd 2014-09-08 07:46:10 +08:00
Seven Du 023f6e148a fix http header parsing, now it accepts short header 2014-09-07 11:47:38 +08:00
Seven Du c02b2427e8 refactor http parsing and prevent read body more than content-length 2014-09-06 19:35:05 +08:00
Seven Du f5c0c13931 add http query string parsing and improve http header parsing 2014-09-06 17:21:58 +08:00
Jeff Lenk 76b093a098 fix trivial windows compiler warning for vs2010 2014-09-05 22:43:52 -05:00
Travis Cross 5fadb52758 Fix build on gcc-4.9
GCC doesn't like when variables that are set but never used.
2014-09-04 03:43:36 +00:00
Seven Du f0b9407cca add http utils 2014-09-04 08:43:51 +08:00
Travis Cross e2d67d4ead Remove dead assignment 2014-08-22 00:58:53 +00:00
Travis Cross b5a87aea7f Avoid using undefined memory in `switch_fulldate_cmp`
The `switch_split_date` and `switch_split_time` functions only set as
many variables as they believe exist values in the input string.
Since we didn't have defaults assigned we would read undefined stack
memory if the input string didn't contain e.g. an hour.

With this commit, we use 1970 if no year is present, January if no
month is present, the first day of the month if none is given, and
zero for each of a missing hour, minute, or second.
2014-08-22 00:47:22 +00:00
Travis Cross bf42dd65f1 Refactor `switch_fulldate_cmp`
We're moving the variable declarations down to the smallest possible
scope (a good idea in general) so we can address the use of undefined
memory by the function in a later commit.
2014-08-22 00:43:27 +00:00
William King b1f382c67e CID 1229134: fix small memory leak 2014-07-29 21:42:31 -07:00
Jeff Lenk 86ef5d2668 trivial compiler fix 2014-07-27 17:23:51 -05:00
Anthony Minessale 4f1b09a3ca add switch_socket_waitlist for waiting on multiple sockets and abstract it to poll and select so windows can use it too 2014-07-25 00:23:08 +05:00
Anthony Minessale a2921e269c update verto with some fixes and enhancements with reconnection 2014-07-18 01:04:04 +05:00
Mike Jerris 6dca24bb2a Merge pull request #5 in FS/freeswitch from ~KATHLEEN.KING/freeswitch-fork:clang-warnings-werror to master
* commit '1affff9db4aaa29ab66f9f5db76f575eeabd86b5':
  Fixed a clang-3.5 missing-prototype warning and added doxygen documentation for switch_channel_set_presence_data_vals. #doxygen
  Fixed dead code.
  Fixed trucation of value warning.
  Removed a useless called to abs.
  Removed an autological-pointer-compare from src/switch_utils.c.
  Fixed trucation of value warning.
2014-07-14 17:38:21 -05:00