]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
39 hours agochan_websocket: Use leftover data if no frames are available when the timer fires. master
George Joseph [Mon, 29 Jun 2026 20:12:33 +0000 (14:12 -0600)] 
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

2 days agores_pjsip_session: Bound delayed BYE behind UAC INVITE
Mehrdad Seifzadeh [Sat, 6 Jun 2026 10:08:43 +0000 (13:38 +0330)] 
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
7 days agoextensions.ael.sample: Restore removed macros
Sean Bright [Wed, 24 Jun 2026 20:22:46 +0000 (20:22 +0000)] 
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.

8 days agoformat_cap: guard against NULL src in *_from_cap helpers
Alexandre Fournier [Tue, 23 Jun 2026 15:28:11 +0000 (11:28 -0400)] 
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.

8 days agoast_loggrabber: Install the ast_tsconvert.py script to a secure temp directory.
ThatTotallyRealMyth [Wed, 18 Mar 2026 22:40:57 +0000 (09:40 +1100)] 
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

8 days agochan_unistim.c: Prevent overrun of phone_number field.
George Joseph [Mon, 15 Jun 2026 13:41:10 +0000 (07:41 -0600)] 
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

8 days agoooh323c: not checking for IE minimum length
Mike Bradeen [Mon, 6 Jun 2022 23:11:30 +0000 (17:11 -0600)] 
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

8 days agores_ari: Ensure read-only users are properly authorized via REST Over WebSocket.
George Joseph [Fri, 12 Jun 2026 20:23:22 +0000 (14:23 -0600)] 
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

8 days agopjsip_message_filter: Use pj_strdup instead of pj_strassign to save local address.
George Joseph [Wed, 10 Jun 2026 23:07:07 +0000 (17:07 -0600)] 
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

8 days agoooh323c/ooq931.c: Ensure ooQ931Decode doesn't run out-of-bounds.
George Joseph [Tue, 2 Jun 2026 16:38:59 +0000 (10:38 -0600)] 
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

8 days agoARI: Make ARI applications respect live_dangerously.
George Joseph [Thu, 21 May 2026 13:55:01 +0000 (07:55 -0600)] 
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

8 days agores_rtp_asterisk.c: Address 2 potential T.140 RED buffer overruns.
George Joseph [Mon, 27 Apr 2026 14:29:29 +0000 (08:29 -0600)] 
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

8 days agores/res_pjsip_pubsub.c: Fix buffer over-read in MWI body parser
Roberto Paleari [Wed, 29 Apr 2026 12:18:31 +0000 (14:18 +0200)] 
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

8 days agomanager: Use remote address in user error logging
Mike Bradeen [Mon, 30 Mar 2026 23:17:10 +0000 (17:17 -0600)] 
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

8 days agoooh323: Prevent potential buffer overflow in trace logging
Mike Bradeen [Tue, 31 Mar 2026 17:41:10 +0000 (11:41 -0600)] 
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

8 days agoapp_sms: Bound protocol 1 SMS unpacking to fixed-size buffers
Pengpeng Hou [Wed, 1 Apr 2026 12:20:10 +0000 (20:20 +0800)] 
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

8 days agores_xmpp: Fix stack buffer overflow in namespace prefix handling
Milan Kyselica [Thu, 26 Mar 2026 14:48:28 +0000 (15:48 +0100)] 
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

8 days agores_pjsip_pubsub: Add width limit to sscanf in MWI NOTIFY parser
Milan Kyselica [Tue, 24 Mar 2026 18:22:02 +0000 (19:22 +0100)] 
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

8 days agores_config_ldap: Escape LDAP filter values per RFC 4515
Milan Kyselica [Mon, 23 Mar 2026 14:20:27 +0000 (15:20 +0100)] 
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

8 days agocel_pgsql, cel_tds: Escape eventtype field to prevent SQL injection
Milan Kyselica [Mon, 23 Mar 2026 14:18:48 +0000 (15:18 +0100)] 
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

8 days agohttp: Escape error page text to prevent reflected XSS
Milan Kyselica [Wed, 8 Apr 2026 18:02:19 +0000 (20:02 +0200)] 
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

8 days agocodec_codec2: Only process complete Codec2 frames in decoder
Milan Kyselica [Wed, 8 Apr 2026 16:29:30 +0000 (18:29 +0200)] 
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

8 days agoformat_ogg_speex: Add bounds check to prevent heap buffer overflow
Milan Kyselica [Mon, 23 Mar 2026 14:15:18 +0000 (15:15 +0100)] 
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

9 days agoconfigs: Comment out `values` setting to avoid parse error
Sean Bright [Tue, 23 Jun 2026 18:19:51 +0000 (18:19 +0000)] 
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 ...
```

2 weeks agoapp_mixmonitor: Fix duplex recording for non 8K codecs
Mike Bradeen [Wed, 10 Jun 2026 17:00:17 +0000 (11:00 -0600)] 
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
2 weeks agores_http_websocket: Add timeout to client handshakes.
George Joseph [Tue, 9 Jun 2026 15:29:35 +0000 (09:29 -0600)] 
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

3 weeks agoextension_state: Add new extension state API.
Joshua C. Colp [Tue, 10 Feb 2026 21:42:50 +0000 (17:42 -0400)] 
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.

3 weeks agores_pjsip: Add external_signaling_hostname transport option
Alexis Chenard [Mon, 1 Jun 2026 20:38:28 +0000 (20:38 +0000)] 
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'.

3 weeks agoWebSocket Enhancements: Proxies and Keepalives for ARI and Media Outbound Websockets.
George Joseph [Tue, 12 May 2026 22:04:03 +0000 (16:04 -0600)] 
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.

4 weeks agochan_local: Update chan_local references for Local channels.
Naveen Albert [Wed, 1 Apr 2026 19:50:03 +0000 (15:50 -0400)] 
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

4 weeks agores_ari: Add res_ari_model as an optional_module.
George Joseph [Wed, 3 Jun 2026 20:13:39 +0000 (14:13 -0600)] 
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

4 weeks agores ari: Add attachable states to Channels and Bridges
Mike Bradeen [Tue, 31 Mar 2026 16:56:51 +0000 (10:56 -0600)] 
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]}`

4 weeks agoARI: Added paths to get and set multiple channel variables.
Ben Ford [Wed, 15 Apr 2026 17:09:29 +0000 (12:09 -0500)] 
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.

4 weeks agores_stir_shaken: avoid direct ASN1_STRING accesses
Bernd Kuhls [Sat, 2 May 2026 12:20:05 +0000 (14:20 +0200)] 
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

4 weeks agotcptls.c: fix build with OpenSSL 4
Bernd Kuhls [Sat, 2 May 2026 12:08:41 +0000 (14:08 +0200)] 
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

4 weeks agores_calendar: Fix build with libical 4.X
mikhail_grishak [Tue, 26 May 2026 18:04:06 +0000 (21:04 +0300)] 
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
4 weeks agoapp_record: Fix hangup handling during beep playback
UpBeta [Sat, 23 May 2026 21:00:53 +0000 (21:00 +0000)] 
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

4 weeks agoodbc: Don't use prepared statements for distinct SQL statements
smtcbn [Fri, 25 Apr 2025 12:29:18 +0000 (15:29 +0300)] 
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

