]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
4 months ago.github: Change branch of reusable workflows to main.
George Joseph [Sun, 16 Feb 2025 23:24:27 +0000 (16:24 -0700)] 
.github: Change branch of reusable workflows to main.

(cherry picked from commit 07f37f51fedf3b6d74adcc683e044109d98905b7)

4 months ago.github: Refactor to use pull_request_target trigger.
George Joseph [Thu, 13 Feb 2025 20:22:31 +0000 (13:22 -0700)] 
.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 ebb33475bc0e4b1d439689f7ff09882890831da0)

4 months agores_config_pgsql: Fix regression that removed dbname config.
George Joseph [Tue, 11 Feb 2025 18:35:14 +0000 (11:35 -0700)] 
res_config_pgsql: Fix regression that removed dbname config.

A recent commit accidentally removed the code that sets dbname.
This commit adds it back in.

Resolves: #1119
(cherry picked from commit aef37c2a65aec743fe47337198648cb96933ced5)

4 months agores_stir_shaken: Allow missing or anonymous CID to continue to the dialplan.
George Joseph [Wed, 5 Feb 2025 17:33:10 +0000 (10:33 -0700)] 
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 85fa81ad4591905dd13828b1384cdaefdda50988)

4 months agoresource_channels.c: Fix memory leak in ast_ari_channels_external_media.
George Joseph [Tue, 4 Feb 2025 20:00:16 +0000 (13:00 -0700)] 
resource_channels.c: Fix memory leak in ast_ari_channels_external_media.

Between ast_ari_channels_external_media(), external_media_rtp_udp(),
and external_media_audiosocket_tcp(), the `variables` structure being passed
around wasn't being cleaned up properly when there was a failure.

* In ast_ari_channels_external_media(), the `variables` structure is now
  defined with RAII_VAR to ensure it always gets cleaned up.

* The ast_variables_destroy() call was removed from external_media_rtp_udp().

* The ast_variables_destroy() call was removed from
  external_media_audiosocket_tcp(), its `endpoint` allocation was changed to
  to use ast_asprintf() as external_media_rtp_udp() does, and it now
  returns an error on failure.

* ast_ari_channels_external_media() now checks the new return code from
  external_media_audiosocket_tcp() and sets the appropriate error response.

Resolves: #1109
(cherry picked from commit 1a1eb8821185c0f4945d6ca0654ea6763e1560fb)

4 months agoari/pjsip: Make it possible to control transfers through ARI
Holger Hans Peter Freyther [Sat, 15 Jun 2024 08:01:58 +0000 (16:01 +0800)] 
ari/pjsip: Make it possible to control transfers through ARI

Introduce a ChannelTransfer event and the ability to notify progress to
ARI. Implement emitting this event from the PJSIP channel instead of
handling the transfer in Asterisk when configured.

Introduce a dialplan function to the PJSIP channel to switch between the
"core" and "ari-only" behavior.

UserNote: Call transfers on the PJSIP channel can now be controlled by
ARI. This can be enabled by using the PJSIP_TRANSFER_HANDLING(ari-only)
dialplan function.

(cherry picked from commit a0d0c47d064206b61b958a016322dd3b1144ed3c)

4 months ago.github: Remove concurrency check in on-labelled workflows.
George Joseph [Tue, 11 Feb 2025 20:59:17 +0000 (13:59 -0700)] 
.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 d53f96b6afb74ff44df7c8882857ff1ae55c0172)

4 months agochannel.c: Remove dead AST_GENERATOR_FD code.
Sean Bright [Thu, 6 Feb 2025 16:35:27 +0000 (11:35 -0500)] 
channel.c: Remove dead AST_GENERATOR_FD code.

Nothing ever sets the `AST_GENERATOR_FD`, so this block of code will
never execute. It also is the only place where the `generate` callback
is called with the channel lock held which made it difficult to reason
about the thread safety of `ast_generator`s.

In passing, also note that `AST_AGENT_FD` isn't used either.

(cherry picked from commit 46017ea15bf5ee482dcc05ad44ffd2c6695d9281)

4 months ago.github: Move PRChanged,PRChangedPriv,PRCPCheck,PRReCheck,PRMerge logic.
George Joseph [Tue, 11 Feb 2025 15:40:14 +0000 (08:40 -0700)] 
.github: Move PRChanged,PRChangedPriv,PRCPCheck,PRReCheck,PRMerge logic.

Moved to asterisk-ci-actions reusable workflows.

(cherry picked from commit 595739a21ca6a7899c8c8c6ec232fddf4b04f931)

4 months ago.github: OnPRCherryPickTest,OnPRStateChanged,OnPRRecheck: Add job summaries.
George Joseph [Sat, 8 Feb 2025 21:21:17 +0000 (14:21 -0700)] 
.github: OnPRCherryPickTest,OnPRStateChanged,OnPRRecheck: Add job summaries.

...and refactor environment variables.

(cherry picked from commit 9b1616e501ea22d40493174537e1c0f6dad7e664)

4 months ago.github: Clean up CreateDocs
George Joseph [Mon, 10 Feb 2025 18:44:18 +0000 (11:44 -0700)] 
.github: Clean up CreateDocs

(cherry picked from commit ad0f268c5b3da497603f499411d729cc0c779a55)

4 months agofunc_strings.c: Prevent SEGV in HASH single-argument mode.
George Joseph [Thu, 30 Jan 2025 15:49:33 +0000 (08:49 -0700)] 
func_strings.c: Prevent SEGV in HASH single-argument mode.

When in single-argument mode (very rarely used), a malformation of a column
name (also very rare) could cause a NULL to be returned when retrieving the
channel variable for that column.  Passing that to strncat causes a SEGV.  We
now check for the NULL and print a warning message.

Resolves: #1101
(cherry picked from commit 6574f6532d964ca6f31ff04b0a6d0f3b7aa7f215)

4 months agodocs: Add version information to AGI command XML elements.
George Joseph [Fri, 24 Jan 2025 20:55:47 +0000 (13:55 -0700)] 
docs: Add version information to AGI command XML elements.

This process was a bit different than the others because everything
is in the same file, there's an array that contains the command
names and their handler functions, and the last command was created
over 15 years ago.

* Dump a `git blame` of res/res_agi.c from BEFORE the handle_* prototypes
  were changed.
* Create a command <> handler function xref by parsing the the agi_command
  array.
* For each entry, grep the function definition line "static int handle_*"
  from the git blame output and capture the commit.  This will be the
  commit the command was created in.
* Do a `git tag --contains <commit> | sort -V | head -1` to get the
  tag the function was created in.
* Add a single since/version element to the command XML.  Multiple versions
  aren't supported here because the branching and tagging scheme changed
  several times in the 2000's.

(cherry picked from commit 8dd5c2349417c0b463e87082c254eefe10e2c4fe)

4 months agodocs: Fix minor typo in MixMonitor AMI action
Jeremy LainĂ© [Tue, 28 Jan 2025 15:25:32 +0000 (16:25 +0100)] 
docs: Fix minor typo in MixMonitor AMI action

The `Options` argument was erroneously documented as lowercase
`options`.

(cherry picked from commit 85538b6d715097de9809c4fe562b832cbf4aa035)

4 months agoutils: Disable old style definition warnings for libdb.
Naveen Albert [Fri, 24 Jan 2025 01:08:23 +0000 (20:08 -0500)] 
utils: Disable old style definition warnings for libdb.

Newer versions of gcc now warn about old style definitions, such
as those in libdb, which causes compilation failure with DEVMODE
enabled. Ignore these warnings for libdb.

Resolves: #1085
(cherry picked from commit 5b2f36ffae330961a43503db83114618e4667848)

