]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
7 hours agosafe_asterisk: Add ownership checks for /etc/asterisk/startup.d and its files. certified/18.9
ThatTotallyRealMyth [Tue, 10 Jun 2025 07:18:00 +0000 (17:18 +1000)] 
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

9 days agocdr.c: Set tenantid from party_a->base instead of chan->base.
George Joseph [Thu, 17 Jul 2025 21:18:50 +0000 (15:18 -0600)] 
cdr.c: Set tenantid from party_a->base instead of chan->base.

The CDR tenantid was being set in cdr_object_alloc from the channel->base
snapshot.  Since this happens at channel creation before the dialplan is even
reached, calls to `CHANNEL(tenantid)=<something>` in the dialplan were being
ignored.  Instead we now take tenantid from party_a when
cdr_object_create_public_records() is called which is after the call has
ended and all channel snapshots rebuilt.  This is exactly how accountcode
and amaflags, which can also be set in tha dialplpan, are handled.

Resolves: #1259

13 days ago.github: Reduce number of inputs to Releaser to 10.
George Joseph [Fri, 18 Jul 2025 17:26:37 +0000 (11:26 -0600)] 
.github: Reduce number of inputs to Releaser to 10.

The max number of inputs supported by GitHub is 10 so
is_security and is_hotfix were factored into a single choice
entry.

13 days ago.github: Add skip-cherry-pick and skip-test-builds to Releaser.
George Joseph [Fri, 18 Jul 2025 17:04:04 +0000 (11:04 -0600)] 
.github: Add skip-cherry-pick and skip-test-builds to Releaser.

2 months agoasterisk.c: Add option to restrict shell access from remote consoles.
George Joseph [Mon, 19 May 2025 14:16:53 +0000 (08:16 -0600)] 
asterisk.c: Add option to restrict shell access from remote consoles.

UserNote: A new asterisk.conf option 'disable_remote_console_shell' has
been added that, when set, will prevent remote consoles from executing
shell commands using the '!' prefix.

Resolves: #GHSA-c7p6-7mvq-8jq2

2 months agores_pjsip_messaging.c: Mask control characters in received From display name
George Joseph [Mon, 24 Mar 2025 20:59:42 +0000 (14:59 -0600)] 
res_pjsip_messaging.c: Mask control characters in received From display name

Incoming SIP MESSAGEs will now have their From header's display name
sanitized by replacing any characters < 32 (space) with a space.

Resolves: #GHSA-2grh-7mhv-fcfw

4 months agores_pjsip: Backport pjsip uri utilities.
George Joseph [Tue, 25 Mar 2025 22:22:04 +0000 (16:22 -0600)] 
res_pjsip: Backport pjsip uri utilities.

The following utilities have been backported:

ast_sip_is_uri_sip_sips
ast_sip_is_allowed_uri
ast_sip_pjsip_uri_get_username
ast_sip_pjsip_uri_get_hostname
ast_sip_pjsip_uri_get_other_param

They were originally included in the commit for supporting TEL uris.
Support for TEL uris is NOT included here however.

4 months agobuild_tools: Backport from 18
George Joseph [Tue, 25 Mar 2025 22:08:49 +0000 (16:08 -0600)] 
build_tools: Backport from 18

There are several build fixes that never made it into certified/18.9.
Unfortunately the commits that contained the fixes also contained other
stuff that won't cherry-pick into cert so the build files had to be
just copied from 18.

4 months agochan_sip.c: Fix __sip_reliable_xmit build error
Sean Bright [Thu, 17 Oct 2024 21:20:31 +0000 (17:20 -0400)] 
chan_sip.c: Fix __sip_reliable_xmit build error

Fixes #954

4 months agochan_dahdi.c: Resolve a format-truncation build warning.
Sean Bright [Fri, 19 Aug 2022 16:02:07 +0000 (12:02 -0400)] 
chan_dahdi.c: Resolve a format-truncation build warning.

With gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0:

> chan_dahdi.c:4129:18: error: ā€˜%s’ directive output may be truncated
>   writing up to 255 bytes into a region of size between 242 and 252
>   [-Werror=format-truncation=]

This removes the error-prone sizeof(...) calculations in favor of just
doubling the size of the base buffer.

Change-Id: I2d276785286730d3d5d0a921bcea2e065dbf27c5

4 months agoxml.c: Update deprecated libxml2 API usage.
Sean Bright [Thu, 23 May 2024 14:23:03 +0000 (10:23 -0400)] 
xml.c: Update deprecated libxml2 API usage.

Two functions are deprecated as of libxml2 2.12:

  * xmlSubstituteEntitiesDefault
  * xmlParseMemory

So we update those with supported API.

Additionally, `res_calendar_caldav` has been updated to use libxml2's
xmlreader API instead of the SAX2 API which has always felt a little
hacky (see deleted comment block in `res_calendar_caldav.c`).

The xmlreader API has been around since libxml2 2.5.0 which was
released in 2003.

Fixes #725

4 months agodocumentation: Update Gosub, Goto, and add new documentationtype.
Ben Ford [Fri, 14 Mar 2025 22:05:30 +0000 (17:05 -0500)] 
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.

4 months agoREADME.md: Updates and Fixes
George Joseph [Wed, 5 Mar 2025 19:21:45 +0000 (12:21 -0700)] 
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

4 months agoREADME.md: Removed outdated link
Shyju Kanaprath [Fri, 23 Feb 2024 17:07:48 +0000 (21:07 +0400)] 
README.md: Removed outdated link

Removed outdated link http://www.quicknet.net from README.md

cherry-pick-to: 18
cherry-pick-to: 20
cherry-pick-to: 21

4 months agogeneral: Fix broken links.
Naveen Albert [Thu, 9 Nov 2023 21:26:46 +0000 (16:26 -0500)] 
general: Fix broken links.

This fixes a number of broken links throughout the
tree, mostly caused by wiki.asterisk.org being replaced
with docs.asterisk.org, which should eliminate the
need for sporadic fixes as in f28047db36a70e81fe373a3d19132c43adf3f74b.

Resolves: #430

4 months agodocumentation: Add information on running install_prereq script in readme
Marcel Wagner [Wed, 23 Mar 2022 21:04:13 +0000 (22:04 +0100)] 
documentation: Add information on running install_prereq script in readme

Adding information in the readme about running the install_preqreq script to install components that the ./configure script might indicate as missing.

ASTERISK-29976 #close

Change-Id: Ic287b46300168729838bddd8f9265e98fc22bce6

