34451 Commits

Author SHA1 Message Date
Roel van Meer 40be910b05 bridging: Add support for TOUCH_MIXMONITOR_OPTIONS
This channel variable can be used to override the default automixmon
options (which are 'b' or 'bB(<n>)'). If both TOUCH_MIXMONITOR_OPTIONS
and TOUCH_MIXMONITOR_BEEP are set, TOUCH_MIXMONITOR_BEEP is ignored with
a warning.
It is the responsibility of the user to configure valid options in
TOUCH_MIXMONITOR_OPTIONS.

Fixes: #1981

UserNote: The TOUCH_MIXMONITOR_OPTIONS channel variable can now be used
to configure the options used by the mixmonitor application when it is
started via automixmon. If both TOUCH_MIXMONITOR_OPTIONS and
TOUCH_MIXMONITOR_BEEP are set, TOUCH_MIXMONITOR_BEEP is ignored with
a warning.
2026-07-21 12:11:25 +00:00
George Joseph 1441cfde6b res_pjsip_refer: Fix issues with Refer-Sub:false and ARI.
When an attended transfer is controlled by ARI using
PJSIP_TRANSFER_HANDLING()=ari-only, and a REFER request is received with
a Refer-Sub: false header to suppress the automatic progress
subscription, a segfault occurs in
res_pjsip_refer:refer_incoming_ari_request().

However, even if the segfault were prevented, there's another issue...
Suppressing the subscription and NOTIFYs to the referer also prevents
the ARI app from getting any progress events for the transfer which it's
controlling.

So...

* The segfault has been fixed.
* Suppressing the subscription no longer suppress the ARI events from being
sent to the controlling ARI app.
* A good amount of tracing has also been added.

Resolves: #2021
2026-07-21 12:11:07 +00:00
Mike Bradeen a214896515 build: re-add pjsua test application
pjsua and it's python bindings were removed as part of PR
1854. Testing for RTT requires the pjsua application be
re-added to the third pary build process.  This applies to
the pjsua application ONLY and not the associated python
bindings.

Resolves: #2024
2026-07-15 16:18:37 +00:00
Naveen Albert e62a3c2aeb res_pjsip: Document 'none' option for 'dtmf_mode'.
The 'none' value can be used to disable DSP processing for DTMF
on PJSIP channels and is sometimes necessary for this reason,
and already exists in the code, but is not documented. Add it to
the documentation enum.

Resolves: #2026
2026-07-15 16:02:43 +00:00
Mike Bradeen 70e62048a8 Audiohooks: Allow whisper audiohooks to work without an underlying stream
Audiohook whispers work by mixing audio with the current stream of frames being
written to the hooked channel. Prior to this change if there were no audio
frames being written to the channel outside of the audiohook, then any whisper
audio has nothing to mix with and so is not heard on the hooked channel.

This change removes that requirement by creating a framehook driven timer on the
channel that creates silent frames the whispered frames can be mixed into.

The framehook is automatically added with the first attached whisper audiohook
and is removed when the last one is detached.  If there are no attached streams
being written to the channel, the timer is used to generate a default one. If
a stream is attached; the timer is ignored until the stream stops. This stop
and start is automatically triggered by the presence of a written stream and does
not require any external action.

Resolves: #1966

UserNote: There is no longer a requirement to play silence or otherwise have
a stream of audio being sent to a hooked channel for whispered frames to be
heard.
2026-07-15 15:39:46 +00:00
Ben Ford 8680f249b6 Logger: Don't discard WARNING or ERROR messages.
When the logger reaches it's threshold for messages, don't discard the
WARNING or ERROR messages up to a certain amount. If THAT threshold
reaches its maximum, start discarding the oldest non-WARNING/ERROR
messages until we only have WARNING and ERROR messages left. Everything
will be discarded after that until we have room again for more.

Also added a test that limits the queue sizes and logs many messages to
see the queues hitting their maximums and discarding the appropriate
messages.

