]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
2 days agores_pjsip_header_funcs: Add new PJSIP_INHERITABLE_HEADER dialplan function 20
Mike Bradeen [Wed, 19 Nov 2025 18:31:50 +0000 (11:31 -0700)] 
res_pjsip_header_funcs: Add new PJSIP_INHERITABLE_HEADER dialplan function

Adds a new PJSIP_INHERITABLE_HEADER dialplan function to add
inheritable headers from the inbound channel to an outbound
bridged channel.  This works similarly to the existing
PJSIP_HEADER function, but will set the header on the bridged
outbound channel's INVITE upon Dial.

Inheritable headers can be updated or removed from the inbound
channel as well as from a pre-dial handler

Resolves: #1670

UserNote: A new PJSIP_HEADER option has been added that allows
inheriting pjsip headers from the inbound to the outbound bridged
channel.
Example- same => n,Set(PJSIP_INHERITABLE_HEADER(add,X-custom-1)=alpha)
will add X-custom-1: alpha to the outbound pjsip channel INVITE
upon Dial.

2 days agoapp_queue: Queue Timing Parity with Dial() and Accurate Wait Metrics
phoneben [Sun, 18 Jan 2026 18:34:01 +0000 (20:34 +0200)] 
app_queue: Queue Timing Parity with Dial() and Accurate Wait Metrics

app_queue: Set Dial-compatible timing variables

Extends Queue() to set Dial-compatible timing variables (ANSWEREDTIME, DIALEDTIME) and introduces a precise QUEUEWAIT metric calculated at agent connect time, with proper initialization to prevent stale or misleading values.

2 days agostasis.c: Fix deadlock in stasis_topic_pool_get_topic during module load
phoneben [Sat, 29 Nov 2025 18:08:13 +0000 (20:08 +0200)] 
stasis.c: Fix deadlock in stasis_topic_pool_get_topic during module load

stasis.c: Fix deadlock in stasis_topic_pool_get_topic during module load.

Deadlock occurs when res_manager_devicestate loads concurrently with
device state operations due to lock ordering violation:

Thread 1: Holds pool lock → needs topic lock (in stasis_forward_all)
Thread 2: Holds topic lock → needs pool lock (in stasis_topic_pool_get_topic)

Fix: Release pool lock before calling stasis_topic_create() and
stasis_forward_all(). Re-acquire only for insertion with race check.

Preserves borrowed reference semantics while breaking the deadlock cycle.

Fixes: #1611
2 days agoapp_queue: Fix rN raise_penalty ignoring min_penalty in calc_metric
phoneben [Tue, 6 Jan 2026 19:53:45 +0000 (21:53 +0200)] 
app_queue: Fix rN raise_penalty ignoring min_penalty in calc_metric

QUEUE_RAISE_PENALTY=rN was not respected during member selection. calc_metric() raised penalties below QUEUE_MIN_PENALTY, allowing excluded members to be selected.

This change makes calc_metric() honor raise_respect_min, keeping behavior consistent with queue empty checks and expected rN semantics

UserNote: Fixes an issue where QUEUE_RAISE_PENALTY=rN could raise a member’s penalty below QUEUE_MIN_PENALTY during member selection. This could allow members intended to be excluded to be selected. The queue now consistently respects the minimum penalty when raising penalties, aligning member selection behavior with queue empty checks and documented rN semantics.

2 days agoapp_queue: Only compare calls at 1st position across queues when forcing longest...
serfreeman1337 [Mon, 5 Jan 2026 15:47:22 +0000 (20:47 +0500)] 
app_queue: Only compare calls at 1st position across queues when forcing longest waiting caller.

This prevents a situation where a call joining at 1st position to a queue with calls
leads to a state where no callers are considered the longest waiting,
causing queues to stop offering calls.

Resolves: #1691

2 days agoasterisk.c: Use C.UTF-8 locale instead of relying on user's environment.
Sean Bright [Fri, 23 Jan 2026 15:57:19 +0000 (10:57 -0500)] 
asterisk.c: Use C.UTF-8 locale instead of relying on user's environment.

Resolves: #1739

6 days agochannelstorage_cpp_map_name_id: Fix get_by_name_prefix prefix match
Jasper Hafkenscheid [Wed, 21 Jan 2026 06:51:36 +0000 (07:51 +0100)] 
channelstorage_cpp_map_name_id: Fix get_by_name_prefix prefix match

Lower bound filter did not ensure prefix match.

Resolves: #1730

6 days agoapp_amd: Remove errant space in documentation for totalAnalysisTime.
George Joseph [Thu, 22 Jan 2026 18:37:05 +0000 (11:37 -0700)] 
app_amd: Remove errant space in documentation for totalAnalysisTime.

6 days agosay.c: added language support for pashto and dari
Talha Asghar [Thu, 22 Jan 2026 15:33:12 +0000 (15:33 +0000)] 
say.c: added language support for pashto and dari

With this new feature, users who speak these languages can now benefit from the
text-to-speech functionality provided by asterisk. This will make the platform
more accessible and useful to a wider range of users, particularly those in
regions where Pashto and Dari are spoken. This contribution will help to improve
the overall usability and inclusivity of the asterisk platform.

Fixes: #1724
7 days agores_pjsip_session.c: Prevent INVITE failover when session is cancelled
hishamway [Thu, 15 Jan 2026 09:34:08 +0000 (15:04 +0530)] 
res_pjsip_session.c: Prevent INVITE failover when session is cancelled

When an outbound INVITE transaction times out (408) or receives a 503 error,
check_request_status() attempts to failover to the next available address by
restarting the INVITE session. However, the function did not check if the
inv_session was already cancelled before attempting the failover.

This caused unexpected behavior when a caller hung up during a ring group
scenario: after CANCEL was sent but the remote endpoint failed to respond
with 487 (e.g., due to network disconnection), the transaction timeout
would trigger a NEW outbound INVITE to the next address, even though the
session was already terminated.

This violates RFC 3261 Section 9.1 which states that if no final response
is received after CANCEL within 64*T1 seconds, the client should consider
the transaction cancelled and destroy it, not retry to another address.

The fix adds a check for both PJSIP_INV_STATE_DISCONNECTED and inv->cancelling
at the beginning of check_request_status(). This ensures that:
- Failover is blocked when the user explicitly cancelled the call (CANCEL sent)
- Failover is still allowed for legitimate timeout/503 scenarios where no
  CANCEL was initiated (e.g., SRV failover when first server is unreachable)

Resolves: #1716

7 days agores_pjsip_pubsub: Fix ao2 reference leak of subscription tree in ast_sip_subscription
Alexei Gradinari [Wed, 7 Jan 2026 20:39:05 +0000 (15:39 -0500)] 
res_pjsip_pubsub: Fix ao2 reference leak of subscription tree in ast_sip_subscription

allocate_subscription() increments the ao2 reference count of the subscription tree,
but the reference was not consistently released during subscription destruction,
resulting in leaked sip_subscription_tree objects.

This patch makes destroy_subscription() responsible for releasing sub->tree,
removes ad-hoc cleanup in error paths,
and guards tree cleanup to ensure refcount symmetry and correct ownership.

Fixes: #1703
7 days agochan_websocket.conf.sample: Fix category name.
George Joseph [Wed, 21 Jan 2026 16:13:02 +0000 (09:13 -0700)] 
chan_websocket.conf.sample: Fix category name.

UserNote: The category name in the chan_websocket.conf.sample file was
incorrect.  It should be "global" instead of "general".

2 weeks agochan_websocket: Fixed Ping/Pong messages hanging up the websocket channel
Joe Garlick [Thu, 15 Jan 2026 14:56:47 +0000 (14:56 +0000)] 
chan_websocket: Fixed Ping/Pong messages hanging up the websocket channel

