]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
12 days ago.lastclean: Remove from git releases/20
George Joseph [Fri, 18 Jul 2025 14:21:38 +0000 (08:21 -0600)] 
.lastclean: Remove from git

It never should been versioned in the first place.

13 days agoUpdate for 20.15.0 20.15.0
Asterisk Development Team [Thu, 17 Jul 2025 14:27:58 +0000 (14:27 +0000)] 
Update for 20.15.0

2 weeks agoUpdate for 20.15.0-rc3 20.15.0-rc3
Asterisk Development Team [Thu, 10 Jul 2025 15:59:04 +0000 (15:59 +0000)] 
Update for 20.15.0-rc3

2 weeks agochannelstorage: Rename callbacks that conflict with DEBUG_FD_LEAKS.
George Joseph [Tue, 8 Jul 2025 11:42:51 +0000 (05:42 -0600)] 
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

2 weeks agochannelstorage_cpp_map_name_id: Fix callback returning non-matching channels.
George Joseph [Wed, 9 Jul 2025 17:14:55 +0000 (11:14 -0600)] 
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

3 weeks agoUpdate for 20.15.0-rc2 20.15.0-rc2
Asterisk Development Team [Thu, 3 Jul 2025 16:36:13 +0000 (16:36 +0000)] 
Update for 20.15.0-rc2

3 weeks agoaudiohook.c: Improve frame pairing logic to avoid MixMonitor breakage with mixed...
Michal Hajek [Wed, 21 May 2025 08:28:20 +0000 (10:28 +0200)] 
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

3 weeks agochannelstorage_makeopts.xml: Remove errant XML character.
Sean Bright [Mon, 30 Jun 2025 22:00:02 +0000 (18:00 -0400)] 
channelstorage_makeopts.xml: Remove errant XML character.

Resolves: #1282

4 weeks agoUpdate for 20.15.0-rc1 20.15.0-rc1
Asterisk Development Team [Thu, 26 Jun 2025 18:58:13 +0000 (18:58 +0000)] 
Update for 20.15.0-rc1

4 weeks agores_stir_shaken.so: Handle X5U certificate chains.
George Joseph [Wed, 18 Jun 2025 20:38:08 +0000 (14:38 -0600)] 
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.

(cherry picked from commit b3de33b76b2165cbae489a3b9fc25cc6894cafb0)

4 weeks agores_stir_shaken: Add "ignore_sip_date_header" config option.
George Joseph [Sun, 15 Jun 2025 20:43:13 +0000 (14:43 -0600)] 
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
(cherry picked from commit 6b107e90f33fe168055f5a7a38f5237ddacfa599)

4 weeks agoapp_record: Add RECORDING_INFO function.
Naveen Albert [Mon, 22 Jan 2024 12:23:47 +0000 (07:23 -0500)] 
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.

(cherry picked from commit b5a04ed7ac0b2c374ad0880e66262abac75dfbb5)

4 weeks agoapp_sms.c: Fix sending and receiving SMS messages in protocol 2
Itzanh [Sun, 6 Apr 2025 12:13:21 +0000 (14:13 +0200)] 
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.

(cherry picked from commit 7ee6a3502d390fa0ed508a79109f00a1e0969e6f)

4 weeks agoapp_queue: queue rules – Add support for QUEUE_RAISE_PENALTY=rN to raise penalties...
phoneben [Mon, 26 May 2025 20:52:34 +0000 (23:52 +0300)] 
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.

(cherry picked from commit 435c36b557b96b3261c8c9c031761b0c295db694)

4 weeks agores_websocket_client: Add more info to the XML documentation.
George Joseph [Thu, 5 Jun 2025 14:06:47 +0000 (08:06 -0600)] 
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.

(cherry picked from commit 9e446d872eebe83caceaee852b7249e5b89db727)

4 weeks agores_odbc: cache_size option to limit the cached connections.
Jaco Kroon [Thu, 12 Dec 2024 22:35:55 +0000 (00:35 +0200)] 
res_odbc: cache_size option to limit the cached connections.

Signed-off-by: Jaco Kroon <jaco@uls.co.za>
UserNote: New cache_size option for res_odbc to on a per class basis limit the
number of cached connections. Please reference the sample configuration
for details.

(cherry picked from commit ef09126eb124a06d04cfbfd773c127a27fb6cef9)

4 weeks agores_odbc: cache_type option for res_odbc.
Jaco Kroon [Tue, 10 Dec 2024 20:36:02 +0000 (22:36 +0200)] 
res_odbc: cache_type option for res_odbc.

This enables setting cache_type classes to a round-robin queueing system
rather than the historic stack mechanism.

This should result in lower risk of connection drops due to shorter idle
times (the first connection to go onto the stack could in theory never
be used again, ever, but sit there consuming resources, there could be
multiple of these).

And with a queue rather than a stack, dead connections are guaranteed to
be detected and purged eventually.

This should end up better balancing connection_cnt with actual load
over time, assuming the database doesn't keep connections open
excessively long from it's side.

Signed-off-by: Jaco Kroon <jaco@uls.co.za>
UserNote: When using res_odbc it should be noted that back-end
connections to the underlying database can now be configured to re-use
the cached connections in a round-robin manner rather than repeatedly
re-using the same connection.  This helps to keep connections alive, and
to purge dead connections from the system, thus more dynamically
adjusting to actual load.  The downside is that one could keep too many
connections active for a longer time resulting in resource also begin
consumed on the database side.

(cherry picked from commit 6422509ce6706e79126a5ba6cceac6f30ee2a9de)

4 weeks agores_pjsip: Fix empty `ActiveChannels` property in AMI responses.
Sean Bright [Tue, 27 May 2025 16:56:30 +0000 (12:56 -0400)] 
res_pjsip: Fix empty `ActiveChannels` property in AMI responses.

The logic appears to have been reversed since it was introduced in
05cbf8df.

Resolves: #1254
(cherry picked from commit 0f5ea4797e483dadd636c9686c69cd473924e786)

4 weeks agoARI Outbound Websockets
George Joseph [Fri, 28 Mar 2025 12:54:21 +0000 (06:54 -0600)] 
ARI Outbound Websockets

Asterisk can now establish websocket sessions _to_ your ARI applications
as well as accepting websocket sessions _from_ them.
Full details: http://s.asterisk.net/ari-outbound-ws

Code change summary:
* Added an ast_vector_string_join() function,
* Added ApplicationRegistered and ApplicationUnregistered ARI events.
* Converted res/ari/config.c to use sorcery to process ari.conf.
* Added the "outbound-websocket" ARI config object.
* Refactored res/ari/ari_websockets.c to handle outbound websockets.
* Refactored res/ari/cli.c for the sorcery changeover.
* Updated res/res_stasis.c for the sorcery changeover.
* Updated apps/app_stasis.c to allow initiating per-call outbound websockets.
* Added CLI commands to manage ARI websockets.
* Added the new "outbound-websocket" object to ari.conf.sample.
* Moved the ARI XML documentation out of res_ari.c into res/ari/ari_doc.xml

UserNote: Asterisk can now establish websocket sessions _to_ your ARI applications
as well as accepting websocket sessions _from_ them.
Full details: http://s.asterisk.net/ari-outbound-ws

(cherry picked from commit 87097b3dd1f01ecf08d27acf92b0215142c48a37)

4 weeks agores_websocket_client: Create common utilities for websocket clients.
George Joseph [Fri, 2 May 2025 14:52:54 +0000 (08:52 -0600)] 
res_websocket_client: Create common utilities for websocket clients.

Since multiple Asterisk capabilities now need to create websocket clients
it makes sense to create a common set of utilities rather than making
each of those capabilities implement their own.