Fixes: #1882
2026-07-13 16:49:35 +00:00
Aqeel Abbas 23b95cc4f7 func_strings: Fix syntax error in STRBETWEEN documentation example
The STRBETWEEN function documentation example was missing a closing
brace in the SendDTMF call. Corrected the syntax to ensure the
dialplan example is functional.
2026-07-13 15:59:54 +00:00
Mehrdad Seifzadeh d18b11b9c1 res_pjsip_registrar: Resolve AOR for identified endpoints
When an inbound REGISTER is matched to an endpoint using an
identification method such as IP, header, or request URI, the endpoint can
be identified and authenticated successfully while registrar AOR
resolution still fails.

find_registrar_aor() only resolved AOR names for username and
auth_username identify methods. A header-only endpoint therefore left
aor_name unset and failed registration with "AOR '' not found" even when
the REGISTER To URI matched one of the endpoint's configured AORs.

Resolve the REGISTER AOR from the To URI for endpoint identification
methods that do not directly provide an AOR name, while still
constraining the match to the already-identified endpoint's configured AOR
list.

Fixes: #1398
2026-07-13 15:15:29 +00:00
Thomas Guebels 10917330ce res_http_websocket: Unref session when it fails to establish.
Two error paths in res_http_websocket could leak an ast_websocket session by
failing to drop a reference after the session had been allocated.

The first occurs when session ID generation fails. While this is largely
theoretical, as it would require an out-of-memory condition, the session
reference should still be released correctly.

The second occurs when the ast_websocket_pre_callback session_attempted callback
returns an error. This path is reachable through ari_websockets, which
implements this callback and can legitimately fail under certain conditions.

Fixes: #2020
2026-07-09 16:50:00 +00:00
George Joseph dc2a760bd5 Bundled pjproject: Make it easier to override options in config_site.h.
Bundled pjproject uses ./third-party/pjproject/patches/config_site.h to set
many pjproject build options like PJ_IOQUEUE_MAX_HANDLES, PJSIP_MAX_URL_SIZE,
etc. Editing that file however, causes the git tree to become dirty which
is inconvenient.  So...

* Updated the Asterisk configure scripts to pass the PJPROJECT_CFLAGS variable
down to the pjproject configure scripts.  See the UserNote below for details.

* Updated ./third-party/pjproject/patches/config_site.h to allow the following
options to be overridden:
PJ_MAX_HOSTNAME, PJSIP_MAX_URL_SIZE, PJ_IOQUEUE_MAX_HANDLES.
Other options in config_site.h are not overridable because they can have a
bad effect on the overall operation of pjproject.  This may be revisited in
the future.  Options not already set in config_site.h can still be set.

* Fixed an issue where if the Linux `epoll` facility is used (which it is by
default) the default PJ_IOQUEUE_MAX_HANDLES and PJSIP_MAX_TRANSPORTS were
being left at 1024 instead of being icnreased to 5000.

* The `pjproject show buildopts` CLI command previously only showed options from
the top level `PJ` pjproject layer but now also shows many from the `PJSIP`
layer.  Many of these, such as PJSIP_MAX_TRANSPORTS, can be set using
PJPROJECT_CFLAGS provided they're not already unconditionally set in
config_site.h.

* The `pjsip dump endpt` CLI command previously required that the pjproject
log level be already set to at least 3 or no output would be produced.  The
command now does that automatically then sets it back to whatever it was.
This isn't strictly related to this PR but was just nagging me.

UserNote: Bundled pjproject: It's now possible to override some of the pjproject
build options contained in ./third-party/pjproject/patches/config_site.h by
adding PJPROJECT_CFLAGS to your Asterisk ./configure command line.  For example:
`./configure ... PJPROJECT_CFLAGS='-DPJ_OPT1=8192 -DPJ_OPT2=512'`
Any option in config_site.h that's wrapped in a `#ifndef` block can be overridden
and many of the `PJSIP` options displayed by `pjproject show buildopts` can be
set.  WARNING: Adjusting these options without understanding their effect can
cripple your Asterisk instances.  You shouldn't adjust them unless you need
to solve a specific issue.

Resolves: #2011
2026-07-07 15:56:55 +00:00
Joshua C. Colp ae1277e0f8 test_performance: Add performance experimentation test module.
This is a module which is only built when TEST_FRAMEWORK is enabled
and provides CLI commands for testing performance of certain things
on the system they are invoked on. The first CLI commands added
cover the most common container usage: storage of objects with a
lookup based on a string key. These commands take various arguments
and allow you to see how they perform. There is also an "all" command
named "performance test container_key_lookup_all" that will execute
all of these container tests and pass through the given arguments,
which makes it easy to run all of the tests for given usage.