5 months ago.github: Change concurrency group ids so they're unique.
George Joseph [Thu, 20 Feb 2025 17:40:04 +0000 (10:40 -0700)] 
.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`.

5 months ago.github: Refactor Releaser to use reusable workflow
George Joseph [Sun, 16 Feb 2025 23:30:00 +0000 (16:30 -0700)] 
.github: Refactor Releaser to use reusable workflow

5 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.

5 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

5 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. :(

5 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.

5 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.

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

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.

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

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.'

6 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.

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

6 months agogcc14: Fix issues caught by gcc 14
George Joseph [Fri, 3 Jan 2025 21:39:52 +0000 (14:39 -0700)] 
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

7 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

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 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.

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

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.

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

8 months ago.github: NightlyAdmin now calls external CloseStaleIssuesAndPRs
George Joseph [Wed, 20 Mar 2024 19:07:44 +0000 (13:07 -0600)] 
.github: NightlyAdmin now calls external CloseStaleIssuesAndPRs

9 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

9 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

9 months agomanager.c: Add unit test for Originate app and appdata permissions
George Joseph [Thu, 3 Oct 2024 15:10:36 +0000 (09:10 -0600)] 
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.

9 months agoalembic: Drop redundant voicemail_messages index.
Sean Bright [Thu, 26 Sep 2024 20:21:31 +0000 (16:21 -0400)] 
alembic: Drop redundant voicemail_messages index.

The `voicemail_messages_dir` index is a left prefix of the table's
primary key and therefore unnecessary.

9 months agoapp_voicemail: add NoOp alembic script to maintain sync
Mike Bradeen [Wed, 17 Jan 2024 16:21:13 +0000 (09:21 -0700)] 
app_voicemail: add NoOp alembic script to maintain sync

Adding a NoOp alembic script for the voicemail database to maintain
version sync with other branches.

Fixes: #527
10 months agores_pjsip_pubsub: Persist subscription 'generator_data' in sorcery
Sean Bright [Mon, 23 Sep 2024 20:49:27 +0000 (16:49 -0400)] 
res_pjsip_pubsub: Persist subscription 'generator_data' in sorcery

Fixes #895

10 months agoFix application references to Background
George Joseph [Fri, 20 Sep 2024 13:47:53 +0000 (07:47 -0600)] 
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.

10 months ago.github: Fix realtime param on Weekly and Nightly tests and...
George Joseph [Mon, 23 Sep 2024 14:24:02 +0000 (08:24 -0600)] 
.github: Fix realtime param on Weekly and Nightly tests and...

Rename the "Cleanup" job in the cherry-pick and recheck jobs
to "Summary".

10 months ago.github: Add WeeklyTests and make Nightlies Monday-Saturday
George Joseph [Wed, 18 Sep 2024 17:09:13 +0000 (11:09 -0600)] 
.github: Add WeeklyTests and make Nightlies Monday-Saturday

...and add "realtime" option.

10 months ago.github: Changes required to use cached builds and shorten names
George Joseph [Sun, 28 Jul 2024 19:51:31 +0000 (13:51 -0600)] 
.github: Changes required to use cached builds and shorten names

10 months agores_resolver_unbound: Test for NULL ub_result in unbound_resolver_callback
George Joseph [Mon, 12 Aug 2024 17:58:12 +0000 (11:58 -0600)] 
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

10 months agoapp_voicemail: Fix sql insert mismatch caused by cherry-pick
Jean-Denis Girard [Wed, 7 Aug 2024 16:38:09 +0000 (06:38 -1000)] 
app_voicemail: Fix sql insert mismatch caused by cherry-pick

When commit e8c9cb80 was cherry-picked in from master, the
fact that the 20 and 18 branches still had the old "macrocontext"
column wasn't taken into account so the number of named parameters
didn't match the number of '?' placeholders.  They do now.

We also now use ast_asprintf to create the full mailbox query SQL
statement instead of trying to calculate the proper length ourselves.

Resolves: #831

11 months agoalembic: Make 'revises' header comment match reality.
Sean Bright [Sat, 17 Aug 2024 19:12:56 +0000 (15:12 -0400)] 
alembic: Make 'revises' header comment match reality.

11 months agores_pjsip_notify: add dialplan application
Mike Bradeen [Tue, 9 Jul 2024 22:11:36 +0000 (16:11 -0600)] 
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>

11 months agomanager.c: Fix FRACK when doing CoreShowChannelMap in DEVMODE
George Joseph [Thu, 8 Aug 2024 16:57:14 +0000 (10:57 -0600)] 
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.

11 months agochannel: Add multi-tenant identifier.
Ben Ford [Tue, 21 May 2024 16:11:26 +0000 (11:11 -0500)] 
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.

11 months agomanager.c: Add entries to Originate blacklist
George Joseph [Mon, 22 Jul 2024 14:05:03 +0000 (08:05 -0600)] 
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

11 months agores_stasis: fix intermittent delays on adding channel to bridge
Mike Bradeen [Wed, 10 Jul 2024 18:58:44 +0000 (12:58 -0600)] 
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

12 months ago.github: Allow testing an Asterisk PR against a testsuite PR
George Joseph [Fri, 26 Jul 2024 16:37:21 +0000 (10:37 -0600)] 
.github: Allow testing an Asterisk PR against a testsuite PR

12 months ago.github: Add params to Releaser for FPBX issue creation
George Joseph [Fri, 26 Jul 2024 13:27:37 +0000 (07:27 -0600)] 
.github: Add params to Releaser for FPBX issue creation

12 months agores_pjsip_config_wizard.c: Refactor load process
George Joseph [Tue, 23 Jul 2024 16:04:26 +0000 (10:04 -0600)] 
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.

12 months agovoicemail.conf.sample: Fix ':' comment typo
George Joseph [Wed, 24 Jul 2024 12:13:03 +0000 (06:13 -0600)] 
voicemail.conf.sample: Fix ':' comment typo

...and removed an errant trailing space.

Resolves: #819

12 months agobridge_softmix: Fix queueing VIDUPDATE control frames
George Joseph [Wed, 17 Jul 2024 16:44:17 +0000 (10:44 -0600)] 
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

12 months ago.github: Pass app_id and app_priv_key to AsteriskMergePR
George Joseph [Wed, 10 Jul 2024 16:38:00 +0000 (10:38 -0600)] 
.github: Pass app_id and app_priv_key to AsteriskMergePR

12 months ago.github: Change OnPRMergeApproved to use default token
George Joseph [Wed, 10 Jul 2024 15:24:28 +0000 (09:24 -0600)] 
.github: Change OnPRMergeApproved to use default token

12 months agologger.h: Include SCOPE_CALL_WITH_INT_RESULT() in non-dev-mode builds.
Sean Bright [Sat, 29 Jun 2024 18:09:11 +0000 (14:09 -0400)] 
logger.h: Include SCOPE_CALL_WITH_INT_RESULT() in non-dev-mode builds.

Fixes #785

12 months agoapp_voicemail_odbc: Allow audio to be kept on disk
George Joseph [Tue, 9 Apr 2024 13:23:36 +0000 (07:23 -0600)] 
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.

12 months agologger.h: Add SCOPE_CALL and SCOPE_CALL_WITH_RESULT
George Joseph [Tue, 9 Apr 2024 20:49:36 +0000 (14:49 -0600)] 
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.

12 months agoapp_voicemail.c: Completely resequence mailbox folders.
Sean Bright [Mon, 27 Nov 2023 15:20:02 +0000 (10:20 -0500)] 
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

13 months ago.github: Use ASTERISKTEAM_PAT for PR merging
George Joseph [Fri, 28 Jun 2024 19:41:32 +0000 (13:41 -0600)] 
.github: Use ASTERISKTEAM_PAT for PR merging

13 months ago.github: Replace PR workflows with stubs that call reusables
George Joseph [Tue, 25 Jun 2024 13:07:39 +0000 (07:07 -0600)] 
.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.

13 months ago.github: Refactor NightlyTests to use workflow in asterisk-ci-actions
George Joseph [Tue, 25 Jun 2024 01:16:00 +0000 (19:16 -0600)] 
.github: Refactor NightlyTests to use workflow in asterisk-ci-actions

14 months ago.github: Add branches to workflow_dispatch for NightlyTests
George Joseph [Tue, 14 May 2024 17:54:17 +0000 (11:54 -0600)] 
.github: Add branches to workflow_dispatch for NightlyTests

14 months agoasterisk.c: Fix sending incorrect messages to systemd notify
Ivan Poddubny [Sun, 5 May 2024 12:53:11 +0000 (14:53 +0200)] 
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.

14 months agores_http_websocket.c: Set hostname on client for certificate validation.
Sean Bright [Thu, 9 Nov 2023 22:59:19 +0000 (17:59 -0500)] 
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

15 months agotcptls/iostream: Add support for setting SNI on client TLS connections
George Joseph [Tue, 23 Apr 2024 20:15:20 +0000 (14:15 -0600)] 
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.

15 months agomake_buildopts_h: Always include DETECT_DEADLOCKS
George Joseph [Sat, 27 Apr 2024 20:40:28 +0000 (14:40 -0600)] 
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

15 months agortp_engine and stun: call ast_register_atexit instead of ast_register_cleanup
George Joseph [Tue, 2 Apr 2024 20:28:35 +0000 (14:28 -0600)] 
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.

15 months agomanager.c: Add missing parameters to Login documentation
George Joseph [Wed, 3 Apr 2024 13:51:31 +0000 (07:51 -0600)] 
manager.c: Add missing parameters to Login documentation

* Added the AuthType and Key parameters for MD5 authentication.

* Added the Events parameter.

Resolves: #689

15 months agoFix incorrect application and function documentation references
George Joseph [Mon, 1 Apr 2024 12:30:54 +0000 (06:30 -0600)] 
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.

16 months ago.github: Add PAT to PRSubmitActions/Add Reviewers
George Joseph [Wed, 6 Mar 2024 16:21:33 +0000 (09:21 -0700)] 
.github: Add PAT to PRSubmitActions/Add Reviewers

16 months ago.github: Remove timeout-minutes from gatetests
George Joseph [Tue, 5 Mar 2024 22:17:33 +0000 (15:17 -0700)] 
.github: Remove timeout-minutes from gatetests

16 months ago.github: Pass only single GATETEST_COMMAND to AsteriskGateComposite
George Joseph [Tue, 5 Mar 2024 15:52:01 +0000 (08:52 -0700)] 
.github: Pass only single GATETEST_COMMAND to AsteriskGateComposite

17 months agoRename dialplan_functions.xml to dialplan_functions_doc.xml
George Joseph [Mon, 26 Feb 2024 23:16:37 +0000 (16:16 -0700)] 
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.

17 months agoopenssl: Supress deprecation warnings from OpenSSL 3.0
Sean Bright [Fri, 25 Mar 2022 13:19:35 +0000 (09:19 -0400)] 
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

17 months ago.github: Add force_cherry_pick option to Releaser
George Joseph [Tue, 20 Feb 2024 13:49:20 +0000 (06:49 -0700)] 
.github: Add force_cherry_pick option to Releaser

17 months ago.github: Remove start_version from Releaser
George Joseph [Tue, 17 Oct 2023 18:39:04 +0000 (12:39 -0600)] 
.github: Remove start_version from Releaser

17 months agoapp_chanspy: Add 'D' option for dual-channel audio
Mike Bradeen [Wed, 31 Jan 2024 15:55:04 +0000 (08:55 -0700)] 
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.

17 months ago.github: Update github-script to v7 and fix a rest bug
George Joseph [Mon, 5 Feb 2024 15:31:47 +0000 (08:31 -0700)] 
.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.

18 months agomanager.c: Fix regression due to using wrong free function.
Naveen Albert [Tue, 26 Dec 2023 17:14:11 +0000 (17:14 +0000)] 
manager.c: Fix regression due to using wrong free function.

Commit 424be345639d75c6cb7d0bd2da5f0f407dbd0bd5 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

19 months agores_rtp_asterisk: Fix regression issues with DTLS client check
George Joseph [Fri, 15 Dec 2023 16:37:54 +0000 (09:37 -0700)] 
res_rtp_asterisk: Fix regression issues with DTLS client check

* Since ICE candidates are used for the check and pjproject is
  required to use ICE, res_rtp_asterisk was failing to compile
  when pjproject wasn't available.  The check is now wrapped
  with an #ifdef HAVE_PJPROJECT.

* The rtp->ice_active_remote_candidates container was being
  used to check the address on incoming packets but that
  container doesn't contain peer reflexive candidates discovered
  during negotiation. This was causing the check to fail
  where it shouldn't.  We now check against pjproject's
  real_ice->rcand array which will contain those candidates.

* Also fixed a bug in ast_sockaddr_from_pj_sockaddr() where
  we weren't zeroing out sin->sin_zero before returning.  This
  was causing ast_sockaddr_cmp() to always return false when
  one of the inputs was converted from a pj_sockaddr, even
  if both inputs had the same address and port.

Resolves: #500
Resolves: #503
Resolves: #505

19 months agodoc: Remove obsolete CHANGES-staging directrory
George Joseph [Fri, 15 Dec 2023 16:59:02 +0000 (09:59 -0700)] 
doc: Remove obsolete CHANGES-staging directrory

This should have been removed after the last release but
was missed.

19 months agores_pjsip_header_funcs: Duplicate new header value, don't copy.
Gitea [Mon, 10 Jul 2023 15:43:06 +0000 (12:43 -0300)] 
res_pjsip_header_funcs: Duplicate new header value, don't copy.

When updating an existing header the 'update' code incorrectly
just copied the new value into the existing buffer. If the
new value exceeded the available buffer size memory outside
of the buffer would be written into, potentially causing
a crash.

This change makes it so that the 'update' now duplicates
the new header value instead of copying it into the existing
buffer.

19 months agores_rtp_asterisk.c: Check DTLS packets against ICE candidate list
George Joseph [Thu, 9 Nov 2023 16:14:03 +0000 (09:14 -0700)] 
res_rtp_asterisk.c: Check DTLS packets against ICE candidate list

When ICE is in use, we can prevent a possible DOS attack by allowing
DTLS protocol messages (client hello, etc) only from sources that
are in the active remote candidates list.

Resolves: GHSA-hxj9-xwr8-w8pq

19 months agomanager.c: Prevent path traversal with GetConfig.
Ben Ford [Mon, 13 Nov 2023 17:08:50 +0000 (11:08 -0600)] 
manager.c: Prevent path traversal with GetConfig.

When using AMI GetConfig, it was possible to access files outside of the
Asterisk configuration directory by using filenames with ".." and "./"
even while live_dangerously was not enabled. This change resolves the
full path and ensures we are still in the configuration directory before
attempting to access the file.

19 months agores_pjsip: disable raw bad packet logging
Mike Bradeen [Thu, 14 Dec 2023 17:34:53 +0000 (10:34 -0700)] 
res_pjsip: disable raw bad packet logging

    Add patch to split the log level for invalid packets received on the signaling port.
    The warning regarding the packet will move to level 2 so that it can still be displayed,
    while the raw packet will be at level 4.

19 months agoMergeApproved.yml: Remove unneeded concurrency
George Joseph [Wed, 6 Dec 2023 21:27:01 +0000 (14:27 -0700)] 
MergeApproved.yml:  Remove unneeded concurrency

The concurrency parameter on the MergeAndCherryPick job has
been rmeoved.  It was a hold-over from earlier days.

20 months agoSECURITY.md: Update with correct documentation URL
George Joseph [Thu, 9 Nov 2023 18:45:08 +0000 (11:45 -0700)] 
SECURITY.md: Update with correct documentation URL

20 months agochan_pjsip: Add PJSIPHangup dialplan app and manager action
George Joseph [Tue, 31 Oct 2023 21:08:14 +0000 (15:08 -0600)] 
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.

20 months agoRemove files that are no longer updated
Mark Murawski [Mon, 30 Oct 2023 15:38:22 +0000 (11:38 -0400)] 
Remove files that are no longer updated

Fixes: #360
21 months agores_speech: allow speech to translate input channel
Mike Bradeen [Thu, 7 Sep 2023 17:21:32 +0000 (11:21 -0600)] 
res_speech: allow speech to translate input channel

* Allow res_speech to translate the input channel if the
  format is translatable to a format suppored by the
  speech provider.

Resolves: #129

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

21 months ago.github: PRSubmitActions: Fix adding reviewers to PR
George Joseph [Thu, 19 Oct 2023 15:54:43 +0000 (09:54 -0600)] 
.github: PRSubmitActions: Fix adding reviewers to PR

21 months ago.github: New PR Submit workflows
George Joseph [Tue, 17 Oct 2023 12:59:43 +0000 (06:59 -0600)] 
.github: New PR Submit workflows

The workflows that get triggered when PRs are submitted or updated
have been replaced with ones that are more secure and have
a higher level of parallelism.