When chan_websocket received a Ping or a Pong opcode it would cause the channel to hangup. This change allows Ping/Pong opcodes and allows them to silently pass

2 weeks agocli.c: Allow 'channel request hangup' to accept patterns.
Sean Bright [Mon, 5 Jan 2026 16:44:47 +0000 (11:44 -0500)] 
cli.c: Allow 'channel request hangup' to accept patterns.

This extends 'channel request hangup' to accept multiple channel
names, a POSIX Extended Regular Expression, a glob-like pattern, or a
combination of all of them.

UserNote: The 'channel request hangup' CLI command now accepts
multiple channel names, POSIX Extended Regular Expressions, glob-like
patterns, or a combination of all of them. See the CLI command 'core
show help channel request hangup' for full details.

2 weeks agochan_sip.c: Ensure Contact header is set on responses to INVITE.
Etienne Lessard [Fri, 9 Jan 2026 16:41:14 +0000 (11:41 -0500)] 
chan_sip.c: Ensure Contact header is set on responses to INVITE.

From the original report* on ASTERISK-24915:

  > The problem occurs because the handle_incoming function updates
  p->method to req->method (p being a struct sip_pvt *) before
  checking if the CSeq makes sense, and if the CSeq is unexpected, it
  does not reset p->method to its old value before returning. Then,
  when asterisk sends the 200 OK response for the original INVITE,
  since p->method is now equal to SIP_ACK (instead of SIP_INVITE), the
  resp_need_contact function (called from respprep) says "its a SIP
  ACK, no need to add a Contact header for the response", which is
  wrong, since it's not a SIP ACK but a SIP INVITE dialog.

I have confirmed that the analysis is correct and that the patch fixes
the behavior.

*: https://issues-archive.asterisk.org/ASTERISK-24915

Resolves: #1711

3 weeks agores_sorcery_memory_cache: Reduce cache lock time for sorcery memory cache populate...
Mike Bradeen [Tue, 6 Jan 2026 17:04:50 +0000 (10:04 -0700)] 
res_sorcery_memory_cache: Reduce cache lock time for sorcery memory cache populate command

Reduce cache lock time for AMI and CLI sorcery memory cache populate
commands by adding a new populate_lock to the sorcery_memory_cache
struct which is locked separately from the existing cache lock so that
the cache lock can be maintained for a reduced time, locking only when
the cache objects are removed and re-populated.

Resolves: #1700

UserNote: The AMI command sorcery memory cache populate will now
return an error if there is an internal error performing the populate.
The CLI command will display an error in this case as well.

3 weeks agoAdd comment to asterisk.conf.sample clarifying that template sections are ignored
phoneben [Mon, 5 Jan 2026 16:19:23 +0000 (18:19 +0200)] 
Add comment to asterisk.conf.sample clarifying that template sections are ignored

Add comment to asterisk.conf.sample clarifying that template sections are ignored.

Resolves: #1692

3 weeks agochan_websocket: Use the channel's ability to poll fds for the websocket read.
George Joseph [Tue, 30 Dec 2025 19:15:26 +0000 (12:15 -0700)] 
chan_websocket: Use the channel's ability to poll fds for the websocket read.

We now add the websocket's file descriptor to the channel's fd array and let
it poll for data availability instead if having a dedicated thread that
does the polling. This eliminates the thread and allows removal of most
explicit locking since the core channel code will lock the channel to prevent
simultaneous calls to webchan_read, webchan_hangup, etc.

While we were here, the hangup code was refactored to use ast_hangup_with_cause
instead of directly queueing an AST_CONTROL_HANGUP frame.  This allows us
to set hangup causes and generate snapshots.

For a bit of extra debugging, a table of websocket close codes was added
to http_websocket.h with an accompanying "to string" function added to
res_http_websocket.c

Resolves: #1683

3 weeks agoasterisk.c: Allow multi-byte characters on the Asterisk CLI.
Sean Bright [Sat, 13 Dec 2025 20:15:24 +0000 (15:15 -0500)] 
asterisk.c: Allow multi-byte characters on the Asterisk CLI.

Versions of libedit that support Unicode expect that the
EL_GETCFN (the function that does character I/O) will fill in a
`wchar_t` with a character, which may be multi-byte. The built-in
function that libedit provides, but does not expose with a public API,
does properly handle multi-byte sequences.

Due to the design of Asterisk's console processing loop, Asterisk
provides its own implementation which does not handle multi-byte
characters. Changing Asterisk to use libedit's built-in function would
be ideal, but would also require changing some fundamental things
about console processing which could be fairly disruptive.

Instead, we bring in libedit's `read_char` implementation and modify
it to suit our specific needs.

Resolves: #60

3 weeks agofunc_presencestate.c: Allow `NOT_SET` to be set from CLI.
Sean Bright [Thu, 1 Jan 2026 17:50:07 +0000 (12:50 -0500)] 
func_presencestate.c: Allow `NOT_SET` to be set from CLI.

Resolves: #1647

3 weeks agores/ari/resource_bridges.c: Normalize channel_format ref handling for bridge media
Peter Krall [Wed, 17 Dec 2025 12:23:17 +0000 (13:23 +0100)] 
res/ari/resource_bridges.c: Normalize channel_format ref handling for bridge media

Always take an explicit reference on the format used for bridge playback
and recording channels, regardless of where it was sourced, and release
it after prepare_bridge_media_channel. This aligns the code paths and
avoids mixing borrowed and owned references while preserving behavior.

Fixes: #1648
3 weeks agores_geolocation: Fix multiple issues with XML generation.
George Joseph [Wed, 17 Dec 2025 22:49:06 +0000 (15:49 -0700)] 
res_geolocation:  Fix multiple issues with XML generation.

* 3d positions were being rendered without an enclosing `<gml:pos>`
  element resulting in invalid XML.
* There was no way to set the `id` attribute on the enclosing `tuple`, `device`
  and `person` elements.
* There was no way to set the value of the `deviceID` element.
* Parsing of degree and radian UOMs was broken resulting in them appearing
  outside an XML element.
* The UOM schemas for degrees and radians were reversed.
* The Ellipsoid shape was missing and the Ellipse shape was defined multiple
  times.
* The `crs` location_info parameter, although documented, didn't work.
* The `pos3d` location_info parameter appears in some documentation but
  wasn't being parsed correctly.
* The retransmission-allowed and retention-expiry sub-elements of usage-rules
  were using the `gp` namespace instead of the `gbp` namespace.

In addition to fixing the above, several other code refactorings were
performed and the unit test enhanced to include a round trip
XML -> eprofile -> XML validation.

Resolves: #1667

UserNote: Geolocation: Two new optional profile parameters have been added.
* `pidf_element_id` which sets the value of the `id` attribute on the top-level
  PIDF-LO `device`, `person` or `tuple` elements.
* `device_id` which sets the content of the `<deviceID>` element.
Both parameters can include channel variables.

UpgradeNote: Geolocation: In order to correct bugs in both code and
documentation, the following changes to the parameters for GML geolocation
locations are now in effect:
* The documented but unimplemented `crs` (coordinate reference system) element
  has been added to the location_info parameter that indicates whether the `2d`
  or `3d` reference system is to be used. If the crs isn't valid for the shape
  specified, an error will be generated. The default depends on the shape
  specified.
* The Circle, Ellipse and ArcBand shapes MUST use a `2d` crs.  If crs isn't
  specified, it will default to `2d` for these shapes.
  The Sphere, Ellipsoid and Prism shapes MUST use a `3d` crs. If crs isn't
  specified, it will default to `3d` for these shapes.
  The Point and Polygon shapes may use either crs.  The default crs is `2d`
  however so if `3d` positions are used, the crs must be explicitly set to `3d`.