* A new configuration file "websocket_client.conf" is used to store common
client parameters in named configuration sections.
* APIs are provided to list and retrieve ast_websocket_client objects created
from the named configurations.
* An API is provided that accepts an ast_websocket_client object, connects
to the remote server with retries and returns an ast_websocket object. TLS is
supported as is basic authentication.
* An observer can be registered to receive notification of loaded or reloaded
client objects.
* An API is provided to compare an existing client object to one just
reloaded and return the fields that were changed. The caller can then decide
what action to take based on which fields changed.

Also as part of thie commit, several sorcery convenience macros were created
to make registering common object fields easier.

UserNote: A new module "res_websocket_client" and config file
"websocket_client.conf" have been added to support several upcoming new
capabilities that need common websocket client configuration.

(cherry picked from commit 974489e5a78403170acd2738babcad218d9674c5)

4 weeks agoasterisk.c: Add option to restrict shell access from remote consoles.
George Joseph [Mon, 19 May 2025 14:16:53 +0000 (08:16 -0600)] 
asterisk.c: Add option to restrict shell access from remote consoles.

UserNote: A new asterisk.conf option 'disable_remote_console_shell' has
been added that, when set, will prevent remote consoles from executing
shell commands using the '!' prefix.

Resolves: #GHSA-c7p6-7mvq-8jq2
(cherry picked from commit 443fc4d2d56b53102d8a860286041ceec7d82fcb)

4 weeks agoframe.c: validate frame data length is less than samples when adjusting volume
mkmer [Mon, 12 May 2025 14:18:19 +0000 (10:18 -0400)] 
frame.c: validate frame data length is less than samples when adjusting volume

Resolves: #1230
(cherry picked from commit f916d5f4a2f0098d0560b77456a58d37ebeb1e89)

4 weeks agores_audiosocket.c: Add retry mechanism for reading data from AudioSocket
Sven Kube [Tue, 13 May 2025 14:01:32 +0000 (16:01 +0200)] 
res_audiosocket.c: Add retry mechanism for reading data from AudioSocket

The added retry mechanism addresses an issue that arises when fragmented TCP
packets are received, each containing only a portion of an AudioSocket packet.
This situation can occur if the external service sending the AudioSocket data
has Nagle's algorithm enabled.

(cherry picked from commit 787c8f647cd12dceb48f3ca02fe5c7f905e2fd98)

4 weeks agores_audiosocket.c: Set the TCP_NODELAY socket option
Sven Kube [Tue, 13 May 2025 13:37:38 +0000 (15:37 +0200)] 
res_audiosocket.c: Set the TCP_NODELAY socket option

Disable Nagle's algorithm by setting the TCP_NODELAY socket option.
This reduces latency by preventing delays caused by packet buffering.

(cherry picked from commit f8b70a97aa3589d9807e7bb7e545a22457a93e10)

4 weeks agomenuselect: Fix GTK menu callbacks for Fedora 42 compatibility
Thomas B. Clark [Mon, 12 May 2025 21:46:00 +0000 (17:46 -0400)] 
menuselect: Fix GTK menu callbacks for Fedora 42 compatibility

This patch resolves a build failure in `menuselect_gtk.c` when running
`make menuconfig` on Fedora 42. The new version of GTK introduced stricter
type checking for callback signatures.

Changes include:
- Add wrapper functions to match the expected `void (*)(void)` signature.
- Update `menu_items` array to use these wrappers.

Fixes: #1243
(cherry picked from commit 41d54dfaa2f0ac492dccf410ec34ad168e3a5f81)

4 weeks agojansson: Upgrade version to jansson 2.14.1
Stanislav Abramenkov [Mon, 24 Mar 2025 13:10:26 +0000 (15:10 +0200)] 
jansson: Upgrade version to jansson 2.14.1

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

Resolves: #1178
(cherry picked from commit e2741ff01817398d031d1191e9a0efb160b79885)

4 weeks agopjproject: Increase maximum SDP formats and attribute limits
Joe Searle [Thu, 15 May 2025 13:06:29 +0000 (14:06 +0100)] 
pjproject: Increase maximum SDP formats and attribute limits

Since Chrome 136, using Windows, when initiating a video call the INVITE SDP exceeds the maximum number of allowed attributes, resulting in the INVITE being rejected. This increases the attribute limit and the number of formats allowed when using bundled pjproject.

Fixes: #1240
(cherry picked from commit 569ceeb46b71d95c84c28d1dbe7b8e15650eaad9)

4 weeks agomanager.c: Invalid ref-counting when purging events
Nathan Monfils [Mon, 5 May 2025 08:47:43 +0000 (10:47 +0200)] 
manager.c: Invalid ref-counting when purging events

We have a use-case where we generate a *lot* of events on the AMI, and
then when doing `manager show eventq` we would see some events which
would linger for hours or days in there. Obviously something was leaking.
Testing allowed us to track down this logic bug in the ref-counting on
the event purge.

Reproducing the bug was not super trivial, we managed to do it in a
production-like load testing environment with multiple AMI consumers.

The race condition itself:

1. something allocates and links `session`
2. `purge_sessions` iterates over that `session` (takes ref)
3. `purge_session` correctly de-referencess that session
4. `purge_session` re-evaluates the while() loop, taking a reference
5. `purge_session` exits (`n_max > 0` is false)
6. whatever allocated the `session` deallocates it, but a reference is
   now lost since we exited the `while` loop before de-referencing.
7. since the destructor is never called, the session->last_ev->usecount
   is never decremented, leading to events lingering in the queue

The impact of this bug does not seem major. The events are small and do
not seem, from our testing, to be causing meaningful additional CPU
usage. Mainly we wanted to fix this issue because we are internally
adding prometheus metrics to the eventq and those leaked events were
causing the metrics to show garbage data.

(cherry picked from commit 81785db9663d64a9c997a484bc097852a123d86b)

4 weeks agores_pjsip_nat.c: Do not overwrite transfer host
Mike Bradeen [Thu, 8 May 2025 18:12:33 +0000 (12:12 -0600)] 
res_pjsip_nat.c: Do not overwrite transfer host

When a call is transfered via dialplan behind a NAT, the
host portion of the Contact header in the 302 will no longer
be over-written with the external NAT IP and will retain the
hostname.

Fixes: #1141
(cherry picked from commit 36a2fa2de7d7cd339a2d6d0e24b686dd9047a80b)

4 weeks agochan_pjsip: Serialize INVITE creation on DTMF attended transfer
Mike Bradeen [Mon, 5 May 2025 18:05:15 +0000 (12:05 -0600)] 
chan_pjsip: Serialize INVITE creation on DTMF attended transfer

When a call is transfered via DTMF feature code, the Transfer Target and
Transferer are bridged immediately.  This opens the possibilty of a race
condition between the creation of an INVITE and the bridge induced colp
update that can result in the set caller ID being over-written with the
transferer's default info.

Fixes: #1234
(cherry picked from commit ba4680f7ec0c6aebd0952d6052d10c7e3cb99005)

4 weeks agosig_analog: Add Call Waiting Deluxe support.
Naveen Albert [Thu, 24 Aug 2023 14:07:06 +0000 (14:07 +0000)] 
sig_analog: Add Call Waiting Deluxe support.

Adds support for Call Waiting Deluxe options to enhance
the current call waiting feature.

As part of this change, a mechanism is also added that
allows a channel driver to queue an audio file for Dial()
to play, which is necessary for the announcement function.

ASTERISK-30373 #close

Resolves: #271

UserNote: Call Waiting Deluxe can now be enabled for FXS channels
by enabling its corresponding option.

(cherry picked from commit 76ab68b7e915f6ca2803c8e215ffce72250084a8)

4 weeks agoapp_sms: Ignore false positive vectorization warning.
Naveen Albert [Fri, 24 Jan 2025 14:35:50 +0000 (09:35 -0500)] 
app_sms: Ignore false positive vectorization warning.

Ignore gcc warning about writing 32 bytes into a region of size 6,
since we check that we don't go out of bounds for each byte.
This is due to a vectorization bug in gcc 15, stemming from
gcc commit 68326d5d1a593dc0bf098c03aac25916168bc5a9.