4 months agortp.conf.sample: Correct stunaddr example.
fabriziopicconi [Wed, 25 Sep 2024 09:54:01 +0000 (11:54 +0200)] 
rtp.conf.sample: Correct stunaddr example.

(cherry picked from commit 4d9a73af71eca4c6509f45b626b09709e22880a7)

4 months agodocs: Add version information to ARI resources and methods.
George Joseph [Mon, 27 Jan 2025 15:30:40 +0000 (08:30 -0700)] 
docs: Add version information to ARI resources and methods.

* Dump a git blame of each file in rest-api/api-docs.

* Get the commit for each "resourcePath" and "httpMethod" entry.

* Find the tags for each commit (same as other processes).

* Insert a "since" array after each "resourcePath" and "httpMethod" entry.

(cherry picked from commit bbc0a609fc8a7c60b5cf62fb223ea5c193145721)

4 months agodocs: Indent <since> tags.
Sean Bright [Thu, 23 Jan 2025 21:35:58 +0000 (16:35 -0500)] 
docs: Indent <since> tags.

Also updates the 'since' of applications/functions that existed before
XML documentation was introduced (1.6.2.0).

(cherry picked from commit 67e89b3e77b56186b334e546ddb389579c20f3b1)

6 months agoUpdate for 22.2.0 22.2.0
Asterisk Development Team [Thu, 6 Feb 2025 17:18:25 +0000 (17:18 +0000)] 
Update for 22.2.0

6 months agoUpdate for 22.2.0-rc2 22.2.0-rc2
Asterisk Development Team [Thu, 30 Jan 2025 16:28:53 +0000 (16:28 +0000)] 
Update for 22.2.0-rc2

6 months agores_pjsip_authenticator_digest: Make correct error messages appear again.
George Joseph [Tue, 28 Jan 2025 16:14:34 +0000 (09:14 -0700)] 
res_pjsip_authenticator_digest: Make correct error messages appear again.

When an incoming request can't be matched to an endpoint, the "artificial"
auth object is used to create a challenge to return in a 401 response and we
emit a "No matching endpoint found" log message. If the client then responds
with an Authorization header but the request still can't be matched to an
endpoint, the verification will fail and, as before, we'll create a challenge
to return in a 401 response and we emit a "No matching endpoint found" log
message.  HOWEVER, because there WAS an Authorization header and it failed
verification, we should have also been emitting a "Failed to authenticate"
log message but weren't because there was a check that short-circuited that
it if the artificial auth was used.  Since many admins use the "Failed to
authenticate" message with log parsers like fail2ban, those attempts were not
being recognized as suspicious.

Changes:

* digest_check_auth() now always emits the "Failed to authenticate" log
  message if verification of an Authorization header failed even if the
  artificial auth was used.

* The verification logic was refactored to be clearer about the handling
  of the return codes from verify().

* Comments were added clarify what return codes digest_check_auth() should
  return to the distributor and the implications of changing them.

Resolves: #1095

6 months agoalembic: Database updates required.
George Joseph [Tue, 28 Jan 2025 16:51:42 +0000 (09:51 -0700)] 
alembic: Database updates required.

This commit doesn't actually change anything.  It just adds the following
upgrade notes that were omitted from the original commits.

Resolves: #1097

UpgradeNote: Two commits in this release...
'Add SHA-256 and SHA-512-256 as authentication digest algorithms'
'res_pjsip: Add new AOR option "qualify_2xx_only"'
...have modified alembic scripts for the following database tables: ps_aors,
ps_contacts, ps_auths, ps_globals. If you don't use the scripts to update
your database, reads from those tables will succeeed but inserts into the
ps_contacts table by res_pjsip_registrar will fail.

6 months agores_pjsip: Fix startup/reload memory leak in config_auth.
George Joseph [Thu, 23 Jan 2025 21:02:25 +0000 (14:02 -0700)] 
res_pjsip: Fix startup/reload memory leak in config_auth.

An issue in config_auth.c:ast_sip_auth_digest_algorithms_vector_init() was
causing double allocations for the two supported_algorithms vectors to the
tune of 915 bytes.  The leak only happens on startup and when a reload is done
and doesn't get bigger with the number of auth objects defined.

* Pre-initialized the two vectors in config_auth:auth_alloc().
* Removed the allocations in ast_sip_auth_digest_algorithms_vector_init().
* Added a note to the doc for ast_sip_auth_digest_algorithms_vector_init()
  noting that the vector passed in should be initialized and empty.
* Simplified the create_artificial_auth() function in pjsip_distributor.
* Set the vector initialization count to 0 in config_global:global_apply().

6 months agoUpdate for 22.2.0-rc1 22.2.0-rc1
Asterisk Development Team [Thu, 23 Jan 2025 18:42:32 +0000 (18:42 +0000)] 
Update for 22.2.0-rc1

6 months agodocs: Add version information to application and function XML elements
George Joseph [Thu, 23 Jan 2025 16:27:32 +0000 (09:27 -0700)] 
docs: Add version information to application and function XML elements

* Do a git blame on the embedded XML application or function element.

* From the commit hash, grab the summary line.

* Do a git log --grep <summary> to find the cherry-pick commits in all
  branches that match.

* Do a git patch-id to ensure the commits are all related and didn't get
  a false match on the summary.

* Do a git tag --contains <commit> to find the tags that contain each
  commit.

* Weed out all tags not ..0.

* Sort and discard any .0.0 and following tags where the commit
  appeared in an earlier branch.

* The result is a single tag for each branch where the application or function
  was defined.

The applications and functions defined in the following files were done by
hand because the XML was extracted from the C source file relatively recently.
* channels/pjsip/dialplan_functions_doc.xml
* main/logger_doc.xml
* main/manager_doc.xml
* res/res_geolocation/geoloc_doc.xml
* res/res_stir_shaken/stir_shaken_doc.xml

(cherry picked from commit f6a193e87eaa04af0058c45d78e2c41f5c94dcea)

6 months agodocs: Add version information to manager event instance XML elements
George Joseph [Mon, 20 Jan 2025 18:33:20 +0000 (11:33 -0700)] 
docs: Add version information to manager event instance XML elements

* Do a git blame on the embedded XML managerEvent elements.

* From the commit hash, grab the summary line.

* Do a git log --grep <summary> to find the cherry-pick commits in all
  branches that match.

* Do a git patch-id to ensure the commits are all related and didn't get
  a false match on the summary.

* Do a git tag --contains <commit> to find the tags that contain each
  commit.

* Weed out all tags not ..0.

* Sort and discard any .0.0 and following tags where the commit
  appeared in an earlier branch.

* The result is a single tag for each branch where the application or function
  was defined.

The events defined in res/res_pjsip/pjsip_manager.xml were done by hand
because the XML was extracted from the C source file relatively recently.

Two bugs were fixed along the way...

* The get_documentation awk script was exiting after it processed the first
  DOCUMENTATION block it found in a file.  We have at least 1 source file
  with multiple DOCUMENTATION blocks so only the first one in them was being
  processed.  The awk script was changed to continue searching rather
  than exiting after the first block.

* Fixing the awk script revealed an issue in logger.c where the third
  DOCUMENTATION block contained a XML fragment that consisted only of
  a managerEventInstance element that wasn't wrapped in a managerEvent
  element.  Since logger_doc.xml already existed, the remaining fragments
  in logger.c were moved to it and properly organized.

(cherry picked from commit 936e88512e41c7fd5db5fb1628759ae591b50be2)

6 months agoLICENSE: Update company name, email, and address.
Joshua C. Colp [Tue, 21 Jan 2025 22:22:46 +0000 (18:22 -0400)] 
LICENSE: Update company name, email, and address.