4 weeks agoabstract_jb.c: Remove timerfd from channel when disabling jitter buffer
Alexander Bakker [Wed, 20 May 2026 19:32:36 +0000 (21:32 +0200)] 
abstract_jb.c: Remove timerfd from channel when disabling jitter buffer

Previously, the lingering timerfd would cause a tight loop if the
channel enters a BridgeWait after the jitter buffer was disabled.

Fixes: #1762
4 weeks agores_pjsip: Don't allow a leading period when wildcard matching
Sean Bright [Tue, 26 May 2026 14:05:48 +0000 (14:05 +0000)] 
res_pjsip: Don't allow a leading period when wildcard matching

The reference identifier (what the client provides - in this case a
hostname) must start with a domain label, not a `.`.

The current implementation will match `.seanbright.com` against
`*.seanbright.com` which is incorrect.

4 weeks agoEnsure channel locks aren't held while calling ast_set_variables.
George Joseph [Wed, 20 May 2026 15:47:00 +0000 (09:47 -0600)] 
Ensure channel locks aren't held while calling ast_set_variables.

If the channel is locked when calling ast_set_variables and any of the
variables contained dialplan functions, there's a possiblilty of a deadlock.
To prevent this, either the explicit locks were removed or the call to
ast_set_variables moved out of the lock scope.  A warning to not hold
channel locks is also added to the documentation for ast_set_variables.

Resolves: #1936

4 weeks agoapp_queue: fix double increment of member->calls with shared_lastcall
smtcbn [Fri, 23 Jan 2026 14:31:44 +0000 (17:31 +0300)] 
app_queue: fix double increment of member->calls with shared_lastcall

Under high concurrency, update_queue() may be invoked multiple times
for the same call, causing member->calls and queue-level counters to
be incremented more than once.

The existing starttime check is not atomic and allows concurrent
execution paths to pass. Treat member->starttime as a single-use token
and consume it via CAS to ensure the call is counted exactly once.

This also prevents incorrect call distribution when using strategies
such as fewestcalls.

Observed as a regression after upgrading to 20.17.

Resolves: #1736

4 weeks agochan_dahdi: Fix set but not used in mfcr2_show_links_of().
George Joseph [Thu, 21 May 2026 19:20:11 +0000 (13:20 -0600)] 
chan_dahdi: Fix set but not used in mfcr2_show_links_of().

When openr2 is installed mfcr2_show_links_of() is no longer ifdeffed out
which makes gcc-16 complain with 'variable â€˜x’ set but not used'.

Resolves: #1947

6 weeks agotests: add tests/test_codec_translations.c
Sebastian Jennen [Fri, 6 Mar 2026 08:07:41 +0000 (09:07 +0100)] 
tests: add tests/test_codec_translations.c

This tests checks [slin -> codec -> slin] and then compares slin in vs out
regarding signal noise ratio and delay.

Near-lossless codecs (ulaw, alaw) are checked with a maximum per-sample
error bound.  Lossy codecs are checked with a per-codec SNR threshold.
Cross-correlation alignment compensates for algorithmic delay in codecs
like speex and opus.

Covered codecs: ulaw, alaw, adpcm, g726, g726aal2, gsm, speex,
speex16, speex32, ilbc, codec2, lpc10, g722, opus.

Resolves: #1812

6 weeks agoinstall_prereq: Add a 'minimal' mode for basic build dependencies
Sean Bright [Wed, 20 May 2026 19:10:36 +0000 (19:10 +0000)] 
install_prereq: Add a 'minimal' mode for basic build dependencies

6 weeks agochan_websocket: Handle incoming CONTINUATION frames.
George Joseph [Wed, 20 May 2026 15:16:48 +0000 (09:16 -0600)] 
chan_websocket: Handle incoming CONTINUATION frames.

chan_websocket now tells res_http_websocket to accumulate incoming CONTINUATION
frames into 1024 byte TEXT or BINARY frames.

Resolves: #1941

6 weeks agores_rtp_asterisk: Fix incorrect reference in ast_rtp_get_stat().
George Joseph [Tue, 19 May 2026 20:50:45 +0000 (14:50 -0600)] 
res_rtp_asterisk: Fix incorrect reference in ast_rtp_get_stat().

```
AST_RTP_STAT_SET(AST_RTP_INSTANCE_STAT_LOCAL_STDEVMES, \
AST_RTP_INSTANCE_STAT_COMBINED_MES, stats->local_stdevmes, \
rtp->rtcp->stdev_rxjitter);
```

Should have been

```
AST_RTP_STAT_SET(AST_RTP_INSTANCE_STAT_LOCAL_STDEVMES, \
AST_RTP_INSTANCE_STAT_COMBINED_MES, stats->local_stdevmes, \
rtp->rtcp->stdev_rxmes);
```

Note the last macro parameter name.

Resolves: #1938

6 weeks agojansson: Upgrade version to jansson 2.15.0
Stanislav Abramenkov [Wed, 13 May 2026 15:40:08 +0000 (18:40 +0300)] 
jansson: Upgrade version to jansson 2.15.0

UpgradeNote: jansson has been upgraded to 2.15.0. For more
information visit jansson Github page: https://github.com/akheron/jansson/releases/tag/v2.15.0

Resolves: #1931

6 weeks agochannel.c: Move setting RTP stats from ast_softhangup to ast_ari_channels_hangup.
George Joseph [Wed, 13 May 2026 00:30:04 +0000 (18:30 -0600)] 
channel.c: Move setting RTP stats from ast_softhangup to ast_ari_channels_hangup.

The original trigger for setting the RTP stats in ast_softhangup() came from
an ARI issue where stats weren't being set in time to be reported on STASIS_END
events. The thought was that setting them in a common place like ast_softhangup()
would ensure the stats were set in possibly other scenarios.  Unfortunately,
setting the RTP stats variables in ast_softhangup() broke ABI as it required
that no channel locks be held which was not the case earlier.

Given that the original issue was ARI, we can move setting the stats to
ast_ari_channels_hangup() in resource_channels just before it calls
ast_softhangup().  This might not catch all cases of the stats not being set,
but it won't break ABI or deadlock either.

Resolves: #1928

6 weeks agores_rtp_asterisk: Add option to control stun host resolution when TTL = 0
George Joseph [Tue, 5 May 2026 20:01:38 +0000 (14:01 -0600)] 
res_rtp_asterisk: Add option to control stun host resolution when TTL = 0

If a hostname is specified for stunaddr in rtp.conf, periodic DNS resolution
is enabled based on the TTL returned in the DNS results.  If the TTL returned
is 0, it means that the next time the IP address is needed, it must be
looked up again.  I.E.  Don't cache.  Historically (and incorrectly) however,
res_rtp_asterisk stopped the periodic resolution and never re-resolved the
hostname again.

Besides what's mentioned in the user notes...
* Additional debugging was added in various STUN/DNS functions.
* The `rtp show settings` CLI command shows more detailed STUN info.
* Some debugging was added to dns_core.c and dns_recurring.c.