Resolves: #1088
(cherry picked from commit 3951a5a2dcd375adf4980b157e2c1643d61c4674)

4 weeks agolock.h: Add include for string.h when DEBUG_THREADS is defined.
George Joseph [Fri, 2 May 2025 18:19:25 +0000 (12:19 -0600)] 
lock.h: Add include for string.h when DEBUG_THREADS is defined.

When DEBUG_THREADS is defined, lock.h uses strerror(), which is defined
in the libc string.h file, to print warning messages. If the including
source file doesn't include string.h then strerror() won't be found and
and compile errors will be thrown. Since lock.h depends on this, string.h
is now included from there if DEBUG_THREADS is defined.  This way, including
source files don't have to worry about it.

(cherry picked from commit 8eaad114f4d77376c64a1ad88c05490ac67352c0)

4 weeks agoAlternate Channel Storage Backends
George Joseph [Tue, 31 Dec 2024 18:27:02 +0000 (11:27 -0700)] 
Alternate Channel Storage Backends

Full details: http://s.asterisk.net/dc679ec3

The previous proof-of-concept showed that the cpp_map_name_id alternate
storage backed performed better than all the others so this final PR
adds only that option.  You still need to enable it in menuselect under
the "Alternate Channel Storage Backends" category.

To select which one is used at runtime, set the "channel_storage_backend"
option in asterisk.conf to one of the values described in
asterisk.conf.sample.  The default remains "ao2_legacy".

UpgradeNote: With this release, you can now select an alternate channel
storage backend based on C++ Maps.  Using the new backend may increase
performance and reduce the chances of deadlocks on heavily loaded systems.
For more information, see http://s.asterisk.net/dc679ec3

2 months agoUpdate for 20.14.1 20.14.1
Asterisk Development Team [Thu, 22 May 2025 15:54:07 +0000 (15:54 +0000)] 
Update for 20.14.1

2 months agoasterisk.c: Add option to restrict shell access from remote consoles.
George Joseph [Mon, 19 May 2025 14:16:53 +0000 (08:16 -0600)] 
asterisk.c: Add option to restrict shell access from remote consoles.

UserNote: A new asterisk.conf option 'disable_remote_console_shell' has
been added that, when set, will prevent remote consoles from executing
shell commands using the '!' prefix.

Resolves: #GHSA-c7p6-7mvq-8jq2

2 months agores_pjsip_messaging.c: Mask control characters in received From display name
George Joseph [Mon, 24 Mar 2025 20:59:42 +0000 (14:59 -0600)] 
res_pjsip_messaging.c: Mask control characters in received From display name

Incoming SIP MESSAGEs will now have their From header's display name
sanitized by replacing any characters < 32 (space) with a space.

Resolves: #GHSA-2grh-7mhv-fcfw

2 months agoUpdate for 20.14.0 20.14.0
Asterisk Development Team [Thu, 8 May 2025 12:33:18 +0000 (12:33 +0000)] 
Update for 20.14.0

2 months agoUpdate for 20.14.0-rc1 20.14.0-rc1
Asterisk Development Team [Thu, 1 May 2025 12:39:53 +0000 (12:39 +0000)] 
Update for 20.14.0-rc1

2 months agores_pjsip_caller_id: Also parse URI parameters for ANI2.
Naveen Albert [Sat, 26 Apr 2025 12:33:20 +0000 (08:33 -0400)] 
res_pjsip_caller_id: Also parse URI parameters for ANI2.

If the isup-oli was sent as a URI parameter, rather than a header
parameter, it was not being parsed. Make sure we parse both if
needed so the ANI2 is set regardless of which type of parameter
the isup-oli is sent as.

Resolves: #1220
(cherry picked from commit 5d82f69b9b98428e46dc442275e9b4f177841729)

2 months agoapp_meetme: Remove inaccurate removal version from xmldocs.
Naveen Albert [Sat, 26 Apr 2025 17:10:06 +0000 (13:10 -0400)] 
app_meetme: Remove inaccurate removal version from xmldocs.

app_meetme is deprecated but wasn't removed as planned in 21,
so remove the inaccurate removal version.

Resolves: #1224
(cherry picked from commit 907030212612fc24ee3ce632789e8fe43a3d9c76)

2 months agodocs: Fix typos in apps/
Luz Paz [Wed, 9 Apr 2025 13:02:27 +0000 (09:02 -0400)] 
docs: Fix typos in apps/

Found via codespell

(cherry picked from commit b877d20d757ed3436e361ef3ea0b1383b0f4f59b)

2 months agostasis/control.c: Set Hangup Cause to No Answer on Dial timeout
Mike Bradeen [Thu, 17 Apr 2025 15:50:21 +0000 (09:50 -0600)] 
stasis/control.c: Set Hangup Cause to No Answer on Dial timeout

Other Dial operations (dial, app_dial) use Q.850 cause 19 when a dial timeout occurs,
but the Dial command via ARI did not set an explicit reason. This resulted in a
CANCEL with Normal Call Clearing and corresponding ChannelDestroyed.

This change sets the hangup cause to AST_CAUSE_NO_ANSWER to be consistent with the
other operations.

Fixes: #963
UserNote:  A Dial timeout on POST /channels/{channelId}/dial will now result in a
CANCEL and ChannelDestroyed with cause 19 / User alerting, no answer.  Previously
no explicit cause was set, resulting in a cause of 16 / Normal Call Clearing.

(cherry picked from commit b4edd3ab7dbd55500496d94bcfb37695218f3f23)

2 months agochan_iax2: Minor improvements to documentation and warning messages.
Naveen Albert [Fri, 18 Apr 2025 13:03:10 +0000 (09:03 -0400)] 
chan_iax2: Minor improvements to documentation and warning messages.

* Update Dial() documentation for IAX2 to include syntax for RSA
  public key names.
* Add additional details to a couple warnings to provide more context
  when an undecodable frame is received.

Resolves: #1206
(cherry picked from commit 7724e5e6ad66fd5e1d4345588b9760ea0165d362)

2 months agopbx_ael: unregister AELSub application and CLI commands on module load failure
Andreas Wehrmann [Fri, 18 Apr 2025 08:56:05 +0000 (10:56 +0200)] 
pbx_ael: unregister AELSub application and CLI commands on module load failure

This fixes crashes/hangs I noticed with Asterisk 20.3.0 and 20.13.0 and quickly found out,
that the AEL module doesn't do proper cleanup when it fails to load.
This happens for example when there are syntax errors and AEL fails to compile in which case pbx_load_module()
returns an error but load_module() doesn't then unregister CLI cmds and the application.

(cherry picked from commit aca78d493698acae12d0368c441faa359ce008a5)

2 months agores_pjproject: Fix DTLS client check failing on some platforms
Albrecht Oster [Thu, 10 Apr 2025 21:54:00 +0000 (23:54 +0200)] 
res_pjproject: Fix DTLS client check failing on some platforms

Certain platforms (mainly BSD derivatives) have an additional length
field in `sockaddr_in6` and `sockaddr_in`.
`ast_sockaddr_from_pj_sockaddr()` does not take this field into account
when copying over values from the `pj_sockaddr` into the `ast_sockaddr`.
The resulting `ast_sockaddr` will have an uninitialized value for
`sin6_len`/`sin_len` while the other `ast_sockaddr` (not converted from
a `pj_sockaddr`) to check against in `ast_sockaddr_pj_sockaddr_cmp()`
has the correct length value set.

This has the effect that `ast_sockaddr_cmp()` will always indicate
an address mismatch, because it does a bitwise comparison, and all DTLS
packets are dropped even if addresses and ports match.

`ast_sockaddr_from_pj_sockaddr()` now checks whether the length fields
are available on the current platform and sets the values accordingly.

Resolves: #505
(cherry picked from commit 5f9cd260acfcd0de355938c31de5b9946724620e)

2 months agoPrequisites for ARI Outbound Websockets
George Joseph [Wed, 16 Apr 2025 19:40:52 +0000 (13:40 -0600)] 
Prequisites for ARI Outbound Websockets

