Commit Graph

34175 Commits

Author SHA1 Message Date
Ben Ford
ca5335d90e Update version for Asterisk 23 23.0.0-pre1 2025-08-13 19:03:24 +00:00
Alexey Khabulyak
b0421fc87c app_dial.c: Moved channel lock to prevent deadlock
It's reproducible with pbx_lua, not regular dialplan.

deadlock description:
1. asterisk locks a channel
2. calls function onedigit_goto
3. calls ast_goto_if_exists funciton
4. checks ast_exists_extension -> pbx_extension_helper
5. pbx_extension_helper calls pbx_find_extension
6. Then asterisk starts autoservice in a new thread
7. autoservice run tries to lock the channel again

Because our channel is locked already, autoservice can't lock.
Autoservice can't lock -> autoservice stop is waiting forever.
onedigit_goto waits for autoservice stop.

Resolves: https://github.com/asterisk/asterisk/issues/1335
2025-08-11 14:37:22 +00:00
Mike Bradeen
dce107234a res_pjsip_diversion: resolve race condition between Diversion header processing and redirect
Based on the firing order of the PJSIP call-backs on a redirect, it was possible for
the Diversion header to not be included in the outgoing 181 response to the UAC and
the INVITE to the UAS.

This change moves the Diversion header processing to an earlier PJSIP callback while also
preventing the corresponding update that can cause a duplicate 181 response when processing
the header at that time.

