Commit Graph

33948 Commits

Author SHA1 Message Date
Asterisk Development Team
356f4d0087 Update for certified-20.7-cert7 certified-20.7-cert7 2025-07-31 16:33:56 +00:00
ThatTotallyRealMyth
85a76a11b1 safe_asterisk: Add ownership checks for /etc/asterisk/startup.d and its files.
UpgradeNote: The safe_asterisk script now checks that, if it was run by the
root user, the /etc/asterisk/startup.d directory and all the files it contains
are owned by root.  If the checks fail, safe_asterisk will exit with an error
and Asterisk will not be started.  Additionally, the default logging
destination is now stderr instead of tty "9" which probably won't exist
in modern systems.

Resolves: #GHSA-v9q8-9j8m-5xwp
2025-07-31 08:46:51 -06:00
George Joseph
67261916fa res_stir_shaken: Test for missing semicolon in Identity header.
ast_stir_shaken_vs_verify() now makes sure there's a semicolon in
the Identity header to prevent a possible segfault.

Resolves: #GHSA-mrq5-74j5-f5cr
2025-07-31 08:38:22 -06:00
George Joseph
157502e0f6 .lastclean: Remove from git
It never should been versioned in the first place.
2025-07-18 08:24:51 -06:00
Asterisk Development Team
5b15600bd7 Update for certified-20.7-cert6 certified-20.7-cert6 2025-06-02 13:38:18 +00:00
Ben Ford
435e0e0db1 documentation: Update Gosub, Goto, and add new documentationtype.
Gosub and Goto were not displaying their syntax correctly on the docs
site. This change adds a new way to specify an optional context, an
optional extension, and a required priority that the xml stylesheet can
parse without having to know which optional parameters come in which
order. In Asterisk, it looks like this:

  parameter name="context" documentationtype="dialplan_context"
  parameter name="extension" documentationtype="dialplan_extension"
  parameter name="priority" documentationtype="dialplan_priority" required="true"

The stylesheet will ignore the context and extension parameters, but for
priority, it will automatically inject the following:

  [[context,]extension,]priority

This is the correct oder for applications such as Gosub and Goto.

(cherry picked from commit 1f482aec8d)
2025-06-02 13:38:14 +00:00
George Joseph
560bdad1e4 README.md: Updates and Fixes
* Outdated information has been removed.
* New links added.
* Placeholder added for link to change logs.

Going forward, the release process will create HTML versions of the README
and change log and will update the link in the README to the current
change log for the branch...

* In the development branches, the link will always point to the current
  release on GitHub.
* In the "releases/*" branches and the tarballs, the link will point to the
  ChangeLogs/ChangeLog-<version>.html file in the source directory.
* On the downloads website, the link will point to the
  ChangeLog-<version>.html file in the same directory.

Resolves: #1131
(cherry picked from commit e938c6ed8b)
2025-06-02 13:38:14 +00:00
George Joseph
735012bd87 manager.c: Check for restricted file in action_createconfig.
The `CreateConfig` manager action now ensures that a config file can
only be created in the AST_CONFIG_DIR unless `live_dangerously` is set.

Resolves: #1122
(cherry picked from commit bac20a4c09)
2025-06-02 13:38:14 +00:00
George Joseph
1dcff16085 swagger_model.py: Fix invalid escape sequence in get_list_parameter_type().
Recent python versions complain when backslashes in strings create invalid
escape sequences.  This causes issues for strings used as regex patterns like
`'^List\[(.*)\]$'` where you want the regex parser to treat `[` and `]`
as literals.  Double-backslashing is one way to fix it but simply converting
the string to a raw string `re.match(r'^List\[(.*)\]$', text)` is easier
and less error prone.

(cherry picked from commit 5e187e528b)
2025-06-02 13:38:14 +00:00
George Joseph
854fbed8b4 .github: Change concurrency group ids so they're unique.
GitHub strikes again.  Apparently the github.ref context variable only
contains the PR number if the workflow is triggered by "pull_request" so
since we just changed the trigger to "pull_request_target" the variable
no longer contains the PR number and is therefore not unique and can't be
used as a concurrency group id.  We now use
`github.triggering_actor-github.head_ref`.