* The `geoloc show gml_shape_defs` CLI command has been updated to show which
  coordinate reference systems are valid for each shape.
* The `pos3d` element has been removed in favor of allowing the `pos` element
  to include altitude if the crs is `3d`.  The number of values in the `pos`
  element MUST be 2 if the crs is `2d` and 3 if the crs is `3d`.  An error
  will be generated for any other combination.
* The angle unit-of-measure for shapes that use angles should now be included
  in the respective parameter.  The default is `degrees`. There were some
  inconsistent references to `orientation_uom` in some documentation but that
  parameter never worked and is now removed.  See examples below.
Examples...
```
  location_info = shape="Sphere", pos="39.0 -105.0 1620", radius="20"
  location_info = shape="Point", crs="3d", pos="39.0 -105.0 1620"
  location_info = shape="Point", pos="39.0 -105.0"
  location_info = shape=Ellipsoid, pos="39.0 -105.0 1620", semiMajorAxis="20"
                semiMinorAxis="10", verticalAxis="0", orientation="25 degrees"
  pidf_element_id = ${CHANNEL(name)}-${EXTEN}
  device_id = mac:001122334455
  Set(GEOLOC_PROFILE(pidf_element_id)=${CHANNEL(name)}/${EXTEN})
```

4 weeks agostasis/control.c: Add destructor to timeout_datastore.
George Joseph [Wed, 31 Dec 2025 13:47:34 +0000 (06:47 -0700)] 
stasis/control.c: Add destructor to timeout_datastore.

The timeout_datastore was missing a destructor resulting in a leak
of 16 bytes for every outgoing ARI call.

Resolves: #1681

4 weeks agofunc_talkdetect.c: Remove reference to non-existent variables.
Sean Bright [Tue, 30 Dec 2025 17:57:58 +0000 (12:57 -0500)] 
func_talkdetect.c: Remove reference to non-existent variables.

4 weeks agoconfigure.ac: use AC_PATH_TOOL for nm
Nathaniel Wesley Filardo [Thu, 27 Nov 2025 17:21:12 +0000 (17:21 +0000)] 
configure.ac: use AC_PATH_TOOL for nm

`nm` might, especially in cross-compilation scenarios, be available but prefixed with the target triple. So: use `AC_PATH_TOOL` rather than `AC_PATH_PROG` to find it. (See https://www.gnu.org/software/autoconf/manual/autoconf-2.68/html_node/Generic-Programs.html .)

Found and proposed fix tested by cross-compiling Asterisk using Nixpkgs on x86_64 targeting aarch64. :)

4 weeks agores_pjsip_mwi: Fix off-nominal endpoint ao2 ref leak in mwi_get_notify_data
Alexei Gradinari [Mon, 29 Dec 2025 17:14:04 +0000 (12:14 -0500)] 
res_pjsip_mwi: Fix off-nominal endpoint ao2 ref leak in mwi_get_notify_data

Delay acquisition of the ast_sip_endpoint reference in mwi_get_notify_data()
to avoid an ao2 ref leak on early-return error paths.

Move ast_sip_subscription_get_endpoint() to just before first use so all
acquired references are properly cleaned up.

Fixes: #1675
4 weeks agores_pjsip_messaging: Add support for following 3xx redirects
Maximilian Fridrich [Fri, 7 Nov 2025 11:27:11 +0000 (12:27 +0100)] 
res_pjsip_messaging: Add support for following 3xx redirects

This commit integrates the redirect module into res_pjsip_messaging
to enable following 3xx redirect responses for outgoing SIP MESSAGEs.

When follow_redirect_methods contains 'message' on an endpoint, Asterisk
will now follow 3xx redirect responses for MESSAGEs, similar to how
it behaves for INVITE responses.

Resolves: #1576

UserNote: A new pjsip endpoint option follow_redirect_methods was added.
This option is a comma-delimited, case-insensitive list of SIP methods
for which SIP 3XX redirect responses are followed. An alembic upgrade
script has been added for adding this new option to the Asterisk
database.

4 weeks agores_pjsip: Introduce redirect module for handling 3xx responses
Maximilian Fridrich [Fri, 7 Nov 2025 11:26:45 +0000 (12:26 +0100)] 
res_pjsip: Introduce redirect module for handling 3xx responses

This commit introduces a new redirect handling module that provides
infrastructure for following SIP 3xx redirect responses. The redirect
functionality respects the endpoint's redirect_method setting and only
follows redirects when set to 'uri_pjsip'. This infrastructure can be
used by any PJSIP module that needs to handle 3xx redirect responses.

4 weeks agoapp_mixmonitor.c: Fix crash in mixmonitor_ds_remove_and_free when datastore is NULL
Tinet-mucw [Fri, 26 Dec 2025 05:18:03 +0000 (21:18 -0800)] 
app_mixmonitor.c: Fix crash in mixmonitor_ds_remove_and_free when datastore is NULL

The datastore may be NULL, so a null pointer check needs to be added.

Resolves: #1673

4 weeks agores_pjsip_refer: don't defer session termination for ari transfer
Sven Kube [Thu, 23 Oct 2025 06:57:00 +0000 (08:57 +0200)] 
res_pjsip_refer: don't defer session termination for ari transfer

Allow session termination during an in progress ari handled transfer.

4 weeks agochan_dahdi.conf.sample: Avoid warnings with default configs.
Naveen Albert [Thu, 23 Oct 2025 12:18:45 +0000 (08:18 -0400)] 
chan_dahdi.conf.sample: Avoid warnings with default configs.

callgroup and pickupgroup may only be specified for FXO-signaled channels;
however, the chan_dahdi sample config had these options uncommented in
the [channels] section, thus applying these settings to all channels,
resulting in warnings. Comment these out so there are no warnings with
an unmodified sample config.

Resolves: #1552

4 weeks agomain/dial.c: Set channel hangup cause on timeout in handle_timeout_trip
sarangr7 [Thu, 18 Dec 2025 06:04:14 +0000 (11:34 +0530)] 
main/dial.c: Set channel hangup cause on timeout in handle_timeout_trip

When dial attempts timeout in the core dialing API, the channel's hangup
cause was not being set before hanging up. Only the ast_dial_channel
structure's internal cause field was updated, but the actual ast_channel
hangup cause remained unset.

This resulted in incorrect or missing hangup cause information being
reported through CDRs, AMI events, and other mechanisms that read the
channel's hangup cause when dial timeouts occurred via applications
using the dialing API (FollowMe, Page, etc.).

The fix adds proper channel locking and sets AST_CAUSE_NO_ANSWER on
the channel before calling ast_hangup(), ensuring consistent hangup
cause reporting across all interfaces.

Resolves: #1660

4 weeks agocel: Add missing manager documentation.
Sean Bright [Fri, 12 Dec 2025 19:44:15 +0000 (14:44 -0500)] 
cel: Add missing manager documentation.

The LOCAL_OPTIMIZE_BEGIN, STREAM_BEGIN, STREAM_END, and DTMF CEL
events were not all documented in the CEL configuration file or the
manager documentation for the CEL event.

4 weeks agores_odbc: Use SQL_SUCCEEDED() macro where applicable.
Sean Bright [Wed, 17 Dec 2025 22:08:58 +0000 (17:08 -0500)] 
res_odbc: Use SQL_SUCCEEDED() macro where applicable.

This is just a cleanup of some repetitive code.

4 weeks agortp/rtcp: Configure dual-stack behavior via IPV6_V6ONLY
Justin T. Gibbs [Mon, 22 Dec 2025 01:30:10 +0000 (18:30 -0700)] 
rtp/rtcp: Configure dual-stack behavior via IPV6_V6ONLY

