Commit Graph

33799 Commits

Author SHA1 Message Date
Brad Smith 14120485f1 BuildSystem: Bump autotools versions on OpenBSD.
Bump up to the more commonly used and modern versions of
autoconf and automake.

(cherry picked from commit d43d15b052)
2024-03-07 14:16:38 +00:00
Brad Smith e8c32a6d6b main/utils: Simplify the FreeBSD ast_get_tid() handling
FreeBSD has had kernel threads for 20+ years.

(cherry picked from commit 75dc596843)
2024-03-07 14:16:38 +00:00
Sean Bright c9c2c575b8 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 72523f19a9)
2024-03-07 14:16:38 +00:00
Sean Bright 9954a3160e rtp_engine.c: Correct sample rate typo for L16/44100.
Fixes #555

(cherry picked from commit 0defd65e63)
2024-03-07 14:16:38 +00:00
Naveen Albert edf7b07040 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 57bb985b26)
2024-03-07 14:16:38 +00:00
Naveen Albert 454407ef5a 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 d1da985143)
2024-03-07 14:16:38 +00:00
Sean Bright 295ef9d052 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 9dd9615edf)
2024-03-07 14:16:38 +00:00
Mike Bradeen cf91d9f53d app_voicemail: add NoOp alembic script to maintain sync
Adding a NoOp alembic script for the voicemail database to maintain
version sync with other branches.

Fixes: #527
(cherry picked from commit d6c10075f8)
2024-03-07 14:16:38 +00:00
Naveen Albert a7dd513b5d 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 49ec57fc7c)
2024-03-07 14:16:38 +00:00
PeterHolik ea0cd51885 chan_rtp.c: MulticastRTP missing refcount without codec option
Fixes: #529
(cherry picked from commit 683da188c9)
2024-03-07 14:16:38 +00:00
PeterHolik ae747ba0ee chan_rtp.c: Change MulticastRTP nameing to avoid memory leak
Fixes: asterisk#536
(cherry picked from commit 9044dcc80a)
2024-03-07 14:16:38 +00:00
Naveen Albert c320c9959c 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 6b82ed819c)
2024-03-07 14:16:38 +00:00
Asterisk Development Team f2289e470b Update for 18.21.0 2024-01-25 16:17:00 +00:00
Asterisk Development Team edba366246 Update for 18.21.0-rc2 2024-01-18 16:41:20 +00:00
Naveen Albert b9373a206c logger: Fix linking regression.
Commit 008731b0a4
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
2024-01-17 14:54:33 -07:00
Asterisk Development Team 14ba935ee1 Update for 18.21.0-rc1 2024-01-12 18:21:52 +00:00
George Joseph 67f98056da Revert "core & res_pjsip: Improve topology change handling."
This reverts commit 315eb551db.

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 b71e338eea)
2024-01-12 18:21:33 +00:00
Naveen Albert efc79dba0c 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 494fb0b675)
2024-01-12 18:21:33 +00:00
Maximilian Fridrich 3b26874eaa 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 85dd7cea8a)
2024-01-12 18:21:33 +00:00
Naveen Albert 4f4d997aa1 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 f4edb3b87e)
2024-01-12 18:21:33 +00:00
Naveen Albert 7528192c62 manager.c: Fix regression due to using wrong free function.
Commit 424be34563 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 d6245bcfa3)
2024-01-12 18:21:33 +00:00
Naveen Albert 0b8535d143 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 98186cba63)
2024-01-12 18:21:33 +00:00
Naveen Albert 1c02e51f46 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 ba742bd9de)
2024-01-12 18:21:33 +00:00
Sean Bright 4480cf39b5 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 7909aba37f)
2024-01-12 18:21:33 +00:00
Naveen Albert 7af4934943 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 f28047db36.

Resolves: #430
(cherry picked from commit 8cc5fc2e39)
2024-01-12 18:21:33 +00:00
George Joseph 8c378f78d4 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 74904a0b3a)
2024-01-12 18:21:33 +00:00
Maximilian Fridrich 94de48c80c 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 8d7665db7b)
2024-01-12 18:21:33 +00:00
George Joseph 8dcac793e6 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 26c98bc68b)
2024-01-12 18:21:33 +00:00
Sean Bright b777ae258a 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 2f405d232a)
2024-01-12 18:21:33 +00:00
Matthew Fredrickson 4d54627fe8 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 058ead0ea5)
2024-01-12 18:21:33 +00:00
Sean Bright 17324c6cf9 res_pjsip_header_funcs.c: Check URI parameter length before copying.
Fixes #477