(cherry picked from commit 2b09d5bb31)
2025-06-02 13:38:14 +00:00
George Joseph
5b82ff566a .github: Refactor Releaser to use reusable workflow
(cherry picked from commit daa96bf7ba)
2025-06-02 13:38:14 +00:00
George Joseph
9bb74ecbe1 .github: Change branch of reusable workflows to main.
(cherry picked from commit 2efbe0f8e6)
2025-06-02 13:38:14 +00:00
George Joseph
48125ddf89 .github: Refactor to use pull_request_target trigger.
After careful review, we believe we can now use the "pull_request_target"
workflow trigger instead of "pull_request" which required a separate
privliged workflow to add labels and comments to PRs when they are submitted
or updated.  This allows us to greatly streamline our workflows and remove
unneeded ones.

* The OnPRChanged workflow was...
  * Renamed to OnPRCheck
  * Changed to trigger on pull_request_target and the "recheckpr" label.
  * Changed to simply call reusable workflows in asterisk-ci-actions.
  * Changed to use better concurrency groups.
* The OnPRCPCheck and OnPRMergeApproved workflows were also...
  * Changed to simply call reusable workflows in asterisk-ci-actions.
  * Changed to use better concurrency groups.
* The NightlyTest and CreateDocs were also tweaked

(cherry picked from commit ee9580ffdb)
2025-06-02 13:38:14 +00:00
George Joseph
72d69c3904 res_stir_shaken: Allow missing or anonymous CID to continue to the dialplan.
The verification check for missing or anonymous callerid was happening before
the endpoint's profile was retrieved which meant that the failure_action
parameter wasn't available.  Therefore, if verification was enabled and there
was no callerid or it was "anonymous", the call was immediately terminated
instead of giving the dialplan the ability to decide what to do with the call.

* The callerid check now happens after the verification context is created and
  the endpoint's stir_shaken_profile is available.

* The check now processes the callerid failure just as it does for other
  verification failures and respects the failure_action parameter.  If set
  to "continue" or "continue_return_reason", `STIR_SHAKEN(0,verify_result)`
  in the dialplan will return "invalid_or_no_callerid".

* If the endpoint's failure_action is "reject_request", the call will be
  rejected with `433 "Anonymity Disallowed"`.

* If the endpoint's failure_action is "continue_return_reason", the call will
  continue but a `Reason: STIR; cause=433; text="Anonymity Disallowed"`
  header will be added to the next provisional or final response.