stasis:
* Added stasis_app_is_registered().
* Added stasis_app_control_mark_failed().
* Added stasis_app_control_is_failed().
* Fixed res_stasis_device_state so unsubscribe all works properly.
* Modified stasis_app_unregister() to unsubscribe from all event sources.
* Modified stasis_app_exec to return -1 if stasis_app_control_is_failed()
  returns true.

http:
* Added ast_http_create_basic_auth_header().

md5:
* Added define for MD5_DIGEST_LENGTH.

tcptls:
* Added flag to ast_tcptls_session_args to suppress connection log messages
  to give callers more control over logging.

http_websocket:
* Add flag to ast_websocket_client_options to suppress connection log messages
  to give callers more control over logging.
* Added username and password to ast_websocket_client_options to support
  outbound basic authentication.
* Added ast_websocket_result_to_str().

(cherry picked from commit cc92adc5fb08f60e0159ce4aa8f720c4c8c27f4e)

2 months agocontrib: Add systemd service and timer files for malloc trim.
Ben Ford [Wed, 16 Apr 2025 18:45:03 +0000 (13:45 -0500)] 
contrib: Add systemd service and timer files for malloc trim.

Adds two files to the contrib/systemd/ directory that can be installed
to periodically run "malloc trim" on Asterisk. These files do nothing
unless they are explicitly moved to the correct location on the system.
Users who are experiencing Asterisk memory issues can use this service
to potentially help combat the problem. These files can also be
configured to change the start time and interval. See systemd.timer(5)
and systemd.time(7) for more information.

UserNote: Service and timer files for systemd have been added to the
contrib/systemd/ directory. If you are experiencing memory issues,
install these files to have "malloc trim" periodically run on the
system.

(cherry picked from commit 6925b0118e55f06eff1456ba1b71af4e918fed53)

2 months agoaction_redirect: remove after_bridge_goto_info
Peter Jannesen [Thu, 13 Mar 2025 21:52:53 +0000 (22:52 +0100)] 
action_redirect: remove after_bridge_goto_info

Under certain circumstances the context/extens/prio are stored in the
after_bridge_goto_info. This info is used when the bridge is broken by
for hangup of the other party. In the situation that the bridge is
broken by an AMI Redirect this info is not used but also not removed.
With the result that when the channel is put back in a bridge and the
bridge is broken the execution continues at the wrong
context/extens/prio.

Resolves: #1144
(cherry picked from commit f9e5b9aa010af2011e2bd3c23aa1f0fc8a3cc178)

2 months agochannel: Always provide cause code in ChannelHangupRequest.
Joshua C. Colp [Wed, 16 Apr 2025 09:29:11 +0000 (06:29 -0300)] 
channel: Always provide cause code in ChannelHangupRequest.

When queueing a channel to be hung up a cause code can be
specified in one of two ways:

1. ast_queue_hangup_with_cause
This function takes in a cause code and queues it as part
of the hangup request, which ultimately results in it being
set on the channel.

2. ast_channel_hangupcause_set + ast_queue_hangup
This combination sets the hangup cause on the channel before
queueing the hangup instead of as part of that process.

In the #2 case the ChannelHangupRequest event would not contain
the cause code. For consistency if a cause code has been set
on the channel it will now be added to the event.

Resolves: #1197
(cherry picked from commit ca341910e7cc1b550754fdbeeb08439230ca2d34)

2 months agoAdd log-caller-id-name option to log Caller ID Name in queue log
phoneben [Thu, 27 Feb 2025 23:25:50 +0000 (01:25 +0200)] 
Add log-caller-id-name option to log Caller ID Name in queue log

Add log-caller-id-name option to log Caller ID Name in queue log

This patch introduces a new global configuration option, log-caller-id-name,
to queues.conf to control whether the Caller ID name is logged when a call enters a queue.

When log-caller-id-name=yes, the Caller ID name is logged
as parameter 4 in the queue log, provided it’s allowed by the
existing log_restricted_caller_id rules. If log-caller-id-name=no (the default),
the Caller ID name is omitted from the logs.

Fixes: #1091
UserNote: This patch adds a global configuration option, log-caller-id-name, to queues.conf
to control whether the Caller ID name is logged as parameter 4 when a call enters a queue.
When log-caller-id-name=yes, the Caller ID name is included in the queue log,
Any '|' characters in the caller ID name will be replaced with '_'.
(provided it’s allowed by the existing log_restricted_caller_id rules).
When log-caller-id-name=no (the default), the Caller ID name is omitted.

(cherry picked from commit f843f24be47c7128d084acd47ae1b918990dd4f7)

2 months agoasterisk.c: Add "pre-init" and "pre-module" capability to cli.conf.
George Joseph [Thu, 10 Apr 2025 13:59:34 +0000 (07:59 -0600)] 
asterisk.c: Add "pre-init" and "pre-module" capability to cli.conf.

Commands in the "[startup_commands]" section of cli.conf have historically run
after all core and module initialization has been completed and just before
"Asterisk Ready" is printed on the console. This meant that if you
wanted to debug initialization of a specific module, your only option
was to turn on debug for everything by setting "debug" in asterisk.conf.

This commit introduces options to allow you to run CLI commands earlier in
the asterisk startup process.

A command with a value of "pre-init" will run just after logger initialization
but before most core, and all module, initialization.

A command with a value of "pre-module" will run just after all core
initialization but before all module initialization.

A command with a value of "fully-booted" (or "yes" for backwards
compatibility) will run as they always have been...after all
initialization and just before "Asterisk Ready" is printed on the console.

This means you could do this...

```
[startup_commands]
core set debug 3 res_pjsip.so = pre-module
core set debug 0 res_pjsip.so = fully-booted
```

This would turn debugging on for res_pjsip.so to catch any module
initialization debug messages then turn it off again after the module is
loaded.

UserNote: In cli.conf, you can now define startup commands that run before
core initialization and before module initialization.

(cherry picked from commit aacabb48ee848acb9c81d632345dc6edcd17c036)

2 months agoapp_confbridge: Prevent crash when publishing channel-less event.
Sean Bright [Mon, 7 Apr 2025 21:05:28 +0000 (17:05 -0400)] 
app_confbridge: Prevent crash when publishing channel-less event.

Resolves: #1190
(cherry picked from commit efeb1025073813e029b21bc6d81b0491e657a0eb)

2 months agoari_websockets: Fix frack if ARI config fails to load.
George Joseph [Wed, 2 Apr 2025 14:44:00 +0000 (08:44 -0600)] 
ari_websockets: Fix frack if ARI config fails to load.

ari_ws_session_registry_dtor() wasn't checking that the container was valid
before running ao2_callback on it to shutdown registered sessions.

(cherry picked from commit 234ca964e5ff7d42974b4211e950721c50ffe178)

2 months agoARI: REST over Websocket
George Joseph [Wed, 12 Mar 2025 21:58:51 +0000 (15:58 -0600)] 
ARI: REST over Websocket

This commit adds the ability to make ARI REST requests over the same
websocket used to receive events.

For full details on how to use the new capability, visit...

https://docs.asterisk.org/Configuration/Interfaces/Asterisk-REST-Interface-ARI/ARI-REST-over-WebSocket/

Changes:

* Added utilities to http.c:
  * ast_get_http_method_from_string().
  * ast_http_parse_post_form().
* Added utilities to json.c:
  * ast_json_nvp_array_to_ast_variables().
  * ast_variables_to_json_nvp_array().
* Added definitions for new events to carry REST responses.
* Created res/ari/ari_websocket_requests.c to house the new request handlers.
* Moved non-event specific code out of res/ari/resource_events.c into
  res/ari/ari_websockets.c
* Refactored res/res_ari.c to move non-http code out of ast_ari_callback()
  (which is http specific) and into ast_ari_invoke() so it can be shared
  between both the http and websocket transports.