(cherry picked from commit cf18bd6fd1cb62daa684881e96b43840da83b8a8)

6 months agores_prometheus.c: Set Content-Type header on /metrics response.
Sean Bright [Tue, 21 Jan 2025 23:37:54 +0000 (18:37 -0500)] 
res_prometheus.c: Set Content-Type header on /metrics response.

This should resolve the Prometheus error:

> Error scraping target: non-compliant scrape target
  sending blank Content-Type and no
  fallback_scrape_protocol specified for target.

Resolves: #1075
(cherry picked from commit 2d958812ad3be76ae20bf147bda4a74b7d1d66c3)

6 months agoREADME.md, asterisk.c: Update Copyright Dates
George Joseph [Mon, 20 Jan 2025 19:58:18 +0000 (12:58 -0700)] 
README.md, asterisk.c: Update Copyright Dates

(cherry picked from commit d52cd705d3f25f8492a6fc746af0152a391b09ff)

6 months agodocs: Add version information to configObject and configOption XML elements
George Joseph [Thu, 16 Jan 2025 21:54:35 +0000 (14:54 -0700)] 
docs: Add version information to configObject and configOption XML elements

Most of the configObjects and configOptions that are implemented with
ACO or Sorcery now have `<since>/<version>` elements added.  There are
probably some that the script I used didn't catch.  The version tags were
determined by the following...
 * Do a git blame on the API call that created the object or option.
 * From the commit hash, grab the summary line.
 * Do a `git log --grep <summary>` to find the cherry-pick commits in all
   branches that match.
 * Do a `git patch-id` to ensure the commits are all related and didn't get
   a false match on the summary.
 * Do a `git tag --contains <commit>` to find the tags that contain each
   commit.
 * Weed out all tags not <major>.<minor>.0.
 * Sort and discard any <major>.0.0 and following tags where the commit
   appeared in an earlier branch.
 * The result is a single tag for each branch where the API was last touched.

configObjects and configOptions elements implemented with the base
ast_config APIs were just not possible to find due to the non-deterministic
way they are accessed.

Also note that if the API call was on modified after it was added, the
version will be the one it was last modified in.

Final note:  The configObject and configOption elements were introduced in
12.0.0 so options created before then may not have any XML documentation.

(cherry picked from commit 772221c82a63b30c6381d7b758e0b2a8d1e40373)

6 months agores_pjsip_authenticator_digest: Fix issue with missing auth and DONT_OPTIMIZE
George Joseph [Fri, 17 Jan 2025 16:20:16 +0000 (09:20 -0700)] 
res_pjsip_authenticator_digest: Fix issue with missing auth and DONT_OPTIMIZE

The return code fom digest_check_auth wasn't explicitly being initialized.
The return code also wasn't explicitly set to CHALLENGE when challenges
were sent.  When optimization was turned off (DONT_OPTIMIZE), the compiler
was setting it to "0"(CHALLENGE) which worked fine.  However, with
optimization turned on, it was setting it to "1" (SUCCESS) so if there was
no incoming Authorization header, the function was returning SUCCESS to the
distributor allowing the request to incorrectly succeed.

The return code is now initialized correctly and is now explicitly set
to CHALLENGE when we send challenges.

(cherry picked from commit fb533fcc73aa045063d2bf29940dcb6308a25946)

6 months agoast_tls_cert: Add option to skip passphrase for CA private key.
Naveen Albert [Tue, 14 Jan 2025 22:49:53 +0000 (17:49 -0500)] 
ast_tls_cert: Add option to skip passphrase for CA private key.

Currently, the ast_tls_cert file is hardcoded to use the -des3 option
for 3DES encryption, and the script needs to be manually modified
to not require a passphrase. Add an option (-e) that disables
encryption of the CA private key so no passphrase is required.

Resolves: #1064
(cherry picked from commit eca4ec6b5ea29a7ab9a67fb21fbe0b93b214c9f1)

6 months agochan_iax2: Avoid unnecessarily backlogging non-voice frames.
Naveen Albert [Fri, 10 Jan 2025 01:49:14 +0000 (20:49 -0500)] 
chan_iax2: Avoid unnecessarily backlogging non-voice frames.

Currently, when receiving an unauthenticated call, we keep track
of the negotiated format in the chosenformat, which allows us
to later create the channel using the right format. However,
this was not done for authenticated calls. This meant that in
certain circumstances, if we had not yet received a voice frame
from the peer, only certain other types of frames (e.g. text),
there were no variables containing the appropriate frame.
This led to problems in the jitterbuffer callback where we
unnecessarily bailed out of retrieving a frame from the jitterbuffer.
This was logic intentionally added in commit 73103bdcd5b342ce5dfa32039333ffadad551151
in response to an earlier regression, and while this prevents
crashes, it also backlogs legitimate frames unnecessarily.

The abort logic was initially added because at this point in the
code, we did not have the negotiated format available to us.
However, it should always be available to us as a last resort
in chosenformat, so we now pull it from there if needed. This
allows us to process frames the jitterbuffer even if voicefmt
and peerfmt aren't set and still avoid the crash. The failsafe
logic is retained, but now it shouldn't be triggered anymore.

Resolves: #1054
(cherry picked from commit 1b0cd8b10dc0f84199c0752b2441ebbbb6fce058)

6 months agoconfig.c: fix #tryinclude being converted to #include on rewrite
Allan Nathanson [Mon, 16 Sep 2024 18:58:59 +0000 (14:58 -0400)] 
config.c: fix #tryinclude being converted to #include on rewrite

Correct an issue in ast_config_text_file_save2() when updating configuration
files with "#tryinclude" statements. The API currently replaces "#tryinclude"
with "#include". The API also creates empty template files if the referenced
files do not exist. This change resolves these problems.

Resolves: https://github.com/asterisk/asterisk/issues/920
(cherry picked from commit 7e58e8d4f6cf550d58c0ce6cdbafc8e54ff6bf5b)

6 months agosig_analog: Add Last Number Redial feature.
Naveen Albert [Fri, 10 Nov 2023 13:30:33 +0000 (08:30 -0500)] 
sig_analog: Add Last Number Redial feature.

This adds the Last Number Redial feature to
simple switch.

UserNote: Users can now redial the last number
called if the lastnumredial setting is set to yes.

Resolves: #437
(cherry picked from commit abfa8206f383665621b0c0cc1c102020e6cd3c6d)

6 months agodocs: Various XML fixes
George Joseph [Wed, 15 Jan 2025 23:19:27 +0000 (16:19 -0700)] 
docs: Various XML fixes

* channels/pjsip/dialplan_functions_doc.xml: Added xmlns:xi to docs element.

* main/bucket.c: Removed XML completely since the "bucket" and "file" objects
  are internal only with no config file.

* main/named_acl.c: Fixed the configFile element name. It was "named_acl.conf"
  and should have been "acl.conf"

* res/res_geolocation/geoloc_doc.xml: Added xmlns:xi to docs element.

* res/res_http_media_cache.c: Fixed the configFile element name. It was
  "http_media_cache.conf" and should have been "res_http_media_cache.conf".

(cherry picked from commit 15ed3577472e0f9295eae10d0c07721c853b9f65)

6 months agostrings.c: Improve numeric detection in `ast_strings_match()`.
Sean Bright [Wed, 15 Jan 2025 16:42:29 +0000 (11:42 -0500)] 
strings.c: Improve numeric detection in `ast_strings_match()`.

Essentially, we were treating 1234x1234 and 1234x5678 as 'equal'
because we were able to convert the prefix of each of these strings to
the same number.