Dual-stack behavior (simultaneous listening for IPV4 and IPV6
connections on a single socket) is required by Asterisk's ICE
implementation.  On systems with the IPV6_V6ONLY sockopt, set
the option to 0 (dual-stack enabled) when binding to the IPV6
any address. This ensures correct behavior regardless of the
system's default dual-stack configuration.

4 weeks agohttp.c: Include remote address in URI handler message.
Sean Bright [Mon, 22 Dec 2025 16:43:41 +0000 (11:43 -0500)] 
http.c: Include remote address in URI handler message.

Resolves: #1662

6 weeks agopjsip: Move from threadpool to taskpool
Joshua C. Colp [Thu, 4 Dec 2025 21:08:58 +0000 (17:08 -0400)] 
pjsip: Move from threadpool to taskpool

This change moves the PJSIP module from the threadpool API
to the taskpool API. PJSIP-specific implementations for
task usage have been removed and replaced with calls to
the optimized taskpool implementations instead. The need
for a pool of serializers has also been removed as
taskpool inherently provides this. The default settings
have also been changed to be more realistic for common
usage.

UpgradeNote: The threadpool_* options in pjsip.conf have now
been deprecated though they continue to be read and used.
They have been replaced with taskpool options that give greater
control over the underlying taskpool used for PJSIP. An alembic
upgrade script has been added to add these options to realtime
as well.

6 weeks agoDisable device state caching for ephemeral channels
phoneben [Tue, 9 Dec 2025 21:15:21 +0000 (23:15 +0200)] 
Disable device state caching for ephemeral channels

chan_audiosocket/chan_rtp/res_stasis_snoop: Disable device state caching for ephemeral channels

Resolves: #1638

6 weeks agochan_websocket: Add locking in send_event and check for NULL websocket handle.
George Joseph [Wed, 10 Dec 2025 17:45:24 +0000 (10:45 -0700)] 
chan_websocket: Add locking in send_event and check for NULL websocket handle.

On an outbound websocket connection, when the triggering caller hangs up,
webchan_hangup() closes the outbound websocket session and sets the websocket
session handle to NULL.  If the hangup happened in the tiny window between
opening the outbound websocket connection and before read_thread_handler()
was able to send the MEDIA_START message, it could segfault because the
websocket session handle was NULL.  If it didn't actually segfault, there was
also the possibility that the websocket instance wouldn't get cleaned up which
could also cause the channel snapshot to not get cleaned up.  That could
cause memory leaks and `core show channels` to list phantom WebSocket
channels.

To prevent the race, the send_event() macro now locks the websocket_pvt
instance and checks the websocket session handle before attempting to send
the MEDIA_START message.

Resolves: #1643
Resolves: #1645

7 weeks agoFix false null-deref warning in channel_state
phoneben [Sun, 7 Dec 2025 22:31:11 +0000 (00:31 +0200)] 
Fix false null-deref warning in channel_state

Resolve analyzer warning in channel_state by checking AST_FLAG_DEAD on snapshot, which is guaranteed non-NULL.

Resolves: #1430

7 weeks agoendpoint.c: Plug a memory leak in ast_endpoint_shutdown().
George Joseph [Mon, 8 Dec 2025 20:40:00 +0000 (13:40 -0700)] 
endpoint.c: Plug a memory leak in ast_endpoint_shutdown().

Commit 26795be introduced a memory leak of ast_endpoint when
ast_endpoint_shutdown() was called. The leak occurs only if a configuration
change removes an endpoint and isn't related to call volume or the length of
time asterisk has been running.  An ao2_ref(-1) has been added to
ast_endpoint_shutdown() to plug the leak.

Resolves: #1635

7 weeks agoRevert "func_hangupcause.c: Add access to Reason headers via HANGUPCAUSE()"
Sean Bright [Wed, 3 Dec 2025 16:36:34 +0000 (11:36 -0500)] 
Revert "func_hangupcause.c: Add access to Reason headers via HANGUPCAUSE()"

This reverts commit 517766299093d7a9798af68b39951ed8b2469836.

For rationale, see #1621 and #1606

7 weeks agocel_manager.c: Correct manager event mask for CEL events.
Sean Bright [Fri, 5 Dec 2025 22:01:01 +0000 (17:01 -0500)] 
cel_manager.c: Correct manager event mask for CEL events.

There is no EVENT_FLAG_CEL and these events are raised with as
EVENT_FLAG_CALL.

7 weeks agoapp_queue.c: Update docs to correct QueueMemberPause event name.
Sean Bright [Thu, 4 Dec 2025 23:31:51 +0000 (18:31 -0500)] 
app_queue.c: Update docs to correct QueueMemberPause event name.

8 weeks agotaskprocessors: Improve logging and add new cli options
Mike Bradeen [Tue, 28 Oct 2025 21:26:03 +0000 (15:26 -0600)] 
taskprocessors: Improve logging and add new cli options

This change makes some small changes to improve log readability in
addition to the following changes:

Modified 'core show taskprocessors' to now show Low time and High time
for task execution.

New command 'core show taskprocessor name <taskprocessor-name>' to dump
taskprocessor info and current queue.

Addionally, a new test was added to demonstrate the 'show taskprocessor
name' functionality:
test execute category /main/taskprocessor/ name taskprocessor_cli_show

Setting 'core set debug 3 taskprocessor.c' will now log pushed tasks.
(Warning this is will cause extremely high levels of logging at even
low traffic levels.)

Resolves: #1566

UserNote: New CLI command has been added -
core show taskprocessor name <taskprocessor-name>

8 weeks agomanager: fix double free of criteria variable when adding filter
Michal Hajek [Mon, 13 Oct 2025 12:02:43 +0000 (14:02 +0200)] 
manager: fix double free of criteria variable when adding filter

Signed-off-by: Michal Hajek <michal.hajek@daktela.com>
Fixes: #1531
8 weeks agoapp_stream_echo.c: Check that stream is non-NULL before dereferencing.
Sean Bright [Mon, 1 Dec 2025 20:41:26 +0000 (15:41 -0500)] 
app_stream_echo.c: Check that stream is non-NULL before dereferencing.

Also re-order and rename the arguments of `stream_echo_write_error` to
match those of `ast_write_stream` for consistency.

Resolves: #1427

8 weeks agoabstract_jb.c: Remove redundant timer check per static analysis.
Sean Bright [Mon, 1 Dec 2025 20:28:04 +0000 (15:28 -0500)] 
abstract_jb.c: Remove redundant timer check per static analysis.

While this check is technically unnecessary, it also was not harmful.

The 2 other items mentioned in the linked issue are false positives
and require no action.

Resolves: #1417

8 weeks agochannelstorage_cpp: Fix fallback return value in channelstorage callback
phoneben [Wed, 26 Nov 2025 12:00:21 +0000 (14:00 +0200)] 
channelstorage_cpp: Fix fallback return value in channelstorage callback

callback returned the last iterated channel when no match existed, causing invalid channel references and potential double frees. Updated to correctly return NULL when there is no match.

Resolves: #1609

8 weeks agoccss: Add option to ccss.conf to globally disable it.
George Joseph [Wed, 19 Nov 2025 21:57:46 +0000 (14:57 -0700)] 
ccss:  Add option to ccss.conf to globally disable it.

The Call Completion Supplementary Service feature is rarely used but many of
it's functions are called by app_dial and channel.c "just in case".  These
functions lock and unlock the channel just to see if CCSS is enabled on it,
which it isn't 99.99% of the time.

UserNote: A new "enabled" parameter has been added to ccss.conf.  It defaults
to "yes" to preserve backwards compatibility but CCSS is rarely used so
setting "enabled = no" in the "general" section can save some unneeded channel
locking operations and log message spam.  Disabling ccss will also prevent
the func_callcompletion and chan_dahdi modules from loading.