UpgradeNote: This commit adds the ability to make ARI REST requests over the same
websocket used to receive events.
See https://docs.asterisk.org/Configuration/Interfaces/Asterisk-REST-Interface-ARI/ARI-REST-over-WebSocket/

(cherry picked from commit 4e07d3d50f67fcb5d47f87413247ccbfd8535271)

2 months agoaudiohook.c: Add ability to adjust volume with float
mkmer [Tue, 18 Mar 2025 11:51:06 +0000 (07:51 -0400)] 
audiohook.c: Add ability to adjust volume with float

Add the capability to audiohook for float type volume adjustments.  This allows for adjustments to volume smaller than 6dB.  With INT adjustments, the first step is 2 which converts to ~6dB (or 1/2 volume / double volume depending on adjustment sign). 3dB is a typical adjustment level which can now be accommodated with an adjustment value of 1.41.

This is accomplished by the following:
  Convert internal variables to type float.
  Always use ast_frame_adjust_volume_float() for adjustments.
  Cast int to float in original functions ast_audiohook_volume_set(), and ast_volume_adjust().
  Cast float to int in ast_audiohook_volume_get()
  Add functions ast_audiohook_volume_get_float, ast_audiohook_volume_set_float, and ast_audiohook_volume_adjust_float.

This update maintains 100% backward compatibility.

Resolves: #1171
(cherry picked from commit 874fde592417f8333067b2225898352eece3a849)

2 months agoaudiosocket: added support for DTMF frames
Florent CHAUVEAU [Fri, 28 Feb 2025 07:47:18 +0000 (08:47 +0100)] 
audiosocket: added support for DTMF frames