To facilitate a vector bsearch test a new AST_VECTOR_BSEARCH macro
has been added that allows more efficient searching of sorted vectors.
2026-07-07 15:38:28 +00:00
Joshua C. Colp b749d4509b manager: Move away from shared linked list for events.
This change moves manager away from a shared linked list
for events to a per-session vector of pending events. This
allows early filtering of events which eliminates the need
to wake up threads for events that they have no interest in.

TCP based connections have also been moved to an alert pipe
based wakeup mechanism to reduce locking and simplify usage.

UserNote: The "manager show eventq" CLI command has been
removed as there is no longer a single event queue to display.
2026-07-07 15:36:17 +00:00
George Joseph 6d2e59c481 chan_websocket: Use leftover data if no frames are available when the timer fires.
When the 20ms channel timer fires but there are no frames available in
the queue, we now check for leftover data in the buffer and if there is
any, we create a frame with it and send it to the core. This resolves an
issue with the leftover data being delayed if a STOP_MEDIA_BUFFERING
command is delayed. Some existing comments were also clarified to
account for the new behavior.

Resolves: #2006
2026-07-02 18:06:22 +00:00
Mehrdad Seifzadeh 4f9e01cb8f res_pjsip_session: Bound delayed BYE behind UAC INVITE
When a confirmed session is being terminated while an outgoing in-dialog
INVITE transaction is still outstanding, the BYE is delayed until the
outstanding transaction terminates.

If that INVITE has already received a provisional response and the final
response is malformed and rejected before transaction processing, the
transaction can remain outstanding and the delayed BYE can keep the
session, media state, RTP instance, and PJPROJECT pools referenced after
the channels are gone.

When a BYE is delayed behind an outstanding UAC INVITE, set a PJPROJECT
transaction timeout on that INVITE so the delayed cleanup path has a
bounded wait. If PJPROJECT terminates the dialog as a result of the
timeout, discard the delayed BYE instead of sending a duplicate BYE.

Fixes: #1965
2026-07-01 18:53:17 +00:00
Sean Bright a729c5ae85 extensions.ael.sample: Restore removed macros
Commit e8f548c1 removed AEL `macro` definition and calls from the
sample configuration file, but those do not use the deprecated/removed
`Macro` app - they use `Gosub` under the hood.
2026-06-26 15:07:09 +00:00
Alexandre Fournier 444538939c format_cap: guard against NULL src in *_from_cap helpers
ast_format_cap_append_from_cap() and ast_format_cap_replace_from_cap()
dereference 'src' (src->preference_order) without checking it for NULL.

A dummy channel allocated with ast_dummy_channel_alloc() never sets a
native-format capability, so ast_channel_nativeformats() returns NULL on
such channels. When CHANNEL(audionativeformat) / CHANNEL(videonativeformat)
is evaluated against a dummy channel (e.g. via ARI channelvars during a
Stasis VarSet event raised while app_voicemail builds the notification
email on a dummy channel), func_channel_read() passes that NULL straight
into ast_format_cap_append_from_cap(), causing a NULL dereference at
offset 0x28 and a SIGSEGV.

Guard both helpers against a NULL source. A NULL source simply means
"no formats to copy", so appending/replacing nothing is the correct
no-op behaviour. This also protects all other callers.

Fixes https://github.com/asterisk/asterisk/issues/1992

AI disclosure: this was generated using Claude Opus 4.8, tested to fix the issue. Not sure if it is the *right* way to do it.
2026-06-25 23:39:39 +00:00
ThatTotallyRealMyth b02369135e ast_loggrabber: Install the ast_tsconvert.py script to a secure temp directory.
The ast_tsconvert.py script called by ast_loggrabber is now installed in a
temporary directory that isn't world readable or writable.

Resolves: #GHSA-xgj6-2gc5-5x9c
2026-06-25 08:22:20 -06:00
George Joseph 8b71fe8b16 chan_unistim.c: Prevent overrun of phone_number field.
Add a check to key_dial_page() to ensure that dialed digits won't overrun
the phone_number field.