UserNote: A new `stunaddr_reresolve_ttl_0` parameter has been added to rtp.conf
that allows control over what happens when a STUN server hostname lookup
returns a TTL of 0.  The values can be set as follows:
- 'no': This is the historical (and current default) behavior of not doing
any further lookups and continuing to use the last successful result until
Asterisk is restarted or rtp.conf is reloaded.
- 'yes': Use the last cached result for the current call but trigger
re-resolution in the background for the benefit of future calls.
If the result of the background lookup is a ttl > 0, periodic resolution
will be restarted otherwise the next call will use the new cached value
and will trigger a background lookup again.

UserNote: A new CLI command `rtp resolve stun hostname` has been added
that will force a resolution of the STUN hostname and (re)start periodic
resolution if the result has a TTL > 0.

Resolves: #1858

6 weeks agopjsip_configuration: Show actual dtls_verify config.
Jaco Kroon [Thu, 7 May 2026 21:07:32 +0000 (23:07 +0200)] 
pjsip_configuration: Show actual dtls_verify config.

Rather than merely showing

dtls_verify : Yes/No

in pjsip show endpoint xxx it will now be shown what exactly is being
checked, ie, one of:

dtls_verify : No
dtls_verify : Fingerprint
dtls_verify : Certificate
dtls_verify : Yes

Where Yes implies both Fingerprint and Certificate.

Signed-off-by: Jaco Kroon <jaco@uls.co.za>
7 weeks agoapp_dial: Properly handle callee hangup while sending digits.
Naveen Albert [Wed, 6 May 2026 01:52:18 +0000 (21:52 -0400)] 
app_dial: Properly handle callee hangup while sending digits.

If we are sending digits (either DTMF, MF, or SF) to the called channel
after receiving progress or a wink, and the callee hangs up before we
have finished sending it digits, there are several problems that can ensue:

* If the callee hung up without answering, the calling channel would
  hang up and not continue in the dialplan.
* If the callee *did* answer before hanging up, the answer was never
  passed through to the caller, since this gets "eaten" by the various
  digit streaming functions and is never processed by app_dial.

This is generally an edge case that occurs due to some kind of signaling
failure, but to better handle this:

* Set to_answer to 0 to prevent hangup on the exit path, just like other
  parts of wait_for_answer.
* Better document this usage of to_answer.
* If the channel did answer while it was receiving digits, manually
  answer the calling channel before we abort. The call would not continue
  in the dialplan anyways (either before or after this fix), but technically
  the call was answered, so the CDRs should probably reflect that, and this
  mirrors the behavior of calls which normally do not continue.

Resolves: #1915

UserNote: If a called channel sends progress or wink and the caller begins
sending digits but the callee answers and then hangs up before digit
sending can finish, the call is now answered before being disconnected.
If the callee hangs up without answering, the call now continues in
the dialplan.

7 weeks agores_pjsip_messaging: Update To URI only if it is a SIP(S) URI
Maximilian Fridrich [Thu, 7 May 2026 06:53:28 +0000 (08:53 +0200)] 
res_pjsip_messaging: Update To URI only if it is a SIP(S) URI

When a message is sent via ARI, the ARI endpoint only provides a To
field which is also used as destination field. This means that the To
field might not necessarily contain a SIP URI but might instead specify
an Asterisk endpoint (in MessageDestinationInfo format). This led to
many warnings even though the message was sent correctly.

The fix is to only call `ast_sip_update_to_uri` if the To field starts
with the sip: or sips: scheme.

Resolves: #1357

7 weeks agoUpgrade bundled pjproject to 2.17.
Stanislav Abramenkov [Mon, 27 Apr 2026 17:05:07 +0000 (20:05 +0300)] 
Upgrade bundled pjproject to 2.17.

Resolves: #1888

UserNote: Bundled pjproject has been upgraded to 2.17. For more
information about what is included in this release, see the
pjproject Github page: https://github.com/pjsip/pjproject/releases/tag/2.17

7 weeks agores_stir_shaken: fix memory free crash when Asterisk is built with malloc_debug
Mike Bradeen [Wed, 6 May 2026 22:33:43 +0000 (16:33 -0600)] 
res_stir_shaken: fix memory free crash when Asterisk is built with malloc_debug

crypto_utils uses ast_asprintf to allocate the search string when checking the
certificate subject, but was not using ast_free to free it. This caused a crash
when Asterisk was built with malloc_debug

Resolves: #1921

7 weeks agomanager: Eliminate unnecessary code, simplify sessions in stasis callbacks
Joshua C. Colp [Mon, 4 May 2026 21:02:38 +0000 (18:02 -0300)] 
manager: Eliminate unnecessary code, simplify sessions in stasis callbacks

Due to stasis filtering the stasis callback for AMI type messages is
guaranteed to only receive messages that can be turned into AMI events,
so remove the check done in the callback.

The sessions container usage for the stasis callbacks has also been
simplified by having a reference on the message router subscription
instead of having to acquire the sessions from the global object each
time.

8 weeks agores_stasis/resource_bridges: Split bridge playback control and wrapper cleanup
Peter Krall [Fri, 17 Apr 2026 12:35:31 +0000 (14:35 +0200)] 
res_stasis/resource_bridges: Split bridge playback control and wrapper cleanup

Modified the bridge playback teardown so the worker thread removes only the
playback control, while the after-bridge callback removes the playback
wrapper once the announcer has actually left the bridge.

This avoids a stale window where a new playback request could create a
replacement announcer before the old announcer had fully exited the holding
bridge.

Also replaced the flexible trailing bridge_id storage in the shared worker
thread data with an optional bridge_id pointer, since recording paths use the
same structure without a bridge id.

Fixes: #1861
8 weeks agores_pjsip_outbound_publish.c: Add more verbose documentation for outbound_proxy usage
Sebastian Denz [Thu, 26 Mar 2026 08:17:42 +0000 (09:17 +0100)] 
res_pjsip_outbound_publish.c: Add more verbose documentation for outbound_proxy usage

8 weeks agochannel.c: Don't lock the channel in ast_softhangup while setting rtp instance vars
George Joseph [Tue, 5 May 2026 16:41:15 +0000 (10:41 -0600)] 
channel.c: Don't lock the channel in ast_softhangup while setting rtp instance vars

ast_softhangup() was locking the channel before calling ast_rtp_instance_set_stats_vars()
which, if the channel was in a bridge, then locked the bridge peer channel.  If another
thread attempted to set bridge variables on the peer, it would lock that channel first,
then this channel causing a lock inversion.  ast_softhangup() now holds the channel lock
while retrieving the rtp instance, then unlocks it before calling
ast_rtp_instance_set_stats_vars(), then locks it again after it returns.

Resolves: #1907

2 months agochan_pjsip: Fix deadlock when endpoint set_var uses PJSIP_HEADER
Charles Langlois [Thu, 16 Apr 2026 20:02:54 +0000 (16:02 -0400)] 
chan_pjsip: Fix deadlock when endpoint set_var uses PJSIP_HEADER

When a PJSIP endpoint is configured with set_var invoking a dialplan
function (e.g. PJSIP_HEADER(add,...)), chan_pjsip_new() calls
pbx_builtin_setvar_helper() while holding the channel lock.
For function-style variables, this dispatches to ast_func_write()
which, in the case of PJSIP_HEADER, calls
ast_sip_push_task_wait_serializer() -- blocking synchronously while
the channel lock is held.