Resolves: #1028
(cherry picked from commit dafac1f6f4e163901bb888e791417d11e2406dad)

6 months agodocs: Enable since/version handling for XML, CLI and ARI documentation
George Joseph [Thu, 9 Jan 2025 22:17:14 +0000 (15:17 -0700)] 
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 3c867e6e6c2c76600b82805f1bb8d54d1398a01f)

6 months agologger.h: Fix build when AST_DEVMODE is not defined.
Artem Umerov [Mon, 13 Jan 2025 16:28:45 +0000 (19:28 +0300)] 
logger.h: Fix build when AST_DEVMODE is not defined.

Resolves: #1058
(cherry picked from commit 92d69897b7251bcd5d79467c333104eeb10f8a1c)

6 months agodialplan_functions_doc.xml: Document PJSIP_MEDIA_OFFER's `media` argument.
Sean Bright [Tue, 14 Jan 2025 16:45:15 +0000 (11:45 -0500)] 
dialplan_functions_doc.xml: Document PJSIP_MEDIA_OFFER's `media` argument.

Resolves: #1023
(cherry picked from commit 032235bd296d379ac6b5e7db4a11bac5069f9510)

6 months agosamples: Use "asterisk" instead of "postgres" for username
Abdelkader Boudih [Tue, 7 Jan 2025 20:17:56 +0000 (21:17 +0100)] 
samples: Use "asterisk" instead of "postgres" for username

(cherry picked from commit 4b6d40bd6615da84a149d4d7ae6e295a5dba4438)

6 months agomanager: Add `<since>` tags for all AMI actions.
Sean Bright [Thu, 2 Jan 2025 19:38:30 +0000 (14:38 -0500)] 
manager: Add `<since>` tags for all AMI actions.

(cherry picked from commit 131682c2c51e7a84ccd18374b21d163d43eb7efc)

6 months agologger.c fix: malformed JSON template
Steffen Arntz [Wed, 8 Jan 2025 16:57:54 +0000 (17:57 +0100)] 
logger.c fix: malformed JSON template

this typo was mentioned before, but never got fixed.
https://community.asterisk.org/t/logger-cannot-log-long-json-lines-properly/87618/6

(cherry picked from commit d31b79b2f8a336b0296b9fe576f10d61378b8b58)

6 months agomanager.c: Rename restrictedFile to is_restricted_file.
Sean Bright [Thu, 9 Jan 2025 19:34:39 +0000 (14:34 -0500)] 
manager.c: Rename restrictedFile to is_restricted_file.

Also correct the spelling of 'privileges.'

(cherry picked from commit e4635e817ff249c2a8722e7c76b0514e757d642f)

6 months agores_config_pgsql: normalize database connection option with cel and cdr by supporting...
Abdelkader Boudih [Wed, 8 Jan 2025 22:00:39 +0000 (23:00 +0100)] 
res_config_pgsql: normalize database connection option with cel and cdr by supporting new options name

(cherry picked from commit 7c40d82f0279d7cd4d4217e8d4587f33bb2cfbbc)

6 months agores_pjproject: Fix typo (OpenmSSL->OpenSSL)
Stanislav Abramenkov [Fri, 10 Jan 2025 17:12:41 +0000 (19:12 +0200)] 
res_pjproject: Fix typo (OpenmSSL->OpenSSL)

Fix typo (OpenmSSL->OpenSSL) mentioned by bkford in #972

(cherry picked from commit e95f97ad383e72a450edd0736981b1710c79fb52)

6 months agoAdd SHA-256 and SHA-512-256 as authentication digest algorithms
George Joseph [Thu, 17 Oct 2024 14:02:08 +0000 (08:02 -0600)] 
Add SHA-256 and SHA-512-256 as authentication digest algorithms

* Refactored pjproject code to support the new algorithms and
added a patch file to third-party/pjproject/patches

* Added new parameters to the pjsip auth object:
  * password_digest = <algorithm>:<digest>
  * supported_algorithms_uac = List of algorithms to support
    when acting as a UAC.
  * supported_algorithms_uas = List of algorithms to support
    when acting as a UAS.
  See the auth object in pjsip.conf.sample for detailed info.

* Updated both res_pjsip_authenticator_digest.c (for UAS) and
res_pjsip_outbound_authentocator_digest.c (UAC) to suport the
new algorithms.

The new algorithms are only available with the bundled version
of pjproject, or an external version > 2.14.1.  OpenSSL version
1.1.1 or greater is required to support SHA-512-256.

Resolves: #948

UserNote: The SHA-256 and SHA-512-256 algorithms are now available
for authentication as both a UAS and a UAC.

(cherry picked from commit 7dc9d85f2bf12f5e39530fc26786f4405d82c86b)

6 months agoconfig.c: retain leading whitespace before comments
Allan Nathanson [Wed, 30 Oct 2024 20:52:41 +0000 (16:52 -0400)] 
config.c: retain leading whitespace before comments

Configurations loaded with the ast_config_load2() API and later written
out with ast_config_text_file_save2() will have any leading whitespace
stripped away.  The APIs should make reasonable efforts to maintain the
content and formatting of the configuration files.

This change retains any leading whitespace from comment lines that start
with a ";".

Resolves: https://github.com/asterisk/asterisk/issues/970
(cherry picked from commit 1cb741df4aaa3588281f1c19524822b89bce61ae)

6 months agoconfig.c: Fix off-nominal reference leak.
Sean Bright [Tue, 7 Jan 2025 16:34:04 +0000 (11:34 -0500)] 
config.c: Fix off-nominal reference leak.

This was identified and fixed by @Allan-N in #918 but it is an
important fix in its own right.

The fix here is slightly different than Allan's in that we just move
the initialization of the problematic AO2 container to where it is
first used.

Fixes #1046

(cherry picked from commit 6b3dadfbe27404d995fdbbc4d31e2b3d5ed2fca6)

6 months agonormalize contrib/ast-db-manage/queue_log.ini.sample
Abdelkader Boudih [Sun, 5 Jan 2025 14:08:24 +0000 (15:08 +0100)] 
normalize contrib/ast-db-manage/queue_log.ini.sample

(cherry picked from commit cc2b5ec88bf9560ce29bf0b8fe6f7202990a7af2)

6 months agoAdd C++ Standard detection to configure and fix a new C++20 compile issue
George Joseph [Fri, 3 Jan 2025 22:38:52 +0000 (15:38 -0700)] 
Add C++ Standard detection to configure and fix a new C++20 compile issue

* The autoconf-archive package contains macros useful for detecting C++
  standard and testing other C++ capabilities but that package was never
  included in the install_prereq script so many existing build environments
  won't have it.  Even if it is installed, older versions won't newer C++
  standards and will actually cause an error if you try to test for that
  version. To make it available for those environments, the
  ax_cxx_compile_stdcxx.m4 macro has copied from the latest release of
  autoconf-archive into the autoconf directory.

* A convenience wrapper(ast_cxx_check_std) around ax_cxx_compile_stdcxx was
  also added so checking the standard version and setting the
  asterisk-specific PBX_ variables becomes a one-liner:
  `AST_CXX_CHECK_STD([std], [force_latest_std])`.
  Calling that with a version of `17` for instance, will set PBX_CXX17
  to 0 or 1 depending on whether the current c++ compiler supports stdc++17.
  HAVE_CXX17 will also be 'defined" or not depending on the result.

* C++ compilers hardly ever default to the latest standard they support.  g++
  version 14 for instance supports up to C++23 but only uses C++17 by default.
  If you want to use C++23, you have to add `-std=gnu++=23` to the g++
  command line.  If you set the second argument of AST_CXX_CHECK_STD to "yes",
  the macro will automatically keep the highest `-std=gnu++` value that
  worked and pass that to the Makefiles.