(cherry picked from commit 0ed2e8200a)
2024-01-12 18:21:33 +00:00
Sean Bright ceeb4fba17 config.c: Log #exec include failures.
If the script referenced by `#exec` does not exist, writes anything to
stderr, or exits abnormally or with a non-zero exit status, we log
that to Asterisk's error logging channel.

Additionally, write out a warning if the script produces no output.

Fixes #259

(cherry picked from commit 461c3c60e2)
2024-01-12 18:21:33 +00:00
Sean Bright 4070a5f038 make_xml_documentation: Properly handle absolute LOCAL_MOD_SUBDIRS.
If LOCAL_MOD_SUBDIRS contains absolute paths, do not prefix them with
the path to Asterisk's source tree.

Fixes #142

(cherry picked from commit e196ccb7c2)
2024-01-12 18:21:33 +00:00
Sean Bright 5288c25dc1 app_voicemail.c: Completely resequence mailbox folders.
Resequencing is a process that occurs when we open a voicemail folder
and discover that there are gaps between messages (e.g. `msg0000.txt`
is missing but `msg0001.txt` exists). Resequencing involves shifting
the existing messages down so we end up with a sequential list of
messages.

Currently, this process stops after reaching a threshold based on the
message limit (`maxmsg`) configured on the current folder. However, if
`maxmsg` is lowered when a voicemail folder contains more than
`maxmsg + 10` messages, resequencing will not run completely leaving
the mailbox in an inconsistent state.

We now resequence up to the maximum number of messages permitted by
`app_voicemail` (currently hard-coded at 9999 messages).

Fixes #86

(cherry picked from commit 242a0685b1)
2024-01-12 18:21:33 +00:00
Naveen Albert 212befbcf1 sig_analog: Fix channel leak when mwimonitor is enabled.
When mwimonitor=yes is enabled for an FXO port,
the do_monitor thread will launch mwi_thread if it thinks
there could be MWI on an FXO channel, due to the noise
threshold being satisfied. This, in turns, calls
analog_ss_thread_start in sig_analog. However, unlike
all other instances where __analog_ss_thread is called
in sig_analog, this call path does not properly set
pvt->ss_astchan to the Asterisk channel, which means
that the Asterisk channel is NULL when __analog_ss_thread
starts executing. As a result, the thread exits and the
channel is never properly cleaned up by calling ast_hangup.

This caused issues with do_monitor on incoming calls,
as it would think the channel was still owned even while
receiving events, leading to an infinite barrage of
warning messages; additionally, the channel would persist
improperly.

To fix this, the assignment is added to the call path
where it is missing (which is only used for mwi_thread).
A warning message is also added since previously there
was no indication that __analog_ss_thread was exiting
abnormally. This resolves both the channel leak and the
condition that led to the warning messages.

Resolves: #458
(cherry picked from commit 069d480138)
2024-01-12 18:21:33 +00:00
Sean Bright 97f422e4f6 res_rtp_asterisk.c: Update for OpenSSL 3+.
In 5ac5c2b0 we defined `OPENSSL_SUPPRESS_DEPRECATED` to silence
deprecation warnings. This commit switches over to using
non-deprecated API.

(cherry picked from commit 410b734533)
2024-01-12 18:21:33 +00:00
Sean Bright a2d50679dd alembic: Update list of TLS methods available on ps_transports.
Related to #221 and #222.

Also adds `*.ini` to the `.gitignore` file in ast-db-manage for
convenience.

(cherry picked from commit b16d4a3420)
2024-01-12 18:21:33 +00:00
Naveen Albert 2be4ffa5e9 func_channel: Expose previously unsettable options.
Certain channel options are not set anywhere or
exposed in any way to users, making them unusable.
This exposes some of these options which make sense
for users to manipulate at runtime.

Resolves: #442
(cherry picked from commit 147f014072)
2024-01-12 18:21:33 +00:00
Sean Bright a8015816b1 app.c: Allow ampersands in playback lists to be escaped.
Any function or application that accepts a `&`-separated list of
filenames can now include a literal `&` in a filename by wrapping the
entire filename in single quotes, e.g.:

```
exten = _X.,n,Playback('https://example.com/sound.cgi?a=b&c=d'&hello-world)
```

Fixes #172

UpgradeNote: Ampersands in URLs passed to the `Playback()`,
`Background()`, `SpeechBackground()`, `Read()`, `Authenticate()`, or
`Queue()` applications as filename arguments can now be escaped by
single quoting the filename. Additionally, this is also possible when
using the `CONFBRIDGE` dialplan function, or configuring various
features in `confbridge.conf` and `queues.conf`.

(cherry picked from commit 6b4d7f2125)
2024-01-12 18:21:33 +00:00
Sean Bright 3344b19dac uri.c: Simplify ast_uri_make_host_with_port()
(cherry picked from commit c25271f2ae)
2024-01-12 18:21:33 +00:00
Sean Bright 56710cd1b1 func_curl.c: Remove CURLOPT() plaintext documentation.
I assume this was missed when initially converting to XML
documentation and we've been kicking the can down the road since.

(cherry picked from commit b91f97577d)
2024-01-12 18:21:33 +00:00
Sean Bright fbecf18b05 res_http_websocket.c: Set hostname on client for certificate validation.
Additionally add a `assert()` to in the TLS client setup code to
ensure that hostname is set when it is supposed to be.

Fixes #433

(cherry picked from commit 992ea86981)
2024-01-12 18:21:32 +00:00
Sean Bright 00498f4f67 live_ast: Add astcachedir to generated asterisk.conf.
`astcachedir` (added in b0842713) was not added to `live_ast` so
continued to point to the system `/var/cache` directory instead of the
one in the live environment.

(cherry picked from commit 04fd8704e1)
2024-01-12 18:21:32 +00:00
George Joseph 2359af9ea3 SECURITY.md: Update with correct documentation URL
(cherry picked from commit 08cadf999e)
2024-01-12 18:21:32 +00:00
Naveen Albert 28028a372f func_lock: Add missing see-also refs to documentation.
Resolves: #423
(cherry picked from commit 44b0590e59)
2024-01-12 18:21:32 +00:00
Matthew Fredrickson d8434ca398 app_followme.c: Grab reference on nativeformats before using it
Fixes a crash due to a lack of proper reference on the nativeformats
object before passing it into ast_request().  Also found potentially
similar use case bugs in app_chanisavail.c, bridge.c, and bridge_basic.c

Fixes: #388
(cherry picked from commit eeae61b2f8)
2024-01-12 18:21:32 +00:00
Naveen Albert 1701775d07 configs: Improve documentation for bandwidth in iax.conf.
This improves the documentation for the bandwidth setting
in iax.conf by making it clearer what the ramifications
of this setting are. It also changes the sample default
from low to high, since only high is compatible with good
codecs that people will want to use in the vast majority
of cases, and this is a common gotcha that trips up new users.

Resolves: #425
(cherry picked from commit 1f66a9fc28)
2024-01-12 18:21:32 +00:00
Naveen Albert aa43343687 logger: Add channel-based filtering.
This adds the ability to filter console
logging by channel or groups of channels.
This can be useful on busy systems where
an administrator would like to analyze certain
calls in detail. A dialplan function is also
included for the purpose of assigning a channel
to a group (e.g. by tenant, or some other metric).

ASTERISK-30483 #close

Resolves: #242

UserNote: The console log can now be filtered by
channels or groups of channels, using the
logger filter CLI commands.

(cherry picked from commit 318710cf6e)
2024-01-12 18:21:32 +00:00
Sean Bright 152f5bdd2e chan_iax2.c: Don't send unsanitized data to the logger.
This resolves an issue where non-printable characters could be sent to
the console/log files.

(cherry picked from commit 7b297cb90d)
2024-01-12 18:21:32 +00:00
George Joseph acf0b399cb codec_ilbc: Disable system ilbc if version >= 3.0.0
Fedora 37 started shipping ilbc 3.0.4 which we don't yet support.
configure.ac now checks the system for "libilbc < 3" instead of
just "libilbc".  If true, the system version of ilbc will be used.
If not, the version included at codecs/ilbc will be used.

Resolves: #84
(cherry picked from commit bee37b7404)
2024-01-12 18:21:32 +00:00