DeveloperNote: A new API ast_is_cc_enabled() has been added.  It should be
used to ensure that CCSS is enabled before making any other ast_cc_* calls.

8 weeks agoapp_directed_pickup.c: Change some log messages from NOTICE to VERBOSE.
George Joseph [Thu, 20 Nov 2025 14:45:27 +0000 (07:45 -0700)] 
app_directed_pickup.c: Change some log messages from NOTICE to VERBOSE.

UpgradeNote: In an effort to reduce log spam, two normal progress
"pickup attempted" log messages from app_directed_pickup have been changed
from NOTICE to VERBOSE(3).  This puts them on par with other normal
dialplan progress messages.

8 weeks agochan_websocket: Fix crash on DTMF_END event.
Sean Bright [Thu, 20 Nov 2025 16:31:28 +0000 (11:31 -0500)] 
chan_websocket: Fix crash on DTMF_END event.

Resolves: #1604

2 months agochan_websocket.c: Tolerate other frame types
Joe Garlick [Wed, 12 Nov 2025 11:47:38 +0000 (11:47 +0000)] 
chan_websocket.c: Tolerate other frame types

Currently, if chan_websocket receives an un supported frame like comfort noise it will exit the websocket. The proposed change is to tolerate the other frames by not sending them down the websocket but instead just ignoring them.

Resolves: #1587

2 months agoapp_reload: Fix Reload() without arguments.
Naveen Albert [Mon, 17 Nov 2025 21:14:16 +0000 (16:14 -0500)] 
app_reload: Fix Reload() without arguments.

Calling Reload() without any arguments is supposed to reload
everything (equivalent to a 'core reload'), but actually does
nothing. This is because it was calling ast_module_reload with
an empty string, and the argument needs to explicitly be NULL.

Resolves: #1597

2 months agopbx.c: Print new context count when reloading dialplan.
Naveen Albert [Mon, 17 Nov 2025 21:16:59 +0000 (16:16 -0500)] 
pbx.c: Print new context count when reloading dialplan.

When running "dialplan reload", the number of contexts reported
is initially wrong, as it is the old context count. Running
"dialplan reload" a second time returns the correct number of
contexts that are loaded. This can confuse users into thinking
that the reload didn't work successfully the first time.

This counter is currently only incremented when iterating the
old contexts prior to the context merge; at the very end, get
the current number of elements in the context hash table and
report that instead. This way, the count is correct immediately
whenever a reload occurs.

Resolves: #1599

2 months agoMakefile: Add module-list-* targets.
C. Maj [Mon, 17 Nov 2025 13:54:40 +0000 (06:54 -0700)] 
Makefile: Add module-list-* targets.

Convenience wrappers for showing modules at various support levels.

* module-list-core
* module-list-extended
* module-list-deprecated

Resolves: #1572

UserNote: Try "make module-list-deprecated" to see what modules
are on their way out the door.

2 months agocore_unreal.c: Use ast instead of p->chan to get the DIALSTATUS variable
Tinet-mucw [Fri, 14 Nov 2025 02:01:28 +0000 (18:01 -0800)] 
core_unreal.c: Use ast instead of p->chan to get the DIALSTATUS variable

After p->chan = NULL, ast still points to the valid channel object,
using ast safely accesses the channel's DIALSTATUS variable before it's fully destroyed

Resolves: #1590

2 months agoast_coredumper: Fix multiple issues
George Joseph [Fri, 7 Nov 2025 21:39:12 +0000 (14:39 -0700)] 
ast_coredumper: Fix multiple issues

* Fixed an issue with tarball-coredumps when asterisk was invoked without an
absolute path.

* Fixed an issue with gdb itself segfaulting when trying to get symbols from
separate debuginfo files.  The command line arguments needed to be altered
such that the gdbinit files is loaded before anything else but the
`dump-asterisk` command is run after full initialization.

In the embedded gdbinit script:

* The extract_string_symbol function needed a `char *` cast to work properly.

* The s_strip function needed to be updated to continue to work with the
cpp_map_name_id channel storage backend.

* A new function was added to dump the channels when cpp_map_name_id was
used.

* The Channel object was updated to account for the new channel storage
backends

* The show_locks function was refactored to work correctly.

2 months agoapp_mixmonitor: Add 's' (skip) option to delay recording.
Daouda Taha [Wed, 29 Oct 2025 00:57:00 +0000 (20:57 -0400)] 
app_mixmonitor: Add 's' (skip) option to delay recording.

The 's' (skip) option delays MixMonitor recording until the specified number of seconds
(can be fractional) have elapsed since MixMonitor was invoked.

No audio is written to the recording file during this time. If the call ends before this
period, no audio will be saved. This is useful for avoiding early audio such as
announcements, ringback tones, or other non-essential sounds.

UserNote: This change introduces a new 's(<seconds>)' (skip) option to the MixMonitor
application. Example:
  MixMonitor(${UNIQUEID}.wav,s(3))

This skips recording for the first 3 seconds before writing audio to the file.
Existing MixMonitor behavior remains unchanged when the 's' option is not used.

2 months agostasis: switch stasis show topics temporary container from list - RBtree
phoneben [Tue, 11 Nov 2025 17:00:56 +0000 (19:00 +0200)] 
stasis: switch stasis show topics temporary container from list - RBtree

switch stasis show topics temporary container from list to RB-tree
minimizing lock time

Resolves: #1585

2 months agoapp_dtmfstore: Avoid a potential buffer overflow.
Sean Bright [Fri, 7 Nov 2025 22:45:21 +0000 (17:45 -0500)] 
app_dtmfstore: Avoid a potential buffer overflow.

Prefer snprintf() so we can readily detect if our output was
truncated.

Resolves: #1421

2 months agomain: Explicitly mark case statement fallthrough as such.
Sean Bright [Fri, 7 Nov 2025 22:36:35 +0000 (17:36 -0500)] 
main: Explicitly mark case statement fallthrough as such.

Resolves: #1442

2 months agobridge_softmix: Return early on topology allocation failure.
Sean Bright [Fri, 7 Nov 2025 22:09:06 +0000 (17:09 -0500)] 
bridge_softmix: Return early on topology allocation failure.

Resolves: #1446

2 months agobridge_simple: Increase code verbosity for clarity.
Sean Bright [Fri, 7 Nov 2025 22:17:28 +0000 (17:17 -0500)] 
bridge_simple: Increase code verbosity for clarity.

There's no actual problem here, but I can see how it might by
confusing.

Resolves: #1444

2 months agoapp_queue.c: Only announce to head caller if announce_to_first_user
Kristian F. Høgh [Thu, 30 Oct 2025 13:43:37 +0000 (14:43 +0100)] 
app_queue.c: Only announce to head caller if announce_to_first_user

Only make announcements to head caller if announce_to_first_user is true

Fixes: #1568
UserNote: When announce_to_first_user is false, no announcements are played to the head caller

2 months agochannelstorage: Allow storage driver read locking to be skipped.
George Joseph [Thu, 6 Nov 2025 19:45:14 +0000 (12:45 -0700)] 
channelstorage:  Allow storage driver read locking to be skipped.

After PR #1498 added read locking to channelstorage_cpp_map_name_id, if ARI
channels/externalMedia was called with a custom channel id AND the
cpp_map_name_id channel storage backend is in use, a deadlock can occur when
hanging up the channel. It's actually triggered in
channel.c:__ast_channel_alloc_ap() when it gets a write lock on the
channelstorage driver then subsequently does a lookup for channel uniqueid
which now does a read lock. This is an invalid operation and causes the lock
state to get "bad". When the channels try to hang up, a write lock is
attempted again which hangs and causes the deadlock.

