Commit Graph

33394 Commits

Author SHA1 Message Date
Sean Bright
42d3038141 alembic: Make 'revises' header comment match reality.
(cherry picked from commit 13d38eeabe)
2024-09-05 17:05:53 +00:00
Mike Bradeen
03b72fae96 res_pjsip_notify: add dialplan application
Add dialplan application PJSIPNOTIFY to send either pre-configured
NOTIFY messages from pjsip_notify.conf or with headers defined in
dialplan.

Also adds the ability to send pre-configured NOTIFY commands to a
channel via the CLI.

Resolves: #799

UserNote: A new dialplan application PJSIPNotify is now available
which can send SIP NOTIFY requests from the dialplan.

The pjsip send notify CLI command has also been enhanced to allow
sending NOTIFY messages to a specific channel. Syntax:

pjsip send notify <option> channel <channel>

(cherry picked from commit 8e97266810)
2024-09-05 17:05:53 +00:00
George Joseph
d46bc45df9 manager.c: Fix FRACK when doing CoreShowChannelMap in DEVMODE
If you run an AMI CoreShowChannelMap on a channel that isn't in a
bridge and you're in DEVMODE, you can get a FRACK because the
bridge id is empty.  We now simply return an empty list for that
request.

(cherry picked from commit 0778c95e37)
2024-09-05 17:05:53 +00:00
Ben Ford
240597fb26 channel: Add multi-tenant identifier.
This patch introduces a new identifier for channels: tenantid. It's
a stringfield on the channel that can be used for general purposes. It
will be inherited by other channels the same way that linkedid is.

You can set tenantid in a few ways. The first is to set it in the
dialplan with the Set and CHANNEL functions:

exten => example,1,Set(CHANNEL(tenantid)=My tenant ID)

It can also be accessed via CHANNEL:

exten => example,2,NoOp(CHANNEL(tenantid))

Another method is to use the new tenantid option for pjsip endpoints in
pjsip.conf:

[my_endpoint]
type=endpoint
tenantid=My tenant ID

This is considered the best approach since you will be able to see the
tenant ID as early as the Newchannel event.

It can also be set using set_var in pjsip.conf on the endpoint like
setting other channel variable:

set_var=CHANNEL(tenantid)=My tenant ID

Note that set_var will not show tenant ID on the Newchannel event,
however.

Tenant ID has also been added to CDR. It's read-only and can be accessed
via CDR(tenantid). You can also get the tenant ID of the last channel
communicated with via CDR(peertenantid).

Tenant ID will also show up in CEL records if it has been set, and the
version number has been bumped accordingly.

Fixes: #740

UserNote: tenantid has been added to channels. It can be read in
dialplan via CHANNEL(tenantid), and it can be set using
Set(CHANNEL(tenantid)=My tenant ID). In pjsip.conf, it is recommended to
use the new tenantid option for pjsip endpoints (e.g., tenantid=My
tenant ID) so that it will show up in Newchannel events. You can set it
like any other channel variable using set_var in pjsip.conf as well, but
note that this will NOT show up in Newchannel events. Tenant ID is also
available in CDR and can be accessed with CDR(tenantid). The peer tenant
ID can also be accessed with CDR(peertenantid). CEL includes tenant ID
as well if it has been set.

UpgradeNote: A new versioned struct (ast_channel_initializers) has been
added that gets passed to __ast_channel_alloc_ap. The new function
ast_channel_alloc_with_initializers should be used when creating
channels that require the use of this struct. Currently the only value
in the struct is for tenantid, but now more fields can be added to the
struct as necessary rather than the __ast_channel_alloc_ap function. A
new option (tenantid) has been added to endpoints in pjsip.conf as well.
CEL has had its version bumped to include tenant ID.

(cherry picked from commit 9ee00e0d60)
2024-09-05 17:05:53 +00:00
George Joseph
5283b32993 res_resolver_unbound: Test for NULL ub_result in unbound_resolver_callback
The ub_result pointer passed to unbound_resolver_callback by
libunbound can be NULL if the query was for something malformed
like `.1` or `[.1]`.  If it is, we now set a 'ns_r_formerr' result
and return instead of crashing with a SEGV.  This causes pjproject
to simply cancel the transaction with a "No answer record in the DNS
response" error.  The existing "off nominal" unit test was also
updated to check this condition.