Resolves: #GHSA-3g56-cgrh-95p5
2026-06-25 08:22:20 -06:00
Mike Bradeen d5982c2fe2 ooh323c: not checking for IE minimum length
When decoding q.931 encoded calling/called number
now checking for length being less than minimum required.

Resolves: #GHSA-h5hv-jmgj-92q2
2026-06-25 08:22:20 -06:00
George Joseph 1088d0ecca res_ari: Ensure read-only users are properly authorized via REST Over WebSocket.
The REST over WebSocket path now properly prevents non-GET methods from
being executed on inbound WebSockets.

* The query parameters from the original incoming GET request that caused the
upgrade to WebSocket are now passed to all REST requests that come from the
client. This ensures that if the client authenticated with a read-only
userid using the "api_key" query_string parameter, REST requests coming
in over the WebSocket will only be able to execute GETs on resources.
The HTTP headers were already passed to the REST requests so if the
client had authenticated via an "Authorization" it was properly handled.

* New tests have been added to test_ari.c to check that read-only users
are properly denied access to resources using non-GET methods.  Several
memory leaks were also squashed.

Resolves: #GHSA-wcvv-g26m-wx5c
2026-06-25 08:22:20 -06:00
George Joseph 1b2503fbed pjsip_message_filter: Use pj_strdup instead of pj_strassign to save local address.
The filter_on_tx_message() function was using pj_strassign() to save the pointer
of the pjproject transport local address to a local pj_str_t variable.  That
variable was ultimately used to set the Contact header's uri->host and the SDP
connection attribute's address again using pj_strassign.  pj_strassign() doesn't
copy the actual value of the pj_str_t however, it just copies the pointer so
if a connection-oriented transport is disconnected before the 200 OK with the
SDP is sent, those pointers will be invalid which can cause use-after-free
issues. To prevent this, filter_on_tx_message() now uses pj_strdup with the
tdata->pool as the backing store to save the local IP address to the local
variable.  pj_strassign() can then be used safely later on since the tdata
will be available for the life of the transaction.

Resolves: #GHSA-g8q2-p36q-94f6
2026-06-25 08:22:20 -06:00
George Joseph 066bd8646c ooh323c/ooq931.c: Ensure ooQ931Decode doesn't run out-of-bounds.
Several bounds checks have been edded to ooQ931Decode to prevent it from
running past the end of the data buffer when parsing information elements.

Resolves: #GHSA-746q-794h-cc7f
2026-06-25 08:22:20 -06:00
George Joseph 3d5672c90d ARI: Make ARI applications respect live_dangerously.
DeveloperNote: ARI applications can no longer call "dangerous" dialplan
functions like DB(), FILE(), SHELL(), CURL(), STAT(), etc. without
enabling "live_dangerously" in asterisk.conf.

Resolves: #GHSA-vrfp-mg3q-3959
2026-06-25 08:22:20 -06:00
George Joseph 65491cea8c res_rtp_asterisk.c: Address 2 potential T.140 RED buffer overruns.
* Add check to red_t140_to_red() to ensure that the new primary payload
can't cause the rtp_red->len array items to wrap or cause an overrun of
the rtp_red->t140red_data buffer.

* Add check to rtp_red_buffer() to ensure that a T.140 frame to be sent
can't cause rtp_red->len array items to wrap or cause an overrun of
the rtp_red->buf_data buffer.

Resolves: #GHSA-vfhr-r9x9-c687
Resolves: #GHSA-j2mm-57pq-jh94
2026-06-25 08:22:20 -06:00
Roberto Paleari 3779ed3346 res/res_pjsip_pubsub.c: Fix buffer over-read in MWI body parser
Add constraint checks to prevent unauthenticated users from crashing Asterisk
instance by sending a crafted inbound SIP NOTIFY request with "Content-Type:
application/simple-message-summary".

Resolves: #GHSA-8jw3-ccr9-xrmf
2026-06-25 08:22:20 -06:00
Mike Bradeen b64a721ac4 manager: Use remote address in user error logging
To avoid a potential null dereference use the remote address
in error logging when there is no user or the user acl fails.

Resolves: #GHSA-3rhj-hhw7-m6fw
2026-06-25 08:22:20 -06:00
Mike Bradeen 2317e28bdf ooh323: Prevent potential buffer overflow in trace logging
Replace a call to vsprintf with a call to ast_vasprintf to
prevent a possible buffer overflow.

