]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
13 days agoUpdate for 21.10.0 releases/21 21.10.0
Asterisk Development Team [Thu, 17 Jul 2025 14:28:58 +0000 (14:28 +0000)] 
Update for 21.10.0

2 weeks agoUpdate for 21.10.0-rc3 21.10.0-rc3
Asterisk Development Team [Thu, 10 Jul 2025 15:58:55 +0000 (15:58 +0000)] 
Update for 21.10.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 21.10.0-rc2 21.10.0-rc2
Asterisk Development Team [Thu, 3 Jul 2025 16:37:41 +0000 (16:37 +0000)] 
Update for 21.10.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 21.10.0-rc1 21.10.0-rc1
Asterisk Development Team [Thu, 26 Jun 2025 18:57:28 +0000 (18:57 +0000)] 
Update for 21.10.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 ec2591c60b63e05d1b74eb5a80408974fed0f2a4)

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 6e9c33caad26e8f129cb5a60e6c0b794d0cb2ade)

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 47250b716c7fc8b80a945e91dbc4b2889d659c1d)

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 30e72092495da30a9e4cdd1bddd9279a486287bb)

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 12440d232fea6970250381b408982b9a6e4c9ff2)

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 a743003e1ef9e686cb758db62b4cb0e05bb33b22)

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 e125410e5c0e24ce3d49fed3982b0633b2882b37)

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 49d87e4f81392c1c9e8be50f1e645b9081a66c1d)

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 b1065e783dcdf24b2d97b3d8cf5ee9e6bdfe6959)

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 1c0d552155a747d7945aa52d32d9ec5f8ff61bdd)

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 36fc358bc9f0c67f42578f43b8f39f9255d2b54a)

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 fe1ab659ad7bd1b67bdf09be59a9c775736e0f65)

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 113c7d0a8d0bdfb66b4e41e60470c2795c3b185c)

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 0f414f6a9444010daf7986bfd9739a63e6e2be96)

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 c0e8f4f63b2ec2f3bb94e4dec8c9c43da332360d)

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 28f5d4a2ecc1c98239367cd43f5b022bef403b58)

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 296cf69925697e7bb6ff3657af46e8b90f6d4289)

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 ae5ea528ca65884d3ae3a533d8291470eb9cb921)

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 019d4ef17ce90d6655f67a8028d50b6067f1de66)

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 0a249440015af0725849af5b2fd82b951e007ee4)

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 a5ac74ef68535f1db0496465a664eb99bd3ff2a7)

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 876c25a9538fdffad37c889e8bff0e8e5cfc8aaf)

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 dc2d559ccf06a806eff8045372dbdee048b261ee)

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 54682a538ac88eb23e337730e897dad8a3f467ea)

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 21.9.1 21.9.1
Asterisk Development Team [Thu, 22 May 2025 15:57:26 +0000 (15:57 +0000)] 
Update for 21.9.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 21.9.0 21.9.0
Asterisk Development Team [Thu, 8 May 2025 12:34:42 +0000 (12:34 +0000)] 
Update for 21.9.0

2 months agoUpdate for 21.9.0-rc1 21.9.0-rc1
Asterisk Development Team [Thu, 1 May 2025 12:41:21 +0000 (12:41 +0000)] 
Update for 21.9.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 2bb607f7b74332a83aea6e5200c7569ea707d16b)

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 be9c2cd6ffd285726bb572c8118bd1678f11572e)

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 a20cfc68ef5c36434e27b790d56cbd5fc2c1f894)

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 4dc3ca4c9a4a339e14d1b2a042443176199ffd7a)

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 06f8092ae9ffa5dc5734580dafb0bc353753f81d)

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 c00e809ff0fd20e4b9a1a18ceddda47787a315c7)

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 c251afadb91a80e6626449a86cda60567fa1f3c9)

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 f8bc3ddeb9ddac220847bb2e0143fadfb3f80911)

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 bff3fd0fa8b35057e25fd56cb0070d5e80c118c1)

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 6881b6249f43585f8ed1f047b8a8f0a3922394db)

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 bcd0e53ef698bd5131ceb8423e0ed4fb0ea41405)

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 7457d7d215a1496ffd4dcf8a347d0db850330a5b)

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 ade69af6d9ea753e7fb85d964fbedeeff0369e04)

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 8bae6a1d8c8c609168071b68108353bfd537fa80)

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 62e73f9bd8d50598ff9a71350ab01f20c988aaf7)

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 6bc055416bab24e1b27d9e2d2ff8dfc529ebfafd)

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 ca8adc245422b26c489456b82c6b3a9fdcf74e4d)

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 ea657ec7c7f14995e346a9f263627d89754aac52)

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 1c1515fc214a24da3ea602b9b0482468c4729fe2)

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 e8209bf56b0f20f1df48e797a6fb40f47d922c13)

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 abc8c5c93af939cda304d1fbb47f40db92e68c0a)

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 d6bd26573c98985e2bb26a463f195270f0d56cd7)

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 03cf8c62ad40531454ac6acd3feafa505ac6bff2)

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 f24729a48d9a63b5fa4b2966b92551c16900f1a8)