Now instead of the cpp_map_name_id channelstorage driver "get" APIs
automatically performing a read lock, they take a "lock" parameter which
allows a caller who already has a write lock to indicate that the "get" API
must not attempt its own lock.  This prevents the state from getting mesed up.

The ao2_legacy driver uses the ao2 container's recursive mutex so doesn't
have this issue but since it also implements the common channelstorage API,
it needed its "get" implementations updated to take the lock parameter. They
just don't use it.

Resolves: #1578

2 months agochan_websocket: Add ability to place a MARK in the media stream.
George Joseph [Wed, 5 Nov 2025 21:27:32 +0000 (14:27 -0700)] 
chan_websocket: Add ability to place a MARK in the media stream.

Also cleaned up a few unused #if blocks, and started sending a few ERROR
events back to the apps.

Resolves: #1574

DeveloperNote: Apps can now send a `MARK_MEDIA` command with an optional
`correlation_id` parameter to chan_websocket which will be placed in the
media frame queue. When that frame is dequeued after all intervening media
has been played to the core, chan_websocket will send a
`MEDIA_MARK_PROCESSED` event to the app with the same correlation_id
(if any).

2 months agochan_websocket: Add capability for JSON control messages and events.
George Joseph [Wed, 22 Oct 2025 12:23:31 +0000 (06:23 -0600)] 
chan_websocket: Add capability for JSON control messages and events.

With recent enhancements to chan_websocket, the original plain-text
implementation of control messages and events is now too limiting.  We
probably should have used JSON initially but better late than never.  Going
forward, enhancements that require control message or event changes will
only be done to the JSON variants and the plain-text variants are now
deprecated but not yet removed.

* Added the chan_websocket.conf config file that allows setting which control
message format to use globally: "json" or "plain-text".  "plain-text" is the
default for now to preserve existing behavior.

* Added a dialstring option `f(json|plain-text)` to allow the format to be
overridden on a call-by-call basis.  Again, 'plain-text' is the default for
now to preserve existing behavior.

The JSON for commands sent by the app to Asterisk must be...
`{ "command": "<command>" ... }` where `<command>` is one of `ANSWER`, `HANGUP`,
`START_MEDIA_BUFFERING`, etc.  The `STOP_MEDIA_BUFFERING` command takes an
additional, optional parameter to be returned in the corresponding
`MEDIA_BUFFERING_COMPLETED` event:
`{ "command": "STOP_MEDIA_BUFFERING", "correlation_id": "<correlation id>" }`.

The JSON for events sent from Asterisk to the app will be...
`{ "event": "<event>", "channel_id": "<channel_id>" ... }`.
The `MEDIA_START` event will now look like...

```
{
  "event": "MEDIA_START",
  "connection_id": "media_connection1",
  "channel": "WebSocket/media_connection1/0x5140001a0040",
  "channel_id": "1761245643.1",
  "format": "ulaw",
  "optimal_frame_size": 160,
  "ptime": 20,
  "channel_variables": {
    "DIALEDPEERNUMBER": "media_connection1/c(ulaw)",
    "MEDIA_WEBSOCKET_CONNECTION_ID": "media_connection1",
    "MEDIA_WEBSOCKET_OPTIMAL_FRAME_SIZE": "160"
  }
}
```

Note the addition of the channel variables which can't be supported
with the plain-text formatting.

The documentation will be updated with the exact formats for all commands
and events.

Resolves: #1546
Resolves: #1563

DeveloperNote: The chan_websocket plain-text control and event messages are now
deprecated (but remain the default) in favor of JSON formatted messages.
See https://docs.asterisk.org/Configuration/Channel-Drivers/WebSocket for
more information.

DeveloperNote: A "transport_data" parameter has been added to the
channels/externalMedia ARI endpoint which, for websocket, allows the caller
to specify parameters to be added to the dialstring for the channel.  For
instance, `"transport_data": "f(json)"`.

2 months agobuild: Add menuselect options to facilitate code tracing and coverage
George Joseph [Thu, 30 Oct 2025 12:55:49 +0000 (06:55 -0600)] 
build: Add menuselect options to facilitate code tracing and coverage

The following options have been added to the menuselect "Compiler Flags"
section...

CODE_COVERAGE: The ability to enable code coverage via the `--enable-coverage`
configure flag has existed for many years but changing it requires
re-running ./configure which is painfully slow.  With this commit, you can
now enable and disable it via menuselect. Setting this option adds the
`-ftest-coverage` and `-fprofile-arcs` flags on the gcc and ld command lines.
It also sets DONT_OPTIMIZE. Note: If you use the `--enable-coverage` configure
flag, you can't turn it off via menuselect so choose one method and stick to
it.

KEEP_FRAME_POINTERS: This option sets `-fno-omit-frame-pointers` on the gcc
command line which can facilitate debugging with 'gdb' and tracing with 'perf'.
Unlike CODE_COVERAGE, this option doesn't depend on optimization being
disabled.  It does however conflict with COMPILE_DOUBLE.

3 months agores_audiosocket: fix temporarily unavailable
Roman Pertsev [Tue, 7 Oct 2025 09:49:12 +0000 (12:49 +0300)] 
res_audiosocket: fix temporarily unavailable

Operations on non-blocking sockets may return a resource temporarily unavailable error (EAGAIN or EWOULDBLOCK). This is not a fatal error but a normal condition indicating that the operation would block.

This patch corrects the handling of this case. Instead of incorrectly treating it as a reason to terminate the connection, the code now waits for data to arrive on the socket.

3 months agosafe_asterisk: Resolve a POSIX sh problem and restore globbing behavior.
Sean Bright [Wed, 22 Oct 2025 14:53:46 +0000 (10:53 -0400)] 
safe_asterisk: Resolve a POSIX sh problem and restore globbing behavior.

* Using `==` with the POSIX sh `test` utility is UB.
* Switch back to using globs instead of using `$(find … | sort)`.
* Fix a missing redirect when checking for the OS type.

Resolves: #1554

3 months agores_stir_shaken: Add STIR_SHAKEN_ATTESTATION dialplan function.
George Joseph [Fri, 24 Oct 2025 15:34:47 +0000 (09:34 -0600)] 
res_stir_shaken: Add STIR_SHAKEN_ATTESTATION dialplan function.

Also...

* Refactored the verification datastore process so instead of having
a separate channel datastore for each verification result, there's only
one channel datastore with a vector of results.

* Refactored some log messages to include channel name and removed
some that would be redundant if a memory allocation failed.

Resolves: #781

UserNote: The STIR_SHAKEN_ATTESTATION dialplan function has been added
which will allow suppressing attestation on a call-by-call basis
regardless of the profile attached to the outgoing endpoint.

3 months agoRevert "pjsip: Move from threadpool to taskpool"
Joshua C. Colp [Mon, 27 Oct 2025 13:06:49 +0000 (10:06 -0300)] 
Revert "pjsip: Move from threadpool to taskpool"

This reverts commit bb6b76c2d8239b2665223dcbf6d507aa9aa4534e.

3 months agoiostream.c: Handle TLS handshake attacks in order to resolve the issue of exceeding...
Tinet-mucw [Mon, 27 Oct 2025 05:57:32 +0000 (22:57 -0700)] 
iostream.c: Handle TLS handshake attacks in order to resolve the issue of exceeding the maximum number of HTTPS sessions.

The TCP three-way handshake completes, but if the server is under a TLS handshake attack, asterisk will get stuck at SSL_do_handshake().
In this case, a timeout mechanism should be set for the SSL/TLS handshake process to prevent indefinite waiting during the SSL handshake.

Resolves: #1559

3 months agochan_pjsip: Disable SSRC change for WebRTC endpoints.
George Joseph [Tue, 21 Oct 2025 15:34:23 +0000 (09:34 -0600)] 
chan_pjsip: Disable SSRC change for WebRTC endpoints.