If a concurrent operation (ARI, AMI, rtp_check_timeout) traverses
the channels container via ast_channel_get_by_name(), it acquires
the container lock then tries to lock individual channels in the
iteration callback (by_uniqueid_cb/by_name_cb). When the serializer
thread also needs the container lock, a circular dependency forms:

  channel_lock -> serializer_wait -> container_lock -> channel_lock

This causes a complete Asterisk freeze. In the observed case, 36
threads were blocked on the container lock until res_freeze_check
triggered SIGABRT after its 30-second timeout.

Unlock the channel before iterating endpoint channel_vars so that
dialplan functions can block without holding the channel lock. Re-lock
the channel for ast_channel_stage_snapshot_done() so the batched
snapshot is published under lock and captures the full channel state
including the variables set during the loop.

Fixes: #1872
2 months agores_pjsip: Add per-endpoint RTP port range configuration
mattia [Wed, 1 Apr 2026 12:46:57 +0000 (14:46 +0200)] 
res_pjsip: Add per-endpoint RTP port range configuration

Add rtp_port_start and rtp_port_end options to PJSIP endpoint
configuration, allowing each endpoint to use a dedicated RTP port
range instead of the global rtp.conf setting.

This is useful for scenarios where different endpoints need isolated
port ranges, such as firewall rules per trunk, multi-tenant systems,
or network QoS policies tied to port ranges.

The implementation adds ast_rtp_instance_new_with_port_range() to the
RTP engine API, which sets the port range on the instance before the
engine allocates the transport. The default RTP engine
(res_rtp_asterisk) checks for per-instance overrides in
rtp_allocate_transport() and falls back to the global range when
none is set.

Both options must be set together, with values >= 1024 and
rtp_port_end > rtp_port_start. Setting both to 0 (the default)
preserves existing behavior.

Resolves: https://github.com/asterisk/asterisk-feature-requests/issues/71

UserNote: PJSIP endpoints now support rtp_port_start and
rtp_port_end options to configure a dedicated RTP port range per
endpoint, overriding the global rtp.conf setting.

UpgradeNote: An alembic database migration has been added to add
the rtp_port_start and rtp_port_end columns to the ps_endpoints
table. Run "alembic upgrade head" to apply the schema change.

DeveloperNote: New public API: ast_rtp_instance_new_with_port_range()
creates an RTP instance with a per-instance port range.
ast_rtp_instance_get_port_start() and ast_rtp_instance_get_port_end()
allow RTP engines to query the override. Third-party RTP engines can
use these getters to support per-instance port ranges.

2 months agoapp_queue: Fix raise_respect_min lost in copy_rules() breaking rN queue rules
phoneben [Sun, 26 Apr 2026 20:34:00 +0000 (23:34 +0300)] 
app_queue: Fix raise_respect_min lost in copy_rules() breaking rN queue rules

app_queue: Fix raise_respect_min not copied in copy_rules() causing rN rules to be ignored.

`copy_rules()` never copied `raise_respect_min` into the per-call rule list, so the flag was always 0 when a timed penaltychange rule fired, making `rN` behave like plain `N` and raising members below `min_penalty` that should have been excluded.

Also fixes `update_qe_rule()` not propagating the flag from `qe->pr` to `qe`, and dropping the `r` prefix when saving back to `QUEUE_RAISE_PENALTY`.

Resolves: #1901

2 months agoapp_voicemail_odbc: fix msgnum race and crash on failed STORE
phoneben [Thu, 9 Apr 2026 20:00:52 +0000 (23:00 +0300)] 
app_voicemail_odbc: fix msgnum race and crash on failed STORE

app_voicemail_odbc: fix msgnum race and crash on failed STORE

Two concurrent callers leaving voicemail to the same mailbox could be
assigned the same msgnum because ast_unlock_path() was called before
STORE(), allowing a second thread to read the same LAST_MSG_INDEX()
before the first INSERT committed. The losing thread got a duplicate
key error, but execution continued into notify_new_message() ->
RETRIEVE() because the STORE() return value was not checked.
RETRIEVE() then fetched the winning thread's DB row, mmap'd its blob
size against the locally truncated file, and crashed with SIGBUS.

Hold the path lock through STORE() and bail out on failure.

Fixes: #1653
2 months agoari_websockets: Fix two issues in the cleanup of outbound websockets.
George Joseph [Wed, 22 Apr 2026 15:09:48 +0000 (09:09 -0600)] 
ari_websockets: Fix two issues in the cleanup of outbound websockets.

1.  session_cleanup() now saves the websocket type before unlinking the
session from the session registry.  This prevents a FRACK when cleaning
up per-call websockets when MALLOC_DEBUG is used.

2.  session_shutdown_cb() and outbound_sessions_load() now call
pthread_cancel() to cancel the session handler thread to prevent the
thread from continually trying to connect to a server after the
connection config has been removed by a reload.  This required the
thread to use pthread_cleanup_push() to clean up its reference to the
session instead of RAII because RAII destructors don't get run when
pthread_cancel() is used.

Resolves: #1894

2 months agocompat.h: Ensure check for `__STDC_VERSION__` is not attempted for c++.
George Joseph [Mon, 27 Apr 2026 17:52:27 +0000 (11:52 -0600)] 
compat.h: Ensure check for `__STDC_VERSION__` is not attempted for c++.

`__STDC_VERSION__` is specific to C but up until gcc 16, the g++ compiler
also defined it.  With g++ 16.0 it's no longer defined (which is the correct
behavior) so compiling channelstorage_cpp_map_name_id.cc fails.  The
check for `__STDC_VERSION__` in compat.h is now skipped if we're compiling
a C++ source file.

Resolves: #1903

2 months agopjproject: Backport fix for OpenSSL < 1.1.0 build failure in ssl_sock_ossl.c
phoneben [Wed, 22 Apr 2026 14:03:05 +0000 (17:03 +0300)] 
pjproject: Backport fix for OpenSSL < 1.1.0 build failure in ssl_sock_ossl.c

Backport pjsip/pjproject#4941 which fixes a build/link failure when
compiling against OpenSSL < 1.1.0 (e.g. OpenSSL 1.0.2k on CentOS 7).

Two symbols introduced in OpenSSL 1.1.x were called unconditionally
in ssl_sock_ossl.c without version guards:

- `TLS_method()` in `init_ossl_ctx()` is now guarded with
  `OPENSSL_VERSION_NUMBER < 0x10100000L`, falling back to
  `SSLv23_method()` on older OpenSSL.

- `SSL_CTX_set_ciphersuites()` is now guarded with
  `OPENSSL_VERSION_NUMBER >= 0x1010100fL` since this function
  was introduced in OpenSSL 1.1.1 and is absent in 1.0.x.

Without this fix, linking fails with:
  undefined reference to `TLS_method'
  undefined reference to `SSL_CTX_set_ciphersuites'

when building Asterisk with bundled pjproject on systems such as
CentOS 7 with OpenSSL 1.0.2k.

Resolves: #1892

2 months agoasterisk.c: Fix #if HAVE_LIBEDIT_IS_UNICODE.
George Joseph [Wed, 22 Apr 2026 17:03:46 +0000 (11:03 -0600)] 
asterisk.c: Fix #if HAVE_LIBEDIT_IS_UNICODE.

Line 2729 has `#if HAVE_LIBEDIT_IS_UNICODE` instead if `#ifdef`.  Since
macros defined by autoconf are either set to `1` or not set at all,
older distros where libedit isn't unicode won't have that macro defined
and will fail to compile.