Resolves: #1112
(cherry picked from commit cd4689dc5e)
2025-06-02 13:38:14 +00:00
George Joseph
042b46a098 .github: Remove concurrency check in on-labelled workflows.
Apparently you can't use `${{ github.event.number }}` in a concurrency
block in a job that calls a reusable workflow. :(

(cherry picked from commit 78108fae44)
2025-06-02 13:38:14 +00:00
George Joseph
0b2168afaf .github: Move PRChanged,PRChangedPriv,PRCPCheck,PRReCheck,PRMerge logic.
Moved to asterisk-ci-actions reusable workflows.

(cherry picked from commit c1ba1e5e04)
2025-06-02 13:38:14 +00:00
George Joseph
abb6d252a9 .github: OnPRCherryPickTest,OnPRStateChanged,OnPRRecheck: Add job summaries.
...and refactor environment variables.

(cherry picked from commit 60b1a23fcc)
2025-06-02 13:38:14 +00:00
George Joseph
fea5a75b3e .github: Clean up CreateDocs
(cherry picked from commit fe2123952f)
2025-06-02 13:38:14 +00:00
Joshua C. Colp
92a1483567 LICENSE: Update company name, email, and address.
(cherry picked from commit bab607c5f5)
2025-06-02 13:38:14 +00:00
George Joseph
2a36a8864a README.md, asterisk.c: Update Copyright Dates
(cherry picked from commit 2988315c2a)
2025-06-02 13:38:14 +00:00
George Joseph
a21971cfeb docs: Enable since/version handling for XML, CLI and ARI documentation
* Added the "since" element to the XML configObject and configOption elements
  in appdocsxml.dtd.

* Added the "Since" section to the following CLI output:
  ```
  config show help <module> <object>
  config show help <module> <object> <option>
  core show application <app>
  core show function <func>
  manager show command <command>
  manager show event <event>
  agi show commands topic <topic>
  ```

* Refactored the commands above to output their sections in the same order:
  Synopsis, Since, Description, Syntax, Arguments, SeeAlso

* Refactored the commands above so they all use the same pattern for writing
  the output to the CLI.

* Fixed several memory leaks caused by failure to free temporary output
  buffers.

* Added a "since" array to the mustache template for the top-level resources
  (Channel, Endpoint, etc.) and to the paths/methods underneath them. These
  will be added to the generated markdown if present.
  Example:
  ```
    "resourcePath": "/api-docs/channels.{format}",
    "requiresModules": [
        "res_stasis_answer",
        "res_stasis_playback",
        "res_stasis_recording",
        "res_stasis_snoop"
    ],
    "since": [
        "18.0.0",
        "21.0.0"
    ],
    "apis": [
        {
            "path": "/channels",
            "description": "Active channels",
            "operations": [
                {
                    "httpMethod": "GET",
                    "since": [
                        "18.6.0",
                        "21.8.0"
                    ],
                    "summary": "List all active channels in Asterisk.",
                    "nickname": "list",
                    "responseClass": "List[Channel]"
                },

  ```

NOTE:  No versioning information is actually added in this commit.
Those will be added separately and instructions for adding and maintaining
them will be published on the documentation site at a later date.

(cherry picked from commit d5e7988df4)
2025-06-02 13:38:14 +00:00
Sean Bright
82c1fb71e6 manager: Add <since> tags for all AMI actions.
(cherry picked from commit 7d97560656)
2025-06-02 13:38:14 +00:00
George Joseph
b2b2fde59e manager.c: Split XML docs into separate file
To keep the source tree somewhat compatible with the base 20 branch
the XML documentation from manager.c has been extracted into manager_doc.xml.
This will give future cherry-picks a better channce of succeeding without
manual intervention.

(cherry picked from commit 6af64e714d)
2025-06-02 13:38:14 +00:00
Sean Bright
9fb3d0c4a6 manager.c: Rename restrictedFile to is_restricted_file.
Also correct the spelling of 'privileges.'

(cherry picked from commit bfe22f162f)
2025-06-02 13:38:13 +00:00
George Joseph
5c581c6bd1 .github: Set exit 0 in CherryPick and Recheck workflow Cleanup steps
(cherry picked from commit eaca3ef78d)
2025-06-02 13:38:13 +00:00
George Joseph
e2c161ed65 gcc14: Fix issues caught by gcc 14
* reqresp_parser.c: Fix misuse of "static" with linked list definitions
* test_message.c: Fix segfaults caused by passing NULL as an sprintf fmt

(cherry picked from commit 27b7daab83)
2025-06-02 13:38:13 +00:00
George Joseph
dd7ff17e7f .github: Change the run name for OnPRStateChangedPriv
(cherry picked from commit b5fac0bee4)
2025-06-02 13:38:13 +00:00
George Joseph
bfa947d9f4 Allow C++ source files (as extension .cc) in the main directory
Although C++ files (as extension .cc) have been handled in the module
directories for many years, the main directory was missing one line in its
Makefile that prevented C++ files from being recognised there.

(cherry picked from commit 7700534f17)
2025-06-02 13:38:13 +00:00
George Joseph
cacb5f0f1a res_stir_shaken: Allow sending Identity headers for unknown TNs
Added a new option "unknown_tn_attest_level" to allow Identity
headers to be sent when a callerid TN isn't explicitly configured
in stir_shaken.conf.  Since there's no TN object, a private_key_file
and public_cert_url must be configured in the attestation or profile
objects.

Since "unknown_tn_attest_level" uses the same enum as attest_level,
some of the sorcery macros had to be refactored to allow sharing
the enum and to/from string conversion functions.

Also fixed a memory leak in crypto_utils:pem_file_cb().

Resolves: #921

UserNote: You can now set the "unknown_tn_attest_level" option
in the attestation and/or profile objects in stir_shaken.conf to
enable sending Identity headers for callerid TNs not explicitly
configured.

(cherry picked from commit 35a6c77b5f)
2025-06-02 13:38:13 +00:00
George Joseph
c4ba07fef6 res_pjsip: Change suppress_moh_on_sendonly to OPT_BOOL_T
The suppress_moh_on_sendonly endpoint option should have been
defined as OPT_BOOL_T in pjsip_configuration.c and AST_BOOL_VALUES
in the alembic script instead of OPT_YESNO_T and YESNO_VALUES.

Also updated contrib/ast-db-manage/README.md to indicate that
AST_BOOL_VALUES should always be used and provided an example.

Resolves: #995
(cherry picked from commit 297559dc1e)
2025-06-02 13:38:13 +00:00
George Joseph
74a05b9c70 res_pjsip: Add new endpoint option "suppress_moh_on_sendonly"
Normally, when one party in a call sends Asterisk an SDP with
a "sendonly" or "inactive" attribute it means "hold" and causes
Asterisk to start playing MOH back to the other party. This can be
problematic if it happens at certain times, such as in a 183
Progress message, because the MOH will replace any early media you
may be playing to the calling party. If you set this option
to "yes" on an endpoint and the endpoint receives an SDP
with "sendonly" or "inactive", Asterisk will NOT play MOH back to
the other party.

Resolves: #979

UserNote: The new "suppress_moh_on_sendonly" endpoint option
can be used to prevent playing MOH back to a caller if the remote
end sends "sendonly" or "inactive" (hold) to Asterisk in an SDP.

(cherry picked from commit d443a960e2)
2025-06-02 13:38:13 +00:00
chrsmj
57d4147c13 samples: remove and/or change some wiki mentions
Cleaned some dead links. Replaced word wiki with
either docs or link to https://docs.asterisk.org/

Resolves: #974
(cherry picked from commit 856f6e80ca)
2025-06-02 13:38:13 +00:00
George Joseph
17d48b8d4c res_pjsip: Move tenantid to end of ast_sip_endpoint
The tenantid field was originally added to the ast_sip_endpoint
structure at the end of the AST_DECLARE_STRING_FIELDS block.  This
caused everything after it in the structure to move down in memory
and break ABI compatibility.  It's now at the end of the structure
as an AST_STRING_FIELD_EXTENDED.  Given the number of string fields
in the structure now, the initial string field allocation was
also increased from 64 to 128 bytes.

Resolves: #982
(cherry picked from commit eafb8f148e)
2025-06-02 13:38:13 +00:00
Ben Ford
39d8fe8b14 Add res_pjsip_config_sangoma external module.
Adds res_pjsip_config_sangoma as an external module that can be
downloaded via menuselect. It lives under the Resource Modules section.

(cherry picked from commit 9e47db099e)
2025-06-02 13:38:13 +00:00
Ben Ford
4914253ea1 app_mixmonitor: Add 'D' option for dual-channel audio.
Adds the 'D' option to app_mixmonitor that interleaves the input and
output frames of the channel being recorded in the monitor output frame.
This allows for two streams in the recording: the transmitted audio and
the received audio. The 't' and 'r' options are compatible with this.

Fixes: #945

UserNote: The MixMonitor application now has a new 'D' option which
interleaves the recorded audio in the output frames. This allows for
stereo recording output with one channel being the transmitted audio and
the other being the received audio. The 't' and 't' options are
compatible with this.

(cherry picked from commit 84c0266faa)
2025-06-02 13:38:13 +00:00
George Joseph
d2ae133919 .github: Redirect NightlyAdmin to AsteriskNightlyAdmin
(cherry picked from commit 3963364ae7)
2025-06-02 13:38:13 +00:00
George Joseph
bc09ccdb9f .github: NightlyAdmin now calls external CloseStaleIssuesAndPRs
(cherry picked from commit 777684b7aa)
2025-06-02 13:38:13 +00:00
George Joseph
a0bfc7b5ea core_unreal.c: Fix memory leak in ast_unreal_new_channels()
When the channel tech is multistream capable, the reference to
chan_topology was passed to the new channel.  When the channel tech
isn't multistream capable, the reference to chan_topology was never
released.  "Local" channels are multistream capable so it didn't
affect them but the confbridge "CBAnn" and the bridge_media
"Recorder" channels are not so they caused a leak every time one
of them was created.

Also added tracing to ast_stream_topology_alloc() and
stream_topology_destroy() to assist with debugging.

Resolves: #938
(cherry picked from commit 99350fd91c)
2025-06-02 13:38:13 +00:00
George Joseph
54388dab63 geolocation.sample.conf: Fix comment marker at end of file
Resolves: #937
(cherry picked from commit d2b16e57bf)
2025-06-02 13:38:13 +00:00
George Joseph
6eaf6bc14d manager.c: Add unit test for Originate app and appdata permissions
This unit test checks that dialplan apps and app data specified
as parameters for the Originate action are allowed with the
permissions the user has.

(cherry picked from commit e3f0374d21)
2025-06-02 13:38:13 +00:00
Sean Bright
d4325257ad alembic: Drop redundant voicemail_messages index.
The `voicemail_messages_dir` index is a left prefix of the table's
primary key and therefore unnecessary.

(cherry picked from commit 72cf38957c)
2025-06-02 13:38:13 +00:00
Sean Bright
f6d2663024 res_pjsip_pubsub: Persist subscription 'generator_data' in sorcery
Fixes #895

(cherry picked from commit cb7268234d)
2025-06-02 13:38:13 +00:00
George Joseph
628b2dbb85 stir_shaken: Fix propagation of attest_level and a few other values
attest_level, send_mky and check_tn_cert_public_url weren't
propagating correctly from the attestation object to the profile
and tn.

* In the case of attest_level, the enum needed to be changed
so the "0" value (the default) was "NOT_SET" instead of "A".  This
now allows the merging of the attestation object, profile and tn
to detect when a value isn't set and use the higher level value.

* For send_mky and check_tn_cert_public_url, the tn default was
forced to "NO" which always overrode the profile and attestation
objects.  Their defaults are now "NOT_SET" so the propagation
happens correctly.

* Just to remove some redundant code in tn_config.c, a bunch of calls to
generate_sorcery_enum_from_str() and generate_sorcery_enum_to_str() were
replaced with a single call to generate_acfg_common_sorcery_handlers().

Resolves: #904
(cherry picked from commit b068c01af1)
2025-06-02 13:38:13 +00:00
George Joseph
ac5e2e7676 Fix application references to Background
The app is actually named "BackGround" but several references
in XML documentation were spelled "Background" with the lower
case "g".  This was causing documentation links to return
"not found" messages.

(cherry picked from commit db94ec50f9)
2025-06-02 13:38:13 +00:00
George Joseph
549fe6062e .github: Fix realtime param on Weekly and Nightly tests and...
Rename the "Cleanup" job in the cherry-pick and recheck jobs
to "Summary".

(cherry picked from commit 0b5e9302c1)
2025-06-02 13:38:13 +00:00
George Joseph
d1c56a4754 .github: Add WeeklyTests and make Nightlies Monday-Saturday
...and add "realtime" option.

(cherry picked from commit 078966d48d)
2025-06-02 13:38:13 +00:00
George Joseph
3d476392c5 db.c: Remove limit on family/key length
Consumers like media_cache have been running into issues with
the previous astdb "/family/key" limit of 253 bytes when needing
to store things like long URIs.  An Amazon S3 URI is a good example
of this.  Now, instead of using a static 256 byte buffer for
"/family/key", we use ast_asprintf() to dynamically create it.

Both test_db.c and test_media_cache.c were also updated to use
keys/URIs over the old 253 character limit.

Resolves: #881

UserNote: The `ast_db_*()` APIs have had the 253 byte limit on
"/family/key" removed and will now accept families and keys with a
total length of up to SQLITE_MAX_LENGTH (currently 1e9!).  This
affects the `DB*` dialplan applications, dialplan functions,
manager actions and `databse` CLI commands.  Since the
media_cache also uses the `ast_db_*()` APIs, you can now store
resources with URIs longer than 253 bytes.

(cherry picked from commit 52cdfbbb64)
2025-06-02 13:38:13 +00:00
George Joseph
ad6bef924d .github: Changes required to use cached builds and shorten names
(cherry picked from commit 6469f83909)
2025-06-02 13:38:13 +00:00
George Joseph
c2145f1531 res_stir_shaken: Remove stale include for jansson.h in verification.c
verification.c had an include for jansson.h left over from previous
versions of the module.  Since res_stir_shaken no longer has a
dependency on jansson, the bundled version wasn't added to GCC's
include path so if you didn't also have a jansson development package
installed, the compile would fail.  Removing the stale include
was the only thing needed.

Resolves: #889
(cherry picked from commit 57e9d35605)
2025-06-02 13:38:13 +00:00
George Joseph
a1de7aba2e res_stir_shaken.c: Fix crash when stir_shaken.conf is invalid
* If the call to ast_config_load() returns CONFIG_STATUS_FILEINVALID,
check_for_old_config() now returns LOAD_DECLINE instead of continuing
on with a bad pointer.

* If CONFIG_STATUS_FILEMISSING is returned, check_for_old_config()
assumes the config is being loaded from realtime and now returns
LOAD_SUCCESS.  If it's actually not being loaded from realtime,
sorcery will catch that later on.

* Also refactored the error handling in load_module() a bit.

Resolves: #884
(cherry picked from commit c1b78daf8a)
2025-06-02 13:38:13 +00:00