Commit b333ee3b introduced a fix to chan_pjsip that addressed RTP issues with
blind transfers and some SBCs.  Unfortunately, the fix broke some WebRTC
clients that are sensitive to SSRC changes and non-monotonic timestamps so
the fix is now disabled for endpoints with the "bundle" parameter set to true.

Resolves: #1535

3 months agochan_websocket: Add channel_id to MEDIA_START, DRIVER_STATUS and DTMF_END events.
gauravs456 [Tue, 21 Oct 2025 16:57:04 +0000 (22:27 +0530)] 
chan_websocket: Add channel_id to MEDIA_START, DRIVER_STATUS and DTMF_END events.

Resolves: #1544

3 months agopjsip: Move from threadpool to taskpool
Joshua C. Colp [Tue, 23 Sep 2025 21:54:22 +0000 (18:54 -0300)] 
pjsip: Move from threadpool to taskpool

This change moves the PJSIP module from the threadpool API
to the taskpool API. PJSIP-specific implementations for
task usage have been removed and replaced with calls to
the optimized taskpool implementations instead. The need
for a pool of serializers has also been removed as
taskpool inherently provides this. The default settings
have also been changed to be more realistic for common
usage.

UpgradeNote: The threadpool_* options in pjsip.conf have now
been deprecated though they continue to be read and used.
They have been replaced with taskpool options that give greater
control over the underlying taskpool used for PJSIP. An alembic
upgrade script has been added to add these options to realtime
as well.

3 months agosafe_asterisk: Fix logging and sorting issue.
George Joseph [Fri, 17 Oct 2025 15:51:34 +0000 (09:51 -0600)] 
safe_asterisk:  Fix logging and sorting issue.

Re-enabled "TTY=9" which was erroneously disabled as part of a recent
security fix and removed another logging "fix" that was added.

Also added a sort to the "find" that enumerates the scripts to be sourced so
they're sourced in the correct order.

Resolves: #1539

3 months agoFix Endianness detection in utils.h for non-Linux
Christoph Moench-Tegeder [Sun, 19 Oct 2025 17:03:43 +0000 (19:03 +0200)] 
Fix Endianness detection in utils.h for non-Linux

Commit 43bf8a4ded7a65203b766b91eaf8331a600e9d8d introduced endian
dependend byte-swapping code in include/asterisk/utils.h, where the
endianness was detected using the __BYTE_ORDER macro. This macro
lives in endian.h, which on Linux is included implicitely (by the
network-related headers, I think), but on FreeBSD the headers are
laid out differently and we do not get __BYTE_ORDER the implicit way.