Although not necessary for this fix, we also made
ast_dns_resolver_completed() tolerant of a NULL result.

Resolves: GHSA-v428-g3cw-7hv9
2024-09-05 10:40:47 -06:00
Asterisk Development Team
fce1a9b823 Update for certified-18.9-cert11 certified-18.9-cert11 2024-08-08 13:25:25 +00:00
Mike Bradeen
6b8d8a9823 res_stasis: fix intermittent delays on adding channel to bridge
Previously, on command execution, the control thread was awoken by
sending a SIGURG. It was found that this still resulted in some
instances where the thread was not immediately awoken.

This change instead sends a null frame to awaken the control thread,
which awakens the thread more consistently.

Resolves: #801
(cherry picked from commit f974ea2810)
2024-08-08 13:25:21 +00:00
George Joseph
6a2aad1d41 .github: Allow testing an Asterisk PR against a testsuite PR
(cherry picked from commit a47f92c2f8)
2024-08-08 13:25:21 +00:00
George Joseph
e1962c0911 .github: Add params to Releaser for FPBX issue creation
(cherry picked from commit 74328a7bfe)
2024-08-08 13:25:21 +00:00
George Joseph
a89e9ca13e res_pjsip_config_wizard.c: Refactor load process
The way we have been initializing the config wizard prevented it
from registering its objects if res_pjsip happened to load
before it.

* We now use the object_type_registered sorcery observer to kick
things off instead of the wizard_mapped observer.

* The load_module function now checks if res_pjsip has been loaded
already and if it was it fires the proper observers so the objects
load correctly.

Resolves: #816

UserNote: The res_pjsip_config_wizard.so module can now be reloaded.
(cherry picked from commit 9e56766cde)
2024-08-08 13:25:21 +00:00
George Joseph
bae7edddcb voicemail.conf.sample: Fix ':' comment typo
...and removed an errant trailing space.

Resolves: #819
(cherry picked from commit fa69a286a2)
2024-08-08 13:25:20 +00:00
George Joseph
c77fdb59f4 bridge_softmix: Fix queueing VIDUPDATE control frames
softmix_bridge_write_control() now calls ast_bridge_queue_everyone_else()
with the bridge_channel so the VIDUPDATE control frame isn't echoed back.

softmix_bridge_write_control() was setting bridge_channel to NULL
when calling ast_bridge_queue_everyone_else() for VIDUPDATE control
frames.  This was causing the frame to be echoed back to the
channel it came from.  In certain cases, like when two channels or
bridges are being recorded, this can cause a ping-pong effect that
floods the system with VIDUPDATE control frames.

Resolves: #780
(cherry picked from commit 3be176dfc4)
2024-08-08 13:25:20 +00:00
George Joseph
7a0090325b manager.c: Add entries to Originate blacklist
Added Reload and DBdeltree to the list of dialplan application that
can't be executed via the Originate manager action without also
having write SYSTEM permissions.

Added CURL, DB*, FILE, ODBC and REALTIME* to the list of dialplan
functions that can't be executed via the Originate manager action
without also having write SYSTEM permissions.

If the Queue application is attempted to be run by the Originate
manager action and an AGI parameter is specified in the app data,
it'll be rejected unless the manager user has either the AGI or
SYSTEM permissions.

Resolves: #GHSA-c4cg-9275-6w44
2024-08-08 07:10:13 -06:00
Asterisk Development Team
c6e587c8a9 Update for certified-18.9-cert10 certified-18.9-cert10 2024-07-18 14:04:45 +00:00
George Joseph
1fad739c76 .github: Pass app_id and app_priv_key to AsteriskMergePR
(cherry picked from commit b7a46921c4)
2024-07-18 14:04:42 +00:00
George Joseph
5eff492417 .github: Change OnPRMergeApproved to use default token
(cherry picked from commit 6cd51f082b)
2024-07-18 14:04:42 +00:00
Sean Bright
d4b70f2194 logger.h: Include SCOPE_CALL_WITH_INT_RESULT() in non-dev-mode builds.
Fixes #785

