]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
14 months agostir_shaken: Fix memory leak, typo in config, tn canonicalization
George Joseph [Thu, 25 Apr 2024 17:56:15 +0000 (11:56 -0600)] 
stir_shaken:  Fix memory leak, typo in config, tn canonicalization

* Fixed possible memory leak in tn_config:tn_get_etn() where we
weren't releasing etn if tn or eprofile were null.
* We now canonicalize TNs before using them for lookups or adding
them to Identity headers.
* Fixed a typo in stir_shaken.conf.sample.

Resolves: #716
(cherry picked from commit b7ed77a7c5e2db6883e16d14a01d886dda1a0d8f)

14 months agomake_buildopts_h: Always include DETECT_DEADLOCKS
George Joseph [Sat, 27 Apr 2024 20:40:28 +0000 (14:40 -0600)] 
make_buildopts_h: Always include DETECT_DEADLOCKS

Since DETECT_DEADLOCKS is now split from DEBUG_THREADS, it must
always be included in buildopts.h instead of only when
ADD_CFLAGS_TO_BUILDOPTS_H is defined.  A SEGV will result otherwise.

Resolves: #719
(cherry picked from commit d1d80af0c0e26a4c4aa95578c2d88c35901c587d)

14 months agosorcery.c: Fixed crash error when executing "module reload"
Spiridonov Dmitry [Sun, 14 Apr 2024 12:41:47 +0000 (15:41 +0300)] 
sorcery.c: Fixed crash error when executing "module reload"

Fixed crash error when cli "module reload". The error appears when
compiling with res_prometheus and using the sorcery memory cache for
registrations

(cherry picked from commit b8525e87aeb11c780b0b5d4e8729258c77352fcb)

14 months agocallerid.c: Parse previously ignored Caller ID parameters.
Naveen Albert [Mon, 1 Apr 2024 21:16:29 +0000 (17:16 -0400)] 
callerid.c: Parse previously ignored Caller ID parameters.

Commit f2f397c1a8cc48913434ebb297f0ff50d96993db previously
made it possible to send Caller ID parameters to FXS stations
which, prior to that, could not be sent.

This change is complementary in that we now handle receiving
all these parameters on FXO lines and provide these up to
the dialplan, via chan_dahdi. In particular:

* If a redirecting reason is provided, the channel's redirecting
  reason is set. No redirecting number is set, since there is
  no parameter for this in the Caller ID protocol, but the reason
  can be checked to determine if and why a call was forwarded.
* If the Call Qualifier parameter is received, the Call Qualifier
  variable is set.
* Some comments have been added to explain why some of the code
  is the way it is, to assist other people looking at it.

With this change, Asterisk's Caller ID implementation is now
reasonably complete for both FXS and FXO operation.

Resolves: #681
(cherry picked from commit 4cf8d9d94a46b8b49498e8d15fde9f35dcb3a6d5)

14 months agologger.h: Add SCOPE_CALL and SCOPE_CALL_WITH_RESULT
George Joseph [Tue, 9 Apr 2024 20:49:36 +0000 (14:49 -0600)] 
logger.h:  Add SCOPE_CALL and SCOPE_CALL_WITH_RESULT

If you're tracing a large function that may call another function
multiple times in different circumstances, it can be difficult to
see from the trace output exactly which location that function
was called from.  There's no good way to automatically determine
the calling location.  SCOPE_CALL and SCOPE_CALL_WITH_RESULT
simply print out a trace line before and after the call.

The difference between SCOPE_CALL and SCOPE_CALL_WITH_RESULT is
that SCOPE_CALL ignores the function's return value (if any) where
SCOPE_CALL_WITH_RESULT allows you to specify the type of the
function's return value so it can be assigned to a variable.
SCOPE_CALL_WITH_INT_RESULT is just a wrapper for SCOPE_CALL_WITH_RESULT
and the "int" return type.

(cherry picked from commit cf5c46d8ae563c60ff6bf4348fcc0abd723031d6)

14 months agoapp_queue.c: Properly handle invalid strategies from realtime.
Sean Bright [Sat, 13 Apr 2024 17:30:22 +0000 (13:30 -0400)] 
app_queue.c: Properly handle invalid strategies from realtime.

The existing code sets the queue strategy to `ringall` but it is then
immediately overwritten with an invalid one.

Fixes #707

(cherry picked from commit 6914c93791062f8841e0062b5bab8fa6406f7bef)

14 months agofile.c, channel.c: Don't emit warnings if progress received.
Naveen Albert [Wed, 10 Apr 2024 00:01:36 +0000 (20:01 -0400)] 
file.c, channel.c: Don't emit warnings if progress received.

Silently ignore AST_CONTROL_PROGRESS where appropriate,
as most control frames already are.

Resolves: #696
(cherry picked from commit 051ddbe72955b95dd4e8c80fd091d1b305a736a3)

14 months agoalembic: Correct NULLability of PJSIP id columns.
Sean Bright [Sat, 6 Apr 2024 13:57:43 +0000 (09:57 -0400)] 
alembic: Correct NULLability of PJSIP id columns.

Fixes #695

(cherry picked from commit df6f30022f30dd787b10f5a71fa2789a6be1dee8)

14 months agortp_engine and stun: call ast_register_atexit instead of ast_register_cleanup
George Joseph [Tue, 2 Apr 2024 20:28:35 +0000 (14:28 -0600)] 
rtp_engine and stun: call ast_register_atexit instead of ast_register_cleanup

rtp_engine.c and stun.c were calling ast_register_cleanup which
is skipped if any loadable module can't be cleanly unloaded
when asterisk shuts down.  Since this will always be the case,
their cleanup functions never get run.  In a practical sense
this makes no difference since asterisk is shutting down but if
you're in development mode and trying to use the leak sanitizer,
the leaks from both of those modules clutter up the output.

(cherry picked from commit 1eec3b6d18f41334e263a9f69125ae08f5a445f9)

14 months agomanager.c: Add missing parameters to Login documentation
George Joseph [Wed, 3 Apr 2024 13:51:31 +0000 (07:51 -0600)] 
manager.c: Add missing parameters to Login documentation

* Added the AuthType and Key parameters for MD5 authentication.

* Added the Events parameter.

Resolves: #689
(cherry picked from commit b2bcc0cd09ac1c93ef4943013efed23d2c3236b3)

14 months agofunc_callerid: Emit warning if invalid redirecting reason set.
Naveen Albert [Mon, 1 Apr 2024 21:24:13 +0000 (17:24 -0400)] 
func_callerid: Emit warning if invalid redirecting reason set.

Emit a warning if REDIRECTING(reason) is set to an invalid
reason, consistent with what happens when
REDIRECTING(orig-reason) is set to an invalid reason.

Resolves: #683
(cherry picked from commit 9ba6875a3f7b55c0349deee3586b8747bfe43990)

14 months agochan_dahdi: Add DAHDIShowStatus AMI action.
Naveen Albert [Fri, 29 Mar 2024 14:46:18 +0000 (10:46 -0400)] 
chan_dahdi: Add DAHDIShowStatus AMI action.

* Add an AMI action to correspond to the "dahdi show status"
  command, allowing span information to be retrieved via AMI.
* Show span number and sig type in "dahdi show channels".

Resolves: #673
(cherry picked from commit 4ff93474dfa75d7ae219a4140305d181f0d59046)

14 months agores_pjsip_endpoint_identifier_ip: Add endpoint identifier transport address.
Sperl Viktor [Thu, 28 Mar 2024 15:22:24 +0000 (16:22 +0100)] 
res_pjsip_endpoint_identifier_ip: Add endpoint identifier transport address.