Resolves: #1896

2 months agocdrel_custom: fix SQLite compatibility for versions < 3.20.0
phoneben [Tue, 21 Apr 2026 20:13:54 +0000 (23:13 +0300)] 
cdrel_custom: fix SQLite compatibility for versions < 3.20.0

cdrel_custom: fix SQLite compatibility for versions < 3.20.0

Replace sqlite3_prepare_v3 + SQLITE_PREPARE_PERSISTENT with a version-guarded fallback to sqlite3_prepare_v2 for older SQLite builds.

Resolves: #1885

2 months agotranslate.c: implement different sample_types for translation computation.
Sebastian Jennen [Thu, 2 Apr 2026 08:33:44 +0000 (10:33 +0200)] 
translate.c: implement different sample_types for translation computation.

The default (codec) still uses the codec provided samples. Additionally
different sample_types can be used with eg: `translate sampletype speech`
and then running `core show translation comp 10` to measure performance
of different audio scenarios.

Resolves: #1807

2 months agostasis_broadcast: Add optional ARI broadcast with first-claim-wins
Daniel Donoghue [Wed, 25 Feb 2026 14:07:48 +0000 (15:07 +0100)] 
stasis_broadcast: Add optional ARI broadcast with first-claim-wins

Adds two optional modules:
res_stasis_broadcast.so: Infrastructure for broadcasting a single incoming
channel to multiple ARI applications with atomic first-claim-wins semantics.

app_stasis_broadcast.so: Provides the StasisBroadcast() dialplan application
which invokes the broadcast infrastructure.

Both modules are self-contained; if neither is loaded there is zero runtime
impact. Loading them does not alter existing Stasis or ARI behavior unless
explicitly used.

Key Features (only active when modules are loaded):
Fisher-Yates shuffled broadcast dispatch for fair claim races
Atomic claim operations using mutex + condition variable signaling
Configurable broadcast timeouts
Safe regex application filtering with validation to mitigate ReDoS risk
Thread-safe channel variable snapshotting (channel locked during reads)
Late-claim safety: broadcast context kept alive until after the Stasis
session ends so concurrent claimants always receive 409 Conflict rather
than 404 Not Found
Memory safety via RAII_VAR, ast_json_ref/unref, and ao2 reference counting

Components Added:
res/res_stasis_broadcast.c: Core broadcast + claim logic
apps/app_stasis_broadcast.c: StasisBroadcast() dialplan application
include/asterisk/stasis_app_broadcast.h: Public API header
res/ari/resource_events.c: Integrates POST /ari/events/claim endpoint
rest-api/api-docs/events.json: New CallBroadcast and CallClaimed events

Implementation Notes:
Broadcast contexts reside in an ao2 hash container keyed by channel id. Each
context holds atomic claim state, winner application name, timeout metadata,
and a condition variable for waiters. Broadcast contexts are kept alive until
after stasis_app_exec() returns so that concurrent claimants racing against
the timeout always receive 409 Conflict. Broadcast dispatch calls
stasis_app_send() directly for each matching application in shuffled order.
Regex filters are validated with bounded length, group depth, quantified
group count, and alternation limits to reduce pathological backtracking.
Timeout calculation uses timespec arithmetic with overflow-safe millisecond
remainder handling. Event JSON follows existing Stasis/ARI conventions;
references are managed correctly to avoid leaks or double frees.

Optional Nature / Impact:
No changes to existing APIs, events, or applications when absent.
Clean fallback: systems ignoring the modules behave identically to prior
versions.

Development was assisted by Claude (Anthropic). All generated code has been
reviewed, tested, and is understood by the author.

UserNote: New optional modules res_stasis_broadcast.so and
app_stasis_broadcast.so enable broadcasting an incoming channel to multiple
ARI applications. The first application to successfully claim (via
POST /ari/events/claim) wins channel control. StasisBroadcast() dialplan
application initiates broadcasts. CallBroadcast and CallClaimed events notify
applications. When modules are not loaded, behavior is unchanged.

DeveloperNote: New public APIs in stasis_app_broadcast.h:
stasis_app_broadcast_channel(), stasis_app_claim_channel(),
stasis_app_broadcast_winner(), and stasis_app_broadcast_wait(). New ARI event
types (CallBroadcast, CallClaimed) added to events.json. All code is isolated;
no existing ABI modified.

2 months agores_audiosocket: Tolerate non-audio frame types
Sven Kube [Wed, 22 Apr 2026 13:26:26 +0000 (15:26 +0200)] 
res_audiosocket: Tolerate non-audio frame types

This commit implements the handling of non-voice or DTMF frames like the
chan_websocket handling added in #1588. Rather than treating unsupported
frames as fatal errors, silently ignore CNG frames and log a warning for
other unsupported types.

2 months agopbx_functions: Save module pointer before calling read and write callbacks.
George Joseph [Tue, 21 Apr 2026 20:31:56 +0000 (14:31 -0600)] 
pbx_functions: Save module pointer before calling read and write callbacks.

Before ast_func_read and ast_func_write call their respective read and write
callbacks for registered dialplan functions, they use the module pointer in
the registered ast_custom_function structure to increment the module use
count.  They then decrement the usecount when the callback returns.  This
prevents the providing module from being unloaded while there's a call using
the function.

Some modules, notably func_odbc, create and destroy dialplan functions based
on the contents of a config file.  Since the ast_custom_function structure is
dynamically allocated, it could be destroyed on reload which means when the
module's read or write callback returns to the ast_func calls it would try to
decrement the usecount using the module pointer from an ast_custom_function
structure that has already been freed.  Proper locking or reference counting
by the module can reduce the possibility of this happening but it can't
prevent it because it doesn't have control after its read or write callback
has returned to ast_func_read or ast_func_write.

To address this, ast_func_read, ast_func_read2 and ast_func_write save the
module pointer to a local variable before calling the module's callback,
then use the saved pointer to decrement the use count.  The module
pointer will always be valid if the module is loaded regardless of the
state of the ast_custom_function structure.

Resolves: #1818

2 months agochan_iax2: Add CHANNEL getter to retrieve auth method.
Naveen Albert [Sat, 18 Apr 2026 09:33:37 +0000 (05:33 -0400)] 
chan_iax2: Add CHANNEL getter to retrieve auth method.

Add a property to the CHANNEL method to retrieve the auth method,
which can be used to retrieve the specific auth method actually
negotiated for a call (e.g. RSA, MD5, etc.).

Also clean up some of the documentation for the secure properties
to clarify how these relate to call encryption.

Resolves: #1878

UserNote: CHANNEL(auth_method) can now be used to retrieve the
auth method negotiated for a call on IAX2 channels.

2 months agofix: backport pjproject stdatomic.h GCC 4.8 build failure patch
phoneben [Tue, 21 Apr 2026 13:08:18 +0000 (16:08 +0300)] 
fix: backport pjproject stdatomic.h GCC 4.8 build failure patch

pjproject 2.16 (bundled) fails to build on GCC 4.8 (CentOS/RHEL 7)
due to a false positive C11 atomics detection introduced in pjproject
commit #4570. A fix has been submitted upstream to pjproject (#4933).

