Commit Graph
1749 Commits
Author SHA1 Message Date
Dmitry Verenitsin f390069308 [mod_verto] Add enable-chat-api-proto to gate the api chat proto (#3136)
A client message can select which chat proto handles it, and the `api` proto
runs the address as a FreeSWITCH API command. That route does not pass through
`verto.fsapi`, so the per-user fsapi permission does not apply to it. The new
per-profile `enable-chat-api-proto` param controls the route and is off unless
set; a message selecting the proto without it is refused and logged.

The proto compare is case-insensitive, matching the chat interface registry,
which is created with `switch_core_hash_init_nocase()`.

Only the `api` proto is gated. A message carrying no proto selector, or one
naming any other chat proto, routes exactly as before.

The param ships commented out in both vanilla verto profiles.
2026-08-26 18:35:31 +03:00
Dmitry Verenitsin 7015f6a73a [mod_sofia] Add enable-chat-api-proto to gate the api chat proto (#3135)
The chat layer lets an inbound SIP MESSAGE select which chat proto handles it,
and the `api` proto runs the address as a FreeSWITCH API command. The new
per-profile `enable-chat-api-proto` param controls that route and is off unless
set. A MESSAGE selecting the proto on a profile without it is answered 403 and
logged with the source and the requested command.

The proto compare is case-insensitive, matching the chat interface registry,
which is created with `switch_core_hash_init_nocase()`.

The param ships commented out in the four vanilla profiles and the mod_sofia
sofia.conf.xml sample.
2026-08-26 16:46:56 +03:00
ea74c0acb8 Merge commit from fork
* [Core, mod_commands] Interface allowlist (#3086)

* [core] Add interface allowlist to gate module app/api registration

Adds an optional, presence-activated allowlist in switch.conf.xml that
controls which modules may register application / api / json_api /
chat-application interfaces. With no <interface-allowlist> configured
nothing is enforced; when at least one <allow> entry is present, only
listed interfaces register at load time and all others are refused (the
module still loads and switch_loadable_module_process still returns
SUCCESS -- the blocked interface is simply never exposed).

Entries match at three levels of precision:
  mod_commands            - whole module
  mod_commands.system     - any interface named "system"
  mod_commands.system.api - a specific type (app|api|json_api|chat_app)

Enforcement lives in switch_loadable_module_process() so every module, at
boot and at runtime `load`, is subject to the same policy. This gives
operators a way to disable the "system"/"spawn" shell-exec API commands
(and equivalents) system-wide.

Also adds the `interface_allowlist_dump [modules] [plain]` API, which
walks the loaded modules and prints their interfaces in the allowlist key
format so the current state can be captured and pruned offline into config.

* [mod_commands] Add tests for the interface allowlist

New test_interface_allowlist boots the core with an active
<interface-allowlist> (conf_interface_allowlist/) that permits only a
couple of mod_commands interfaces, then loads mod_commands and verifies:

- listed commands register and run (status, version) while unlisted and
  shell-exec commands are refused (system, spawn, uptime) -- refusal
  surfaces as switch_api_execute returning FALSE / command-not-found,
  with the command function never invoked;
- a "module.name.type" entry gates by type: the API "status" loads while
  the JSON API of the same name stays blocked;
- interface_allowlist_dump prints the config format in its xml, modules
  and plain variants, and reflects module capabilities (system appears in
  the dump even though it was blocked from registering).

* [config] Fix interior -- in interface-allowlist comment breaking XML parse

The explanatory comment used -- as em-dash pairs. The XML parser treats
-- inside a comment as the comment close, causing an "unclosed <!--"
error that prevents the whole freeswitch.xml from parsing (boot and
reloadxml both fail). Replace the -- pairs with ordinary punctuation.

* update .gitignore

* [core] Warn when interface-allowlist section is present but parses no entries

Co-authored-by: Chris Rienzo <chris@signalwire.com>

* Merge commit from fork

Add `switch_stun_packet_verify_integrity()`, an HMAC-SHA1
MESSAGE-INTEGRITY verifier that is const and non-mutating: it runs
over a private copy of the pristine network-order packet, so the
caller's buffer and byte order stay untouched, and walks attributes
with its own unsigned bounded helper `stun_wire_attr_bounds()`
instead of the host-order iterator macros. A trailing
MESSAGE-INTEGRITY-SHA256 or FINGERPRINT after MESSAGE-INTEGRITY is
tolerated; any other trailing attribute is rejected.

Gate it in `handle_ice()` behind `ice->verify_integrity`: verify
before any ICE state is touched, keyed by message type (local
`ice->pass` for a request, remote `ice->rpass` for a response or
error response), and drop on failure. Keepalive indications carry no
MESSAGE-INTEGRITY and are ignored.

`ice->verify_integrity` is read from the `ice_verify_message_integrity`
channel variable in `switch_rtp_activate_ice()` and defaults off, so
receive-path behavior is unchanged unless it is enabled. Adds unit
tests in `tests/unit/switch_stun.c`.

* Merge commit from fork

* [core] Verify DTLS client cert against SDP fingerprint (server role)

Add opt-in verification of the client certificate when FreeSWITCH is
the DTLS server, mirroring the binding the client role already performs
on the server certificate: match the peer certificate against the SDP
`a=fingerprint` in `dtls_state_setup()`.

Selected per call by the `rtp_dtls_client_cert_verify_mode` channel
variable (`dtls_client_cert_verify_t`). An unset variable keeps the
default `DTLS_CLIENT_CERT_VERIFY_NONE`, so existing behavior is
unchanged:

- `none`: the server does not request a client certificate.
- `fingerprint`: request it (`SSL_VERIFY_PEER` + `dtls_accept_any_cert`)
  and require its fingerprint to match the SDP value; a self-signed
  certificate is accepted at the TLS layer and the match provides
  authenticity.
- `full`: additionally let OpenSSL enforce the certificate chain.

An unrecognized mode string falls back to `fingerprint` (fail closed)
with a warning.

The mode is set per `SSL` object in `switch_rtp_add_dtls()`. Verification
fails (`DS_FAIL`, no SRTP keys derived) when the client presents no
certificate, its fingerprint does not match, or the peer advertised no
usable `a=fingerprint`: `get_evp_by_name()` returns `NULL` for a missing
or empty hash type and `switch_core_cert_extract_fingerprint()` rejects a
`NULL` algorithm rather than passing it to `X509_digest()`.

`conf/vanilla/vars.xml` documents the knob as a disabled example. Tests
in `tests/unit/switch_rtp.c` cover matching, mismatched, absent-cert,
absent-fingerprint, `none`, and unrecognized-mode cases.

---------

Co-authored-by: Andrey Volk <andywolk@gmail.com>
Co-authored-by: Chris Rienzo <chris@signalwire.com>
2026-08-08 18:14:08 +03:00
Dmitry Verenitsin 68ec688eb6 Merge commit from fork
Add `switch_stun_packet_verify_integrity()`, an HMAC-SHA1
MESSAGE-INTEGRITY verifier that is const and non-mutating: it runs
over a private copy of the pristine network-order packet, so the
caller's buffer and byte order stay untouched, and walks attributes
with its own unsigned bounded helper `stun_wire_attr_bounds()`
instead of the host-order iterator macros. A trailing
MESSAGE-INTEGRITY-SHA256 or FINGERPRINT after MESSAGE-INTEGRITY is
tolerated; any other trailing attribute is rejected.

Gate it in `handle_ice()` behind `ice->verify_integrity`: verify
before any ICE state is touched, keyed by message type (local
`ice->pass` for a request, remote `ice->rpass` for a response or
error response), and drop on failure. Keepalive indications carry no
MESSAGE-INTEGRITY and are ignored.

`ice->verify_integrity` is read from the `ice_verify_message_integrity`
channel variable in `switch_rtp_activate_ice()` and defaults off, so
receive-path behavior is unchanged unless it is enabled. Adds unit
tests in `tests/unit/switch_stun.c`.
2026-08-08 17:03:47 +03:00
Andrey VolkandChris Rienzo c1bb5c6ab3 [Core, mod_commands] Interface allowlist (#3086)
* [core] Add interface allowlist to gate module app/api registration

Adds an optional, presence-activated allowlist in switch.conf.xml that
controls which modules may register application / api / json_api /
chat-application interfaces. With no <interface-allowlist> configured
nothing is enforced; when at least one <allow> entry is present, only
listed interfaces register at load time and all others are refused (the
module still loads and switch_loadable_module_process still returns
SUCCESS -- the blocked interface is simply never exposed).

Entries match at three levels of precision:
  mod_commands            - whole module
  mod_commands.system     - any interface named "system"
  mod_commands.system.api - a specific type (app|api|json_api|chat_app)

Enforcement lives in switch_loadable_module_process() so every module, at
boot and at runtime `load`, is subject to the same policy. This gives
operators a way to disable the "system"/"spawn" shell-exec API commands
(and equivalents) system-wide.

Also adds the `interface_allowlist_dump [modules] [plain]` API, which
walks the loaded modules and prints their interfaces in the allowlist key
format so the current state can be captured and pruned offline into config.

* [mod_commands] Add tests for the interface allowlist

New test_interface_allowlist boots the core with an active
<interface-allowlist> (conf_interface_allowlist/) that permits only a
couple of mod_commands interfaces, then loads mod_commands and verifies:

- listed commands register and run (status, version) while unlisted and
  shell-exec commands are refused (system, spawn, uptime) -- refusal
  surfaces as switch_api_execute returning FALSE / command-not-found,
  with the command function never invoked;
- a "module.name.type" entry gates by type: the API "status" loads while
  the JSON API of the same name stays blocked;
- interface_allowlist_dump prints the config format in its xml, modules
  and plain variants, and reflects module capabilities (system appears in
  the dump even though it was blocked from registering).

* [config] Fix interior -- in interface-allowlist comment breaking XML parse

The explanatory comment used -- as em-dash pairs. The XML parser treats
-- inside a comment as the comment close, causing an "unclosed <!--"
error that prevents the whole freeswitch.xml from parsing (boot and
reloadxml both fail). Replace the -- pairs with ordinary punctuation.

* update .gitignore

* [core] Warn when interface-allowlist section is present but parses no entries

Co-authored-by: Chris Rienzo <chris@signalwire.com>
2026-08-05 18:44:33 +03:00
Dmitry Verenitsin 9da537a19f [mod_sofia] Add SIP 603+ detection and passthrough control. Add unit-tests. (#3035)
Implement SIP 603+ (ATIS-1000099) support for FCC analytics-based call blocking compliance.

Detection:
- Detect incoming 603+ responses by checking "Network Blocked" phrase
and "v=analytics1;" in the `Reason` header text
- Set `sip_603plus_reason` channel variable on both legs for CDR visibility

Passthrough control:
- `sip_603plus_passthrough=true`: forward 603+ phrase and Reason header
- `sip_603plus_passthrough=false`: strip `Reason` header, send clean `603 Decline`
- Not set: existing behavior preserved
- Works independently of `disable_q850_reason` for selective forwarding
2026-05-26 17:33:23 +03:00
Andrey Volk 14b8295dbc [mod_cdr_mongodb] Remove from tree (#2992) 2026-03-06 01:26:20 +03:00
Seven Du 7f9dd270b4 [core] add uuidv7 support 2025-07-31 19:38:54 +03:00
Andrey Volk 3a53566eab [mod_python] Remove from tree 2025-03-31 18:49:17 +03:00
Andrey Volk b3cdc8a783 [mod_oreka] Remove from tree 2025-01-16 02:57:37 +03:00
Andrey Volk 74c6433955 [mod_yaml] Remove from tree 2025-01-16 02:05:17 +03:00
Andrey Volk 54fb449963 [mod_event_zmq] Remove from tree 2025-01-15 01:49:24 +03:00
Andrey Volk d4fd3cc054 [mod_h26x] Remove from tree 2025-01-13 23:24:50 +03:00
Andrey Volk 2b52002e75 [mod_khomp] Remove from tree 2025-01-13 20:48:48 +03:00
Andrey Volk 285df0b026 [mod_xml_radius] Remove from tree 2025-01-13 13:14:44 +03:00
Andrey Volk 4d7a7f9af6 [mod_rss] Remove from tree 2025-01-11 02:36:12 +03:00
Andrey Volk 4c447a98ed [mod_snom] Remove from tree. 2025-01-10 21:31:29 +03:00
Andrey Volk b033d27a38 [mod_unicall] Remove from tree 2025-01-09 19:34:21 +03:00
Andrey Volk c1f4586e2d [mod_abstraction] Remove from tree 2025-01-08 23:47:31 +03:00
Andrey Volk 6286c51ff6 [mod_isac] Remove from tree 2025-01-08 20:46:37 +03:00
Andrey Volk 49e63f6fff [mod_portaudio, mod_portaudio_stream] Remove from tree 2025-01-07 19:18:03 +03:00
Andrey Volk e5ae035d85 [mod_sms_flowroute] Remove from tree 2025-01-06 23:00:07 +03:00
Andrey Volk b7ac2be11b [mod_cepstral] Remove from tree 2025-01-06 17:41:58 +03:00
Andrey Volk 4475a54127 [mod_ladspa] Remove from tree 2025-01-06 16:36:57 +03:00
Andrey Volk 1944260c7b [mod_sangoma_codec] Remove from tree 2025-01-03 01:57:32 +03:00
Andrey Volk 0e412ac0ee [mod_rayo, mod_ssml, iksemel] Remove from tree 2024-12-31 13:43:48 +03:00
Andrey Volk 70d76bcc0e [Core] Remove mod_kazoo from tree 2024-02-21 21:27:35 +03:00
Douglas Vought 7d52ceb69d [timezones] Update timezones to version 2023c. 2023-09-05 12:46:13 -04:00
Len 6355f9190a Update freeswitch.xml 2023-08-11 14:03:04 -04:00
Len c013a7dc64 [Configuration] Use : not , in rtp_secure_media 2023-01-24 02:04:56 +03:00
Dragos Oancea 8e59603d98 [core][mod_sofia] remove ZRTP (deemed obsolete).
[unit-tests][build-system][docs] remove references to ZRTP.
2022-10-28 20:19:42 +03:00
Dmitry Ukolov c6452cc8da [mod_sofia] Add db-spin-up-wait-ms profile parameter. 2022-10-06 12:15:41 +03:00
Len 741d163284 [Configuration] Add vanilla autoload_configs signalwire.conf.xml 2022-09-06 11:16:20 -04:00
Andrey Volk 6d208d3115 [Configuration] Remove jingle_profiles 2022-08-30 01:41:22 +03:00
Andrey Volk 9311ee7dc2 [Build-System] Remove dingaling.conf.xml 2022-08-29 20:17:13 +03:00
Chris Rienzo 3c7e8ff989 [core] remove unimrcp from tree 2022-08-29 20:17:06 +03:00
Chris Rienzo 01c1e74f36 [core] remove libdingaling from tree 2022-08-29 20:17:04 +03:00
Andrey Volk a1d2f83104 [Core] ODBC: Add odbc-skip-autocommit-flip switch param. 2022-08-25 20:14:47 +03:00
Andrey Volk 7ed2a99eb5 [mod_sofia] Implement maximum receiving requests per second max-recv-requests-per-second profile parameter. (Warning: Behaviour change. New default is 1000 requests per second) 2021-10-23 22:01:06 +03:00
Andrey Volk 66a92063b6 [mod_sofia] Add tls-orq-connect-timeout profile parameter so SIP engine could try again sending an outgoing request and when possible - using an alternative address (DNS failover). Add sip_call_tls_orq_connect_timeout channel variable per call to override profile's timeout. 2021-10-23 22:00:36 +03:00
Chris Rienzo cd041b768c [mod_spandsp] Add verbose-log-level configuration. 2021-10-23 22:00:34 +03:00
Anthony Minessale ed98516666 [mod_verto] move websocket implementation to libks 2021-10-23 22:00:17 +03:00
Seven Du 6761e8767e [core] and core video alpha patch test code 2021-10-23 22:00:01 +03:00
Fernando S. Santos 42a6566480 [Configuration] Fix Brazil daylight’s in xml files 2021-10-21 19:35:10 +03:00
Andrey Volk a61c9dca50 Merge pull request #1380 from inoutglobal/master
[daylight saving]- Fixs wrong daylight saving
2021-10-15 16:41:41 +03:00
Andrey Volk e44fd2ea38 [mod_python3, ESL py3mod] Add Python3 support. 2021-10-14 23:26:36 +03:00
Edson Lopes Filho dae624441b [daylight saving]- Fixs wrong daylight saving
Fix wrong daylight saving on America/Sao_Paulo Timezone. There is no more Daylight Savings in Sao Paulo.
2021-10-13 13:13:09 -03:00
Dragos Oancea a562db760c [mod_opus] add cfg setting to overwrite the fmtp stereo param coming from remote. Eg: incoming SDP has stereo=1 but we want a mono call so we answer with stereo=0.
* [mod_opus] add cfg setting to overwrite the fmtp stereo param coming from remote. Eg: incoming SDP has stereo=1 but we want a mono call so we answer with stereo=0.
sprop-stereo will be set to 0 too.

* [core] opus: use switch_core_max_audio_channels() with remote fmtp stereo=1 to allow disabling of stereo.
2021-05-14 18:36:30 +03:00
Dragos Oancea 2915d3aba8 [mod_amrwb] add cfg setting mode-set-overwrite (it will answer with just one mode-set value) - fixes audio quality issues in mod_conference with some UEs. 2021-05-07 14:29:33 +00:00
Dragos Oancea 4734904d2d [mod_amr] introduce new cfg setting force-oa to change between OA/BE when originating, show session in debug logs, update configs. 2021-03-10 15:49:10 +02:00