Resolves: #GHSA-x348-j6c9-77f3
2026-06-25 08:22:20 -06:00
Pengpeng Hou d3c03f7a72 app_sms: Bound protocol 1 SMS unpacking to fixed-size buffers
The protocol 1 unpack helpers trusted externally controlled lengths and wrote
 them directly into fixed-size buffers in sms_t. Clamp the address, header,
 and body copies to the destination array sizes so malformed messages cannot
 overwrite adjacent state.

Resolves: #GHSA-q9fr-m7g8-6ph5
2026-06-25 08:22:20 -06:00
Milan Kyselica d6671e052c res_xmpp: Fix stack buffer overflow in namespace prefix handling
The snprintf size parameter in xmpp_action_hook() is computed from
the attacker-controlled namespace prefix length and is not bounded
by the 256-byte stack buffer size. When a remote XMPP peer sends a
stanza with a child element whose namespace prefix exceeds 249
characters, snprintf writes past the buffer boundary.

Use sizeof(attr) as the snprintf size limit and %.*s precision to
extract only the prefix portion of the element name, preserving
the original truncation behavior for valid inputs.

Resolves: #GHSA-mxgm-8c6f-5p8f
2026-06-25 08:22:20 -06:00
Milan Kyselica bb35a89b19 res_pjsip_pubsub: Add width limit to sscanf in MWI NOTIFY parser
The parse_simple_message_summary() function uses sscanf with an
unbounded %s format specifier to parse the Message-Account field
from incoming SIP NOTIFY bodies into a fixed-size 512-byte stack
buffer (PJSIP_MAX_URL_SIZE). A single unauthenticated SIP NOTIFY
with a Message-Account value exceeding 512 bytes overflows the
buffer, corrupting adjacent stack data and permanently disabling
the PJSIP transport layer without crashing the process.

Add a width specifier (%511s) to limit the sscanf write to
PJSIP_MAX_URL_SIZE - 1 bytes plus the NUL terminator, matching
the destination buffer size.

Resolves: #GHSA-589g-qgf8-m6mx
2026-06-25 08:22:20 -06:00
Milan Kyselica 6e0adb8ff4 res_config_ldap: Escape LDAP filter values per RFC 4515
The LDAP realtime driver constructs search filters by directly
concatenating user-supplied values without RFC 4515 escaping.
When LDAP is used as a realtime backend for endpoint
identification, characters with special meaning in LDAP filters
(*, (, ), \) can be injected via the SIP From header username.

Add ldap_filter_escape_value() that escapes RFC 4515 special
characters to their \HH hex representation, and apply it to
non-LIKE query values. The LIKE query path preserves the existing
wildcard conversion behavior with a note for maintainers.

Resolves: #GHSA-r6c2-hwc2-j4mp
2026-06-25 08:22:20 -06:00
Milan Kyselica 97f0aac7df cel_pgsql, cel_tds: Escape eventtype field to prevent SQL injection
The eventtype column handler in cel_pgsql.c inserts
record.user_defined_name directly into the SQL query without
calling PQescapeStringConn(), while all other string fields in
the same function are properly escaped. Similarly, cel_tds.c
passes the raw user_defined_name into the SQL INSERT without
routing it through anti_injection(), while all other fields are
processed through that function.

For cel_pgsql.c, escape the eventtype value using
PQescapeStringConn(), matching the existing pattern used for all
other string fields at lines 308-331 of the same function.

For cel_tds.c, route the eventtype value through
anti_injection() consistent with how all other fields are handled
in the same function.

Resolves: #GHSA-ph27-3m5q-mj5m
2026-06-25 08:22:20 -06:00
Milan Kyselica a846b9a012 http: Escape error page text to prevent reflected XSS
The text parameter in ast_http_create_response() is inserted into
the HTML body without escaping, while the server name on the same
page is properly escaped via ast_xml_escape(). When res_phoneprov
passes the decoded request URI as the text of a 404 response, HTML
metacharacters in the URI are rendered by the browser.

Apply ast_xml_escape() to the text parameter before inserting it
into the HTML template, using the same function already used for
the server name.