Add a new identify_by option to res_pjsip_endpoint_identifier_ip
called 'transport' this matches endpoints based on the bound
ip address (local) instead of the 'ip' option, which matches on
the source ip address (remote).

UserNote: set identify_by=transport for the pjsip endpoint. Then
use the existing 'match' option and the new 'transport' option of
the identify.

Fixes: #672
(cherry picked from commit c8769f3d5a8b365d919030713982209516bac3b1)

14 months agores_stir_shaken: Fix compilation for CentOS7 (openssl 1.0.2)
George Joseph [Mon, 1 Apr 2024 20:10:32 +0000 (14:10 -0600)] 
res_stir_shaken:  Fix compilation for CentOS7 (openssl 1.0.2)

* OpenSSL 1.0.2 doesn't support X509_get0_pubkey so we now use
  X509_get_pubkey.  The difference is that X509_get_pubkey requires
  the caller to free the EVP_PKEY themselves so we now let
  RAII_VAR do that.
* OpenSSL 1.0.2 doesn't support upreffing an X509_STORE so we now
  wrap it in an ao2 object.
* OpenSSL 1.0.2 doesn't support X509_STORE_get0_objects to get all
  the certs from an X509_STORE and there's no easy way to polyfill
  it so the CLI commands that list profiles will show a "not
  supported" message instead of listing the certs in a store.

Resolves: #676
(cherry picked from commit 16b264d6a9cdeb4a85d225744b905ee58e184efc)

14 months agoFix incorrect application and function documentation references
George Joseph [Mon, 1 Apr 2024 12:30:54 +0000 (06:30 -0600)] 
Fix incorrect application and function documentation references

There were a few references in the embedded documentation XML
where the case didn't match or where the referenced app or function
simply didn't exist any more.  These were causing 404 responses
in docs.asterisk.org.

(cherry picked from commit 9e2179baa10de329f7626f6a43af2a365194ce85)

14 months agocli.c: `core show channels concise` is not really deprecated.
Sean Bright [Mon, 1 Apr 2024 15:08:59 +0000 (11:08 -0400)] 
cli.c: `core show channels concise` is not really deprecated.

Fixes #675

(cherry picked from commit 41daf01866dbbb45f4dd7b3e634b827255d44161)

14 months agores_pjsip_endpoint_identifier_ip: Endpoint identifier request URI
Sperl Viktor [Thu, 28 Mar 2024 13:20:26 +0000 (14:20 +0100)] 
res_pjsip_endpoint_identifier_ip: Endpoint identifier request URI

Add ability to match against PJSIP request URI.

UserNote: this new feature let users match endpoints based on the
indound SIP requests' URI. To do so, add 'request_uri' to the
endpoint's 'identify_by' option. The 'match_request_uri' option of
the identify can be an exact match for the entire request uri, or a
regular expression (between slashes). It's quite similar to the
header identifer.

Fixes: #599
(cherry picked from commit ac297d15f879816947195c5acb28b12bad9306a6)

14 months agochan_dahdi: Don't retry opening nonexistent channels on restart.
Naveen Albert [Tue, 26 Mar 2024 11:43:32 +0000 (07:43 -0400)] 
chan_dahdi: Don't retry opening nonexistent channels on restart.

Commit 729cb1d390b136ccc696430aa5c68d60ea4028be added logic to retry
opening DAHDI channels on "dahdi restart" if they failed initially,
up to 1,000 times in a loop, to address cases where the channel was
still in use. However, this retry loop does not use the actual error,
which means chan_dahdi will also retry opening nonexistent channels
1,000 times per channel, causing a flood of unnecessary warning logs
for an operation that will never succeed, with tens or hundreds of
thousands of open attempts being made.

The original patch would have been more targeted if it only retried
on the specific relevant error (likely EBUSY, although it's hard to
say since the original issue is no longer available).

To avoid the problem above while avoiding the possibility of breakage,
this skips the retry logic if the error is ENXIO (No such device or
address), since this will never succeed.

Resolves: #669
(cherry picked from commit 63aa08fa0b3e30e8d2f1406936c740bf5a5bf539)

14 months agoImplement Configurable TCP Keepalive Settings in PJSIP Transports
Joshua Elson [Mon, 18 Mar 2024 19:14:36 +0000 (15:14 -0400)] 
Implement Configurable TCP Keepalive Settings in PJSIP Transports

This commit introduces configurable TCP keepalive settings for both TCP and TLS transports. The changes allow for finer control over TCP connection keepalives, enhancing stability and reliability in environments prone to connection timeouts or where intermediate devices may prematurely close idle connections. This has proven necessary and has already been tested in production in several specialized environments where access to the underlying transport is unreliable in ways invisible to the operating system directly, so these keepalive and timeout mechanisms are necessary.

Fixes #657

(cherry picked from commit 555eb9d3d2bf9b3afac18a81d1da67fae8651e08)

14 months agores_pjsip_refer.c: Allow GET_TRANSFERRER_DATA
Martin Tomec [Tue, 6 Feb 2024 16:39:18 +0000 (17:39 +0100)] 
res_pjsip_refer.c: Allow GET_TRANSFERRER_DATA

There was functionality in chan_sip to get REFER headers, with GET_TRANSFERRER_DATA variable. This commit implements the same functionality in pjsip, to ease transfer from chan_sip to pjsip.

Fixes: #579
UserNote: the GET_TRANSFERRER_DATA dialplan variable can now be used also in pjsip.
(cherry picked from commit cba82273ae789c193128589a6c3f3679782b1ccd)

14 months agores_ari.c: Add additional output to ARI requests when debug is enabled
Martin Nystroem [Fri, 22 Mar 2024 12:23:58 +0000 (13:23 +0100)] 
res_ari.c: Add additional output to ARI requests when debug is enabled

When ARI debug is enabled the logs will now output http method and the uri.

Fixes: #666
(cherry picked from commit dd91f09481d98aace610097a5bd37c6f51ba4abe)

14 months agoalembic: Fix compatibility with SQLAlchemy 2.0+.
Sean Bright [Wed, 20 Mar 2024 16:20:40 +0000 (12:20 -0400)] 
alembic: Fix compatibility with SQLAlchemy 2.0+.

SQLAlchemy 2.0 changed the way that commits/rollbacks are handled
causing the final `UPDATE` to our `alembic_version_<whatever>` tables
to be rolled back instead of committed.

We now use one connection to determine which
`alembic_version_<whatever>` table to use and another to run the
actual migrations. This prevents the erroneous rollback.

This change is compatible with both SQLAlchemy 1.4 and 2.0.

(cherry picked from commit 1944c9d72e8a87f502aa6029c063ca1b7805d432)

14 months agomanager.c: Add new parameter 'PreDialGoSub' to Originate AMI action
jonatascalebe [Thu, 14 Mar 2024 18:53:43 +0000 (15:53 -0300)] 
manager.c: Add new parameter 'PreDialGoSub' to Originate AMI action

manager.c: Add new parameter 'PreDialGoSub' to Originate AMI action

The action originate does not has the ability to run an subroutine at initial channel, like the Aplication Originate. This update give this ability for de action originate too.

For example, we can run a routine via Gosub on the channel to request an automatic answer, so the caller does not need to accept the call when using the originate command via manager, making the operation more efficient.

UserNote: When using the Originate AMI Action, we now can pass the PreDialGoSub parameter, instructing the asterisk to perform an subrouting at channel before call start. With this parameter an call initiated by AMI can request the channel to start the call automaticaly, adding a SIP header to using GoSUB, instructing to autoanswer the channel, and proceeding the outbuound extension executing. Exemple of an context to perform the previus indication:
[addautoanswer]
exten => _s,1,Set(PJSIP_HEADER(add,Call-Info)=answer-after=0)
exten => _s,n,Set(PJSIP_HEADER(add,Alert-Info)=answer-after=0)
exten => _s,n,Return()