(cherry picked from commit 4ec1be6530)
2024-07-18 14:04:42 +00:00
George Joseph
5c1822a481 app_voicemail_odbc: Allow audio to be kept on disk
This commit adds a new voicemail.conf option 'odbc_audio_on_disk'
which when set causes the ODBC variant of app_voicemail to leave
the message and greeting audio files on disk and only store the
message metadata in the database.  This option came from a concern
that the database could grow to large and cause remote access
and/or replication to become slow.  In a clustering situation
with this option, all asterisk instances would share the same
database for the metadata and either use a shared filesystem
or other filesystem replication service much more suitable
for synchronizing files.

The changes to app_voicemail to implement this feature were actually
quite small but due to the complexity of the module, the actual
source code changes were greater.  They fall into the following
categories:

* Tracing.  The module is so complex that it was impossible to
figure out the path taken for various scenarios without the addition
of many SCOPE_ENTER, SCOPE_EXIT and ast_trace statements, even in
code that's not related to the functional change.  Making this worse
was the fact that many "if" statements in this module didn't use
braces.  Since the tracing macros add multiple statements, many "if"
statements had to be converted to use braces.

* Excessive use of PATH_MAX.  Previous maintainers of this module
used PATH_MAX to allocate character arrays for filesystem paths
and SQL statements as though they cost nothing.  In fact, PATH_MAX
is defined as 4096 bytes!  Some functions had (and still have)
multiples of these.  One function has 7.  Given that the vast
majority of installations use the default spool directory path
`/var/spool/asterisk/voicemail`, the actual path length is usually
less than 80 bytes.  That's over 4000 bytes wasted.  It was the
same for SQL statement buffers.  A 4K buffer for statement that
only needed 60 bytes.  All of these PATH_MAX allocations in the
ODBC related code were changed to dynamically allocated buffers.
The rest will have to be addressed separately.

* Bug fixes.  During the development of this feature, several
pre-existing ODBC related bugs were discovered and fixed.  They
had to do with leaving orphaned files on disk, not preserving
original message ids when moving messages between folders,
not honoring the "formats" config parameter in certain circumstances,
etc.

UserNote: This commit adds a new voicemail.conf option
'odbc_audio_on_disk' which when set causes the ODBC variant of
app_voicemail_odbc to leave the message and greeting audio files
on disk and only store the message metadata in the database.
Much more information can be found in the voicemail.conf.sample
file.

(cherry picked from commit c71fbca918)
2024-07-18 14:04:42 +00:00
George Joseph
0203bc0df5 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 741b3c0dbb)
2024-07-18 14:04:42 +00:00
Sean Bright
c543090c81 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 f8f23c6cef)
2024-07-18 14:04:42 +00:00
George Joseph
c912fd2b1a .github: Use ASTERISKTEAM_PAT for PR merging
(cherry picked from commit 9945c25f31)
2024-07-18 14:04:42 +00:00
George Joseph
ffdb3d748f .github: Replace PR workflows with stubs that call reusables
The PR workflows now are just stubs that call reusable
workflows located in the asterisk-ci-actions repo.

(cherry picked from commit 0527ae4166)
2024-07-18 14:04:42 +00:00
George Joseph
d5dc0551ad .github: Refactor NightlyTests to use workflow in asterisk-ci-actions
(cherry picked from commit a800a20308)
2024-07-18 14:04:42 +00:00
George Joseph
107f992e00 .github: Add branches to workflow_dispatch for NightlyTests
(cherry picked from commit 1406d558dc)
2024-07-18 14:04:42 +00:00
Asterisk Development Team
407989fa7b Update for certified-18.9-cert9 certified-18.9-cert9 2024-05-09 17:36:03 +00:00
Ivan Poddubny
963872daa7 asterisk.c: Fix sending incorrect messages to systemd notify
Send "RELOADING=1" instead of "RELOAD=1" to follow the format
expected by systemd (see sd_notify(3) man page).

Do not send STOPPING=1 in remote console mode:
attempting to execute "asterisk -rx" by the main process leads to
a warning if NotifyAccess=main (the default) or to a forced termination
if NotifyAccess=all.