* The autoconf-archive package was added to install_prereq for future use.

* Updated configure.ac to use AST_CXX_CHECK_STD() to check for C++
  versions 11, 14, 17, 20 and 23.

* Updated configure.ac to accept the `--enable-latest-cxx-std` option which
  will set the second option to AST_CXX_CHECK_STD() to "yes".  The default
  is "no".

* ast_copy_string() in strings.h declares the 'sz' variable as volatile and
  does an `sz--` on it later.  C++20 no longer allows the `++` and `--`
  increment and decrement operators to be used on variables declared as
  volatile however so that was changed to `sz -= 1`.

(cherry picked from commit 79427c1ac1ddb917a37e636e617c8aa00438f04f)

6 months agochan_dahdi: Fix wrong channel state when RINGING recieved.
Naveen Albert [Mon, 16 Dec 2024 13:43:04 +0000 (08:43 -0500)] 
chan_dahdi: Fix wrong channel state when RINGING recieved.

Previously, when AST_CONTROL_RINGING was received by
a DAHDI device, it would set its channel state to
AST_STATE_RINGING. However, an analysis of the codebase
and other channel drivers reveals RINGING corresponds to
physical power ringing, whereas AST_STATE_RING should be
used for audible ringback on the channel. This also ensures
the correct device state is returned by the channel state
to device state conversion.

Since there seems to be confusion in various places regarding
AST_STATE_RING vs. AST_STATE_RINGING, some documentation has
been added or corrected to clarify the actual purposes of these
two channel states, and the associated device state mapping.

An edge case that prompted this fix, but isn't explicitly
addressed here, is that of an incoming call to an FXO port.
The channel state will be "Ring", which maps to a device state
of "In Use", not "Ringing" as would be more intuitive. However,
this is semantic, since technically, Asterisk is treating this
the same as any other incoming call, and so "Ring" is the
semantic state (put another way, Asterisk isn't ringing anything,
like in the cases where channels are in the "Ringing" state).

Since FXO ports don't currently support Call Waiting, a suitable
workaround for the above would be to ignore the device state and
instead check the channel state (e.g. IMPORT(DAHDI/1-1,CHANNEL(state)))
since it will be Ring if the FXO port is idle (but a call is ringing
on it) and Up if the FXO port is actually in use. (In both cases,
the device state would misleadingly be "In Use".)

Resolves: #1029
(cherry picked from commit afd15274e780632a6ec7f44ded8557da27bb4159)

6 months agoUpgrade bundled pjproject to 2.15.1
Stanislav Abramenkov [Tue, 3 Dec 2024 20:25:40 +0000 (22:25 +0200)] 
Upgrade bundled pjproject to 2.15.1
Resolves: asterisk#1016

UserNote: Bundled pjproject has been upgraded to 2.15.1. For more
information visit pjproject Github page: https://github.com/pjsip/pjproject/releases/tag/2.15.1

(cherry picked from commit 2e8d8c4a08f48128e715af4749f7f4710748c368)

6 months ago.github: Set exit 0 in CherryPick and Recheck workflow Cleanup steps
George Joseph [Sun, 5 Jan 2025 17:35:22 +0000 (10:35 -0700)] 
.github: Set exit 0 in CherryPick and Recheck workflow Cleanup steps

(cherry picked from commit 5beb61317a4ce408f5c7f9d7ba80591e25734a7d)

6 months agogcc14: Fix issues caught by gcc 14
George Joseph [Fri, 3 Jan 2025 21:02:22 +0000 (14:02 -0700)] 
gcc14: Fix issues caught by gcc 14

* test_message.c: Fix segfaults caused by passing NULL as an sprintf fmt.

(cherry picked from commit 6fa7c40b57584066da8f4f259c8d0c9f82bf19b7)

6 months agoHeader fixes for compiling C++ source files
George Joseph [Tue, 31 Dec 2024 18:10:20 +0000 (11:10 -0700)] 
Header fixes for compiling C++ source files

A few tweaks needed to be done to some existing header files to allow them to
be compiled when included from C++ source files.

logger.h had declarations for ast_register_verbose() and
ast_unregister_verbose() which caused C++ issues but those functions were
actually removed from logger.c many years ago so the declarations were just
removed from logger.h.

(cherry picked from commit e677ec847323eea2969215c3f1bcf00372605d33)

6 months agoAdd ability to pass arguments to unit tests from the CLI
George Joseph [Fri, 27 Dec 2024 15:19:08 +0000 (08:19 -0700)] 
Add ability to pass arguments to unit tests from the CLI

Unit tests can now be passed custom arguments from the command
line.  For example, the following command would run the "mytest" test
in the "/main/mycat" category with the option "myoption=54"

`CLI> test execute category /main/mycat name mytest options myoption=54`

You can also pass options to an entire category...

`CLI> test execute category /main/mycat options myoption=54`

Basically, everything after the "options" keyword is passed verbatim to
the test which must decide what to do with it.

* A new API ast_test_get_cli_args() was created to give the tests access to
the cli_args->argc and cli_args->argv elements.

* Although not needed for the option processing, a new macro
ast_test_validate_cleanup_custom() was added to test.h that allows you
to specify a custom error message instead of just "Condition failed".

* The test_skel.c was updated to demonstrate parsing options and the use
of the ast_test_validate_cleanup_custom() macro.

(cherry picked from commit 2fa9dcd51cb462da23daa753a9d9e373fa9fedcd)

6 months agores_pjsip: Add new AOR option "qualify_2xx_only"
Kent [Tue, 3 Dec 2024 14:24:44 +0000 (08:24 -0600)] 
res_pjsip: Add new AOR option "qualify_2xx_only"

Added a new option "qualify_2xx_only" to the res_pjsip AOR qualify
feature to mark a contact as available only if an OPTIONS request
returns a 2XX response. If the option is not specified or is false,
any response to the OPTIONS request marks the contact as available.

UserNote: The pjsip.conf AOR section now has a "qualify_2xx_only"
option that can be set so that only 2XX responses to OPTIONS requests
used to qualify a contact will mark the contact as available.

(cherry picked from commit 21dba60ff2a0d29d1bef5da33b77c7c7392d7156)

6 months ago.github: Change the run name for OnPRStateChangedPriv
George Joseph [Wed, 18 Dec 2024 15:16:51 +0000 (08:16 -0700)] 
.github: Change the run name for OnPRStateChangedPriv

(cherry picked from commit 865c8b82322ac2464ce6ca2b5ab8f3b6e49543ab)

6 months agores_odbc: release threads from potential starvation.
Jaco Kroon [Tue, 10 Dec 2024 19:47:49 +0000 (21:47 +0200)] 
res_odbc: release threads from potential starvation.

Whenever a slot is freed up due to a failed connection, wake up a waiter
before failing.

In the case of a dead connection there could be waiters, for example,
let's say two threads tries to acquire objects at the same time, with
one in the cached connections, one will acquire the dead connection, and
the other will enter into the wait state.  The thread with the dead
connection will clear up the dead connection, and then attempt a
re-acquire (at this point there cannot be cached connections else the
other thread would have received that and tried to clean up), as such,
at this point we're guaranteed that either there are no waiting threads,
or that the maxconnections - connection_cnt threads will attempt to
re-acquire connections, and then either succeed, using those
connections, or failing, and then signalling to release more waiters.

Also fix the pointer log for ODBC handle %p dead which would always
reflect NULL.