(cherry picked from commit d4b79cb4660a4cd98ec7bd0f5e24c7e62ed6ae83)

14 months agomenuselect: Minor cosmetic fixes.
Naveen Albert [Thu, 21 Mar 2024 15:21:00 +0000 (11:21 -0400)] 
menuselect: Minor cosmetic fixes.

Improve some of the formatting from
dd3f17c699e320d6d30c94298d8db49573ba28da
(#521).

(cherry picked from commit 4d45b84dee98f21c3743ac97fa767844728f5bf1)

14 months agopbx_variables.c: Prevent SEGV due to stack overflow.
Naveen Albert [Mon, 4 Dec 2023 17:58:17 +0000 (12:58 -0500)] 
pbx_variables.c: Prevent SEGV due to stack overflow.

It is possible for dialplan to result in an infinite
recursion of variable substitution, which eventually
leads to stack overflow. If we detect this, abort
substitution and log an error for the user to fix
the broken dialplan.

Resolves: #480

UpgradeNote: The maximum amount of dialplan recursion
using variable substitution (such as by using EVAL_EXTEN)
is capped at 15.

(cherry picked from commit 310c8a7c68cbbe0e16165116ebe55ea82db2675b)

14 months agores_prometheus: Fix duplicate output of metric and help text
Holger Hans Peter Freyther [Sat, 24 Feb 2024 09:32:19 +0000 (17:32 +0800)] 
res_prometheus: Fix duplicate output of metric and help text

The prometheus exposition format requires each line to be unique[1].
This is handled by struct prometheus_metric having a list of children
that is managed when registering a metric. In case the scrape callback
is used, it is the responsibility of the implementation to handle this
correctly.

Originally the bridge callback didn't handle NULL snapshots, the crash
fix lead to NULL metrics, and fixing that lead to duplicates.

The original code assumed that snapshots are not NULL and then relied on
"if (i > 0)" to establish the parent/children relationship between
metrics of the same class. This is not workerable as the first bridge
might be invisible/lacks a snapshot.

Fix this by keeping a separate array of the first metric by class.
Instead of relying on the index of the bridge, check whether the array
has an entry. Use that array for the output.

Add a test case that verifies that the help text is not duplicated.

Resolves: #642

[1] https://prometheus.io/docs/instrumenting/exposition_formats/#grouping-and-sorting

(cherry picked from commit d45c8e165f94ccc7e0bc5ae2e1050653c8627c5a)

14 months agomanager.c: Add CLI command to kick AMI sessions.
Naveen Albert [Wed, 6 Dec 2023 17:01:49 +0000 (12:01 -0500)] 
manager.c: Add CLI command to kick AMI sessions.

This adds a CLI command that can be used to manually
kick specific AMI sessions.

Resolves: #485

UserNote: The "manager kick session" CLI command now
allows kicking a specified AMI session.

(cherry picked from commit f4fba80708b226771581cb8c82abaaa2d65a13a9)

14 months agochan_dahdi: Allow specifying waitfordialtone per call.
Naveen Albert [Sat, 2 Dec 2023 18:24:20 +0000 (13:24 -0500)] 
chan_dahdi: Allow specifying waitfordialtone per call.

The existing "waitfordialtone" setting in chan_dahdi.conf
applies permanently to a specific channel, regardless of
how it is being used. This rather restrictively prevents
a system from simultaneously being able to pick free lines
for outgoing calls while also allowing barge-in to a trunk
by some other arrangement.

This allows specifying "waitfordialtone" using the CHANNEL
function for only the next call that will be placed, allowing
significantly more flexibility in the use of trunk interfaces.

Resolves: #472

UserNote: "waitfordialtone" may now be specified for DAHDI
trunk channels on a per-call basis using the CHANNEL function.

(cherry picked from commit 7f5131372519cea4567b49b8c96059157a91bc2e)

14 months agores_parking: Fail gracefully if parking lot is full.
Naveen Albert [Sun, 3 Mar 2024 18:37:10 +0000 (13:37 -0500)] 
res_parking: Fail gracefully if parking lot is full.

Currently, if a parking lot is full, bridge setup returns -1,
causing dialplan execution to terminate without TryExec.
However, such failures should be handled more gracefully,
the same way they are on other paths, as indicated by the
module's author, here:

http://lists.digium.com/pipermail/asterisk-dev/2018-December/077144.html

Now, callers will hear the parking failure announcement, and dialplan
will continue, which is consistent with existing failure modes.

Resolves: #624
(cherry picked from commit e1dfa207977b4c68e274ba88476dc21271737420)

14 months agores_config_mysql.c: Support hostnames up to 255 bytes.
Sean Bright [Mon, 18 Mar 2024 14:47:50 +0000 (10:47 -0400)] 
res_config_mysql.c: Support hostnames up to 255 bytes.

Fixes #654

(cherry picked from commit e33bab1bfdaabef7738c7bd73c6556207e1f1c48)

14 months agores_pjsip: Fix alembic downgrade for boolean columns.
Sean Bright [Mon, 18 Mar 2024 21:12:34 +0000 (17:12 -0400)] 
res_pjsip: Fix alembic downgrade for boolean columns.

When downgrading, ensure that we don't touch columns that didn't
actually change during upgrade.

(cherry picked from commit ce8b5645094d55c73c5cf14c92de53071013f800)

14 months agoUpgrade bundled pjproject to 2.14.1
Stanislav Abramenkov [Tue, 12 Mar 2024 07:26:44 +0000 (09:26 +0200)] 
Upgrade bundled pjproject to 2.14.1

Fixes: asterisk#648
UserNote: Bundled pjproject has been upgraded to 2.14.1. For more
information visit pjproject Github page: https://github.com/pjsip/pjproject/releases/tag/2.14.1

(cherry picked from commit 72310b5575eed8cd2f6b99a2daa251d78b70a9fa)

14 months agoalembic: Quote new MySQL keyword 'qualify.'
Sean Bright [Fri, 15 Mar 2024 17:17:57 +0000 (13:17 -0400)] 
alembic: Quote new MySQL keyword 'qualify.'

Fixes #651

(cherry picked from commit 17cf90cc8bb281f45dc06486ff180b7b45c1638b)

14 months agores_pjsip_session: Reset pending_media_state->read_callbacks
Maximilian Fridrich [Thu, 15 Feb 2024 16:07:27 +0000 (17:07 +0100)] 
res_pjsip_session: Reset pending_media_state->read_callbacks

In handle_negotiated_sdp the pending_media_state->read_callbacks must be
reset before they are added in the SDP handlers in
handle_negotiated_sdp_session_media. Otherwise, old callbacks for
removed streams and file descriptors could be added to the channel and
Asterisk would poll on non-existing file descriptors.

Resolves: #611
(cherry picked from commit c5a6d8a6dbd2057878b96b21cc983082710eaa4c)

14 months ago.github: Add PAT to PRSubmitActions/Add Reviewers
George Joseph [Wed, 6 Mar 2024 16:21:33 +0000 (09:21 -0700)] 
.github: Add PAT to PRSubmitActions/Add Reviewers

(cherry picked from commit a02a929d2749df957f543c4ed0667dd46800d155)

16 months agoUpdate for 21.2.0 21.2.0
Asterisk Development Team [Mon, 18 Mar 2024 13:25:20 +0000 (13:25 +0000)] 
Update for 21.2.0

16 months agoUpdate for 21.2.0-rc2 21.2.0-rc2
Asterisk Development Team [Mon, 11 Mar 2024 17:17:46 +0000 (17:17 +0000)] 
Update for 21.2.0-rc2

16 months agores_pjsip_stir_shaken.c: Add checks for missing parameters
George Joseph [Mon, 11 Mar 2024 15:41:14 +0000 (09:41 -0600)] 
res_pjsip_stir_shaken.c:  Add checks for missing parameters

* Added checks for missing session, session->channel and rdata
  in stir_shaken_incoming_request.

* Added checks for missing session, session->channel and tdata
  in stir_shaken_outgoing_request.

Resolves: #645

16 months agoUpdate for 21.2.0-rc1 21.2.0-rc1
Asterisk Development Team [Thu, 7 Mar 2024 14:18:52 +0000 (14:18 +0000)] 
Update for 21.2.0-rc1

16 months agoapp_dial: Add dial time for progress/ringing.
Naveen Albert [Thu, 8 Feb 2024 18:09:49 +0000 (13:09 -0500)] 
app_dial: Add dial time for progress/ringing.

Add a timeout option to control the amount of time
to wait if no early media is received before giving
up. This allows aborting early if the destination
is not being responsive.

Resolves: #588

UserNote: The timeout argument to Dial now allows
specifying the maximum amount of time to dial if
early media is not received.

(cherry picked from commit bdf9327a332cbe9d7b34457e95db2deca7d4aa55)

16 months agoapp_voicemail: Properly reinitialize config after unit tests.
Naveen Albert [Thu, 29 Feb 2024 14:27:09 +0000 (09:27 -0500)] 
app_voicemail: Properly reinitialize config after unit tests.

Most app_voicemail unit tests were not properly cleaning up
after themselves after running. This led to test mailboxes
lingering around in the system. It also meant that if any
unit tests in app_voicemail that create mailboxes were executed
and the module was not unloaded/loaded again prior to running
the test_voicemail_vm_info unit test, Asterisk would segfault
due to an attempt to copy a NULL string.

The load_config test did actually have logic to reinitialize
the config after the test. However, this did not work in practice
since load_config() would not reload the config since voicemail.conf
had not changed during the test; thus, additional logic has been
added to ensure that voicemail.conf is truly reloaded, after any
unit tests which modify the users list.

This prevents the SEGV due to invalid mailboxes lingering around,
and also ensures that the system state is restored to what it was
prior to the tests running.

Resolves: #629
(cherry picked from commit 2ac9c8fb5c0465829aee0b53803f3dda2160c5e7)

16 months agoapp_queue.c : fix "queue add member" usage string
Shaaah [Tue, 23 Jan 2024 11:15:56 +0000 (12:15 +0100)] 
app_queue.c : fix "queue add member" usage string

Fixing bracket placement in the "queue add member" cli usage string.

(cherry picked from commit 6f99268f79e83a4d165c9fb2f81808746ff96722)

16 months agoapp_voicemail: Allow preventing mark messages as urgent.
Naveen Albert [Sat, 24 Feb 2024 20:54:57 +0000 (15:54 -0500)] 
app_voicemail: Allow preventing mark messages as urgent.

This adds an option to allow preventing callers from leaving
messages marked as 'urgent'.

Resolves: #619

UserNote: The leaveurgent mailbox option can now be used to
control whether callers may leave messages marked as 'Urgent'.

(cherry picked from commit 190b6eafb304b83f968e53645448b78e8ca630a2)

16 months agores_pjsip: Use consistent type for boolean columns.
Sean Bright [Tue, 27 Feb 2024 21:40:40 +0000 (16:40 -0500)] 
res_pjsip: Use consistent type for boolean columns.

This migrates the relevant schema objects from the `('yes', 'no')`
definition to the `('0', '1', 'off', 'on', 'false', 'true', 'yes', 'no')`
one.

Fixes #617

(cherry picked from commit 1a94502551343a90f5b18b7509e41bdfaaaac714)

16 months ago.github: Remove timeout-minutes from gatetests
George Joseph [Tue, 5 Mar 2024 22:17:33 +0000 (15:17 -0700)] 
.github: Remove timeout-minutes from gatetests

(cherry picked from commit 94176ecb88c9669e4d61fea0bb9422abf9f4b98c)

16 months agoattestation_config.c: Use ast_free instead of ast_std_free
George Joseph [Tue, 5 Mar 2024 19:12:08 +0000 (12:12 -0700)] 
attestation_config.c: Use ast_free instead of ast_std_free

In as_check_common_config, we were calling ast_std_free on
raw_key but raw_key was allocated with ast_malloc so it
should be freed with ast_free.

Resolves: #636
(cherry picked from commit 1b94c905245840bdfa13330e0f3c1e441d6127f5)

16 months agoMakefile: Add stir_shaken/cache to directories created on install
George Joseph [Mon, 4 Mar 2024 16:46:48 +0000 (09:46 -0700)] 
Makefile: Add stir_shaken/cache to directories created on install

The default location for the stir_shaken cache is
/var/lib/asterisk/keys/stir_shaken/cache but we were only creating
/var/lib/asterisk/keys/stir_shaken on istall.  We now create
the cache sub-directory.

Resolves: #634
(cherry picked from commit 215424aa76e1755882d5e9ae18197eaee46ede96)

16 months ago.github: Pass only single GATETEST_COMMAND to AsteriskGateComposite
George Joseph [Tue, 5 Mar 2024 15:52:01 +0000 (08:52 -0700)] 
.github: Pass only single GATETEST_COMMAND to AsteriskGateComposite

(cherry picked from commit d58ca20247a9b8a4e2ef23fcf723562aad82ec81)

16 months agoStir/Shaken Refactor
George Joseph [Thu, 26 Oct 2023 16:27:35 +0000 (10:27 -0600)] 
Stir/Shaken Refactor

Why do we need a refactor?

The original stir/shaken implementation was started over 3 years ago
when little was understood about practical implementation.  The
result was an implementation that wouldn't actually interoperate
with any other stir-shaken implementations.

There were also a number of stir-shaken features and RFC
requirements that were never implemented such as TNAuthList
certificate validation, sending Reason headers in SIP responses
when verification failed but we wished to continue the call, and
the ability to send Media Key(mky) grants in the Identity header
when the call involved DTLS.

Finally, there were some performance concerns around outgoing
calls and selection of the correct certificate and private key.
The configuration was keyed by an arbitrary name which meant that
for every outgoing call, we had to scan the entire list of
configured TNs to find the correct cert to use.  With only a few
TNs configured, this wasn't an issue but if you have a thousand,
it could be.

What's changed?

* Configuration objects have been refactored to be clearer about
  their uses and to fix issues.
    * The "general" object was renamed to "verification" since it
      contains parameters specific to the incoming verification
      process.  It also never handled ca_path and crl_path
      correctly.
    * A new "attestation" object was added that controls the
      outgoing attestation process.  It sets default certificates,
      keys, etc.
    * The "certificate" object was renamed to "tn" and had it's key
      change to telephone number since outgoing call attestation
      needs to look up certificates by telephone number.
    * The "profile" object had more parameters added to it that can
      override default parameters specified in the "attestation"
      and "verification" objects.
    * The "store" object was removed altogther as it was never
      implemented.

* We now use libjwt to create outgoing Identity headers and to
  parse and validate signatures on incoming Identiy headers.  Our
  previous custom implementation was much of the source of the
  interoperability issues.

* General code cleanup and refactor.
    * Moved things to better places.
    * Separated some of the complex functions to smaller ones.
    * Using context objects rather than passing tons of parameters
      in function calls.
    * Removed some complexity and unneeded encapsuation from the
      config objects.

Resolves: #351
Resolves: #46

UserNote: Asterisk's stir-shaken feature has been refactored to
correct interoperability, RFC compliance, and performance issues.
See https://docs.asterisk.org/Deployment/STIR-SHAKEN for more
information.

UpgradeNote: The stir-shaken refactor is a breaking change but since
it's not working now we don't think it matters. The
stir_shaken.conf file has changed significantly which means that
existing ones WILL need to be changed.  The stir_shaken.conf.sample
file in configs/samples/ has quite a bit more information.  This is
also an ABI breaking change since some of the existing objects
needed to be changed or removed, and new ones added.  Additionally,
if res_stir_shaken is enabled in menuselect, you'll need to either
have the development package for libjwt v1.15.3 installed or use
the --with-libjwt-bundled option with ./configure.

(cherry picked from commit 2e0d837e01277613cb70588955095a4a79e0477c)

16 months agotranslate.c: implement new direct comp table mode
Sebastian Jennen [Sun, 25 Feb 2024 20:53:57 +0000 (21:53 +0100)] 
translate.c: implement new direct comp table mode

The new mode lists for each codec translation the actual real cost in cpu microseconds per second translated audio.
This allows to compare the real cpu usage of translations and helps in evaluation of codec implementation changes regarding performance (regression testing).

- add new table mode
- hide the 999999 comp values, as these only indicate an issue with transcoding
- hide the 0 values, as these also do not contain any information (only indicate a multistep transcoding)

Resolves: #601
(cherry picked from commit 3c72bc8a7b06823dc9f6ff6e6176d8feb31d2f0f)

16 months agoREADME.md: Removed outdated link
Shyju Kanaprath [Fri, 23 Feb 2024 17:07:48 +0000 (21:07 +0400)] 
README.md: Removed outdated link

Removed outdated link http://www.quicknet.net from README.md

cherry-pick-to: 18
cherry-pick-to: 20
cherry-pick-to: 21
(cherry picked from commit 07055dce94231393a7bc291e6828e10b14072ebe)

16 months agostrings.h: Ensure ast_str_buffer(…) returns a 0 terminated string.
Sean Bright [Sat, 17 Feb 2024 19:41:38 +0000 (14:41 -0500)] 
strings.h: Ensure ast_str_buffer(…) returns a 0 terminated string.

If a dynamic string is created with an initial length of 0,
`ast_str_buffer(…)` will return an invalid pointer.

This was a secondary discovery when fixing #65.

(cherry picked from commit 31ab82840b031b17643adf742b84cd2ed6924df2)

16 months ago.github: Add force_cherry_pick option to Releaser
George Joseph [Tue, 20 Feb 2024 13:49:20 +0000 (06:49 -0700)] 
.github: Add force_cherry_pick option to Releaser

(cherry picked from commit 2d1a4bab25b99792655ebc197c38b4244e5e32b0)

16 months ago.github: Remove start_version from Releaser
George Joseph [Tue, 17 Oct 2023 18:39:04 +0000 (12:39 -0600)] 
.github: Remove start_version from Releaser

(cherry picked from commit 4077b4b3404e922f0a6c2bea8406fc340f92c869)

16 months agores_rtp_asterisk.c: Correct coefficient in MOS calculation.
romryz [Tue, 6 Feb 2024 13:57:32 +0000 (15:57 +0200)] 
res_rtp_asterisk.c: Correct coefficient in MOS calculation.

Media Experience Score relies on incorrect pseudo_mos variable
calculation. According to forming an opinion section of the
documentation, calculation relies on ITU-T G.107 standard:

    https://docs.asterisk.org/Deployment/Media-Experience-Score/#forming-an-opinion

ITU-T G.107 Annex B suggests to calculate MOS with a coefficient
"seven times ten to the power of negative six", 7 * 10^(-6). which
would mean 6 digits after the decimal point. Current implementation
has 7 digits after the decimal point, which downrates the calls.

Fixes: #597
(cherry picked from commit a7a03bc294c8c46da00cbe73e6f448bf42db13eb)

16 months agodsp.c: Fix and improve potentially inaccurate log message.
Naveen Albert [Fri, 9 Feb 2024 22:07:13 +0000 (17:07 -0500)] 
dsp.c: Fix and improve potentially inaccurate log message.

If ast_dsp_process is called with a codec besides slin, ulaw,
or alaw, a warning is logged that in-band DTMF is not supported,
but this message is not always appropriate or correct, because
ast_dsp_process is much more generic than just DTMF detection.

This logs a more generic message in those cases, and also improves
codec-mismatch logging throughout dsp.c by ensuring incompatible
codecs are printed out.

Resolves: #595
(cherry picked from commit 6ddcdfce1ff7db5c888d1f135f3800bfa5d1c52c)

16 months agopjsip show channelstats: Prevent possible segfault when faxing
George Joseph [Fri, 9 Feb 2024 16:15:13 +0000 (09:15 -0700)] 
pjsip show channelstats: Prevent possible segfault when faxing

Under rare circumstances, it's possible for the original audio
session in the active_media_state default_session to be corrupted
instead of removed when switching to the t38/image media session
during fax negotiation.  This can cause a segfault when a "pjsip
show channelstats" attempts to print that audio media session's
rtp statistics.  In these cases, the active_media_state
topology is correctly showing only a single t38/image stream
so we now check that there's an audio stream in the topology
before attempting to use the audio media session to get the rtp
statistics.

Resolves: #592
(cherry picked from commit adcfbcd50ea1b05580b3a6ee4c7ffbd09411ebb0)

16 months agoReduce startup/shutdown verbose logging
George Joseph [Wed, 31 Jan 2024 17:46:28 +0000 (10:46 -0700)] 
Reduce startup/shutdown verbose logging

When started with a verbose level of 3, asterisk can emit over 1500
verbose message that serve no real purpose other than to fill up
logs. When asterisk shuts down, it emits another 1100 that are of
even less use. Since the testsuite runs asterisk with a verbose
level of 3, and asterisk starts and stops for every one of the 700+
tests, the number of log messages is staggering.  Besides taking up
resources, it also makes it hard to debug failing tests.

This commit changes the log level for those verbose messages to 5
instead of 3 which reduces the number of log messages to only a
handful. Of course, NOTICE, WARNING and ERROR message are
unaffected.

There's also one other minor change...
ast_context_remove_extension_callerid2() logs a DEBUG message
instead of an ERROR if the extension you're deleting doesn't exist.
The pjsip_config_wizard calls that function to clean up the config
and has been triggering that annoying error message for years.

Resolves: #582
(cherry picked from commit a5ae546b88358f30845647d751d1bdf668652eff)

16 months agoconfigure: Rerun bootstrap on modern platform.
Naveen Albert [Mon, 12 Feb 2024 17:39:18 +0000 (12:39 -0500)] 
configure: Rerun bootstrap on modern platform.

The last time configure was run, it was run on a system that
did not enable -std=gnu11 by default, which meant that the
restrict qualifier would not be recognized on certain platforms.
This regenerates the configure files from running bootstrap.sh,
so that these should be recognized on all supported platforms.

Resolves: #586
(cherry picked from commit d0d09ef0103a76d8f66e5013a9e41c05c33c599d)

16 months agoUpgrade bundled pjproject to 2.14.
Ben Ford [Mon, 5 Feb 2024 20:15:12 +0000 (14:15 -0600)] 
Upgrade bundled pjproject to 2.14.

Fixes: #406
UserNote: Bundled pjproject has been upgraded to 2.14. For more
information on what all is included in this change, check out the
pjproject Github page: https://github.com/pjsip/pjproject/releases

(cherry picked from commit 6efa51f512823ea4ca8a945ba34cd46143f99250)

16 months agores_pjsip_outbound_registration.c: Add User-Agent header override
Flole998 [Wed, 13 Dec 2023 14:28:15 +0000 (14:28 +0000)] 
res_pjsip_outbound_registration.c: Add User-Agent header override

This introduces a setting for outbound registrations to override the
global User-Agent header setting.

Resolves: #515

UserNote: PJSIP outbound registrations now support a per-registration
User-Agent header

(cherry picked from commit c7fc6ae3628379c86aab442435a59131d25d4f24)

16 months agoapp_speech_utils.c: Allow partial speech results.
cmaj [Fri, 2 Feb 2024 17:27:31 +0000 (10:27 -0700)] 
app_speech_utils.c: Allow partial speech results.

Adds 'p' option to SpeechBackground() application.
With this option, when the app timeout is reached,
whatever the backend speech engine collected will
be returned as if it were the final, full result.
(This works for engines that make partial results.)

Resolves: #572

UserNote: The SpeechBackground dialplan application now supports a 'p'
option that will return partial results from speech engines that
provide them when a timeout occurs.

(cherry picked from commit c863e0d77d525ab98ff2c88f374850b3464f0137)

16 months agoutils: Make behavior of ast_strsep* match strsep.
Joshua C. Colp [Wed, 31 Jan 2024 14:03:28 +0000 (10:03 -0400)] 
utils: Make behavior of ast_strsep* match strsep.

Given the scenario of passing an empty string to the
ast_strsep functions the functions would return NULL
instead of an empty string. This is counter to how
strsep itself works.

This change alters the behavior of the functions to
match that of strsep.

Fixes: #565
(cherry picked from commit 8ce69eda14c6564240a7f81640c1abad1cb76778)

16 months agoapp_chanspy: Add 'D' option for dual-channel audio
Mike Bradeen [Wed, 31 Jan 2024 15:55:04 +0000 (08:55 -0700)] 
app_chanspy: Add 'D' option for dual-channel audio

Adds the 'D' option to app chanspy that causes the input and output
frames of the spied channel to be interleaved in the spy output frame.
This allows the input and output of the spied channel to be decoded
separately by the receiver.

If the 'o' option is also set, the 'D' option is ignored as the
audio being spied is inherently one direction.

Fixes: #569
UserNote: The ChanSpy application now accepts the 'D' option which
will interleave the spied audio within the outgoing frames. The
purpose of this is to allow the audio to be read as a Dual channel
stream with separate incoming and outgoing audio. Setting both the
'o' option and the 'D' option and results in the 'D' option being
ignored.

(cherry picked from commit 69fe81481369ba4db6919e77656f287d0011640c)

16 months ago.github: Update github-script to v7 and fix a rest bug
George Joseph [Mon, 5 Feb 2024 15:31:47 +0000 (08:31 -0700)] 
.github: Update github-script to v7 and fix a rest bug

Need to update the github-script to v7 to squash deprecation
warnings.

Also fixed the API name for github.rest.pulls.requestReviewers.

(cherry picked from commit 9baf49497e860b89dae6117c684bc8297072891c)

16 months agoapp_if: Fix next priority calculation.
Naveen Albert [Sun, 28 Jan 2024 13:57:47 +0000 (08:57 -0500)] 
app_if: Fix next priority calculation.

Commit fa3922a4d28860d415614347d9f06c233d2beb07 fixed
a branching issue but "overshoots" when calculating
the next priority. This fixes that; accompanying
test suite tests have also been extended.

Resolves: #560
(cherry picked from commit ed39406838ddfff2812d8d53206e7c3beb62fe35)

16 months agores_pjsip_t38.c: Permit IPv6 SDP connection addresses.
Sean Bright [Mon, 29 Jan 2024 13:51:34 +0000 (08:51 -0500)] 
res_pjsip_t38.c: Permit IPv6 SDP connection addresses.

The existing code prevented IPv6 addresses from being properly parsed.

Fixes #558

(cherry picked from commit 841cd1480c92eaacde30902cf6e2a76cd015034e)

16 months agoBuildSystem: Bump autotools versions on OpenBSD.
Brad Smith [Sat, 27 Jan 2024 08:01:56 +0000 (03:01 -0500)] 
BuildSystem: Bump autotools versions on OpenBSD.

Bump up to the more commonly used and modern versions of
autoconf and automake.

(cherry picked from commit 9deb4c679e23c431a0b31a1a67c5549a9878dffe)

16 months agomain/utils: Simplify the FreeBSD ast_get_tid() handling
Brad Smith [Sat, 27 Jan 2024 07:43:50 +0000 (02:43 -0500)] 
main/utils: Simplify the FreeBSD ast_get_tid() handling

FreeBSD has had kernel threads for 20+ years.

(cherry picked from commit ec2c10689f8c3df1491db295fc7d9fdcf2f62b7d)

16 months agores_pjsip_session.c: Correctly format SDP connection addresses.
Sean Bright [Sat, 27 Jan 2024 14:46:27 +0000 (09:46 -0500)] 
res_pjsip_session.c: Correctly format SDP connection addresses.

Resolves a regression identified by @justinludwig involving the
rendering of IPv6 addresses in outgoing SDP.

Also updates `media_address` on PJSIP endpoints so that if we are able
to parse the configured value as an IP we store it in a format that we
can directly use later. Based on my reading of the code it appeared
that one could configure `media_address` as:

```
[foo]
type = endpoint
...
media_address = [2001:db8::]
```

And that value would be blindly copied into the outgoing SDP without
regard to its format.

Fixes #541

(cherry picked from commit 9f20b4659fc897b8495c7a4c51dfe4365ab937bd)

16 months agortp_engine.c: Correct sample rate typo for L16/44100.
Sean Bright [Sun, 28 Jan 2024 16:34:25 +0000 (11:34 -0500)] 
rtp_engine.c: Correct sample rate typo for L16/44100.

Fixes #555

(cherry picked from commit 671b47cfda18cf63e776c74fac2e02f00aec58fd)

16 months agomanager.c: Fix erroneous reloads in UpdateConfig.
Naveen Albert [Thu, 25 Jan 2024 17:44:29 +0000 (12:44 -0500)] 
manager.c: Fix erroneous reloads in UpdateConfig.

Currently, a reload will always occur if the
Reload header is provided for the UpdateConfig
action. However, we should not be doing a reload
if the header value has a falsy value, per the
documentation, so this makes the reload behavior
consistent with the existing documentation.

Resolves: #551
(cherry picked from commit 874ee6e9aaadc9a0b5a5915d952c9f61e0967dbf)

16 months agores_calendar_icalendar: Print iCalendar error on parsing failure.
Naveen Albert [Thu, 14 Dec 2023 14:43:14 +0000 (09:43 -0500)] 
res_calendar_icalendar: Print iCalendar error on parsing failure.

If libical fails to parse a calendar, print the error message it provdes.

Resolves: #492
(cherry picked from commit ef891529facf373db73ff9820210235eb29f9bb9)

16 months agoapp_confbridge: Don't emit warnings on valid configurations.
Sean Bright [Sun, 21 Jan 2024 16:40:19 +0000 (11:40 -0500)] 
app_confbridge: Don't emit warnings on valid configurations.

The numeric bridge profile options `internal_sample_rate` and
`maximum_sample_rate` are documented to accept the special values
`auto` and `none`, respectively. While these values currently work,
they also emit warnings when used which could be confusing for users.

In passing, also ensure that we only accept the documented range of
sample rate values between 8000 and 192000.

Fixes #546

(cherry picked from commit 03ad690276ece1fa45dfd4eb49a2546edb8e1e1d)

16 months agoapp_voicemail_odbc: remove macrocontext from voicemail_messages table
Mike Bradeen [Wed, 10 Jan 2024 16:47:24 +0000 (09:47 -0700)] 
app_voicemail_odbc: remove macrocontext from voicemail_messages table

When app_macro was deprecated, the macrocontext column was removed from
the INSERT statement but the binds were not renumbered. This broke the
insert.

This change removes the macrocontext column via alembic and re-numbers
the existing columns in the INSERT.

Fixes: #527
UserNote: The fix requires removing the macrocontext column from the
voicemail_messages table in the voicemail database via alembic upgrade.

UpgradeNote: The fix requires that the voicemail database be upgraded via
alembic. Upgrading to the latest voicemail database via alembic will
remove the macrocontext column from the voicemail_messages table.

(cherry picked from commit a22db8fd60c8b25e2c53279014f91dcd0e29567d)

16 months agochan_dahdi: Allow MWI to be manually toggled on channels.
Naveen Albert [Fri, 10 Nov 2023 14:44:25 +0000 (09:44 -0500)] 
chan_dahdi: Allow MWI to be manually toggled on channels.

This adds a CLI command to manually toggle the MWI status
of a channel, useful for troubleshooting or resetting
MWI devices, similar to the capabilities offered with
SIP messaging to manually control MWI status.

UserNote: The 'dahdi set mwi' now allows MWI on channels
to be manually toggled if needed for troubleshooting.

Resolves: #440
(cherry picked from commit 4b908f364d897b3fbdb52b84f84e06b9575b6e56)

16 months agochan_rtp.c: MulticastRTP missing refcount without codec option
PeterHolik [Mon, 15 Jan 2024 11:28:15 +0000 (12:28 +0100)] 
chan_rtp.c: MulticastRTP missing refcount without codec option

Fixes: #529
(cherry picked from commit 3b46872a8f689898afe3f143b9316a8992dbb16a)

16 months agochan_rtp.c: Change MulticastRTP nameing to avoid memory leak
PeterHolik [Tue, 16 Jan 2024 07:42:05 +0000 (08:42 +0100)] 
chan_rtp.c: Change MulticastRTP nameing to avoid memory leak

Fixes: asterisk#536
(cherry picked from commit 6fe045fd646cc2283b19114756fe31b545cdc0b6)

16 months agofunc_frame_trace: Add CLI command to dump frame queue.
Naveen Albert [Fri, 12 Jan 2024 16:33:00 +0000 (11:33 -0500)] 
func_frame_trace: Add CLI command to dump frame queue.

This adds a simple CLI command that can be used for
analyzing all frames currently queued to a channel.

A couple log messages are also adjusted to be more
useful in tracing bridging problems.

Resolves: #533
(cherry picked from commit 67088b256d9584d3c3ebe66686ac16a7a5aebcdc)

18 months agoUpdate for 21.1.0 21.1.0
Asterisk Development Team [Thu, 25 Jan 2024 16:23:00 +0000 (16:23 +0000)] 
Update for 21.1.0

18 months agoUpdate for 21.1.0-rc2 21.1.0-rc2
Asterisk Development Team [Thu, 18 Jan 2024 16:48:17 +0000 (16:48 +0000)] 
Update for 21.1.0-rc2

18 months agologger: Fix linking regression.
Naveen Albert [Tue, 16 Jan 2024 21:58:22 +0000 (16:58 -0500)] 
logger: Fix linking regression.

Commit 008731b0a4b96c4e6c340fff738cc12364985b64
caused a regression by resulting in logger.xml
being compiled and linked into the asterisk
binary in lieu of logger.c on certain platforms
if Asterisk was compiled in dev mode.

To fix this, we ensure the file has a unique
name without the extension. Most existing .xml
files have been named differently from any
.c files in the same directory or did not
pose this issue.

channels/pjsip/dialplan_functions.xml does not
pose this issue but is also being renamed
to adhere to this policy.

Resolves: #539

18 months agoUpdate for 21.1.0-rc1 21.1.0-rc1
Asterisk Development Team [Fri, 12 Jan 2024 18:32:27 +0000 (18:32 +0000)] 
Update for 21.1.0-rc1

18 months agoRevert "core & res_pjsip: Improve topology change handling."
George Joseph [Fri, 12 Jan 2024 12:47:58 +0000 (05:47 -0700)] 
Revert "core & res_pjsip: Improve topology change handling."

This reverts commit 315eb551dbd18ecd424a2f32179d4c1f6f6edd26.

Over the past year, we've had several reports of "topology storms"
occurring where 2 external facing channels connected by one or more
local channels and bridges will get themselves in a state where
they continually send each other topology change requests.  This
usually manifests itself in no-audio calls and a flood of
"Exceptionally long queue length" messages.  It appears that this
commit is the cause so we're reverting it for now until we can
determine a more appropriate solution.

Resolves: #530
(cherry picked from commit c31cd32b8296c675f66be7a4d39e89b45c3aec2c)

18 months agomenuselect: Use more specific error message.
Naveen Albert [Thu, 4 Jan 2024 18:05:32 +0000 (18:05 +0000)] 
menuselect: Use more specific error message.

Instead of using the same error message for
missing dependencies and conflicts, be specific
about what actually went wrong.

Resolves: #520
(cherry picked from commit 7683259f378a34f1b483f05537a5d093d98ca4d8)

18 months agores_pjsip_nat: Fix potential use of uninitialized transport details
Maximilian Fridrich [Mon, 8 Jan 2024 06:03:10 +0000 (07:03 +0100)] 
res_pjsip_nat: Fix potential use of uninitialized transport details

The ast_sip_request_transport_details must be zero initialized,
otherwise this could lead to a SEGV.

Resolves: #509
(cherry picked from commit 81188ada5fb3299dad3ea8107c31bcde3e39686a)

18 months agoapp_if: Fix faulty EndIf branching.
Naveen Albert [Sat, 23 Dec 2023 16:26:13 +0000 (16:26 +0000)] 
app_if: Fix faulty EndIf branching.

This fixes faulty branching logic for the
EndIf application. Instead of computing
the next priority, which should be done
for false conditionals or ExitIf, we should
simply advance to the next priority.

Resolves: #341
(cherry picked from commit 1bf4493371b8cf515e0094a6a7efe6003ff43dae)

18 months agomanager.c: Fix regression due to using wrong free function.
Naveen Albert [Tue, 26 Dec 2023 17:14:11 +0000 (17:14 +0000)] 
manager.c: Fix regression due to using wrong free function.

Commit 424be345639d75c6cb7d0bd2da5f0f407dbd0bd5 introduced
a regression by calling ast_free on memory allocated by
realpath. This causes Asterisk to abort when executing this
function. Since the memory is allocated by glibc, it should
be freed using ast_std_free.

Resolves: #513
(cherry picked from commit bb364fc61f563384645ff6b98779a7dc27032c31)

18 months agodoc: Remove obsolete CHANGES-staging and UPGRADE-staging directories
George Joseph [Fri, 15 Dec 2023 16:56:54 +0000 (09:56 -0700)] 
doc: Remove obsolete CHANGES-staging and UPGRADE-staging directories

These should have been deleted after the release of 21.0.0
but were missed.

(cherry picked from commit df958a7d631606b7301b72fe5d1a0b52b9fe3e9c)

18 months agoconfig_options.c: Fix truncation of option descriptions.
Naveen Albert [Thu, 9 Nov 2023 15:58:41 +0000 (10:58 -0500)] 
config_options.c: Fix truncation of option descriptions.

This increases the format width of option descriptions
to avoid needless truncation for longer descriptions.

Resolves: #428
(cherry picked from commit d20c3e2f6fbf391f4f769209c43e446ae9603fb4)

18 months agomanager.c: Improve clarity of "manager show connected".
Naveen Albert [Tue, 5 Dec 2023 16:36:47 +0000 (11:36 -0500)] 
manager.c: Improve clarity of "manager show connected".

Improve the "manager show connected" CLI command
to clarify that the last two columns are permissions
related, not counts, and use sufficient widths
to consistently display these values.

ASTERISK-30143 #close
Resolves: #482

(cherry picked from commit 09bd80c627cb636f80607c47f0b6a2bc627ad11c)

18 months agomake_xml_documentation: Really collect LOCAL_MOD_SUBDIRS documentation.
Sean Bright [Fri, 1 Dec 2023 20:30:17 +0000 (15:30 -0500)] 
make_xml_documentation: Really collect LOCAL_MOD_SUBDIRS documentation.

Although `make_xml_documentation`'s `print_dependencies` command was
corrected by the previous fix (#461) for #142, the `create_xml` was
not properly handling `LOCAL_MOD_SUBDIRS` XML documentation.

(cherry picked from commit e001a1b6d3e114d4b605e749dee867cdce6ff88b)

18 months agogeneral: Fix broken links.
Naveen Albert [Thu, 9 Nov 2023 21:26:46 +0000 (16:26 -0500)] 
general: Fix broken links.

This fixes a number of broken links throughout the
tree, mostly caused by wiki.asterisk.org being replaced
with docs.asterisk.org, which should eliminate the
need for sporadic fixes as in f28047db36a70e81fe373a3d19132c43adf3f74b.

Resolves: #430
(cherry picked from commit 3bb34477d4320aba312ab807d2c5efd294f1c417)

18 months agoMergeApproved.yml: Remove unneeded concurrency
George Joseph [Wed, 6 Dec 2023 21:27:01 +0000 (14:27 -0700)] 
MergeApproved.yml:  Remove unneeded concurrency

The concurrency parameter on the MergeAndCherryPick job has
been rmeoved.  It was a hold-over from earlier days.

(cherry picked from commit 751f8649fd3754174ca4a23f399489db811b366f)

18 months agoapp_dial: Add option "j" to preserve initial stream topology of caller
Maximilian Fridrich [Thu, 30 Nov 2023 08:57:56 +0000 (09:57 +0100)] 
app_dial: Add option "j" to preserve initial stream topology of caller

Resolves: #462

UserNote: The option "j" is now available for the Dial application which
uses the initial stream topology of the caller to create the outgoing
channels.

(cherry picked from commit 366dc1e99fe91068c6a9658b4bb8320e10de2878)

18 months agopbx_config.c: Don't crash when unloading module.
Sean Bright [Sat, 2 Dec 2023 16:13:31 +0000 (11:13 -0500)] 
pbx_config.c: Don't crash when unloading module.

`pbx_config` subscribes to manager events to capture the `FullyBooted`
event but fails to unsubscribe if the module is loaded after that
event fires. If the module is unloaded, a crash occurs the next time a
manager event is raised.

We now unsubscribe when the module is unloaded if we haven't already
unsubscribed.

Fixes #470

(cherry picked from commit 16a42b2aec1327ca6295f6e516b478848d97373c)

18 months agoast_coredumper: Increase reliability
George Joseph [Sun, 12 Nov 2023 00:40:10 +0000 (17:40 -0700)] 
ast_coredumper: Increase reliability

Instead of searching for the asterisk binary and the modules in the
filesystem, we now get their locations, along with libdir, from
the coredump itself...

For the binary, we can use `gdb -c <coredump> ... "info proc exe"`.
gdb can print this even without having the executable and symbols.

Once we have the binary, we can get the location of the modules with
`gdb ... "print ast_config_AST_MODULE_DIR`

If there was no result then either it's not an asterisk coredump
or there were no symbols loaded.  Either way, it's not usable.

For libdir, we now run "strings" on the note0 section of the
coredump (which has the shared library -> memory address xref) and
search for "libasteriskssl|libasteriskpj", then take the dirname.

Since we're now getting everything from the coredump, it has to be
correct as long as we're not crossing namespace boundaries like
running asterisk in a docker container but trying to run
ast_coredumper from the host using a shared file system (which you
shouldn't be doing).

There is still a case for using --asterisk-bin and/or --libdir: If
you've updated asterisk since the coredump was taken, the binary,
libraries and modules won't match the coredump which will render it
useless.  If you can restore or rebuild the original files that
match the coredump and place them in a temporary directory, you can
use --asterisk-bin, --libdir, and a new --moddir option to point to
them and they'll be correctly captured in a tarball created
with --tarball-coredumps.  If you also use --tarball-config, you can
use a new --etcdir option to point to what normally would be the
/etc/asterisk directory.

Also addressed many "shellcheck" findings.

Resolves: #445
(cherry picked from commit aec24536889cefb64292a138a144b070ba083565)

18 months agologger.c: Move LOG_GROUP documentation to dedicated XML file.
Sean Bright [Fri, 1 Dec 2023 17:03:29 +0000 (12:03 -0500)] 
logger.c: Move LOG_GROUP documentation to dedicated XML file.

The `get_documentation` awk script will only extract the first
DOCUMENTATION block that it finds in a given file. This is by design
(9bc2127) to prevent AMI event documentation from being pulled in to
the core.xml documentation file.

Because of this, the `LOG_GROUP` documentation added in 89709e2 was
not being properly extracted and was missing fom the resulting XML
documentation file. This commit moves the `LOG_GROUP` documentation to
a separate `logger.xml` file.

(cherry picked from commit 1d05e34d98f3958aae64bd125ed1039f95f65125)

18 months agores_odbc.c: Allow concurrent access to request odbc connections
Matthew Fredrickson [Thu, 30 Nov 2023 17:57:53 +0000 (11:57 -0600)] 
res_odbc.c: Allow concurrent access to request odbc connections

There are valid scenarios where res_odbc's connection pool might have some dead
or stuck connections while others are healthy (imagine network
elements/firewalls/routers silently timing out connections to a single DB and a
single IP address, or a heterogeneous connection pool connected to potentially
multiple IPs/instances of a replicated DB using a DNS front end for load
balancing and one replica fails).

In order to time out those unhealthy connections without blocking access to
other parts of Asterisk that may attempt access to the connection pool, it would
be beneficial to not lock/block access around the entire pool in
_ast_odbc_request_obj2 while doing potentially blocking operations on connection
pool objects such as the connection_dead() test, odbc_obj_connect(), or by
dereferencing a struct odbc_obj for the last time and triggering a
odbc_obj_disconnect().

This would facilitate much quicker and concurrent timeout of dead connections
via the connection_dead() test, which could block potentially for a long period
of time depending on odbc.ini or other odbc connector specific timeout settings.

This also would make rapid failover (in the clustered DB scenario) much quicker.

This patch changes the locking in _ast_odbc_request_obj2() to not lock around
odbc_obj_connect(), _disconnect(), and connection_dead(), while continuing to
lock around truly shared, non-immutable state like the connection_cnt member and
the connections list on struct odbc_class.

Fixes: #465
(cherry picked from commit e0bf65bde665efca670c8055499fc8fcf894a450)

18 months agores_pjsip_header_funcs.c: Check URI parameter length before copying.
Sean Bright [Mon, 4 Dec 2023 14:33:26 +0000 (09:33 -0500)] 
res_pjsip_header_funcs.c: Check URI parameter length before copying.

Fixes #477

(cherry picked from commit 002d6c2108184aacfcc3626de93ce85bfe83c051)