Resolves: #GHSA-4pgv-j3mr-3rcp
2026-06-25 08:22:20 -06:00
Milan Kyselica e8c9782fb3 codec_codec2: Only process complete Codec2 frames in decoder
The codec2_samples() function uses floor division (160 * datalen/6)
to compute expected output samples, but the decode loop condition
(x < datalen) iterates with ceiling behavior when datalen is not a
multiple of CODEC2_FRAME_LEN. This mismatch causes the loop to
decode one extra frame beyond what the framework bounds check
budgeted for, leading to an out-of-bounds write on the output buffer.

Change the loop condition to only process complete frames, matching
the floor-division behavior of codec2_samples(). This also prevents
an out-of-bounds read on the input side when fewer than
CODEC2_FRAME_LEN bytes remain.

Resolves: #GHSA-qf8j-jp7h-c5hx
2026-06-25 08:22:20 -06:00
Milan Kyselica 7e7ff21ec6 format_ogg_speex: Add bounds check to prevent heap buffer overflow
The ogg_speex_read() function copies OGG packet data via memcpy()
without validating the packet size against the destination buffer
(BUF_SIZE = 200 bytes). A crafted .spx file with an oversized OGG
audio packet causes a heap buffer overflow that corrupts the
adjacent speex_desc structure containing libogg heap pointers,
leading to a crash (SIGSEGV) on playback.

Add a bounds check for both negative and oversized values before
the memcpy, consistent with how format_ogg_vorbis bounds its reads
via ov_read().

Resolves: #GHSA-8jhw-m2hg-vp3h
2026-06-25 08:22:20 -06:00
Sean Bright 6beea54638 configs: Comment out values setting to avoid parse error
Fixes the following after a `make samples`:

```
config.c:2281 process_text_line: parse error: No category context for line 64 of ...
```
2026-06-24 14:49:45 +00:00
Mike Bradeen 4ed0a1cd67 app_mixmonitor: Fix duplex recording for non 8K codecs
The native sampling of duplex recording is set to match the raw 8K
output format. If one or more of the streams being recorded is above
8K, the frame size coming into the mixmonitor is too large and needs
to be translated to 8K before being mixed into the stereo frame to
avoid garbled and mistimed audio

Fixes: #1779
2026-06-16 14:19:01 +00:00
George Joseph 169ca3e491 res_http_websocket: Add timeout to client handshakes.
The websocket client proxy and server handshakes use ast_iostream_gets which
are blocking calls.  If the outgoing connection succeeds at the TCP or TLS
layer but the proxy (if configured) or the websocket server fails to respond
to the CONNECT or GET requests, the process can hang indefinitely and escalate
to a deadlock.  To address this, the handshakes are now guarded with calls to
ast_iostream_set_timeout_sequence() with the timeout set to the client's
(connection_timeout * 2) milliseconds.

In order to use ast_iostream_set_timeout_sequence(), the iostream has to be
set to non-blocking with ast_iostream_nonblock() but there was no way to
reset the stream back to blocking mode so a new API ast_iostream_blocking()
was added for it.

Tracing was also enabled in the websocket_client_handshake function for
future troubleshooting.

Resolves: #1979
2026-06-16 14:17:41 +00:00
Joshua C. Colp a1ffcfe37d extension_state: Add new extension state API.
Extension state to this point has been an API implemented
inside the PBX core resulting in its state being intermingled
with that of the dialplan. This increased the complexity of
the PBX core and made it difficult to enact improvements.

This change adds a new separate extension state API
which receives updates from the PBX core as configuration
changes but maintains its own separate state. The API is
also written to fully take advantage of modern APIs in a
more selective manner by subscribing each extension state to
only the devices it is interested in, ultimately reducing
resource consumption during updates. Presence state updates
being infrequently done use a single shared subscription that
goes through the extension states to find and update ones
that the update is applicable to.

Legacy API support is provided by reimplementing the API
as wrappers over the new extension state API. This improves
the legacy API by making it multithreaded, with each callback
being individually subscribed.

Autohints support is maintained but has been separated out
into a self contained new implementation.

Synchronous subscription support has also been added to
Stasis to remove the overhead of asynchronous publishing when
the handling of published messages is small and fast.
2026-06-11 18:30:55 +00:00
Alexis Chenard e45da15315 res_pjsip: Add external_signaling_hostname transport option
Adds a new transport option 'external_signaling_hostname' which allows
a hostname or FQDN to be used in SIP Contact and Via headers instead of
the automatically determined IP address. This is useful when a remote
SIP endpoint requires a fully qualified domain name in these headers.