Signed-off-by: Jaco Kroon <jaco@uls.co.za>
(cherry picked from commit 9b45103bc815ccf74d1a4c3e1498bdfd4f8bbda8)

6 months agoapp_queue: indicate the paused state of a dynamically added member in queue_log.
Sperl Viktor [Thu, 5 Dec 2024 16:55:10 +0000 (17:55 +0100)] 
app_queue: indicate the paused state of a dynamically added member in queue_log.

Fixes: #1021
(cherry picked from commit d832aae1d7bb49cf0f4723028ea37c7c09afab78)

6 months agoAllow C++ source files (as extension .cc) in the main directory
George Joseph [Mon, 9 Dec 2024 19:54:53 +0000 (12:54 -0700)] 
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 9a1180c6af22f20bc9891986f77dc8eef72ec92b)

6 months agoformat_gsm.c: Added mime type
Alexey Khabulyak [Tue, 3 Dec 2024 09:53:10 +0000 (12:53 +0300)] 
format_gsm.c: Added mime type

Sometimes it's impossible to get a file extension from URL
(eg. http://example.com/gsm/your) so we have to rely on content-type header.
Currenly, asterisk does not support content-type for gsm format(unlike wav).
Added audio/gsm according to https://www.rfc-editor.org/rfc/rfc4856.html

(cherry picked from commit ced3b41327fd06b049061bcb6691926cf1359ac6)

6 months agofunc_uuid: Add a new dialplan function to generate UUIDs
Maksim Nesterov [Sun, 1 Dec 2024 19:42:50 +0000 (19:42 +0000)] 
func_uuid: Add a new dialplan function to generate UUIDs

This function is useful for uniquely identifying calls, recordings, and other entities in distributed environments, as well as for generating an argument for the AudioSocket application.

(cherry picked from commit c50dea93a5524a59285e4d693b2842d7e032dc8d)

6 months agoapp_queue: allow dynamically adding a queue member in paused state.
Sperl Viktor [Wed, 27 Nov 2024 16:36:39 +0000 (17:36 +0100)] 
app_queue: allow dynamically adding a queue member in paused state.

Fixes: #1007
UserNote: use the p option of AddQueueMember() for paused member state.
Optionally, use the r(reason) option to specify a custom reason for the pause.

(cherry picked from commit 7b7df5d30eb4bbde432cc9834b2eb77d01c4c78f)

6 months agochan_iax2: Add log message for rejected calls.
Naveen Albert [Mon, 6 Nov 2023 12:31:32 +0000 (07:31 -0500)] 
chan_iax2: Add log message for rejected calls.

Add a log message for a path that currently silently drops IAX2
frames without indicating that anything is wrong.

(cherry picked from commit be2bea854ed2da4951727f421910c3bff60e2444)

6 months agochan_pjsip: Send VIDUPDATE RTP frame for all H.264 streams
Maximilian Fridrich [Mon, 2 Dec 2024 11:09:47 +0000 (12:09 +0100)] 
chan_pjsip: Send VIDUPDATE RTP frame for all H.264 streams

Currently, when a chan_pjsip channel receives a VIDUPDATE indication,
an RTP VIDUPDATE frame is only queued on a H.264 stream if WebRTC is
enabled on that endpoint. This restriction does not really make sense.

Now, a VIDUPDATE RTP frame is written even if WebRTC is not enabled (as
is the case with VP8, VP9, and H.265 streams).

Resolves: #1013
(cherry picked from commit 45c5d39c58a6c8a9cca0d8597046031c39b07ca0)

6 months agoaudiohook.c: resolving the issue with audiohook both reading when packet loss on...
Tinet-mucw [Thu, 22 Aug 2024 06:42:19 +0000 (14:42 +0800)] 
audiohook.c: resolving the issue with audiohook both reading when packet loss on one side of the call

When there is 0% packet loss on one side of the call and 15% packet loss on the other side, reading frame is often failed when reading direction_both audiohook. when read_factory available = 0, write_factory available = 320; i think write factory is usable read; because after reading one frame, there is still another frame that can be read together with the next read factory frame.

Resolves: #851
(cherry picked from commit 3ac5f82d4919e7d4313eba82615562964e97c6c5)

6 months agores_curl.conf.sample: clean up sample configuration and add new SSL options
Mike Pultz [Thu, 21 Nov 2024 06:11:51 +0000 (01:11 -0500)] 
res_curl.conf.sample: clean up sample configuration and add new SSL options

This update properly documents all the current configuration options supported
by the curl implementation, including the new ssl_* options.

(cherry picked from commit 424e4ee761c7079725738588f90b07bc8a128774)

6 months agores_rtp_asterisk.c: Set Mark on rtp when timestamp skew is too big
Viktor Litvinov [Tue, 1 Oct 2024 23:57:12 +0000 (01:57 +0200)] 
res_rtp_asterisk.c: Set Mark on rtp when timestamp skew is too big

Set Mark bit in rtp stream when timestamp skew is bigger than MAX_TIMESTAMP_SKEW.

Fixes: #927
(cherry picked from commit 2599aa3be018b73009f0c6a31363676abf55adcf)

6 months agores_rtp_asterisk.c: Fix bridged_payload matching with sample rate for DTMF
Alexey Vasilyev [Mon, 25 Nov 2024 08:41:48 +0000 (09:41 +0100)] 
res_rtp_asterisk.c: Fix bridged_payload matching with sample rate for DTMF

Fixes #1004

(cherry picked from commit e96d1cf2ae915b5979e5d1ec8b68566d489107e6)

6 months agomanager.c: Add Processed Call Count to CoreStatus output
Mike Pultz [Thu, 21 Nov 2024 06:42:44 +0000 (01:42 -0500)] 
manager.c: Add Processed Call Count to CoreStatus output

This update adds the processed call count to the CoreStatus AMI Action responsie. This output is
similar to the values returned by "core show channels" or "core show calls" in the CLI.

UserNote: The current processed call count is now returned as CoreProcessedCalls from the
CoreStatus AMI Action.

(cherry picked from commit 0c193b725b530ce10f3eeb016087d981956c80c8)

6 months agofunc_curl.c: Add additional CURL options for SSL requests
Mike Pultz [Sat, 9 Nov 2024 19:19:49 +0000 (14:19 -0500)] 
func_curl.c: Add additional CURL options for SSL requests

This patch adds additional CURL TLS options / options to support mTLS authenticated requests:

* ssl_verifyhost - perform a host verification on the peer certificate (CURLOPT_SSL_VERIFYHOST)
* ssl_cainfo - define a CA certificate file (CURLOPT_CAINFO)
* ssl_capath - define a CA certificate directory (CURLOPT_CAPATH)
* ssl_cert - define a client certificate for the request (CURLOPT_SSLCERT)
* ssl_certtype - specify the client certificate type (CURLOPT_SSLCERTTYPE)
* ssl_key - define a client private key for the request (CURLOPT_SSLKEY)
* ssl_keytype - specify the client private key type (CURLOPT_SSLKEYTYPE)
* ssl_keypasswd - set a password for the private key, if required (CURLOPT_KEYPASSWD)

UserNote: The following new configuration options are now available
in the res_curl.conf file, and the CURL() function: 'ssl_verifyhost'
(CURLOPT_SSL_VERIFYHOST), 'ssl_cainfo' (CURLOPT_CAINFO), 'ssl_capath'
(CURLOPT_CAPATH), 'ssl_cert' (CURLOPT_SSLCERT), 'ssl_certtype'
(CURLOPT_SSLCERTTYPE), 'ssl_key' (CURLOPT_SSLKEY), 'ssl_keytype',
(CURLOPT_SSLKEYTYPE) and 'ssl_keypasswd' (CURLOPT_KEYPASSWD). See the
libcurl documentation for more details.

(cherry picked from commit 8e289af9de23fe2ca83881b6cedb375f87345d7a)

6 months agosig_analog: Fix regression with FGD and E911 signaling.
Naveen Albert [Thu, 14 Nov 2024 14:15:45 +0000 (09:15 -0500)] 
sig_analog: Fix regression with FGD and E911 signaling.

Commit 466eb4a52b69e6dead7ebba13a83f14ef8a559c1 introduced a regression
which completely broke Feature Group D and E911 signaling, by removing
the call to analog_my_getsigstr, which affected multiple switch cases.
Restore the original behavior for all protocols except Feature Group C
CAMA (MF), which is all that patch was attempting to target.

Resolves: #993
(cherry picked from commit 4f0a506c673e02a1767bfc820a95c280ea71b6f2)

6 months agomain/stasis_channels.c: Fix crash when setting a global variable with invalid UTF8...
James Terhune [Mon, 18 Nov 2024 21:54:30 +0000 (16:54 -0500)] 
main/stasis_channels.c: Fix crash when setting a global variable with invalid UTF8 characters

Add check for null value of chan before referencing it with ast_channel_name()

Resolves: #999
(cherry picked from commit d6b7554012c13a3bb221e9fa00634881e6b68359)

6 months agores_stir_shaken: Allow sending Identity headers for unknown TNs
George Joseph [Fri, 8 Nov 2024 18:22:12 +0000 (11:22 -0700)] 
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 e9f336b47bc034561cab18b52af7fd73abe1778e)