Updated the AudioSocket protocol to allow sending DTMF frames.
AST_FRAME_DTMF frames are now forwarded to the server, in addition to
AST_FRAME_AUDIO frames. A new payload type AST_AUDIOSOCKET_KIND_DTMF
with value 0x03 was added to the protocol. The payload is a 1-byte
ascii representing the DTMF digit (0-9,*,#...).

UserNote: The AudioSocket protocol now forwards DTMF frames with
payload type 0x03. The payload is a 1-byte ascii representing the DTMF
digit (0-9,*,#...).

(cherry picked from commit c44e7e85ecd73ccddd90da3acc94bbcb66a43330)

2 months agoasterisk/channel.h: fix documentation for 'ast_waitfor_nandfds()'
Norm Harrison [Tue, 4 Apr 2023 03:39:09 +0000 (22:39 -0500)] 
asterisk/channel.h: fix documentation for 'ast_waitfor_nandfds()'

Co-authored-by: Florent CHAUVEAU <florentch@pm.me>
(cherry picked from commit 5cfc79ebea39d08d5dbb6d3c5b9b666dbc9ea62d)

2 months agoaudiosocket: fix timeout, fix dialplan app exit, server address in logs
Norm Harrison [Tue, 4 Apr 2023 02:36:11 +0000 (21:36 -0500)] 
audiosocket: fix timeout, fix dialplan app exit, server address in logs

- Correct wait timeout logic in the dialplan application.
- Include server address in log messages for better traceability.
- Allow dialplan app to exit gracefully on hangup messages and socket closure.
- Optimize I/O by reducing redundant read()/write() operations.

Co-authored-by: Florent CHAUVEAU <florentch@pm.me>
(cherry picked from commit 218c64c4eb455ecb783af0cff86341f1f7998fcb)

2 months agochan_pjsip: Add the same details as PJSIPShowContacts to the CLI via 'pjsip show...
Mark Murawski [Mon, 24 Mar 2025 01:05:55 +0000 (21:05 -0400)] 
chan_pjsip:  Add the same details as PJSIPShowContacts to the CLI via 'pjsip show contact'

CLI 'pjsip show contact' does not show enough information.
One must telnet to AMI or write a script to ask Asterisk for example what the User-Agent is on a Contact
This feature adds the same details as PJSIPShowContacts to the CLI

Resolves: #643
(cherry picked from commit 51f9e1f1ba8a4a5a326cd615ae20fad400bb939c)

2 months agoUpdate config.guess and config.sub
Zhai Liangliang [Wed, 26 Mar 2025 06:44:34 +0000 (14:44 +0800)] 
Update config.guess and config.sub

(cherry picked from commit c9a85f7124e8de7c7b33a7ff251129d53d3aa1ff)

2 months agochan_pjsip: set correct Endpoint Device State on multiple channels
Alexei Gradinari [Tue, 25 Mar 2025 21:24:29 +0000 (17:24 -0400)] 
chan_pjsip: set correct Endpoint Device State on multiple channels

1. When one channel is placed on hold, the device state is set to ONHOLD
without checking other channels states.
In case of AST_CONTROL_HOLD set the device state as AST_DEVICE_UNKNOWN
to calculate aggregate device state of all active channels.

2. The current implementation incorrectly classifies channels in use.
The only channels that has the states: UP, RING and BUSY are considered as "in use".
A channel should be considered "in use" if its state is anything other than
DOWN or RESERVED.

3. Currently, if the number of channels "in use" is greater than device_state_busy_at,
the system does not set the state to BUSY. Instead, it incorrectly assigns an aggregate
device state.
The endpoint device state should be BUSY if the number of channels "in use" is greater
than or equal to device_state_busy_at.

Fixes: #1181
(cherry picked from commit ad178d155db599483aedf9936eaedf4ee4b7940f)

2 months agofile.c: missing "custom" sound files should not generate warning logs
Allan Nathanson [Tue, 18 Mar 2025 23:54:48 +0000 (19:54 -0400)] 
file.c: missing "custom" sound files should not generate warning logs

With `sounds_search_custom_dir = yes` we first look to see if a sound file
is present in the "custom" sound directory before looking in the standard
sound directories.  We should not be issuing a WARNING log message if a
sound cannot be found in the "custom" directory.

Resolves: https://github.com/asterisk/asterisk/issues/1170
(cherry picked from commit df8c32f09227ac35f805ec586e35d8521308091b)

4 months agoUpdate for 20.13.0 20.13.0
Asterisk Development Team [Thu, 27 Mar 2025 12:42:24 +0000 (12:42 +0000)] 
Update for 20.13.0

4 months agoUpdate for 20.13.0-rc1 20.13.0-rc1
Asterisk Development Team [Thu, 20 Mar 2025 18:18:34 +0000 (18:18 +0000)] 
Update for 20.13.0-rc1

4 months agodocumentation: Update Gosub, Goto, and add new documentationtype.
Ben Ford [Fri, 14 Mar 2025 22:05:30 +0000 (17:05 -0500)] 
documentation: Update Gosub, Goto, and add new documentationtype.

Gosub and Goto were not displaying their syntax correctly on the docs
site. This change adds a new way to specify an optional context, an
optional extension, and a required priority that the xml stylesheet can
parse without having to know which optional parameters come in which
order. In Asterisk, it looks like this:

  parameter name="context" documentationtype="dialplan_context"
  parameter name="extension" documentationtype="dialplan_extension"
  parameter name="priority" documentationtype="dialplan_priority" required="true"

The stylesheet will ignore the context and extension parameters, but for
priority, it will automatically inject the following:

  [[context,]extension,]priority

This is the correct oder for applications such as Gosub and Goto.

(cherry picked from commit 11684bc0d344d2ad45b092f15df9a24a29a7dd01)

4 months agores_config_curl.c: Remove unnecessary warnings.
Sean Bright [Mon, 17 Mar 2025 14:30:46 +0000 (10:30 -0400)] 
res_config_curl.c: Remove unnecessary warnings.

Resolves: #1164
(cherry picked from commit 92b005abf8aa7fff4ae58cc20d2018a5c2560047)

4 months agores_pjsip_outbound_registration.c: Remove xpointer reference to user_agent.
George Joseph [Fri, 14 Mar 2025 13:13:48 +0000 (07:13 -0600)] 
res_pjsip_outbound_registration.c: Remove xpointer reference to user_agent.

Commit e86f937e added AMI documentation to the module but the cherry-pick
from master to the 20 branch pulled in an xpointer reference to the
`user_agent` config option which doesn't actually exist in 20.  This causes
asterisk to fail to start because it can't load the core-en_US.xml
documentation file.  The CI cherry-pick tests should have caught this but
there was bug in the cherry-picker that was causing the commits to be
cherry-picked to the wrong branch.  Just removing the xpointer reference
resolves the issue.

(cherry picked from commit 92e02c1574c2cf8d29eb27bdddda1daa3a1694f9)

4 months agoREADME.md: Updates and Fixes
George Joseph [Wed, 5 Mar 2025 19:21:45 +0000 (12:21 -0700)] 
README.md: Updates and Fixes

* Outdated information has been removed.
* New links added.
* Placeholder added for link to change logs.

Going forward, the release process will create HTML versions of the README
and change log and will update the link in the README to the current
change log for the branch...

* In the development branches, the link will always point to the current
  release on GitHub.
* In the "releases/*" branches and the tarballs, the link will point to the
  ChangeLogs/ChangeLog-<version>.html file in the source directory.
* On the downloads website, the link will point to the
  ChangeLog-<version>.html file in the same directory.

Resolves: #1131
(cherry picked from commit 9f4b52bf2b4ae5aa71fd942b132084be8a397ecb)

4 months agores_rtp_asterisk.c: Don't truncate spec-compliant `ice-ufrag` or `ice-pwd`.
Sean Bright [Fri, 7 Mar 2025 16:32:00 +0000 (11:32 -0500)] 
res_rtp_asterisk.c: Don't truncate spec-compliant `ice-ufrag` or `ice-pwd`.

RFC 8839[1] indicates that the `ice-ufrag` and `ice-pwd` attributes
can be up to 256 bytes long. While we don't generate values of that
size, we should be able to accomodate them without truncating.

1. https://www.rfc-editor.org/rfc/rfc8839#name-ice-ufrag-and-ice-pwd-attri

(cherry picked from commit 3cafe10d2135ba7616c39a3aee1c9b330a4d6343)

4 months agofix: Correct default flag for tcp_keepalive_enable option
Joshua Elson [Fri, 7 Mar 2025 00:52:26 +0000 (17:52 -0700)] 
fix: Correct default flag for tcp_keepalive_enable option

Resolves an issue where the tcp_keepalive_enable option was not properly enabled in the sample configuration due to an incorrect default flag setting.

Fixes: #1149
(cherry picked from commit 53f3ac7925646f6f76dd431104941b018c76b624)

4 months agodocs: AMI documentation fixes.
Sean Bright [Tue, 18 Feb 2025 16:21:55 +0000 (11:21 -0500)] 
docs: AMI documentation fixes.

Most of this patch is adding missing PJSIP-related event
documentation, but the one functional change was adding a sorcery
to-string handler for endpoint's `redirect_method` which was not
showing up in the AMI event details or `pjsip show endpoint
<endpoint>` output.

The rest of the changes are summarized below:

* app_agent_pool.c: Typo fix Epoche -> Epoch.
* stasis_bridges.c: Add missing AttendedTransfer properties.
* stasis_channels.c: Add missing AgentLogoff properties.
* pjsip_manager.xml:
  - Add missing AorList properties.
  - Add missing AorDetail properties.
  - Add missing ContactList properties.
  - Add missing ContactStatusDetail properties.
  - Add missing EventDetail properties.
  - Add missing AuthList properties.
  - Add missing AuthDetail properties.
  - Add missing TransportDetail properties.
  - Add missing EndpointList properties.
  - Add missing IdentifyDetail properties.
* res_pjsip_registrar.c: Add missing InboundRegistrationDetail documentation.
* res_pjsip_pubsub.c:
  - Add missing ResourceListDetail documentation.
  - Add missing InboundSubscriptionDetail documentation.
  - Add missing OutboundSubscriptionDetail documentation.
* res_pjsip_outbound_registration.c: Add missing OutboundRegistrationDetail documentation.

(cherry picked from commit e86f937e3aedf594508ca090dba69964c2c6e06f)

4 months agoconfig.c: #include of non-existent file should not crash
Allan Nathanson [Mon, 3 Mar 2025 14:53:02 +0000 (09:53 -0500)] 
config.c: #include of non-existent file should not crash

Corrects a segmentation fault when a configuration file has a #include
statement that referenced a file that does not exist.

Resolves: https://github.com/asterisk/asterisk/issues/1139
(cherry picked from commit eec9bed8af075d4be91da4c0d7c8a64128c27f5a)

4 months agomanager.c: Check for restricted file in action_createconfig.
George Joseph [Mon, 3 Mar 2025 21:07:43 +0000 (14:07 -0700)] 
manager.c: Check for restricted file in action_createconfig.

The `CreateConfig` manager action now ensures that a config file can
only be created in the AST_CONFIG_DIR unless `live_dangerously` is set.

Resolves: #1122
(cherry picked from commit 266440ab20c398bb387b9a2e60f4542458d3f3e2)

4 months agoswagger_model.py: Fix invalid escape sequence in get_list_parameter_type().
George Joseph [Tue, 4 Mar 2025 14:29:22 +0000 (07:29 -0700)] 
swagger_model.py: Fix invalid escape sequence in get_list_parameter_type().

Recent python versions complain when backslashes in strings create invalid
escape sequences.  This causes issues for strings used as regex patterns like
`'^List\[(.*)\]$'` where you want the regex parser to treat `[` and `]`
as literals.  Double-backslashing is one way to fix it but simply converting
the string to a raw string `re.match(r'^List\[(.*)\]$', text)` is easier
and less error prone.

(cherry picked from commit cc267af3e1e11d4fb06b3f1080b5cdaae47f7b89)

4 months agoRevert "res_rtp_asterisk.c: Set Mark on rtp when timestamp skew is too big"
Maximilian Fridrich [Fri, 28 Feb 2025 07:43:44 +0000 (08:43 +0100)] 
Revert "res_rtp_asterisk.c: Set Mark on rtp when timestamp skew is too big"

This reverts commit f30ad96b3f467739c38ff415e80bffc4afff1da7.

The original change was not RFC compliant and caused issues because it
set the RTP marker bit in cases when it shouldn't be set. See the
linked issue #1135 for a detailed explanation.

Fixes: #1135.
(cherry picked from commit 5565d00eb41fa30c53bef883dbdfca74cf93bd1f)

4 months agores_rtp_asterisk.c: Use correct timeout value for T.140 RED timer.
Sean Bright [Mon, 24 Feb 2025 21:49:24 +0000 (16:49 -0500)] 
res_rtp_asterisk.c: Use correct timeout value for T.140 RED timer.

Found while reviewing #1128

(cherry picked from commit ccc596ab5fdcb90ba73005f6170da3b30d820c90)

4 months agodocs: Fix typos in cdr/
Luz Paz [Wed, 12 Feb 2025 15:15:10 +0000 (10:15 -0500)] 
docs: Fix typos in cdr/
Found via codespell

(cherry picked from commit 43599cfb2a9db034a639aabde4697efabb2868e6)

4 months agodocs: Fix various typos in channels/
Luz Paz [Tue, 4 Feb 2025 11:44:31 +0000 (06:44 -0500)] 
docs: Fix various typos in channels/
Found via `codespell -q 3 -S "./CREDITS,*.po" -L abd,asent,atleast,cachable,childrens,contentn,crypted,dne,durationm,enew,exten,inout,leapyear,mye,nd,oclock,offsetp,ot,parm,parms,preceeding,pris,ptd,requestor,re-use,re-used,re-uses,ser,siz,slanguage,slin,thirdparty,varn,varns,ues`

(cherry picked from commit aa20bfcf99931efbfd440ed1bf8cf3e9e3114965)

4 months agodocs: Fix various typos in main/
Luz Paz [Tue, 4 Feb 2025 10:53:17 +0000 (05:53 -0500)] 
docs: Fix various typos in main/
Found via `codespell -q 3 -S "./CREDITS" -L abd,asent,atleast,childrens,contentn,crypted,dne,durationm,exten,inout,leapyear,nd,oclock,offsetp,ot,parm,parms,requestor,ser,slanguage,slin,thirdparty,varn,varns,ues`

(cherry picked from commit d2bcdb71f8d288561d5bd2b1c43e04e21f9e6ba5)

4 months agobridging: Fix multiple bridging issues causing SEGVs and FRACKs.
George Joseph [Wed, 22 Jan 2025 20:52:33 +0000 (13:52 -0700)] 
bridging: Fix multiple bridging issues causing SEGVs and FRACKs.

Issues:

* The bridging core allowed multiple bridges to be created with the same
  unique bridgeId at the same time.  Only the last bridge created with the
  duplicate name was actually saved to the core bridges container.

* The bridging core was creating a stasis topic for the bridge and saving it
  in the bridge->topic field but not increasing its reference count.  In the
  case where two bridges were created with the same uniqueid (which is also
  the topic name), the second bridge would get the _existing_ topic the first
  bridge created.  When the first bridge was destroyed, it would take the
  topic with it so when the second bridge attempted to publish a message to
  it it either FRACKed or SEGVd.

* The bridge destructor, which also destroys the bridge topic, is run from the
  bridge manager thread not the caller's thread.  This makes it possible for
  an ARI developer to create a new one with the same uniqueid believing the
  old one was destroyed when, in fact, the old one's destructor hadn't
  completed. This could cause the new bridge to get the old one's topic just
  before the topic was destroyed.  When the new bridge attempted to publish
  a message on that topic, asterisk could either FRACK or SEGV.

* The ARI bridges resource also allowed multiple bridges to be created with
  the same uniqueid but it kept the duplicate bridges in its app_bridges
  container.  This created a situation where if you added two bridges with
  the same "bridge1" uniqueid, all operations on "bridge1" were performed on
  the first bridge created and the second was basically orphaned.  If you
  attempted to delete what you thought was the second bridge, you actually
  deleted the first one created.

Changes:

* A new API `ast_bridge_topic_exists(uniqueid)` was created to determine if
  a topic already exists for a bridge.

* `bridge_base_init()` in bridge.c and `ast_ari_bridges_create()` in
  resource_bridges.c now call `ast_bridge_topic_exists(uniqueid)` to check
  if a bridge with the requested uniqueid already exists and will fail if it
  does.

* `bridge_register()` in bridges.c now checks the core bridges container to
  make sure a bridge doesn't already exist with the requested uniqueid.
  Although most callers of `bridge_register()` will have already called
  `bridge_base_init()`, which will now fail on duplicate bridges, there
  is no guarantee of this so we must check again.

* The core bridges container allocation was changed to reject duplicate
  uniqueids instead of silently replacing an existing one. This is a "belt
  and suspenders" check.

* A global mutex was added to bridge.c to prevent concurrent calls to
  `bridge_base_init()` and `bridge_register()`.

* Even though you can no longer create multiple bridges with the same uniqueid
  at the same time, it's still possible that the bridge topic might be
  destroyed while a second bridge with the same uniqueid was trying to use
  it. To address this, the bridging core now increments the reference count
  on bridge->topic when a bridge is created and decrements it when the
  bridge is destroyed.

* `bridge_create_common()` in res_stasis.c now checks the stasis app_bridges
  container to make sure a bridge with the requested uniqueid doesn't already
  exist.  This may seem like overkill but there are so many entrypoints to
  bridge creation that we need to be safe and catch issues as soon in the
  process as possible.

* The stasis app_bridges container allocation was changed to reject duplicate
  uniqueids instead of adding them. This is a "belt and suspenders" check.

* The `bridge show all` CLI command now shows the bridge name as well as the
  bridge id.

* Response code 409 "Conflict" was added as a possible response from the ARI
  bridge create resources to signal that a bridge with the requested uniqueid
  already exists.

* Additional debugging was added to multiple bridging and stasis files.

Resolves: #211
(cherry picked from commit 6cf62b6032a4b6aefb808915919f3bde00e249bd)

4 months ago.github: Change concurrency group ids so they're unique.
George Joseph [Thu, 20 Feb 2025 17:40:04 +0000 (10:40 -0700)] 
.github: Change concurrency group ids so they're unique.

GitHub strikes again.  Apparently the github.ref context variable only
contains the PR number if the workflow is triggered by "pull_request" so
since we just changed the trigger to "pull_request_target" the variable
no longer contains the PR number and is therefore not unique and can't be
used as a concurrency group id.  We now use
`github.triggering_actor-github.head_ref`.

(cherry picked from commit 32b0b47348167b7f18e66ecd0c62a0546ed2c532)

4 months agobridge_channel: don't set cause code on channel during bridge delete if already set
Mike Bradeen [Tue, 18 Feb 2025 22:17:07 +0000 (15:17 -0700)] 
bridge_channel: don't set cause code on channel during bridge delete if already set

Due to a potential race condition via ARI when hanging up a channel hangup with cause
while also deleting a bridge containing that channel, the bridge delete can over-write
the hangup cause code resulting in Normal Call Clearing instead of the set value.

With this change, bridge deletion will only set the hangup code if it hasn't been
previously set.

Resolves: #1124
(cherry picked from commit a39f3d5adb1b6918225af79eafe6e91723913c2d)

4 months ago.github: Refactor Releaser to use reusable workflow
George Joseph [Sun, 16 Feb 2025 23:30:00 +0000 (16:30 -0700)] 
.github: Refactor Releaser to use reusable workflow

(cherry picked from commit f4d881803a7661e31beb8973da7181c6cf662d59)

4 months ago.github: Change branch of reusable workflows to main.
George Joseph [Sun, 16 Feb 2025 23:24:27 +0000 (16:24 -0700)] 
.github: Change branch of reusable workflows to main.

(cherry picked from commit a5d37e5ecba18d56dd604935ea69ef696e43ba31)

4 months ago.github: Refactor to use pull_request_target trigger.
George Joseph [Thu, 13 Feb 2025 20:22:31 +0000 (13:22 -0700)] 
.github: Refactor to use pull_request_target trigger.

After careful review, we believe we can now use the "pull_request_target"
workflow trigger instead of "pull_request" which required a separate
privliged workflow to add labels and comments to PRs when they are submitted
or updated.  This allows us to greatly streamline our workflows and remove
unneeded ones.

* The OnPRChanged workflow was...
  * Renamed to OnPRCheck
  * Changed to trigger on pull_request_target and the "recheckpr" label.
  * Changed to simply call reusable workflows in asterisk-ci-actions.
  * Changed to use better concurrency groups.
* The OnPRCPCheck and OnPRMergeApproved workflows were also...
  * Changed to simply call reusable workflows in asterisk-ci-actions.
  * Changed to use better concurrency groups.
* The NightlyTest and CreateDocs were also tweaked

(cherry picked from commit 1f56d5fe7ea77dff362eec3baf72ff42c43f1ec4)

4 months agores_config_pgsql: Fix regression that removed dbname config.
George Joseph [Tue, 11 Feb 2025 18:35:14 +0000 (11:35 -0700)] 
res_config_pgsql: Fix regression that removed dbname config.

A recent commit accidentally removed the code that sets dbname.
This commit adds it back in.

Resolves: #1119
(cherry picked from commit fdbb9e29dd34ba2dc1cc5e28980c7db424aeabfb)

4 months agores_stir_shaken: Allow missing or anonymous CID to continue to the dialplan.
George Joseph [Wed, 5 Feb 2025 17:33:10 +0000 (10:33 -0700)] 
res_stir_shaken: Allow missing or anonymous CID to continue to the dialplan.

The verification check for missing or anonymous callerid was happening before
the endpoint's profile was retrieved which meant that the failure_action
parameter wasn't available.  Therefore, if verification was enabled and there
was no callerid or it was "anonymous", the call was immediately terminated
instead of giving the dialplan the ability to decide what to do with the call.

* The callerid check now happens after the verification context is created and
  the endpoint's stir_shaken_profile is available.

* The check now processes the callerid failure just as it does for other
  verification failures and respects the failure_action parameter.  If set
  to "continue" or "continue_return_reason", `STIR_SHAKEN(0,verify_result)`
  in the dialplan will return "invalid_or_no_callerid".

* If the endpoint's failure_action is "reject_request", the call will be
  rejected with `433 "Anonymity Disallowed"`.

* If the endpoint's failure_action is "continue_return_reason", the call will
  continue but a `Reason: STIR; cause=433; text="Anonymity Disallowed"`
  header will be added to the next provisional or final response.

Resolves: #1112
(cherry picked from commit 0b6a3df3315e4b4d80ed8fd8fa3a29e76a4b9d72)

4 months agoresource_channels.c: Fix memory leak in ast_ari_channels_external_media.
George Joseph [Tue, 4 Feb 2025 20:00:16 +0000 (13:00 -0700)] 
resource_channels.c: Fix memory leak in ast_ari_channels_external_media.

Between ast_ari_channels_external_media(), external_media_rtp_udp(),
and external_media_audiosocket_tcp(), the `variables` structure being passed
around wasn't being cleaned up properly when there was a failure.

* In ast_ari_channels_external_media(), the `variables` structure is now
  defined with RAII_VAR to ensure it always gets cleaned up.

* The ast_variables_destroy() call was removed from external_media_rtp_udp().

* The ast_variables_destroy() call was removed from
  external_media_audiosocket_tcp(), its `endpoint` allocation was changed to
  to use ast_asprintf() as external_media_rtp_udp() does, and it now
  returns an error on failure.

* ast_ari_channels_external_media() now checks the new return code from
  external_media_audiosocket_tcp() and sets the appropriate error response.

Resolves: #1109
(cherry picked from commit 873c247f751b83da096abd48b5162c1a9a914554)

4 months agoari/pjsip: Make it possible to control transfers through ARI
Holger Hans Peter Freyther [Sat, 15 Jun 2024 08:01:58 +0000 (16:01 +0800)] 
ari/pjsip: Make it possible to control transfers through ARI

Introduce a ChannelTransfer event and the ability to notify progress to
ARI. Implement emitting this event from the PJSIP channel instead of
handling the transfer in Asterisk when configured.

Introduce a dialplan function to the PJSIP channel to switch between the
"core" and "ari-only" behavior.

UserNote: Call transfers on the PJSIP channel can now be controlled by
ARI. This can be enabled by using the PJSIP_TRANSFER_HANDLING(ari-only)
dialplan function.

(cherry picked from commit 5e4fca062c9f4b4f0aaf5ce9572ae5a3379d6b25)

4 months ago.github: Remove concurrency check in on-labelled workflows.
George Joseph [Tue, 11 Feb 2025 20:59:17 +0000 (13:59 -0700)] 
.github: Remove concurrency check in on-labelled workflows.

Apparently you can't use `${{ github.event.number }}` in a concurrency
block in a job that calls a reusable workflow. :(

(cherry picked from commit 00af359ea9f41bf16dd3871289764590fc501170)

4 months agochannel.c: Remove dead AST_GENERATOR_FD code.
Sean Bright [Thu, 6 Feb 2025 16:35:27 +0000 (11:35 -0500)] 
channel.c: Remove dead AST_GENERATOR_FD code.

Nothing ever sets the `AST_GENERATOR_FD`, so this block of code will
never execute. It also is the only place where the `generate` callback
is called with the channel lock held which made it difficult to reason
about the thread safety of `ast_generator`s.

In passing, also note that `AST_AGENT_FD` isn't used either.

(cherry picked from commit 0883e5e44d49553d70d87d12dcd715c3f114ca32)

4 months ago.github: Move PRChanged,PRChangedPriv,PRCPCheck,PRReCheck,PRMerge logic.
George Joseph [Tue, 11 Feb 2025 15:40:14 +0000 (08:40 -0700)] 
.github: Move PRChanged,PRChangedPriv,PRCPCheck,PRReCheck,PRMerge logic.

Moved to asterisk-ci-actions reusable workflows.

(cherry picked from commit eedb73968bbb0663d23c29d42c220cf6a1964460)

4 months ago.github: OnPRCherryPickTest,OnPRStateChanged,OnPRRecheck: Add job summaries.
George Joseph [Sat, 8 Feb 2025 21:21:17 +0000 (14:21 -0700)] 
.github: OnPRCherryPickTest,OnPRStateChanged,OnPRRecheck: Add job summaries.

...and refactor environment variables.

(cherry picked from commit a5b3709455795c25723884474077a7a1496a85f8)

4 months ago.github: Clean up CreateDocs
George Joseph [Mon, 10 Feb 2025 18:44:18 +0000 (11:44 -0700)] 
.github: Clean up CreateDocs

(cherry picked from commit 00bf3aaaec59ed3b3a3928e48617c289df19dba4)

4 months agofunc_strings.c: Prevent SEGV in HASH single-argument mode.
George Joseph [Thu, 30 Jan 2025 15:49:33 +0000 (08:49 -0700)] 
func_strings.c: Prevent SEGV in HASH single-argument mode.

When in single-argument mode (very rarely used), a malformation of a column
name (also very rare) could cause a NULL to be returned when retrieving the
channel variable for that column.  Passing that to strncat causes a SEGV.  We
now check for the NULL and print a warning message.

Resolves: #1101
(cherry picked from commit 1d5a6f57067c6f05c6830947faa9dac8e8f893b0)

4 months agodocs: Add version information to AGI command XML elements.
George Joseph [Fri, 24 Jan 2025 20:55:47 +0000 (13:55 -0700)] 
docs: Add version information to AGI command XML elements.

This process was a bit different than the others because everything
is in the same file, there's an array that contains the command
names and their handler functions, and the last command was created
over 15 years ago.

* Dump a `git blame` of res/res_agi.c from BEFORE the handle_* prototypes
  were changed.
* Create a command <> handler function xref by parsing the the agi_command
  array.
* For each entry, grep the function definition line "static int handle_*"
  from the git blame output and capture the commit.  This will be the
  commit the command was created in.
* Do a `git tag --contains <commit> | sort -V | head -1` to get the
  tag the function was created in.
* Add a single since/version element to the command XML.  Multiple versions
  aren't supported here because the branching and tagging scheme changed
  several times in the 2000's.

(cherry picked from commit a1b0d3492a0209617e7a5540f651c1ffc28d4061)

4 months agodocs: Fix minor typo in MixMonitor AMI action
Jeremy Lainé [Tue, 28 Jan 2025 15:25:32 +0000 (16:25 +0100)] 
docs: Fix minor typo in MixMonitor AMI action

The `Options` argument was erroneously documented as lowercase
`options`.

(cherry picked from commit 575545b49c785697ac15548fdae73d6004dcedd0)

4 months agoutils: Disable old style definition warnings for libdb.
Naveen Albert [Fri, 24 Jan 2025 01:08:23 +0000 (20:08 -0500)] 
utils: Disable old style definition warnings for libdb.

Newer versions of gcc now warn about old style definitions, such
as those in libdb, which causes compilation failure with DEVMODE
enabled. Ignore these warnings for libdb.

Resolves: #1085
(cherry picked from commit 9bb081a090e929d0951aa6dbda3bc54261b9f31f)

4 months agortp.conf.sample: Correct stunaddr example.
fabriziopicconi [Wed, 25 Sep 2024 09:54:01 +0000 (11:54 +0200)] 
rtp.conf.sample: Correct stunaddr example.

(cherry picked from commit eb80d997acfd7cd1ee1718b218df11249aaff9fb)