The option is mutually exclusive with 'external_signaling_address' and
an error is raised at transport load time if both are set simultaneously.

Resolves: #1749

UserNote: A new pjsip.conf transport option 'external_signaling_hostname'
has been added. When set, this value will be used in SIP Contact and Via
headers instead of the automatically determined IP address. This option
is mutually exclusive with 'external_signaling_address'.
2026-06-09 14:57:19 +00:00
George Joseph 8e3e3735ff WebSocket Enhancements: Proxies and Keepalives for ARI and Media Outbound Websockets.
See the notes below for high-level descriptions of the new features.

* Proxies

Outbound/forward HTTP proxies are now supported and configurable in
websocket_client.conf. You can specify a host:port plus optional proxy_username
and proxy_password. Because WebSockets aren't consistently supported among
proxies (specifically passing through UPGRADEs), the CONNECT method is always
used to establish a TCP tunnel through the proxy. This is required if a TLS
session is to be established with the WebSocket server anyway.  It's important
to understand that that negotiation with the proxy is ALWAYS unsecured. Once
the proxy establishes the tunnel, the TLS session will be negotiated directly
with the remote WebSocket server via the tunnel.

* Keepalives

Both TCP-level and WebSocket PING/PONG keepalives can be configured and are
available with either the curl or tcptls client implementations. The TCP
keepalives are handled entirely by the operating system and require no
resources from Asterisk but by their very nature, they can't traverse proxies.
WebSocket PING/PONGs are implemented in the Asterisk websocket code and require
a scheduler thread to keep track of them so they're a bit more complicated but
they do traverse proxies.  Which one is used is completely up to the admin.
You could use both.

* Other Changes

A few changes were needed to res/ari/ari_websockets and
res/res_aeap/transport_websocket to add explicit calls to ast_websocket_close.
They had been assuming that the websocket session destructor would close the
websocket when it unreffed it but the keepalive process now holds a reference
so the destructor wouldn't actually run without the call to ast_websocket_close
to stop the keepalives.

A few new methods were added to tcptls.c to allow switching an existing
connection from unsecured to TLS.  These were required because the initial
connection and handshake with a proxy is always unsecured but then needs
to be switched to TLS if required for the remote WebSocket server.