7 months agoUpdate for 22.1.1 22.1.1
Asterisk Development Team [Thu, 9 Jan 2025 19:39:23 +0000 (19:39 +0000)] 
Update for 22.1.1

7 months agomanager.c: Restrict ListCategories to the configuration directory.
Ben Ford [Tue, 17 Dec 2024 17:42:48 +0000 (11:42 -0600)] 
manager.c: Restrict ListCategories to the configuration directory.

When using the ListCategories AMI action, it was possible to traverse
upwards through the directories to files outside of the configured
configuration directory. This action is now restricted to the configured
directory and an error will now be returned if the specified file is
outside of this limitation.

Resolves: #GHSA-33x6-fj46-6rfh

UserNote: The ListCategories AMI action now restricts files to the
configured configuration directory.

8 months agoUpdate for 22.1.0 22.1.0
Asterisk Development Team [Thu, 21 Nov 2024 17:18:07 +0000 (17:18 +0000)] 
Update for 22.1.0

8 months agores_pjsip: Change suppress_moh_on_sendonly to OPT_BOOL_T
George Joseph [Fri, 15 Nov 2024 17:24:42 +0000 (10:24 -0700)] 
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

8 months agoUpdate for 22.1.0-rc1 22.1.0-rc1
Asterisk Development Team [Thu, 14 Nov 2024 20:02:07 +0000 (20:02 +0000)] 
Update for 22.1.0-rc1

8 months agores_pjsip: Add new endpoint option "suppress_moh_on_sendonly"
George Joseph [Tue, 5 Nov 2024 18:30:55 +0000 (11:30 -0700)] 
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 03ab004e2665146771214bde158805bd44028244)

8 months agores_pjsip.c: Fix Contact header rendering for IPv6 addresses.
Sean Bright [Fri, 8 Nov 2024 13:08:42 +0000 (08:08 -0500)] 
res_pjsip.c: Fix Contact header rendering for IPv6 addresses.

Fix suggested by @nvsystems.

Fixes #985

(cherry picked from commit 1c0fcd583d6695cf5f7db367b3c0be823e2ab688)

8 months agosamples: remove and/or change some wiki mentions
chrsmj [Fri, 1 Nov 2024 17:46:20 +0000 (11:46 -0600)] 
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 c037fc7faea3274313c394a31d07340ac50f23be)

8 months agofunc_pjsip_aor/contact: Fix documentation for contact ID
George Joseph [Sat, 9 Nov 2024 22:34:41 +0000 (15:34 -0700)] 
func_pjsip_aor/contact: Fix documentation for contact ID

Clarified the use of the contact ID returned from PJSIP_AOR.

Resolves: #990
(cherry picked from commit aa736dac1265f9adac9f76d206f51131cf48405c)

8 months agores_pjsip: Move tenantid to end of ast_sip_endpoint
George Joseph [Wed, 6 Nov 2024 17:31:08 +0000 (10:31 -0700)] 
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 144033db31b33dddc6a58bfc842c5dc98852b6cb)

8 months agopjsip_transport_events: handle multiple addresses for a domain
Thomas Guebels [Tue, 29 Oct 2024 14:32:33 +0000 (15:32 +0100)] 
pjsip_transport_events: handle multiple addresses for a domain

The key used for transport monitors was the remote host name for the
transport and not the remote address resolved for this domain.

This was problematic for domains returning multiple addresses as several
transport monitors were created with the same key.

Whenever a subsystem wanted to register a callback it would always end
up attached to the first transport monitor with a matching key.

The key used for transport monitors is now the remote address and port
the transport actually connected to.

Fixes: #932
(cherry picked from commit 184a30efac73d763781784b8632749d1d5be41b7)

8 months agofunc_evalexten: Add EVAL_SUB function.
Naveen Albert [Thu, 17 Oct 2024 13:18:45 +0000 (09:18 -0400)] 
func_evalexten: Add EVAL_SUB function.

This adds an EVAL_SUB function, which is similar to the existing
EVAL_EXTEN function but significantly more powerful, as it allows
executing arbitrary dialplan and capturing its return value as
the function's output. While EVAL_EXTEN should be preferred if it
is possible to use it, EVAL_SUB can be used in a wider variety
of cases and allows arbitrary computation to be performed in
a dialplan function call, leveraging the dialplan.

Resolves: #951
(cherry picked from commit 34662cf0ea5fd3ff8d6d95ba0a20770e7ed94452)

8 months agores_srtp: Change Unsupported crypto suite msg from verbose to debug
George Joseph [Fri, 1 Nov 2024 14:22:14 +0000 (08:22 -0600)] 
res_srtp: Change Unsupported crypto suite msg from verbose to debug

There's really no point in spamming logs with a verbose message
for every unsupported crypto suite an older client may send
in an SDP.  If none are supported, there will be an error or
warning.

(cherry picked from commit 2717068e1b70a32550016214fa79de94e9ceaff3)

8 months agoAdd res_pjsip_config_sangoma external module.
Ben Ford [Fri, 1 Nov 2024 22:04:11 +0000 (17:04 -0500)] 
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 9f1f3703c9539ac5f1a6fea8bd9928c295c73993)

8 months agoapp_mixmonitor: Add 'D' option for dual-channel audio.
Ben Ford [Mon, 28 Oct 2024 19:06:29 +0000 (14:06 -0500)] 
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 4616408b0932bd67dfbfa9fb51cb2ccbeb56d0bc)

8 months agopjsip_transport_events: Avoid monitor destruction
Thomas Guebels [Mon, 28 Oct 2024 16:29:48 +0000 (17:29 +0100)] 
pjsip_transport_events: Avoid monitor destruction

When a transport is disconnected, several events can arrive following
each other. The first event will be PJSIP_TP_STATE_DISCONNECT and it
will trigger the destruction of the transport monitor object. The lookup
for the transport monitor to destroy is done using the transport key,
that contains the transport destination host:port.

A reconnect attempt by pjsip will be triggered as soon something needs to
send a packet using that transport. This can happen directly after a
disconnect since ca