Resolves: #1349
2025-08-11 13:58:11 +00:00
Allan Nathanson
31571a5079 file.c: with "sounds_search_custom_dir = yes", search "custom" directory
With `sounds_search_custom_dir = yes`, we are supposed to search for sounds
in the `AST_DATA_DIR/sounds/custom` directory before searching the normal
directories.  Unfortunately, a recent change
(https://github.com/asterisk/asterisk/pull/1172) had a typo resulting in
the "custom" directory not being searched.  This change restores this
expected behavior.

Resolves: #1353
2025-08-11 13:53:22 +00:00
Sperl Viktor
c1f24b74d7 cel: Add STREAM_BEGIN, STREAM_END and DTMF event types.
Fixes: #1280

UserNote: Enabling the tracking of the
STREAM_BEGIN and the STREAM_END event
types in cel.conf will log media files and
music on hold played to each channel.
The STREAM_BEGIN event's extra field will
contain a JSON with the file details (path,
format and language), or the class name, in
case of music on hold is played. The DTMF
event's extra field will contain a JSON with
the digit and the duration in milliseconds.
2025-08-11 13:52:30 +00:00
Naveen Albert
613d645d04 func_dialplan: Remove deprecated/redundant function.
Remove VALID_EXTEN, which was deprecated/superseded by DIALPLAN_EXISTS
in Asterisk 11 (commit 8017b65bb9),
as DIALPLAN_EXISTS does the same thing and is more flexible.

Resolves: #1347

UpgradeNote: The deprecated VALID_EXTEN function has been removed.
Use DIALPLAN_EXISTS instead.
2025-08-11 12:32:01 +00:00
Naveen Albert
c8f844a900 logger.c: Remove deprecated/redundant configuration option.
Remove the deprecated 'rotatetimestamp' config option, as this
was deprecated by 'rotatestrategy' in 1.6 by commit
f5a14167f3.

Resolves: #1345

UpgradeNote: The deprecated rotatetimestamp option has been removed.
Use rotatestrategy instead.
2025-08-11 12:23:42 +00:00
Naveen Albert
5c3cd44563 cli.c: Remove deprecated and redundant CLI command.
The "no debug channel" command has been deprecated since
1.6 (commit 691363656f),
as it is replaced by "core set debug channel", which also
supports tab-completion on channels. Remove the redundant
command.

Resolves: #1343

UpgradeNote: The deprecated "no debug channel" command has
now been removed; use "core set debug channel" instead.
2025-08-11 12:22:45 +00:00
Naveen Albert
aca74d100c app_queue: Remove redundant/deprecated function.
QUEUE_MEMBER_COUNT has been deprecated since at least 1.6,
for fully duplicating functionality available in the
QUEUE_MEMBER function; remove it now.

Resolves: #1341

UpgradeNote: The deprecated QUEUE_MEMBER_COUNT function
has been removed; use QUEUE_MEMBER(<queue>,logged) instead.
2025-08-11 12:22:28 +00:00
George Joseph
baa73b6b12 channelstorage_cpp_map_name_id.cc: Refactor iterators for thread-safety.
The fact that deleting an object from a map invalidates any iterator
that happens to currently point to that object was overlooked in the initial
implementation.  Unfortunately, there's no way to detect that an iterator
has been invalidated so the result was an occasional SEGV triggered by modules
like app_chanspy that opens an iterator and can keep it open for a long period
of time.  The new implementation doesn't keep the underlying C++ iterator
open across calls to ast_channel_iterator_next() and uses a read lock
on the map to ensure that, even for the few microseconds we use the
iterator, another thread can't delete a channel from under it.  Even with
this change, the iterators are still WAY faster than the ao2_legacy
storage driver.

Full details about the new implementation are located in the comments for
iterator_next() in channelstorage_cpp_map_name_id.cc.

Resolves: #1309
2025-08-07 14:58:32 +00:00
George Joseph
22d405e900 res_srtp: Add menuselect options to enable AES_192, AES_256 and AES_GCM
UserNote: Options are now available in the menuselect "Resource Modules"
category that allow you to enable the AES_192, AES_256 and AES_GCM
cipher suites in res_srtp. Of course, libsrtp and OpenSSL must support
them but modern versions do.  Previously, the only way to enable them was
to set the CFLAGS environment variable when running ./configure.
The default setting is to disable them preserving existing behavior.
2025-08-06 15:40:02 +00:00
zhou_jiajian
511d22ef5e cdr: add CANCEL dispostion in CDR
In the original implementation, both CANCEL and NO ANSWER states were
consolidated under the NO ANSWER disposition. This patch introduces a
separate CANCEL disposition, with an optional configuration switch to
enable this new disposition.

Resolves: #1323

UserNote: A new CDR option "canceldispositionenabled" has been added
that when set to true, the NO ANSWER disposition will be split into
two dispositions: CANCEL and NO ANSWER. The default value is 'no'
2025-08-06 15:37:52 +00:00
Naveen Albert
2ae6cb7c93 func_curl: Allow auth methods to be set.
Currently the CURL function only supports Basic Authentication,
the default auth method in libcurl. Add an option that also
allows enabling digest authentication.

Resolves: #1332

UserNote: The httpauth field in CURLOPT now allows the authentication
methods to be set.
2025-08-05 16:49:22 +00:00
George Joseph
723410e312 res_stir_shaken: Test for missing semicolon in Identity header.
ast_stir_shaken_vs_verify() now makes sure there's a semicolon in
the Identity header to prevent a possible segfault.

Resolves: #GHSA-mrq5-74j5-f5cr
2025-07-31 08:39:06 -06:00
ThatTotallyRealMyth
f973619520 safe_asterisk: Add ownership checks for /etc/asterisk/startup.d and its files.
UpgradeNote: The safe_asterisk script now checks that, if it was run by the
root user, the /etc/asterisk/startup.d directory and all the files it contains
are owned by root.  If the checks fail, safe_asterisk will exit with an error
and Asterisk will not be started.  Additionally, the default logging
destination is now stderr instead of tty "9" which probably won't exist
in modern systems.

Resolves: #GHSA-v9q8-9j8m-5xwp
2025-07-31 14:06:31 +00:00
George Joseph
43bf8a4ded options: Change ast_options from ast_flags to ast_flags64.
DeveloperNote: The 32-bit ast_options has no room left to accomodate new
options and so has been converted to an ast_flags64 structure. All internal
references to ast_options have been updated to use the 64-bit flag
manipulation macros.  External module references to the 32-bit ast_options
should continue to work on little-endian systems because the
least-significant bytes of a 64 bit integer will be in the same location as a
32-bit integer.  Because that's not the case on big-endian systems, we've
swapped the bytes in the flags manupulation macros on big-endian systems
so external modules should still work however you are encouraged to test.
2025-07-30 16:04:01 +00:00
Alexei Gradinari
3e178dcfd6 res_config_odbc: Prevent Realtime fallback on record-not-found (SQL_NO_DATA)
This patch fixes an issue in the ODBC Realtime engine where Asterisk incorrectly
falls back to the next configured backend when the current one returns
SQL_NO_DATA (i.e., no record found).
This is a logical error and performance risk in multi-backend configurations.

Solution:
Introduced CONFIG_RT_NOT_FOUND ((void *)-1) as a special return marker.
ODBC Realtime backend now return CONFIG_RT_NOT_FOUND when no data is found.
Core engine stops iterating on this marker, avoiding unnecessary fallback.

Notes:
Other Realtime backends (PostgreSQL, LDAP, etc.) can be updated similarly.
This patch only covers ODBC.

Fixes: #1305
2025-07-30 15:38:31 +00:00
Sven Kube
9820a62263 resource_channels.c: Don't call ast_channel_get_by_name on empty optional arguments
`ast_ari_channels_create` and `ast_ari_channels_dial` called the
`ast_channel_get_by_name` function with optional arguments. Since
8f1982c4d6, this function logs an error for empty channel names.
This commit adds checks for empty optional arguments that are used
to call `ast_channel_get_by_name` to prevent these error logs.
2025-07-30 15:36:06 +00:00
Naveen Albert
4a3c9ea574 app_agent_pool: Remove documentation for removed option.
The already-deprecated "password" option for the AGENT function was
removed in commit d43b17a872 for
Asterisk 12, but the documentation for it wasn't removed then.

Resolves: #1321
2025-07-30 14:21:45 +00:00
Tinet-mucw
009e3ef3f5 pbx.c: When the AST_SOFTHANGUP_ASYNCGOTO flag is set, pbx_extension_helper should return directly.
Under certain circumstances the context/extens/prio are set in the ast_async_goto, for example action Redirect.
In the situation that action Redirect is broken by pbx_extension_helper this info is changed.
This will cause the current dialplan location to be executed twice.
In other words, the Redirect action does not take effect.

Resolves: #1315
2025-07-22 18:58:48 +00:00
Sperl Viktor
5f433e2442 res_agi: Increase AGI command buffer size from 2K to 8K
Fixes: #1317
2025-07-22 17:39:43 +00:00
Naveen Albert
741ad37086 app_voicemail: Remove deprecated options.
Remove the deprecated maxmessage and minmessage options,
which have been superseded by maxsecs and minsecs since 1.6.
Also remove the deprecated 'cz' language option (deprecated
since 1.8.)

Resolves: #1298

UpgradeNote: The deprecated maxmessage and minmessage options
have been removed; use maxsecs and minsecs instead.
The deprecated 'cz' language has also been removed; use 'cs' instead.
2025-07-22 17:33:27 +00:00
Naveen Albert
16280837d2 ast_tls_cert: Make certificate validity configurable.
Currently, the ast_tls_cert script is hardcoded to produce certificates
with a validity of 365 days, which is not generally desirable for self-
signed certificates. Make this parameter configurable.

Resolves: #1307
2025-07-22 13:20:20 +00:00
George Joseph
32b8bf0169 cdr.c: Set tenantid from party_a->base instead of chan->base.
The CDR tenantid was being set in cdr_object_alloc from the channel->base
snapshot.  Since this happens at channel creation before the dialplan is even
reached, calls to `CHANNEL(tenantid)=<something>` in the dialplan were being
ignored.  Instead we now take tenantid from party_a when
cdr_object_create_public_records() is called which is after the call has
ended and all channel snapshots rebuilt.  This is exactly how accountcode
and amaflags, which can also be set in tha dialplpan, are handled.

Resolves: #1259
2025-07-22 12:55:25 +00:00
George Joseph
baf729c7f2 .github: Reduce number of inputs to Releaser to 10.
The max number of inputs supported by GitHub is 10 so
is_security and is_hotfix were factored into a single choice
entry.
2025-07-18 11:26:37 -06:00
George Joseph
472eb45dc9 .github: Add skip-cherry-pick and skip-test-builds to Releaser. 2025-07-18 11:04:04 -06:00
George Joseph
1f52ae3582 app_mixmonitor: Update the documentation concerning the "D" option.
When using the "D" option to output interleaved audio, the file extension
must be ".raw".  That info wasn't being properly rendered in the markdown
and HTML on the documentation site.  The XML was updated to move the
note in the option section to a warning in the description.

Resolves: #1269
2025-07-17 15:07:44 +00:00
Naveen Albert
8ef3e4fb3d sig_analog: Properly handle STP, ST2P, and ST3P for fgccamamf.
Previously, we were only using # (ST) as a terminator, and not handling
A (STP), B (ST2P), or C (ST3P), which erroneously led to it being
treated as part of the dialed number. Parse any of these as the start
digit.

Resolves: #1301
2025-07-15 15:16:06 +00:00
Naveen Albert
5de45323c7 res_musiconhold: Remove options that were deprecated in Asterisk 14.
Commit 9c1f34c7e9 added dedicated options
for random sorting functionality and deprecated older options that
now duplicated these capabilities. Remove these deprecated options.

Resolves: #1296

UpgradeNote: The deprecated random and application=r options have
been removed; use sort=random instead.
2025-07-15 15:12:17 +00:00
Naveen Albert
c12f4a886d res_agi: Remove deprecated DeadAGI application.
DeadAGI was deprecated 7 years ago, in Asterisk 15,
as it duplicates functionality in the AGI app.
This removes the application.

Resolves: #258

UpgradeNote: The DeadAGI application, which was
deprecated in Asterisk 15, has now been removed.
The same functionality is available in the AGI app.
2025-07-15 13:57:39 +00:00
kodokaii
f9219284cb chan_websocket: Reset frame_queue_length to 0 after FLUSH_MEDIA
In the WebSocket channel driver, the FLUSH_MEDIA command clears all frames from
the queue but does not reset the frame_queue_length counter.

As a result, the driver incorrectly thinks the queue is full after flushing,
which prevents new multimedia frames from being sent, especially after multiple
flush commands.

This fix sets frame_queue_length to 0 after flushing, ensuring the queue state
is consistent with its actual content.

Fixes: #1304
2025-07-15 13:46:10 +00:00
George Joseph
0086f4a0b8 channelstorage_cpp_map_name_id: Fix callback returning non-matching channels.
When the callback() API was invoked but no channel passed the test, callback
would return the last channel tested instead of NULL.  It now correctly
returns NULL when no channel matches.

Resolves: #1288
2025-07-10 15:07:21 +00:00
Martin Tomec
9e7788ad21 chan_pjsip.c: Change SSRC after media source change
When the RTP media source changes, such as after a blind transfer, the new source introduces a discontinuous timestamp. According to RFC 3550, Section 5.1, an RTP stream's timestamp for a given SSRC must increment monotonically and linearly.
To comply with the standard and avoid a large timestamp jump on the existing SSRC, a new SSRC is generated for the new media stream.
This change resolves known interoperability issues with certain SBCs (like Sonus/Ribbon) that stop forwarding media when they detect such a timestamp violation. This code uses the existing implementation from chan_sip.

Resolves: #927
2025-07-10 14:49:00 +00:00
Naveen Albert
415daae95f users.conf: Remove deprecated users.conf integration.
users.conf was deprecated in Asterisk 21 and is now being removed
for Asterisk 23, in accordance with the Asterisk deprecation policy.

This consists of:
* Removing integration with app_directory, app_voicemail, chan_dahdi,
  chan_iax2, and AMI.
* users.conf was also partially used for res_phoneprov, and this remaining
  functionality is consolidated to a separate phoneprov_users.conf,
  used only by res_phoneprov.

Resolves: #1292

UpgradeNote: users.conf has been removed and all channel drivers must
be configured using their specific configuration files. The functionality
previously in users.conf for res_phoneprov is now in phoneprov_users.conf.
2025-07-10 14:47:38 +00:00
George Joseph
5963e624e2 Media over Websocket Channel Driver
* Created chan_websocket which can exchange media over both inbound and
outbound websockets which the driver will frame and time.
See http://s.asterisk.net/mow for more information.

* res_http_websocket: Made defines for max message size public and converted
a few nuisance verbose messages to debugs.

* main/channel.c: Changed an obsolete nuisance error to a debug.

* ARI channels: Updated externalMedia to include chan_websocket as a supported
transport.

UserNote: A new channel driver "chan_websocket" is now available. It can
exchange media over both inbound and outbound websockets and will both frame
and re-time the media it receives.
See http://s.asterisk.net/mow for more information.

UserNote: The ARI channels/externalMedia API now includes support for the
WebSocket transport provided by chan_websocket.
2025-07-09 17:42:22 +00:00
George Joseph
d5bd2b3ce9 channelstorage: Rename callbacks that conflict with DEBUG_FD_LEAKS.
DEBUG_FD_LEAKS replaces calls to "open" and "close" with functions that keep
track of file descriptors, even when those calls are actually callbacks
defined in structures like ast_channelstorage_instance->open and don't touch
file descriptors.  This causes compilation failures.  Those callbacks
have been renamed to "open_instance" and "close_instance" respectively.

Resolves: #1287
2025-07-08 15:22:45 +00:00
Stanislav Abramenkov
b158011c4e bundled_pjproject: Avoid deadlock between transport and transaction
Backport patch from upstream
* Avoid deadlock between transport and transaction
https://github.com/pjsip/pjproject/commit/edde06f261ac

Issue described in
https://github.com/pjsip/pjproject/issues/4442
2025-07-03 14:34:13 +00:00
Michal Hajek
4522eb1222 audiohook.c: Improve frame pairing logic to avoid MixMonitor breakage with mixed codecs
This patch adjusts the read/write synchronization logic in audiohook_read_frame_both()
to better handle calls where participants use different codecs or sample sizes
(e.g., alaw vs G.722). The previous hard threshold of 2 * samples caused MixMonitor
recordings to break or stutter when frames were not aligned between both directions.

The new logic uses a more tolerant limit (1.5 * samples), which prevents audio tearing
without causing excessive buffer overruns. This fix specifically addresses issues
with MixMonitor when recording directly on a channel in a bridge using mixed codecs.

Reported-by: Michal Hajek <michal.hajek@daktela.com>

Resolves: #1276
Resolves: #1279
2025-07-02 14:34:42 +00:00
Sean Bright
574ddb9eae channelstorage_makeopts.xml: Remove errant XML character.
Resolves: #1282
2025-07-01 14:02:39 +00:00
mkmer
d5ef09ea0c utils.h: Add rounding to float conversion to int.
Quote from an audio engineer NR9V:
There is a minor issue of a small amount of crossover distortion though as a result of `ast_slinear_saturated_multiply_float()` not rounding the float. This could result in some quiet but potentially audible distortion artifacts in lower volume parts of the signal. If you have for example a sign wave function with a max amplitude of just a few samples, all samples between -1 and 1 will be truncated to zero, resulting in the waveform no longer being a sine wave and in harmonic distortion.

Resolves: #1176
2025-06-27 15:38:36 +00:00
Tinet-mucw
8149554e90 pbx.c: when set flag AST_SOFTHANGUP_ASYNCGOTO, ast_explicit_goto should return -1.
Under certain circumstances the context/extens/prio are set in the ast_async_goto, for example action Redirect.
In the situation that action Redirect is broken by GotoIf this info is changed.
that will causes confusion in dialplan execution.

Resolves: #1273
2025-06-27 15:37:38 +00:00
Sean Bright
fa50490b13 res_musiconhold.c: Ensure we're always locked around music state access. 2025-06-27 14:01:24 +00:00
Sean Bright
0e9e381e0d res_musiconhold.c: Annotate when the channel is locked. 2025-06-27 14:01:24 +00:00
Jaco Kroon
014da68306 res_musiconhold: Appropriately lock channel during start.
This relates to #829

This doesn't sully solve the Ops issue, but it solves the specific crash
there.  Further PRs to follow.

In the specific crash the generator was still under construction when
moh was being stopped, which then proceeded to close the stream whilst
it was still in use.

Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2025-06-27 14:01:24 +00:00
George Joseph
8b8a8c1475 res_stir_shaken.so: Handle X5U certificate chains.
The verification process will now load a full certificate chain retrieved
via the X5U URL instead of loading only the end user cert.

* Renamed crypto_load_cert_from_file() and crypto_load_cert_from_memory()
to crypto_load_cert_chain_from_file() and crypto_load_cert_chain_from_memory()
respectively.

* The two load functions now continue to load certs from the file or memory
PEMs and store them in a separate stack of untrusted certs specific to the
current verification context.

* crypto_is_cert_trusted() now uses the stack of untrusted certs that were
extracted from the PEM in addition to any untrusted certs that were passed
in from the configuration (and any CA certs passed in from the config of
course).

Resolves: #1272

UserNote: The STIR/SHAKEN verification process will now load a full
certificate chain retrieved via the X5U URL instead of loading only
the end user cert.
2025-06-25 13:02:07 +00:00
George Joseph
fe341c2b0f res_stir_shaken: Add "ignore_sip_date_header" config option.
UserNote: A new STIR/SHAKEN verification option "ignore_sip_date_header" has
been added that when set to true, will cause the verification process to
not consider a missing or invalid SIP "Date" header to be a failure.  This
will make the IAT the sole "truth" for Date in the verification process.
The option can be set in the "verification" and "profile" sections of
stir_shaken.conf.

Also fixed a bug in the port match logic.

Resolves: #1251
Resolves: #1271
2025-06-18 15:26:47 +00:00
Naveen Albert
2198126231 app_record: Add RECORDING_INFO function.
Add a function that can be used to retrieve info
about a previous recording, such as its duration.

This is being added as a function to avoid possibly
trampling on dialplan variables, and could be extended
to provide other information in the future.

Resolves: #548

UserNote: The RECORDING_INFO function can now be used
to retrieve the duration of a recording.
2025-06-17 14:23:23 +00:00
Itzanh
dbe7c0c5b3 app_sms.c: Fix sending and receiving SMS messages in protocol 2
This fixes bugs in SMS messaging to SMS-capable analog phones that prevented app_sms.c from talking to phones using SMS protocol 2.

- Fix MORX message reception (from phone to Asterisk) in SMS protocol 2
- Fix MTTX message transmission (from Asterisk to phone) in SMS protocol 2

One of the bugs caused messages to have random characters and junk appended at the end up to the character limit. Another bug prevented Asterisk from sending messages from Asterisk to the phone at all. A final bug caused the transmission from Asterisk to the phone to take a long time because app_sms.c did not hang up after correctly sending the message, causing the phone to have to time out and hang up in order to complete the message transmission.

This was tested with a Linksys PAP2T and with a GrandStream HT814, sending and receiving messages with Telefónica DOMO Mensajes phones from Telefónica Spain. I had to play with both the network jitter buffer and the dB gain to get it to work. One of my phones required the gain to be set to +3dB for it to work, while another required it to be set to +6dB.

Only MORX and MTTX were tested, I did not test sending and receiving messages to a TelCo SMSC.
2025-06-12 12:18:56 +00:00
phoneben
c753fe44d1 app_queue: queue rules – Add support for QUEUE_RAISE_PENALTY=rN to raise penalties only for members within min/max range
This update adds support for a new QUEUE_RAISE_PENALTY format: rN

When QUEUE_RAISE_PENALTY is set to rN (e.g., r4), only members whose current penalty
is greater than or equal to the defined min_penalty and less than or equal to max_penalty
will have their penalty raised to N.

Members with penalties outside the min/max range remain unchanged.

Example behaviors:

QUEUE_RAISE_PENALTY=4     → Raise all members with penalty < 4 (existing behavior)
QUEUE_RAISE_PENALTY=r4    → Raise only members with penalty in [min_penalty, max_penalty] to 4

Implementation details:

Adds parsing logic to detect the r prefix and sets the raise_respect_min flag

Modifies the raise logic to skip members outside the defined penalty range when the flag is active

UserNote: This change introduces QUEUE_RAISE_PENALTY=rN, allowing selective penalty raises
only for members whose current penalty is within the [min_penalty, max_penalty] range.
Members with lower or higher penalties are unaffected.
This behavior is backward-compatible with existing queue rule configurations.
2025-06-11 16:23:51 +00:00
George Joseph
a14d585127 res_websocket_client: Add more info to the XML documentation.
Added "see-also" links to chan_websocket and ARI Outbound WebSocket and
added an example configuration for each.
2025-06-11 16:15:43 +00:00