Commit Graph

33842 Commits

Author SHA1 Message Date
Maximilian Fridrich b2eb25a88c 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 3e069f3274)
2024-01-12 18:29:20 +00:00
Naveen Albert d7948f5425 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 83a0cb51e5)
2024-01-12 18:29:20 +00:00
Naveen Albert c6b82b19a4 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 b9ed57092f)
2024-01-12 18:29:20 +00:00
Naveen Albert 8a73bac226 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 fcf36a8766)
2024-01-12 18:29:20 +00:00
Naveen Albert 776c2ca6d7 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 bc53a2a087)
2024-01-12 18:29:20 +00:00
Sean Bright cfe826791e 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 91c733bc69)
2024-01-12 18:29:19 +00:00
Naveen Albert 91127a618f 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 8f5581b0d0)
2024-01-12 18:29:19 +00:00
George Joseph 98a44b95df 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 0005aa2995)
2024-01-12 18:29:19 +00:00
Maximilian Fridrich 8f9200d106 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 dcf58ee88f)
2024-01-12 18:29:19 +00:00
George Joseph 9ae72b0a23 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 44f1522907)
2024-01-12 18:29:19 +00:00
Sean Bright 2c6385a1b3 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 0b6e3bc59b)
2024-01-12 18:29:19 +00:00
Matthew Fredrickson 37a89d3cee 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 bfac3945f6)
2024-01-12 18:29:19 +00:00
Sean Bright 5988da4ec5 res_pjsip_header_funcs.c: Check URI parameter length before copying.
Fixes #477

(cherry picked from commit a2f0d99d9d)
2024-01-12 18:29:19 +00:00
Sean Bright 2f7416711e 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 4327ec2907)
2024-01-12 18:29:19 +00:00
Sean Bright 3ed329edc9 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 2293edffd0)
2024-01-12 18:29:19 +00:00
Sean Bright 06d86c41af 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 6556a92393)
2024-01-12 18:29:19 +00:00
Naveen Albert 7279d7547f 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 22e34193ee)
2024-01-12 18:29:19 +00:00
Sean Bright d52c427533 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 3859b630a7)
2024-01-12 18:29:19 +00:00
Sean Bright b7e66d49b2 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 0dcf03e844)
2024-01-12 18:29:19 +00:00
Naveen Albert a6d856aba2 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 c222343ec6)
2024-01-12 18:29:19 +00:00
Sean Bright f19b74ad31 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 f8212d4594)
2024-01-12 18:29:19 +00:00
Sean Bright 989e61890a uri.c: Simplify ast_uri_make_host_with_port()
(cherry picked from commit ff012323e8)
2024-01-12 18:29:19 +00:00
Sean Bright 69a19aabd8 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 9e1a60727e)
2024-01-12 18:29:19 +00:00
Sean Bright fe92d09361 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 f2961f048d)
2024-01-12 18:29:19 +00:00
Sean Bright eb48273bdf 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 978d09fc35)
2024-01-12 18:29:19 +00:00
George Joseph 3127baec78 SECURITY.md: Update with correct documentation URL
(cherry picked from commit d10d4d9ddd)
2024-01-12 18:29:19 +00:00
Naveen Albert 4d928ee975 func_lock: Add missing see-also refs to documentation.
Resolves: #423
(cherry picked from commit 12b353eae0)
2024-01-12 18:29:19 +00:00
Matthew Fredrickson eac9ad69a8 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 275f7911b5)
2024-01-12 18:29:19 +00:00
Naveen Albert 52388f11f8 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 1f19227eab)
2024-01-12 18:29:19 +00:00
Naveen Albert 0007625ad0 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 a0fc8d1b5f)
2024-01-12 18:29:19 +00:00
Sean Bright c2680f63c5 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 d2afb10eed)
2024-01-12 18:29:19 +00:00
George Joseph 1d87c27cab 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 d819a6bccb)
2024-01-12 18:29:19 +00:00
Sean Bright da35b6a244 resource_channels.c: Explicit codec request when creating UnicastRTP.
Fixes #394

(cherry picked from commit a83c761c95)
2024-01-12 18:29:19 +00:00
Sean Bright fb7d39db6d doc: Update IP Quality of Service links.
Fixes #328

(cherry picked from commit 26918d05f4)
2024-01-12 18:29:19 +00:00
George Joseph 94f931a6d7 chan_pjsip: Add PJSIPHangup dialplan app and manager action
See UserNote below.

Exposed the existing Hangup AMI action in manager.c so we can use
all of it's channel search and AMI protocol handling without
duplicating that code in dialplan_functions.c.

Added a lookup function to res_pjsip.c that takes in the
string represenation of the pjsip_status_code enum and returns
the actual status code.  I.E.  ast_sip_str2rc("DECLINE") returns
603.  This allows the caller to specify PJSIPHangup(decline) in
the dialplan, just like Hangup(call_rejected).

Also extracted the XML documentation to its own file since it was
almost as large as the code itself.

UserNote: A new dialplan app PJSIPHangup and AMI action allows you
to hang up an unanswered incoming PJSIP call with a specific SIP
response code in the 400 -> 699 range.

(cherry picked from commit cd77953172)
2024-01-12 18:29:19 +00:00
Sean Bright f96d7ef7b5 chan_iax2.c: Ensure all IEs are displayed when dumping frame contents.
When IAX2 debugging was enabled (`iax2 set debug on`), if the last IE
in a frame was one that may not have any data - such as the CALLTOKEN
IE in an NEW request - it was not getting displayed.

