Commit Graph

33925 Commits

Author SHA1 Message Date
Ben Ford
f7d37df114 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 6efa51f512)
2024-03-07 14:18:40 +00:00
Flole998
096243745c 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 c7fc6ae362)
2024-03-07 14:18:40 +00:00
cmaj
1377ac9e89 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 c863e0d77d)
2024-03-07 14:18:40 +00:00
Joshua C. Colp
731fddd5d0 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 8ce69eda14)
2024-03-07 14:18:40 +00:00
Mike Bradeen
b510d681a1 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 69fe814813)
2024-03-07 14:18:40 +00:00
George Joseph
5c12fda94e .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 9baf49497e)
2024-03-07 14:18:40 +00:00
Naveen Albert
5e0f1bb5d2 app_if: Fix next priority calculation.
Commit fa3922a4d2 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 ed39406838)
2024-03-07 14:18:40 +00:00
Sean Bright
36184820bd 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 841cd1480c)
2024-03-07 14:18:40 +00:00
Brad Smith
14f84cc202 BuildSystem: Bump autotools versions on OpenBSD.
Bump up to the more commonly used and modern versions of
autoconf and automake.

(cherry picked from commit 9deb4c679e)
2024-03-07 14:18:40 +00:00
Brad Smith
30d05081d7 main/utils: Simplify the FreeBSD ast_get_tid() handling
FreeBSD has had kernel threads for 20+ years.

(cherry picked from commit ec2c10689f)
2024-03-07 14:18:40 +00:00
Sean Bright
2ec0b83e5b 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 9f20b4659f)
2024-03-07 14:18:40 +00:00
Sean Bright
3b74538fcf rtp_engine.c: Correct sample rate typo for L16/44100.
Fixes #555

(cherry picked from commit 671b47cfda)
2024-03-07 14:18:40 +00:00
Naveen Albert
dd90d4536f 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 874ee6e9aa)
2024-03-07 14:18:40 +00:00
Naveen Albert
e65c8cede5 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 ef891529fa)
2024-03-07 14:18:40 +00:00
Sean Bright
dbcd737302 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 03ad690276)
2024-03-07 14:18:40 +00:00
Mike Bradeen
ab1a9fa7d1 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 a22db8fd60)
2024-03-07 14:18:40 +00:00
Naveen Albert
76d33df366 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 4b908f364d)
2024-03-07 14:18:40 +00:00
PeterHolik
727a4cceec chan_rtp.c: MulticastRTP missing refcount without codec option
Fixes: #529
(cherry picked from commit 3b46872a8f)
2024-03-07 14:18:40 +00:00
PeterHolik
8a999b6706 chan_rtp.c: Change MulticastRTP nameing to avoid memory leak
Fixes: asterisk#536
(cherry picked from commit 6fe045fd64)
2024-03-07 14:18:40 +00:00
Naveen Albert
947ba375d7 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 67088b256d)
2024-03-07 14:18:40 +00:00
Asterisk Development Team
2dccaa4830 Update for 21.1.0 21.1.0 2024-01-25 16:23:00 +00:00
Asterisk Development Team
2310df0ff6 Update for 21.1.0-rc2 21.1.0-rc2 2024-01-18 16:48:17 +00:00
Naveen Albert
e735ab8cfb 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:55:27 -07:00
Asterisk Development Team
6b8dd72f50 Update for 21.1.0-rc1 21.1.0-rc1 2024-01-12 18:32:27 +00:00
George Joseph
077a1b171c 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 c31cd32b82)
2024-01-12 18:32:14 +00:00
Naveen Albert
625826afd4 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 7683259f37)
2024-01-12 18:32:14 +00:00
Maximilian Fridrich
b7701ba973 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 81188ada5f)
2024-01-12 18:32:13 +00:00
Naveen Albert
c148203225 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 1bf4493371)
2024-01-12 18:32:13 +00:00
Naveen Albert
ba4a8de400 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 bb364fc61f)
2024-01-12 18:32:13 +00:00
George Joseph
c0843b907a 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 df958a7d63)
2024-01-12 18:32:13 +00:00
Naveen Albert
ce29be5536 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 d20c3e2f6f)
2024-01-12 18:32:13 +00:00
Naveen Albert
6c33bf874d 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 09bd80c627)
2024-01-12 18:32:13 +00:00
Sean Bright
d5fc671ae4 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 e001a1b6d3)
2024-01-12 18:32:13 +00:00
Naveen Albert
f485d3cc8b 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 3bb34477d4)
2024-01-12 18:32:13 +00:00
George Joseph
0fd8f9ca88 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 751f8649fd)
2024-01-12 18:32:13 +00:00
Maximilian Fridrich
b3cff31e1a 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 366dc1e99f)
2024-01-12 18:32:13 +00:00
Sean Bright
0f5d624740 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 16a42b2aec)
2024-01-12 18:32:13 +00:00
George Joseph
b10a8aa212 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 aec2453688)
2024-01-12 18:32:13 +00:00
Sean Bright
b9a9e1e742 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 1d05e34d98)
2024-01-12 18:32:13 +00:00
Matthew Fredrickson
dd79040125 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 e0bf65bde6)
2024-01-12 18:32:13 +00:00
Sean Bright
fb289b0bad res_pjsip_header_funcs.c: Check URI parameter length before copying.
Fixes #477

(cherry picked from commit 002d6c2108)
2024-01-12 18:32:13 +00:00
Sean Bright
1c617f9b01 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 b437cc3267)
2024-01-12 18:32:13 +00:00
Sean Bright
8087a4ef2c 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 5f0b568341)
2024-01-12 18:32:13 +00:00
Sean Bright
77e8011291 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 fbe92dce2b)
2024-01-12 18:32:13 +00:00
Naveen Albert
4e774da45a 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 c930230a73)
2024-01-12 18:32:13 +00:00
Sean Bright
72d631b7bd 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 05924e30f9)
2024-01-12 18:32:13 +00:00
Sean Bright
9831c65f38 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 c7838a352a)
2024-01-12 18:32:13 +00:00
Naveen Albert
bef9a9422d 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 9211fb5e97)
2024-01-12 18:32:13 +00:00
Sean Bright
0620c14eb6 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 33213c1979)
2024-01-12 18:32:13 +00:00
Sean Bright
6a75f22858 uri.c: Simplify ast_uri_make_host_with_port()
(cherry picked from commit e2e18b366c)
2024-01-12 18:32:13 +00:00