Subsequent events can arrive later like PJSIP_TP_STATE_DESTROY and will
also try to trigger the destruction of the transport monitor if not
already done. Since the lookup for the transport monitor to destroy is
done using the transport key, it can match newly created transports
towards the same destination and destroy their monitor object.

Because of this, it was sometimes not possible to monitor a transport
after one or more disconnections.

This fix adds an additional check on the transport pointer to ensure
only a monitor for that specific transport is removed.

Fixes: #923
(cherry picked from commit 008ad8098a3e12097c9cb38f42495784e9176b68)

8 months ago.github: Redirect NightlyAdmin to AsteriskNightlyAdmin
George Joseph [Fri, 1 Nov 2024 13:46:44 +0000 (07:46 -0600)] 
.github: Redirect NightlyAdmin to AsteriskNightlyAdmin

(cherry picked from commit 32193addcc929c783dbaf00247921a3199843efb)

8 months agoapp_dial: Fix progress timeout calculation with no answer timeout.
Naveen Albert [Wed, 16 Oct 2024 21:46:42 +0000 (17:46 -0400)] 
app_dial: Fix progress timeout calculation with no answer timeout.

If to_answer is -1, simply comparing to see if the progress timeout
is smaller than the answer timeout to prefer it will fail. Add
an additional check that chooses the progress timeout if there is
no answer timeout (or as before, if the progress timeout is smaller).

Resolves: #821
(cherry picked from commit 4dd6074f9f47d343bfe7c290cb8365bb02babe59)

8 months agopjproject_bundled: Tweaks to support out-of-tree development
George Joseph [Thu, 17 Oct 2024 15:51:38 +0000 (09:51 -0600)] 
pjproject_bundled:  Tweaks to support out-of-tree development

* pjproject is now configured with --disable-libsrtp so it will
  build correctly when doing "out-of-tree" development.  Asterisk
  doesn't use pjproject for handling media so pjproject doesn't
  need libsrtp itself.

* The pjsua app (which we used to use for the testsuite) no longer
  builds in pjproject's master branch so we just skip it.  The
  testsuite no longer needs it anyway.

See third-party/pjproject/README-hacking.md for more info on building
pjproject "out-of-tree".

(cherry picked from commit 142bdeff5b4416b43275c5374e96c2430c222678)

8 months agoRevert "res_rtp_asterisk: Count a roll-over of the sequence number even on lost packets."
Sean Bright [Mon, 7 Oct 2024 15:29:30 +0000 (11:29 -0400)] 
Revert "res_rtp_asterisk: Count a roll-over of the sequence number even on lost packets."

This reverts commit cb5e3445be6c55517c8d05aca601b648341f8ae9.

The original change from 16 to 15 bit sequence numbers was predicated
on the following from the now-defunct libSRTP FAQ on sourceforge.net:

> *Q6. The use of implicit synchronization via ROC seems
> dangerous. Can senders and receivers lose ROC synchronization?*
>
> **A.** It is possible to lose ROC synchronization between sender and
> receiver(s), though it is not likely in practice, and practical
> steps can be taken to avoid it. A burst loss of 2^16 packets or more
> will always break synchronization. For example, a conversational
> voice codec that sends 50 packets per second will have its ROC
> increment about every 22 minutes. A network with a burst of packet
> loss that long has problems other than ROC synchronization.
>
> There is a higher sensitivity to loss at the very outset of an SRTP
> stream. If the sender's initial sequence number is close to the
> maximum value of 2^16-1, and all packets are lost from the initial
> packet until the sequence number cycles back to zero, the sender
> will increment its ROC, but the receiver will not. The receiver
> cannot determine that the initial packets were lost and that
> sequence-number rollover has occurred. In this case, the receiver's
> ROC would be zero whereas the sender's ROC would be one, while their
> sequence numbers would be so close that the ROC-guessing algorithm
> could not detect this fact.
>
> There is a simple solution to this problem: the SRTP sender should
> randomly select an initial sequence number that is always less than
> 2^15. This ensures correct SRTP operation so long as fewer than 2^15
> initial packets are lost in succession, which is within the maximum
> tolerance of SRTP packet-index determination (see Appendix A and
> page 14, first paragraph of RFC 3711). An SRTP receiver should
> carefully implement the index-guessing algorithm. A naive
> implementation can unintentionally guess the value of
> 0xffffffffffffLL whenever the SEQ in the packet is greater than 2^15
> and the locally stored SEQ and ROC are zero. (This can happen when
> the implementation fails to treat those zero values as a special
> case.)
>
> When ROC synchronization is lost, the receiver will not be able to
> properly process the packets. If anti-replay protection is turned
> on, then the desynchronization will appear as a burst of replay
> check failures. Otherwise, if authentication is being checked, then
> it will appear as a burst of authentication failures. Otherwise, if
> encryption is being used, the desynchronization may not be detected
> by the SRTP layer, and the packets may be improperly decrypted.

However, modern libSRTP (as of 1.0.1[1]) now mentions the following in
their README.md[2]:

> The sequence number in the rtp packet is used as the low 16 bits of
> the sender's local packet index. Note that RTP will start its
> sequence number in a random place, and the SRTP layer just jumps
> forward to that number at its first invocation. An earlier version
> of this library used initial sequence numbers that are less than
> 32,768; this trick is no longer required as the
> rdbx_estimate_index(...) function has been made smarter.

So truncating our initial sequence number to 15 bit is no longer
necessary.

1. https://github.com/cisco/libsrtp/blob/0eb007f0dc611f27cbfe0bf9855ed85182496cec/CHANGES#L271-L289
2. https://github.com/cisco/libsrtp/blob/2de20dd9e9c8afbaf02fcf5d4048ce1ec9ddc0ae/README.md#implementation-notes

(cherry picked from commit a39384721d7cb561ea0633e48ff52523ddc335ed)

8 months agocore_unreal.c: Fix memory leak in ast_unreal_new_channels()
George Joseph [Tue, 15 Oct 2024 17:11:28 +0000 (11:11 -0600)] 
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 41162f963b0d7b13128bef4a02a9bb456c4b6836)

8 months agodnsmgr.c: dnsmgr_refresh() incorrectly flags change with DNS round-robin
Allan Nathanson [Sun, 29 Sep 2024 22:45:51 +0000 (18:45 -0400)] 
dnsmgr.c: dnsmgr_refresh() incorrectly flags change with DNS round-robin

The dnsmgr_refresh() function checks to see if the IP address associated
with a name/service has changed. The gotcha is that the ast_get_ip_or_srv()
function only returns the first IP address returned by the DNS query. If
there are multiple IPs associated with the name and the returned order is
not consistent (e.g. with DNS round-robin) then the other IP addresses are
not included in the comparison and the entry is flagged as changed even
though the IP is still valid.

Updated the code to check all IP addresses and flag a change only if the
original IP is no longer valid.

Resolves: #924
(cherry picked from commit 338e1915392021b529434964847c4be9dcbe7cf4)

8 months agogeolocation.sample.conf: Fix comment marker at end of file
George Joseph [Tue, 8 Oct 2024 18:06:59 +0000 (12:06 -0600)] 
geolocation.sample.conf: Fix comment marker at end of file

Resolves: #937
(cherry picked from commit d92af8acafcd8537944539202f40c98376d4550d)

8 months agofunc_base64.c: Ensure we set aside enough room for base64 encoded data.
Sean Bright [Tue, 8 Oct 2024 19:11:05 +0000 (15:11 -0400)] 
func_base64.c: Ensure we set aside enough room for base64 encoded data.

Reported by SingularTricycle on IRC.

Fixes #940

(cherry picked from commit 349db1de3df11a49d9543bf3b1895e04f9485531)