(cherry picked from commit 0e126b3841)
2024-01-12 18:29:19 +00:00
Naveen Albert e75aebc9bc chan_dahdi: Warn if nonexistent cadence is requested.
If attempting to ring a channel using a nonexistent cadence,
emit a warning, before falling back to the default cadence.

Resolves: #409
(cherry picked from commit 4b9a4483fc)
2024-01-12 18:29:19 +00:00
Holger Hans Peter Freyther 7699af00e1 stasis: Update the snapshot after setting the redirect
The previous commit added the caller_rdnis attribute. Make it
avialble during a possible ChanngelHangupRequest.

(cherry picked from commit 56733c73b4)
2024-01-12 18:29:19 +00:00
Holger Hans Peter Freyther 28f52d35f3 ari: Provide the caller ID RDNIS for the channels
Provide the caller ID RDNIS when available. This will allow an
application to follow the redirect.

(cherry picked from commit 157389bc59)
2024-01-12 18:29:19 +00:00
Brad Smith 089ddaaaed main/utils: Implement ast_get_tid() for OpenBSD
Implement the ast_get_tid() function for OpenBSD. OpenBSD supports
getting the TID via getthrid().

(cherry picked from commit e7943dd4d9)
2024-01-12 18:29:19 +00:00
Brad Smith fb3067dd71 res_rtp_asterisk.c: Fix runtime issue with LibreSSL
The module will fail to load. Use proper function DTLS_method() with LibreSSL.

(cherry picked from commit 65d38c8104)
2024-01-12 18:29:19 +00:00
Naveen Albert 6a4fe8bdab app_directory: Add ADSI support to Directory.
This adds optional ADSI support to the Directory
application, which allows callers with ADSI CPE
to navigate the Directory system significantly
faster than is possible using the audio prompts.
Callers can see the directory name (and optionally
extension) on their screenphone and confirm or
reject a match immediately rather than waiting
for it to be spelled out, enhancing usability.

Resolves: #356
(cherry picked from commit 5046620fa3)
2024-01-12 18:29:19 +00:00
Naveen Albert b47a403b80 core_local: Fix local channel parsing with slashes.
Currently, trying to call a Local channel with a slash
in the extension will fail due to the parsing of characters
after such a slash as being dial modifiers. Additionally,
core_local is inconsistent and incomplete with
its parsing of Local dial strings in that sometimes it
uses the first slash and at other times it uses the last.

For instance, something like DAHDI/5 or PJSIP/device
is a perfectly usable extension in the dialplan, but Local
channels in particular prevent these from being called.

This creates inconsistent behavior for users, since using
a slash in an extension is perfectly acceptable, and using
a Goto to accomplish this works fine, but if specified
through a Local channel, the parsing prevents this.

This fixes this by explicitly parsing options from the
last slash in the extension, rather than the first one,
which doesn't cause an issue for extensions with slashes.

ASTERISK-30013 #close

Resolves: #248
(cherry picked from commit 2191a0d33f)
2024-01-12 18:29:19 +00:00
Mark Murawski 3b70dfcced Remove files that are no longer updated
Fixes: #360
(cherry picked from commit 2ed8daa3cb)
2024-01-12 18:29:19 +00:00
Naveen Albert b5eb5e19c3 app_voicemail: Add AMI event for mailbox PIN changes.
This adds an AMI event that is emitted whenever a
mailbox password is successfully changed, allowing
AMI consumers to process these.

UserNote: The VoicemailPasswordChange event is
now emitted whenever a mailbox password is updated,
containing the mailbox information and the new
password.

Resolves: #398
(cherry picked from commit cf9d7fa9f6)
2024-01-12 18:29:19 +00:00
Sean Bright 3ded0c95fc app_queue.c: Emit unpause reason with PauseQueueMember event.
Fixes #395

(cherry picked from commit fb937d1d89)
2024-01-12 18:29:19 +00:00
George Joseph e2f246c067 bridge_simple: Suppress unchanged topology change requests
In simple_bridge_join, we were sending topology change requests
even when the new and old topologies were the same.  In some
circumstances, this can cause unnecessary re-invites and even
a re-invite flood.  We now suppress those.

Resolves: #384
(cherry picked from commit f301d4559e)
2024-01-12 18:29:19 +00:00
Naveen Albert 120dbba2b3 res_pjsip: Include cipher limit in config error message.
If too many ciphers are specified in the PJSIP config,
include the maximum number of ciphers that may be
specified in the user-facing error message.

Resolves: #396
(cherry picked from commit 8d9d0d3738)
2024-01-12 18:29:19 +00:00
Mike Bradeen 0b4427d621 res_speech: allow speech to translate input channel
* Allow res_speech to translate the input channel if the
  format is translatable to a format suppored by the
  speech provider.

Resolves: #129

UserNote: res_speech now supports translation of an input channel
to a format supported by the speech provider, provided a translation
path is available between the source format and provider capabilites.

(cherry picked from commit c3e2bff36e)
2024-01-12 18:29:19 +00:00
Sean Bright ea74f942ce res_rtp_asterisk.c: Fix memory leak in ephemeral certificate creation.
Fixes #386

(cherry picked from commit deeb1acffe)
2024-01-12 18:29:19 +00:00