(cherry picked from commit 7314a411a9)
2024-05-09 17:36:00 +00:00
Sean Bright
72db4a9530 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 178b2df38a)
2024-05-09 17:36:00 +00:00
George Joseph
10c5aa65e8 tcptls/iostream: Add support for setting SNI on client TLS connections
If the hostname field of the ast_tcptls_session_args structure is
set (which it is for websocket client connections), that hostname
will now automatically be used in an SNI TLS extension in the client
hello.

Resolves: #713

UserNote: Secure websocket client connections now send SNI in
the TLS client hello.

(cherry picked from commit 7223dfe244)
2024-05-09 17:35:59 +00:00
George Joseph
d1cde2a864 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 558d0a8033)
2024-05-09 17:35:59 +00:00
George Joseph
76f922cd1f 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 00940e2abd)
2024-05-09 17:35:59 +00:00
George Joseph
5e46323179 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 d214c72c2a)
2024-05-09 17:35:59 +00:00
George Joseph
4dcdded687 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 0e0a56a0ca)
2024-05-09 17:35:59 +00:00
George Joseph
06e319b15a .github: Add PAT to PRSubmitActions/Add Reviewers
(cherry picked from commit a7e4c193fc)
2024-05-09 17:35:59 +00:00
George Joseph
b11158b852 .github: Remove timeout-minutes from gatetests
(cherry picked from commit 18f3c355f7)
2024-05-09 17:35:59 +00:00
George Joseph
f7fe5a7ac3 .github: Pass only single GATETEST_COMMAND to AsteriskGateComposite
(cherry picked from commit f841ae8e62)
2024-05-09 17:35:59 +00:00
Mark Murawski
84bf0a4d17 Remove files that are no longer updated
Fixes: #360
(cherry picked from commit 81c400a1c2)
2024-05-09 17:35:59 +00:00
Asterisk Development Team
949533f9a9 Update for certified-18.9-cert8 certified-18.9-cert8 2024-03-12 15:51:22 +00:00
Asterisk Development Team
1ae51f1e1a Update for certified-18.9-cert8-rc2 certified-18.9-cert8-rc2 2024-02-26 23:34:17 +00:00
George Joseph
ca897dd37f Rename dialplan_functions.xml to dialplan_functions_doc.xml
When using COMPILE_DOUBLE, dialplan_functions.xml is mistaken
for the source for an embedded XML document and gets compiled
to dialplan_functions.o.  This causes dialplan_functions.c to
be ignored making its functions unavailable and causing chan_pjsip
to fail to load.
2024-02-26 16:25:52 -07:00
Sean Bright
c8d4ad1286 openssl: Supress deprecation warnings from OpenSSL 3.0
There is work going on to update our OpenSSL usage to avoid the
deprecated functions but in the meantime make it possible to compile
in devmode.

Change-Id: Ib082eb8b3751f0185d8aa8fe127da664c93f0726
2024-02-26 16:25:39 -07:00
Asterisk Development Team
378e010902 Update for certified-18.9-cert8-rc1 certified-18.9-cert8-rc1 2024-02-21 13:35:10 +00:00
George Joseph
8735277a4a .github: Add force_cherry_pick option to Releaser
(cherry picked from commit 031703c596)
2024-02-21 13:35:04 +00:00
George Joseph
5988bb529e .github: Remove start_version from Releaser
(cherry picked from commit 7d65b0ad80)
2024-02-21 13:35:04 +00:00
Mike Bradeen
33e95dfb8b 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 e0be8be337)
2024-02-21 13:35:04 +00:00
George Joseph
6d29836274 .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 be9b5bf0a9)
2024-02-21 13:35:04 +00:00
Naveen Albert
a26faa9ac5 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 3ff081e581)
2024-02-21 13:35:04 +00:00
George Joseph
4d512e643f doc: Remove obsolete CHANGES-staging directrory
This should have been removed after the last release but
was missed.

(cherry picked from commit 85fc4ce712)
2024-02-21 13:35:03 +00:00
George Joseph
2d62f1fd05 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 0f20f39db8)
2024-02-21 13:35:03 +00:00
George Joseph
9c950f4889 SECURITY.md: Update with correct documentation URL
(cherry picked from commit c53cd1c82d)
2024-02-21 13:35:03 +00:00
George Joseph
e5f3c646e5 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 8e012faf9e)
2024-02-21 13:35:03 +00:00