There was a bug in sorcery.h where the ast_sorcery_register_uint macro
was referencing _stringify (which doesn't exist) instead of _sorcery_stringify.

Resolves: #1881
Resolves: #1933

UserNote: Forward/outbound proxies can now be specified for outbound websockets.
See the websocket_client.conf.sample file for configuration information.

UserNote: TCP-level or WebSocket PING/PONG keepalives can now be enabled on
outbound websockets.  They can help detect network failures even when a
persistent connection is idle. See the websocket_client.conf.sample
file for configuration information.

DeveloperNote: The addition of the proxy and keepalive configuration parameters
pushed the websocket client parameter count over 32. This necessitated changing
the size of the ast_ws_client_fields enum from a 32 bit bitfield to a 64-bit
bitfield with a corresponding change to the ast_websocket_client structure.
2026-06-09 14:22:57 +00:00
Naveen Albert ee9edaf2d2 chan_local: Update chan_local references for Local channels.
chan_local no longer exists since Local channels are built into the
core (core_local), but there are still comments which reference it,
including in the configs. Update these to avoid confusion.

Resolves: #1849
2026-06-05 14:37:19 +00:00
George Joseph 8c575be596 res_ari: Add res_ari_model as an optional_module.
Under certain timing/load conditions, res_ari_model may not load until after
res_ari on startup or it might unload before res_ari on shutdown. This can
cause a segfault when DEVMODE is enabled and there are persistent outbound
websocket connections because DEVMODE forces validation of outgoing events
against the models.  To prevent this, res_ari_model has been added as an
"optional_module" to res_ari's NODULE_INFO.  This will enforce load/unload
order but not make res_ari dependent on res_ari_model.  However, if
Asterisk is configured with --enable-dev-mode, res_ari will fail to
load if res_ari_model isn't available.

Resolves: #1970
2026-06-04 12:32:56 +00:00
Mike Bradeen a03952428b res ari: Add attachable states to Channels and Bridges
Adds the ability to attach multiple states to both Channels and Bridges in the form
of variables that are included in all events on the associated object.

First, this adds an optional boolean field to channel variables 'report_events'
that causes the variable to automatically be included in all events on that channel.

To allow this, variables can now be either name value pairs (the current format):
`<variable_name>: '<value_string>'`
 - or -
`<variable_name>: {value: '<value_string>', report_events: [true|false]}`

If the old format is used or 'report_events' is not included, it will default to
false and retain current behavior.

Second, this extends both reported and unreported variables to Bridges so they too
may have stateful information.

Resolves: #1910

UserNote: Bridge variables now can be set and retrieved via the following paths:
`/bridges/{bridgeId}/variable`
`/bridges/{bridgeId}/variables`
Both Bridge and Channel variables can now be set with an optional 'report_events'
boolean flag that will cause those variables to be included on all events on that
object. The 'report_events' flag will default to False if not set to maintain
backwards capability.
To allow this, variables can now be either name value pairs (the current format):
`<variable_name>: '<value_string>'`
 - or -
`<variable_name>: {value: '<value_string>', report_events: [true|false]}`
2026-06-03 22:54:42 +00:00
Ben Ford 080ce60991 ARI: Added paths to get and set multiple channel variables.
Two new paths exist for ARI to get and set multiple channel variables at
the same time. This is done via GET and POST like the single get and set
variable equivalents. Leading and trailing whitespace will be stripped
from the variable names for both paths. When setting variables, the
values will be read as-is, whitespace included. GET takes in a single
string with comma-separated values, while POST takes in a dictionary of
key value pairs. The code follows the same paths as when setting
multiple variables when originating a channel via ARI.

UserNote: Added new ARI paths for getting and setting multiple channel
variables at a time. For GET, this takes in a single string of
comma-separated variable names, while POST takes in a dictionary of key
value pairs. The behavior is the same as passing in variables when
originating a channel.
2026-06-03 22:54:41 +00:00
Bernd Kuhls 13a753c71b res_stir_shaken: avoid direct ASN1_STRING accesses
https://github.com/openssl/openssl/issues/29117

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>

Resolves: #1952
2026-06-02 16:15:29 +00:00
Bernd Kuhls 0c6768e97d tcptls.c: fix build with OpenSSL 4
tcptls.c: In function '__ssl_setup':
tcptls.c:417:52: error: implicit declaration of function 'SSLv3_client_method';
 did you mean 'SSLv23_client_method'? [-Wimplicit-function-declaration]
  417 |                         cfg->ssl_ctx = SSL_CTX_new(SSLv3_client_method());

SSLv3_client_method was removed from OpenSSL 4.0.0:
https://github.com/openssl/openssl/blob/openssl-4.0.0/doc/man7/ossl-removed-api.pod?plain=1#L440

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>

Resolves: #1952
2026-06-02 16:15:29 +00:00
mikhail_grishak 3e6231cd0f res_calendar: Fix build with libical 4.X
libical 4.0 removed the icaltime_add() function in favor of icaltime_adjust(). Additionally, the callback signature for icalcomponent_foreach_recurrence() was updated to use a const pointer for the icaltime_span argument.

This commit adds conditional compilation using ICAL_MAJOR_VERSION to support both libical 3.X and the new 4.X API, ensuring backward compatibility.

Fixes: #1957
2026-06-01 16:41:05 +00:00
UpBeta b895e31ccd app_record: Fix hangup handling during beep playback
When a hangup occurs while app_record is playing the initial beep,
the application does not detect the hangup and continues running
until the maxduration timeout expires.

Replace the manual ast_streamfile() + ast_waitstream() sequence with
ast_stream_and_wait(), which properly detects hangup and returns
non-zero, allowing the application to exit immediately with
RECORD_STATUS set to HANGUP.

Resolves: #1950
2026-06-01 16:40:25 +00:00
smtcbn f6823c22da odbc: Don't use prepared statements for distinct SQL statements
Avoids unnecessary prepare for simple INSERT statements that cause
issues with ProxySQL (prepared statement counter overflow).

Resolves: #1217
2026-06-01 16:10:26 +00:00