Instead, this makes the usage of endian.h explicit by including it
where we need it, and switches the BYTE_ORDER/*ENDIAN macros to the
POSIX-defined ones (see
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/endian.h.html
for standard compliance). Additionally, this adds a compile-time check
for the endianness-logic: compilation will fail if neither big nor
little endian can be detected.

Fixes: #1536
3 months agodevicestate: Don't publish redundant device state messages.
Joshua C. Colp [Fri, 17 Oct 2025 11:57:42 +0000 (08:57 -0300)] 
devicestate: Don't publish redundant device state messages.

When publishing device state check the local cache for the
existing device state. If the new device state is unchanged
from the prior one, don't bother publishing the update. This
can reduce the work done by consumers of device state, such
as hints and app_queue, by not publishing a message to them.

These messages would most often occur with devices that are
seeing numerous simultaneous channels. The underlying device
state would remain as in use throughout, but an update would
be published as channels are created and hung up.

3 months agochan_pjsip: Add technology-specific off-nominal hangup cause to events.
George Joseph [Tue, 14 Oct 2025 16:53:06 +0000 (10:53 -0600)] 
chan_pjsip: Add technology-specific off-nominal hangup cause to events.

Although the ISDN/Q.850/Q.931 hangup cause code is already part of the ARI
and AMI hangup and channel destroyed events, it can be helpful to know what
the actual channel technology code was if the call was unsuccessful.
For PJSIP, it's the SIP response code.

* A new "tech_hangupcause" field was added to the ast_channel structure along
with ast_channel_tech_hangupcause() and ast_channel_tech_hangupcause_set()
functions.  It should only be set for off-nominal terminations.

* chan_pjsip was modified to set the tech hangup cause in the
chan_pjsip_hangup() and chan_pjsip_session_end() functions.  This is a bit
tricky because these two functions aren't always called in the same order.
The channel that hangs up first will get chan_pjsip_session_end() called
first which will trigger the core to call chan_pjsip_hangup() on itself,
then call chan_pjsip_hangup() on the other channel.  The other channel's
chan_pjsip_session_end() function will get called last.  Unfortunately,
the other channel's HangupRequest events are sent before chan_pjsip has had a
chance to set the tech hangupcause code so the HangupRequest events for that
channel won't have the cause code set.  The ChannelDestroyed and Hangup
events however will have the code set for both channels.

* A new "tech_cause" field was added to the ast_channel_snapshot_hangup
structure. This is a public structure so a bit of refactoring was needed to
preserve ABI compatibility.

* The ARI ChannelHangupRequest and ChannelDestroyed events were modified to
include the "tech_cause" parameter in the JSON for off-nominal terminations.
The parameter is suppressed for nominal termination.

* The AMI SoftHangupRequest, HangupRequest and Hangup events were modified to
include the "TechCause" parameter for off-nominal terminations. Like their ARI
counterparts, the parameter is suppressed for nominal termination.

DeveloperNote: A "tech_cause" parameter has been added to the
ChannelHangupRequest and ChannelDestroyed ARI event messages and a "TechCause"
parameter has been added to the HangupRequest, SoftHangupRequest and Hangup
AMI event messages.  For chan_pjsip, these will be set to the last SIP
response status code for off-nominally terminated calls.  The parameter is
suppressed for nominal termination.

3 months agores_audiosocket: add message types for all slin sample rates
Sven Kube [Fri, 10 Oct 2025 09:05:43 +0000 (11:05 +0200)] 
res_audiosocket: add message types for all slin sample rates

Extend audiosocket messages with types 0x11 - 0x18 to create asterisk
frames in slin12, slin16, slin24, slin32, slin44, slin48, slin96, and
slin192 format, enabling the transmission of audio at a higher sample
rates. For audiosocket messages sent by Asterisk, the message kind is
determined by the format of the originating asterisk frame.

UpgradeNote: New audiosocket message types 0x11 - 0x18 has been added
for slin12, slin16, slin24, slin32, slin44, slin48, slin96, and
slin192 audio. External applications using audiosocket may need to be
updated to support these message types if the audiosocket channel is
created with one of these audio formats.

3 months agores_fax.c: lower FAXOPT read warning to debug level
phoneben [Thu, 2 Oct 2025 21:25:01 +0000 (00:25 +0300)] 
res_fax.c: lower FAXOPT read warning to debug level

Reading ${FAXOPT()} before a fax session is common in dialplans to check fax state.
Currently this logs an error even when no fax datastore exists, creating excessive noise.
Change these messages to ast_debug(3, …) so they appear only with debug enabled.

Resolves: #1509

3 months agoendpoints: Remove need for stasis subscription.
Joshua C. Colp [Fri, 10 Oct 2025 16:01:23 +0000 (13:01 -0300)] 
endpoints: Remove need for stasis subscription.

When an endpoint is created in the core of Asterisk a subscription
was previously created alongside it to monitor any channels being
destroyed that were related to it. This was done by receiving all
channel snapshot updates for every channel and only reacting when
it was indicated that the channel was dead.

This change removes this logic and instead provides an API call
for directly removing a channel from an endpoint. This is called
when channels are destroyed. This operation is fast, so blocking
the calling thread for a short period of time doesn't have any
noticeable impact.

3 months agoapp_queue: Allow stasis message filtering to work.
Joshua C. Colp [Fri, 10 Oct 2025 15:53:42 +0000 (12:53 -0300)] 
app_queue: Allow stasis message filtering to work.

The app_queue module subscribes on a per-dialed agent basis to both
the bridge all and channel all topics to keep apprised of things going
on involving them. This subscription has associated state that must
be cleaned up when the subscription ends. This was done by setting
a default router callback that only had logic to handle the case
where the subscription ends. By using the default router callback
all filtering for the subscription was disabled, causing unrelated
messages to get published and handled by it.

This change makes it so that an explicit route is added for the
message type used for the message indicating the subscription has
ended and removes the default router callback. This allows message
filtering to occur on publishing reducing the messages to app_queue
to only those it is interested in.

3 months agotaskpool: Fix some references to threadpool that should be taskpool.
George Joseph [Fri, 10 Oct 2025 12:26:05 +0000 (06:26 -0600)] 
taskpool:  Fix some references to threadpool that should be taskpool.

Resolves: #1478

3 months agoUpdate contact information for anthm
Anthony Minessale [Fri, 10 Oct 2025 14:58:27 +0000 (10:58 -0400)] 
Update contact information for anthm

3 months agochan_websocket.c: Change payload references to command instead.
George Joseph [Wed, 8 Oct 2025 13:42:41 +0000 (07:42 -0600)] 
chan_websocket.c: Change payload references to command instead.

Some of the tests in process_text_message() were still comparing to the
websocket message payload instead of the "command" string.

Resolves: #1525

3 months agofunc_callerid: Document limitation of DNID fields.
Naveen Albert [Mon, 6 Oct 2025 20:38:35 +0000 (16:38 -0400)] 
func_callerid: Document limitation of DNID fields.

The Dial() application does not propagate DNID fields, which is counter
to the behavior of the other Caller ID fields. This behavior is likely
intentional since the use of Dial theoretically suggests a new dialed
number, but document this caveat to inform users of it.

Resolves: #1519

3 months agofunc_channel: Allow R/W of ADSI CPE capability setting.
Naveen Albert [Mon, 6 Oct 2025 16:07:37 +0000 (12:07 -0400)] 
func_channel: Allow R/W of ADSI CPE capability setting.

Allow retrieving and setting the channel's ADSI capability from the
dialplan.

Resolves: #1514

UserNote: CHANNEL(adsicpe) can now be read or written to change
the channels' ADSI CPE capability setting.

3 months agocore_unreal: Preserve ADSI capability when dialing Local channels.
Naveen Albert [Mon, 6 Oct 2025 19:00:24 +0000 (15:00 -0400)] 
core_unreal: Preserve ADSI capability when dialing Local channels.

Dial() already preserves the ADSI capability by copying it to the new
channel, but since Local channel pairs consist of two channels, we
also need to copy the capability to the second channel.

Resolves: #1517

3 months agofunc_hangupcause.c: Add access to Reason headers via HANGUPCAUSE()
Igor Goncharovsky [Thu, 4 Sep 2025 04:54:27 +0000 (10:54 +0600)] 
func_hangupcause.c: Add access to Reason headers via HANGUPCAUSE()

As soon as SIP call may end with several Reason headers, we
want to make all of them available through the HAGUPCAUSE() function.
This implementation uses the same ao2 hash for cause codes storage
and adds a flag to make difference between last processed sip
message and content of reason headers.

UserNote: Added a new option to HANGUPCAUSE to access additional
information about hangup reason. Reason headers from pjsip
could be read using 'tech_extended' cause type.

3 months agosig_analog: Allow '#' to end the inter-digit timeout when dialing.
Naveen Albert [Fri, 3 Oct 2025 19:56:06 +0000 (15:56 -0400)] 
sig_analog: Allow '#' to end the inter-digit timeout when dialing.

It is customary to allow # to terminate digit collection immediately
when there would normally be a timeout. However, currently, users are
forced to wait for the timeout to expire when dialing numbers that
are prefixes of other valid matches, and there is no way to end the
timeout early. Customarily, # terminates the timeout, but at the moment,
this is just rejected unless there happens to be a matching extension
ending in #.

Allow # to terminate the timeout in cases where there is no dialplan
match. This ensures that the dialplan is always respected, but if a
valid extension has been dialed that happens to prefix other valid
matches, # can be used to dial it immediately.

Resolves: #1510

3 months agofunc_math: Add DIGIT_SUM function.
Naveen Albert [Wed, 1 Oct 2025 15:34:20 +0000 (11:34 -0400)] 
func_math: Add DIGIT_SUM function.

Add a function (DIGIT_SUM) which returns the digit sum of a number.

Resolves: #1499

UserNote: The DIGIT_SUM function can be used to return the digit sum of
a number.

3 months agoapp_sf: Add post-digit timer option to ReceiveSF.
Naveen Albert [Wed, 1 Oct 2025 14:40:48 +0000 (10:40 -0400)] 
app_sf: Add post-digit timer option to ReceiveSF.

Add a sorely needed option to set a timeout between digits, rather than
for receiving the entire number. This is needed if the number of digits
being sent is unknown by the receiver in advance. Previously, we had
to wait for the entire timer to expire.

Resolves: #1493

UserNote: The 't' option for ReceiveSF now allows for a timer since
the last digit received, in addition to the number-wide timeout.

3 months agores_tonedetect: Fix formatting of XML documentation.
Naveen Albert [Thu, 2 Oct 2025 17:50:50 +0000 (13:50 -0400)] 
res_tonedetect: Fix formatting of XML documentation.

Fix the indentation in the documentation for the variable list.

Resolves: #1507

3 months agores_fax: Add XML documentation for channel variables.
Naveen Albert [Thu, 2 Oct 2025 17:46:29 +0000 (13:46 -0400)] 
res_fax: Add XML documentation for channel variables.

Document the channel variables currently set by SendFAX and ReceiveFAX.

Resolves: #1505

3 months agochannelstorage_cpp_map_name_id: Add read locking around retrievals.
George Joseph [Wed, 1 Oct 2025 14:30:52 +0000 (08:30 -0600)] 
channelstorage_cpp_map_name_id: Add read locking around retrievals.

When we retrieve a channel from a C++ map, we actually get back a wrapper
object that points to the channel then right after we retrieve it, we bump its
reference count.  There's a tiny chance however that between those two
statements a delete and/or unref might happen which would cause the wrapper
object or the channel itself to become invalid resulting in a SEGV.  To avoid
this we now perform a read lock on the driver around those statements.

Resolves: #1491

3 months agoapp_dial: Allow fractional seconds for dial timeouts.
Naveen Albert [Tue, 30 Sep 2025 14:25:01 +0000 (10:25 -0400)] 
app_dial: Allow fractional seconds for dial timeouts.

Even though Dial() internally uses milliseconds for its dial timeouts,
this capability has been mostly obscured from users as the argument is
only parsed as an integer, thus forcing the use of whole seconds for
timeouts.

Parse it as a decimal instead so that timeouts can now truly have
millisecond precision.

Resolves: #1487

UserNote: The answer and progress dial timeouts now have millisecond
precision, instead of having to be whole numbers.

3 months agodsp.c: Make minor fixes to debug log messages.
Naveen Albert [Wed, 1 Oct 2025 14:51:12 +0000 (10:51 -0400)] 
dsp.c: Make minor fixes to debug log messages.

Commit dc8e3eeaaf094a3d16991289934093d5e7127680 improved the debug log
messages in dsp.c. This makes two minor corrections to it:

* Properly guard an added log statement in a conditional.
* Don't add one to the hit count if there was no hit (however, we do
  still want to do this for the case where this is one).

Resolves: #1496