Adding a local patch to third-party/pjproject/patches/ until a fixed
version of pjproject is bundled in Asterisk.

Fixes build error:
../src/pj/os_core_unix.c:52:27: fatal error: stdatomic.h: No such file or directory

Resolves: #1883

2 months agores_rtp_asterisk: Destroy ioqueue in rtp_ioqueue_thread_destroy.
George Joseph [Thu, 16 Apr 2026 12:44:13 +0000 (06:44 -0600)] 
res_rtp_asterisk: Destroy ioqueue in rtp_ioqueue_thread_destroy.

The rtp_ioqueue_thread_destroy() function was destroying the the ioqueue
thread and releasing its pool but not destroying the ioqueue itself.  This
was causing the ioqueue's epoll file descriptor to leak.

Resolves: #1867

2 months agores_pjsip_maintenance: Add PJSIP endpoint maintenance mode
Daniel Donoghue [Tue, 10 Mar 2026 13:49:30 +0000 (14:49 +0100)] 
res_pjsip_maintenance: Add PJSIP endpoint maintenance mode

Introduces res_pjsip_maintenance, a loadable module that allows
operators to place individual PJSIP endpoints into maintenance mode
at runtime without unregistering or disabling them.

While an endpoint is in maintenance mode:
 * New inbound INVITE and SUBSCRIBE dialogs are rejected with
   503 Service Unavailable and a Retry-After: 300 header.
 * In-progress dialogs (re-INVITE, UPDATE, BYE, etc.) are
   unaffected and complete normally.
 * Outbound originations via Dial() or ARI originate are refused
   before any SIP session is created.

State is held in-memory only and is cleared on module unload
or Asterisk restart.

This module was developed with AI assistance (Claude).  All code
has been reviewed and tested by the author, who takes full
responsibility for the submission.

CLI interface:
  pjsip set maintenance <on|off> <endpoint|all>
  pjsip show maintenance [endpoint]

AMI interface:
  Action: PJSIPSetMaintenance
  Endpoint: <name>|all
  State: on|off

  Action: PJSIPShowMaintenance
  Endpoint: <name>  (optional; omit to list all)

  Emits PJSIPMaintenanceStatus events per result, followed by
  PJSIPMaintenanceStatusComplete. State changes also emit an
  unsolicited PJSIPMaintenanceStatus event.

To support outbound blocking, a new session_create callback is
added to ast_sip_session_supplement. Supplements that set this
callback are invoked at the start of ast_sip_session_create_outgoing()
in res_pjsip_session, before any dialog or invite session resources
are allocated. res_pjsip_maintenance registers itself as a session
supplement and uses this callback to gate outbound session creation
on a per-endpoint basis.

MODULEINFO:
  <depend>pjproject</depend>
  <depend>res_pjsip</depend>
  <depend>res_pjsip_session</depend>

UserNote: New module res_pjsip_maintenance adds runtime maintenance
mode for PJSIP endpoints. Use "pjsip set maintenance <on|off>
<endpoint|all>" to enable or disable, and "pjsip show maintenance"
to list affected endpoints. AMI actions PJSIPSetMaintenance and
PJSIPShowMaintenance provide programmatic access. No configuration
file changes required.

DeveloperNote: ast_sip_session_supplement gains a new optional
callback - int (*session_create)(struct ast_sip_endpoint *endpoint,
const char *destination). It is called from the global supplement
list (not per-session) at the start of ast_sip_session_create_outgoing()
via ast_sip_session_check_supplement_create(). Returning non-zero
blocks the outgoing session. Modules that need to gate outbound
SIP session creation should register a supplement with this callback
set rather than hooking into chan_pjsip directly.

2 months agochan_iax2: Add another check to abort frame handling if datalen < 0.
Naveen Albert [Sat, 11 Apr 2026 16:57:18 +0000 (12:57 -0400)] 
chan_iax2: Add another check to abort frame handling if datalen < 0.

Commit 2da221e217cbff957af928e8df43ee25583232d1 added a missing abort
if datalen < 0 check on a code path and an assertion inside
iax_frame_wrap if we ever encountered a frame with a negative frame
length (which will eventually cause a crash).

Add another missing abort check for negative datalen, exposed by this
assertion. (Similar to the previous commit, this is a video frame with
a datalen of -1).

Resolves: #1865

2 months agores_pjsip_outbound_registration: only update the Expires header if the value has...
Mike Bradeen [Wed, 8 Apr 2026 17:03:04 +0000 (11:03 -0600)] 
res_pjsip_outbound_registration: only update the Expires header if the value has changed

The PJSIP outbound registration API has undocumented behavior when reconfiguring
the outbound registration if the expires value being set is the same as what was
previously set.

In this case PJSIP will remove the Expires header entirely from subsequent
outbound REGISTER requests. To eliminate this as an issue we now check the current
expires value against the configured expires value and only apply it if it differs.

This ensures that outbound REGISTER requests always contain an Expires header.

Resolves: #1859

2 months agofunc_talkdetect.c: Clarify dsp_talking_threshold documentation.
Sean Bright [Wed, 8 Apr 2026 15:40:50 +0000 (15:40 +0000)] 
func_talkdetect.c: Clarify dsp_talking_threshold documentation.

Fixes: #1761
2 months agomake_xml_documentation: Remove temporary file on script exit.
Sean Bright [Thu, 9 Apr 2026 19:32:05 +0000 (19:32 +0000)] 
make_xml_documentation: Remove temporary file on script exit.

Fixes: #1862
2 months agores_pjsip_config_wizard: Trigger reloads from a pjsip servant thread
George Joseph [Tue, 7 Apr 2026 14:36:34 +0000 (08:36 -0600)] 
res_pjsip_config_wizard: Trigger reloads from a pjsip servant thread

When res_pjsip is reloaded directly, it does the sorcery reload in a pjsip
servant thread as it's supposed to.  res_pjsip_config_wizard however
was not which was leading to occasional deadlocks.  It now does the reload
in a servant thread just like res_pjsip.

Resolves: #1855

2 months agobuild: remove pjsua, pjsystest, Python bindings and asterisk_malloc_debug stubs from...
Alexei Gradinari [Mon, 6 Apr 2026 22:56:35 +0000 (18:56 -0400)] 
build: remove pjsua, pjsystest, Python bindings and asterisk_malloc_debug stubs from pjproject dev build

The pjsua Python module and the pjsua/pjsystest apps were used by the
Asterisk Test Suite for SIP simulation in dev mode builds. They are now
fully obsolete for three independent reasons:

1. **pjsua Python bindings officially deprecated upstream.** The pjproject
   maintainers added `pjsip-apps/src/python/DEPRECATED.txt` directing
   users to the PJSUA2 SWIG binding instead. A build-fix PR
   (https://github.com/pjsip/pjproject/pull/4892) was closed by the
   maintainer explicitly citing this deprecation.

2. **Removed from the Asterisk Test Suite.** As confirmed by @mbradeen:
   > *"We had to get rid of pjsua when we went to Python3 because it would
   > hang due to a conflict between async calls within pjsua and twisted.
   > There are still some old references to tests we couldn't fully convert
   > to sipp, but those are skipped."*

3. **Broken and unmaintained.** Building with Python 2.7 (the only version
   `configure.ac` searched for) fails with:
   ```
   _pjsua.c: error: 'INIT_RETURN' undeclared (first use in this function)
   ```
   due to a bug in pjproject 2.16's `python3_compat.h` that upstream
   declined to fix.

This PR removes all pjsua-related build artifacts from Asterisk's bundled
pjproject build: the pjsua and pjsystest application binaries, the deprecated
Python (`_pjsua.so`) bindings, the `asterisk_malloc_debug.c` stubs, and the
`PYTHONDEV` detection from `configure.ac`. Also removes `libpjsua` from
Asterisk's main linker flags.

DeveloperNote: The pjsua and pjsystest application binaries, the deprecated
Python pjsua bindings (`_pjsua.so`), and the `asterisk_malloc_debug.c` stub
implementations are no longer built or installed as part of the bundled
pjproject dev mode build. The `PYTHONDEV` (python2.7-dev) build dependency
is also removed. Developers who relied on the pjsua binary for Test Suite
SIP simulation should use SIPp instead, which is the current Asterisk Test
Suite standard.

Fixes: #1840
3 months agores_cdrel_custom: do not free config when no new config was loaded
nappsoft [Thu, 2 Apr 2026 14:07:51 +0000 (16:07 +0200)] 
res_cdrel_custom: do not free config when no new config was loaded

When the res_cdrel_custom modules is reloaded and the config has not been changed asterisk should not free the old config. Otherwise the connection to the database will be closed and no new connection will be opened.

Resolves: #1852

3 months agores_cdrel_custom: Resolve several formatting issues.
George Joseph [Tue, 31 Mar 2026 16:16:48 +0000 (10:16 -0600)] 
res_cdrel_custom: Resolve several formatting issues.

Several issues are resolved:

* Internally, floats were used for timestamp values but this could result
in wrapping so they've been changed to doubles.

* Historically, the default CEL eventtime format is `<seconds>.<microseconds>`
with `<microseconds>` always being 6 digits.  This should have continued to be
the case but res_cdrel_custom wasn't checking the `dateformat` setting in
cel.conf and was defaulting to `%F %T`.  res_cdrel_custom now gets the default
date format from cel.conf, which will be whatever the `dateformat` parameter
is set to or `<seconds>.<microseconds>` if not set.

* The timeval field formatter for both CDR and CEL wasn't handling custom
strftime format strings correctly.  This is now fixed so you should be able
to specifiy custom strftime format strings for the CEL `eventtime` and CDR
`start`, `answer` and `end` fields.  For example: `eventtime(%FT%T%z)`.

Resolves: #1844
Resolves: #1845

3 months agocallerid: fix signed char causing crash in MDMF parser
Milan Kyselica [Wed, 25 Mar 2026 22:29:46 +0000 (23:29 +0100)] 
callerid: fix signed char causing crash in MDMF parser

Change rawdata buffer from char to unsigned char to prevent
sign-extension of TLV length bytes >= 0x80. On signed-char
platforms (all Asterisk builds due to -fsigned-char in
configure.ac), these values become negative when assigned to
int, bypass the `if (res > 32)` bounds check, and reach
memcpy as size_t producing a ~18 EB read that immediately
crashes with SIGSEGV.

Affects DAHDI analog (FXO) channels only. Not reachable
via SIP, PRI/BRI, or DTMF-based Caller ID.

Fixes: #1839
3 months agores_pjsip: Address pjproject security vulnerabilities
Mike Bradeen [Mon, 23 Mar 2026 20:45:30 +0000 (14:45 -0600)] 
res_pjsip: Address pjproject security vulnerabilities

Address the following pjproject security vulnerabilities

[GHSA-j29p-pvh2-pvqp - Buffer overflow in ICE with long username](https://github.com/pjsip/pjproject/security/advisories/GHSA-j29p-pvh2-pvqp)
[GHSA-8fj4-fv9f-hjpc - Heap use-after-free in PJSIP presense subscription termination header](https://github.com/pjsip/pjproject/security/advisories/GHSA-8fj4-fv9f-hjpc)
[GHSA-g88q-c2hm-q7p7 - ICE session use-after-free race conditions](https://github.com/pjsip/pjproject/security/advisories/GHSA-g88q-c2hm-q7p7)
[GHSA-x5pq-qrp4-fmrj - Out-of-bounds read in SIP multipart parsing](https://github.com/pjsip/pjproject/security/advisories/GHSA-x5pq-qrp4-fmrj)

Resolves: #1833

3 months agopbx: Hold channel lock for exception datastore access
Tinet-mucw [Fri, 20 Mar 2026 10:17:31 +0000 (03:17 -0700)] 
pbx: Hold channel lock for exception datastore access

ast_channel_datastore_find() and ast_channel_datastore_add() must only be
called while the channel is locked (see channel.h). raise_exception() and the
EXCEPTION dialplan function read path accessed the exception datastore without
holding ast_channel_lock, which could corrupt the per-channel datastore list
under concurrency and lead to crashes during teardown (e.g. double free in
ast_datastore_free).

Resolves: #1831

3 months agoxmldoc.c: Fix memory leaks in handling of provided_by.
George Joseph [Tue, 17 Mar 2026 16:11:48 +0000 (10:11 -0600)] 
xmldoc.c: Fix memory leaks in handling of provided_by.

Added a few calls to ast_xml_free_attr() to squash memory leaks when handling
"provided_by".

3 months agoSECURITY.md: Update with additional instructions.
George Joseph [Thu, 19 Mar 2026 13:35:30 +0000 (07:35 -0600)] 
SECURITY.md: Update with additional instructions.

Also added line breaks for people reading this file directly
from the code base.

3 months agores_audiosocket: Fix header read loop to use correct buffer offset
Sven Kube [Tue, 17 Mar 2026 09:38:38 +0000 (10:38 +0100)] 
res_audiosocket: Fix header read loop to use correct buffer offset

The PR #1522 introduced the header read loop for audiosocket packets
which does not handle partial header reads correctly. This commit
adds the missing buffer offsets.

3 months agomanager.c : Fix CLI event display
phoneben [Mon, 16 Mar 2026 20:39:21 +0000 (22:39 +0200)] 
manager.c : Fix CLI event display

manager.c: Fix CLI event display

- `manager show events`: fix event names being truncated at 20 characters, widen column to 28 to accommodate the longest registered event name
- `manager show events`: skip duplicate entries caused by multiple modules registering the same event name, list is already sorted so adjacent name comparison is sufficient

3 months agochan_pjsip: Set correct cause codes for non-2XX responses.
George Joseph [Tue, 10 Mar 2026 13:19:41 +0000 (07:19 -0600)] 
chan_pjsip: Set correct cause codes for non-2XX responses.

Redirects initiated by 302 response codes weren't handled correctly
when setting the hangup cause code and tech cause code on the responding
channel.  They're now set to 23 (REDIRECTED_TO_NEW_DESTINATION) and
302 (Moved permanently).  Other non-2XX response codes also had issues.

A new API ast_channel_dialed_causes_iterator() was added to retrieve
the hangup cause codes for a channel.

chan_pjsip_session_end() in chan_pjsip has been refactored to set the
correct cause codes on a channel based on the cause codes added by
chan_pjsip_incoming_response_update_cause().  Copious amounts of
debugging and comments were also added.

Resolves: #1819

3 months agores_pjsip_config_wizard: Force reload on Named ACL change events
Michal Hajek [Wed, 10 Dec 2025 13:51:40 +0000 (14:51 +0100)] 
res_pjsip_config_wizard: Force reload on Named ACL change events

Currently, endpoints created via the PJSIP Config Wizard do not update
their ACL rules if the underlying Named ACL (in acl.conf) changes.
This occurs because the wizard relies on file timestamp and content
caching of pjsip_wizard.conf, which remains unchanged during an external
ACL update. As a result, endpoints retain stale ACL rules even after
a reload.

This patch updates res_pjsip_config_wizard to subscribe to the
ast_named_acl_change_type Stasis event. A local generation counter is
incremented whenever an ACL change event is received.

During a reload, the wizard compares the current local generation against
the generation stored in the wizard object. If a change is detected:
1. The file cache optimization (CONFIG_FLAG_FILEUNCHANGED) is bypassed.
2. Wizard objects utilizing 'acl' or 'contact_acl' are forced to update,
   ensuring they pick up the new IP rules.

Signed-off-by: Michal Hajek michal.hajek@daktela.com
Fixes: #1641
3 months agortp: Set RTPAUDIOQOS variables when ast_softhangup is called.
George Joseph [Fri, 6 Mar 2026 18:52:53 +0000 (11:52 -0700)] 
rtp: Set RTPAUDIOQOS variables when ast_softhangup is called.

If a channel in Stasis/ARI is hung up by the channel driver, the RTPAUDIOQOS
variables are set before the channel leaves Stasis and are therefore
available to the ARI app via ChannelVarset events.  If the channel is hung up
by ARI however, the channel leaves Stasis before the RTPAUDIOQOS variables
are set so the app may not get the ChannelVarset events.

We now set the RTPAUDIOQOS variables when ast_softhangup() is called as well
as when the channel driver hangs up a channel.  Since ARI hangups call
ast_softhangup(), the variables will be set before the channel leaves Stasis
and the app should get the ChannelVarset events.
ast_rtp_instance_set_stats_vars(), which actually sets the variables, now
checks to see if the variables are already set before attempting to set them.
This prevents double messages from being generated.

Resolves: #1816

3 months agochannel: Prevent crash during DTMF emulation when no timing module is loaded
Alexis Hadjisotiriou [Thu, 26 Feb 2026 15:37:56 +0000 (15:37 +0000)] 
channel: Prevent crash during DTMF emulation when no timing module is loaded

Description:
When Asterisk is running without a timing module, attempting to process DTMF
triggers a segmentation fault. This occurs because the system
attempts to access a null timing file descriptor when setting up the
DTMF emulation timer.

This fix ensures that the system checks for a valid timing source before
attempting to start the DTMF emulation timer. If no timing module is
present, it logs a warning and skips the emulation instead of crashing
the process.

Changes:
- Modified main/channel.c to add a safety check within the __ast_read function.
- Implemented a graceful return path when no timing source is available
- Added a LOG_WARNING to inform the administrator that DTMF emulation
  was skipped due to missing timing modules.

Testing:
- Disabled all timing_ modules in modules.conf and confirmed with
  'timing test'.
- Reproduced the crash by modifying the dialplan with:
 exten => 707,1,NoOp(Starting DTMF - No Timing Mode)
 same => n,Answer()
 same => n,Background(demo-congrats)
 same => n,WaitExten(10)
 same => n,Hangup()
  And calling 707 followed by 1
- Verified that with the fix applied, the system logs "No timing module
  loaded; skipping DTMF timer" and continues dialplan
  execution without crashing.
- Confirmed stability during concurrent media sessions and DTMF input.

Fixes: #566
3 months agores_pjsip: Remove temp transport state when a transport fails to load.
George Joseph [Fri, 6 Mar 2026 13:50:22 +0000 (06:50 -0700)] 
res_pjsip: Remove temp transport state when a transport fails to load.

If a pjsip transport (A) fails to load, its temporary state gets left behind
causing the next transport to load (B) to pick up some of its parameters,
including its name. This can cause B to have the correct name (B) in its
transport object but the wrong name (A) in its internal state object. When a
transport state is searched for later on, transport state B is returned but a
retrieval of the actual transport object will fail because B's transport
state id is actually "A" and transport "A" doesn't exist because it failed
to load.

remove_temporary_state() is now being called in all error paths in
config_transport.c functions that call find_or_create_temporary_state().

A bit of extra debugging was also added to res_pjsip_nat.c.

Resolves: #1814

3 months agores_pjsip_messaging: Remove Contact header from out-of-dialog MESSAGE as per RFC3428
Alexis Hadjisotiriou [Mon, 19 Jan 2026 15:20:53 +0000 (15:20 +0000)] 
res_pjsip_messaging: Remove Contact header from out-of-dialog MESSAGE as per RFC3428

According to RFC 3428 (Section 5), a Contact header is not required in a
MESSAGE request unless the sender wants to establish a session. This
patch ensures that the Contact header is removed from out-of-dialog
MESSAGE requests within res_pjsip_messaging.c.

Fixes: #1356
3 months agoacl: Add ACL support to http and ari
Mike Bradeen [Fri, 27 Feb 2026 19:35:37 +0000 (12:35 -0700)] 
acl: Add ACL support to http and ari

Add uri prefix based acl support to the built in http server.
This allows an acl to be added per uri prefix (ie '/metrics'
or '/ws') to restrict access.

Add user based acl support for ARI. This adds new acl options
to the user section of ari.conf to restrict access on a per
user basis.

resolves: #1799

UserNote: A new section, type=restriction has been added to http.conf
to allow an uri prefix based acl to be configured. See
http.conf.sample for examples and more information.
The user section of ari.conf can now contain an acl configuration
to restrict users access. See ari.conf.sample for examples and more
information

4 months agores_rtp_asterisk.c: Fix DTLS packet drop when TURN loopback re-injection occurs befor...
Robert Wilson [Tue, 3 Mar 2026 13:30:15 +0000 (13:30 +0000)] 
res_rtp_asterisk.c: Fix DTLS packet drop when TURN loopback re-injection occurs before ICE candidate check

When TURN is configured in rtp.conf, pjproject re-injects TURN packets
via 127.0.0.1 (the loopback address). The DTLS packet handler checks the
source address against the ICE active candidate list before the loopback
address substitution runs, causing the packet to be silently dropped as
the source 127.0.0.1 is not in the candidate list.

Fix by performing the loopback address substitution before the ICE
candidate source check in the DTLS path, mirroring the logic already
present in the non-DTLS RTP path.

Fixes: #1795
UserNote: WebRTC calls using TURN configured in rtp.conf (turnaddr,
turnusername, turnpassword) will now correctly complete DTLS/SRTP
negotiation. Previously all DTLS packets were silently dropped due to
the loopback re-injection address not being in the ICE active candidate
list.

4 months agodsp.c: Add support for detecting R2 signaling tones.
Naveen Albert [Sun, 1 Mar 2026 19:20:13 +0000 (14:20 -0500)] 
dsp.c: Add support for detecting R2 signaling tones.

Extend the existing DTMF/MF tone detection support by adding support
for R2 tones, another variant of MF (R1) signaling. Both forward
and backward signaling are supported.

Resolves: #1804