4 months agoUpdate for 21.8.0 21.8.0
Asterisk Development Team [Thu, 27 Mar 2025 12:49:43 +0000 (12:49 +0000)] 
Update for 21.8.0

4 months agoUpdate for 21.8.0-rc1 21.8.0-rc1
Asterisk Development Team [Thu, 20 Mar 2025 18:29:26 +0000 (18:29 +0000)] 
Update for 21.8.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 6921ede7cbcd68046e9f3efe3085ef53f1573fa0)

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 bae7dafa1267ca3baf4f2680d4aad1cf9709b3c9)

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 2d57b52e3ddf450307a625dad210e238d1dfa9b3)

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 3a9d7438e05695cb29e169df773f5d3a6debd517)

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 c4123901e5c13ab8c4b010bce9e274ceda695850)

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 f685df5d14674dcfc65a3371cddb18c1fb35edb7)

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 79458d70ebe96ea2a1f20a52d206515a4ffe6574)

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 6f447132b23a3f94d9b66f47a850f98d01fc18dc)

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 f80e2405e64c32898380230c5f5bf38c168814e5)

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 a47fe8f84f89a3e2fdf125002c090034dccb5d59)

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 4dc2efc8c32bd15a7eb5d64c75bcedc207bac88b)

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 16f48f504ed3fceca3fe1d0c260f36bf9492cd31)

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 44a27dc13f78537c21cf8593f8fad209fd4e5a11)

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 03ec0f2d17d6b572353f1c09b1bc31e3e8e63227)

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 46c9f7db8e6f529c242d2f8f43294743b8777258)

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 1a7c9e0a041bf14978a1a4659a4bd18be51c66a5)

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 4a563b6b8d0357202762610642e827db7c21a282)

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 a935133eebd58d7725c3519c87c9f46d1e9d6dec)

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 e8399bcc537680871a8134c1a2386db0917b83bd)

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 9822f6fd25d2bc102ed46381d8e89330cf941e7e)

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 89764215049dc2f8e883b43e70043573fcbe6ed2)

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 71551013c413189179cc481861c3789c169d107f)

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 5267c176452e26af81a208e076e2150df1a8537c)

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 71eb8a262f53f0a417991232ecff0eb67a3bca6a)

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 896a488cd569651a41070984524bab64d99b413b)

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 2cc2710e5f171cad57a7b5685662ba7545e6da02)

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 e09b4dd97f6ebb143089d972d14da7f058a50f6d)

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 478fbbb8289e1ffa13967bcc7ead10219df45297)

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 83fe05ea202204666ed27beff35b18d76629f77a)

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 f5e066a48b8dade79dab87bb8e2940a818ec1894)

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 f1df1cacf6367310bf3a44788704159968156bd0)

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 16bfde8b9b40fe26eedd69ced4066f1520807a9c)

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 a78ec5e7bf061ffb20be154eaf2208d2a59dce7d)

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 c22837543190eb23fd8655695fc93f8d311642a3)

4 months agodocs: Add version information to ARI resources and methods.
George Joseph [Mon, 27 Jan 2025 15:30:40 +0000 (08:30 -0700)] 
docs: Add version information to ARI resources and methods.

* Dump a git blame of each file in rest-api/api-docs.

* Get the commit for each "resourcePath" and "httpMethod" entry.

* Find the tags for each commit (same as other processes).

* Insert a "since" array after each "resourcePath" and "httpMethod" entry.

(cherry picked from commit a84d4cd0b4b154c779a163c27ff70638f2aeb4f4)

4 months agodocs: Indent <since> tags.
Sean Bright [Thu, 23 Jan 2025 21:35:58 +0000 (16:35 -0500)] 
docs: Indent <since> tags.

Also updates the 'since' of applications/functions that existed before
XML documentation was introduced (1.6.2.0).

(cherry picked from commit b4156fecf02ac427a91eb9f6bd49e98b8d6f4fb2)