]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
12 days ago.lastclean: Remove from git releases/18
George Joseph [Fri, 18 Jul 2025 14:21:38 +0000 (08:21 -0600)] 
.lastclean: Remove from git

It never should been versioned in the first place.

2 months agoUpdate for 18.26.2 18.26.2
Asterisk Development Team [Thu, 22 May 2025 15:50:16 +0000 (15:50 +0000)] 
Update for 18.26.2

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

6 months agoUpdate for 18.26.1 18.26.1
Asterisk Development Team [Thu, 9 Jan 2025 19:34:22 +0000 (19:34 +0000)] 
Update for 18.26.1

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.

8 months agoUpdate for 18.26.0 18.26.0
Asterisk Development Team [Thu, 21 Nov 2024 17:16:56 +0000 (17:16 +0000)] 
Update for 18.26.0

8 months agoUpdate for 18.26.0-rc1 18.26.0-rc1
Asterisk Development Team [Thu, 14 Nov 2024 20:00:49 +0000 (20:00 +0000)] 
Update for 18.26.0-rc1

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 38a18f9fbb11a3eac780cfbffc4b2dae54ccd8ca)

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

(cherry picked from commit 678646f7d3b9f8df098110c474a7de04e4f7c9a3)

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 485ccb74297ead4b92769b41b8bce0f8c2d7790b)

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 f9e8c3488b60803c919200e0f6edd10b7427da36)

8 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

(cherry picked from commit 909b93608a33b8ed8b0c69a4b3eac918aef70fc9)

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 e3a0ca20b52cc1538b4b52ab8c7cd65ed6be3451)

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 d6ffbff3331e9afe8a8510fce4ca06ab28217eef)

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 99221c81edc572d0a1a35c29e98267fa71ced720)

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 f9d5d659c6fe57e6ab329060a843f04ec9715394)

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 fae5d21b6a2928184efe67b0e3c6e7df127aed84)

8 months agoapp_dial: Fix progress timeout.
Naveen Albert [Thu, 3 Oct 2024 21:33:39 +0000 (17:33 -0400)] 
app_dial: Fix progress timeout.

Under some circumstances, the progress timeout feature added in commit
320c98eec87c473bfa814f76188a37603ea65ddd does not work as expected,
such as if there is no media flowing. Adjust the waitfor call to
explicitly use the progress timeout if it would be reached sooner than
the answer timeout to ensure we handle the timers properly.

Resolves: #821
(cherry picked from commit 62b6ea32022597ea6a922cb5f2e5f5b9e2e4435f)

8 months agochan_dahdi: Never send MWI while off-hook.
Naveen Albert [Wed, 2 Oct 2024 00:24:00 +0000 (20:24 -0400)] 
chan_dahdi: Never send MWI while off-hook.

In some circumstances, it is possible for the do_monitor thread to
erroneously think that a line is on-hook and send an MWI FSK spill
to it when the line is really off-hook and no MWI should be sent.
Commit 0a8b3d34673277b70be6b0e8ac50191b1f3c72c6 previously fixed this
issue in a more readily encountered scenario, but it has still been
possible for MWI to be sent when it shouldn't be. To robustly fix
this issue, query DAHDI for the hook status to ensure we don't send
MWI on a line that is actually still off hook.

Resolves: #928
(cherry picked from commit fa614f755d2dbfa69483557fb876ff2d6bda5d90)

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

(cherry picked from commit 29e0d77765d58522e059a84776e606f81e9c3eff)

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

(cherry picked from commit 776bb8c56b189171a31474aab0d78a830b4aeb9d)

8 months agores_agi.c: Ensure SIGCHLD handler functions are properly balanced.
Sean Bright [Mon, 30 Sep 2024 15:48:56 +0000 (11:48 -0400)] 
res_agi.c: Ensure SIGCHLD handler functions are properly balanced.

Calls to `ast_replace_sigchld()` and `ast_unreplace_sigchld()` must be
balanced to ensure that we can capture the exit status of child
processes when we need to. This extends to functions that call
`ast_replace_sigchld()` and `ast_unreplace_sigchld()` such as
`ast_safe_fork()` and `ast_safe_fork_cleanup()`.

The primary change here is ensuring that we do not call
`ast_safe_fork_cleanup()` in `res_agi.c` if we have not previously
called `ast_safe_fork()`.

Additionally we reinforce some of the documentation and add an
assertion to, ideally, catch this sooner were this to happen again.

Fixes #922

(cherry picked from commit c80ce750bb170e7e56fd39b2e029629c69a34515)

8 months agomain, res, tests: Fix compilation errors on FreeBSD.
Naveen Albert [Sun, 29 Sep 2024 13:26:10 +0000 (09:26 -0400)] 
main, res, tests: Fix compilation errors on FreeBSD.

asterisk.c, manager.c: Increase buffer sizes to avoid truncation warnings.
config.c: Include header file for WIFEXITED/WEXITSTATUS macros.
res_timing_kqueue: Use more portable format specifier.
test_crypto: Use non-linux limits.h header file.

Resolves: #916
(cherry picked from commit f415e313b4367e740d4c412b60fb9ec86ba00e04)

8 months agores_rtp_asterisk: Fix dtls timer issues causing FRACKs and SEGVs
George Joseph [Mon, 16 Sep 2024 21:17:28 +0000 (15:17 -0600)] 
res_rtp_asterisk: Fix dtls timer issues causing FRACKs and SEGVs

In dtls_srtp_handle_timeout(), when DTLSv1_get_timeout() returned
success but with a timeout of 0, we were stopping the timer and
decrementing the refcount on instance but not resetting the
timeout_timer to -1.  When dtls_srtp_stop_timeout_timer()
was later called, it was atempting to stop a stale timer and could
decrement the refcount on instance again which would then cause
the instance destructor to run early.  This would result in either
a FRACK or a SEGV when ast_rtp_stop(0 was called.

According to the OpenSSL docs, we shouldn't have been stopping the
timer when DTLSv1_get_timeout() returned success and the new timeout
was 0 anyway.  We should have been calling DTLSv1_handle_timeout()
again immediately so we now reschedule the timer callback for
1ms (almost immediately).

Additionally, instead of scheduling the timer callback at a fixed
interval returned by the initial call to DTLSv1_get_timeout()
(usually 999 ms), we now reschedule the next callback based on
the last call to DTLSv1_get_timeout().

Resolves: #487
(cherry picked from commit ec2e26cfe77b93ac93203ec5ee7d4a237e72de2c)

8 months agomanager.c: Restrict ModuleLoad to the configured modules directory.
Ben Ford [Wed, 25 Sep 2024 18:05:58 +0000 (13:05 -0500)] 
manager.c: Restrict ModuleLoad to the configured modules directory.

When using the ModuleLoad AMI action, it was possible to traverse
upwards through the directories to files outside of the configured
modules directory. We decided it would be best to restrict access to
modules exclusively in the configured directory. You will now get an
error when the specified module is outside of this limitation.

Fixes: #897
UserNote: The ModuleLoad AMI action now restricts modules to the
configured modules directory.

(cherry picked from commit 5a237235c00a3a408ddb65874f39dab76f3824cf)

8 months agores_agi.c: Prevent possible double free during `SPEECH RECOGNIZE`
jiangxc [Wed, 17 Jul 2024 09:02:33 +0000 (17:02 +0800)] 
res_agi.c: Prevent possible double free during `SPEECH RECOGNIZE`

When using the speech recognition module, crashes can occur
sporadically due to a "double free or corruption (out)" error. Now, in
the section where the audio stream is being captured in a loop, each
time after releasing fr, it is set to NULL to prevent repeated
deallocation.

Fixes #772

(cherry picked from commit e1da2fec4242a1fd59cd4329a2d0021b3e9483ba)

8 months agocdr_custom: Allow absolute filenames.
Sean Bright [Thu, 26 Sep 2024 16:26:04 +0000 (12:26 -0400)] 
cdr_custom: Allow absolute filenames.

A follow up to #893 that brings the same functionality to
cdr_custom. Also update the sample configuration files to note support
for absolute paths.

(cherry picked from commit 9da3bdefefdf62a524c14e38198494c25ecec7ea)

8 months agoastfd.c: Avoid calling fclose with NULL argument.
Naveen Albert [Tue, 24 Sep 2024 11:29:59 +0000 (07:29 -0400)] 
astfd.c: Avoid calling fclose with NULL argument.

Don't pass through a NULL argument to fclose, which is undefined
behavior, and instead return -1 and set errno appropriately. This
also avoids a compiler warning with glibc 2.38 and newer, as glibc
commit 71d9e0fe766a3c22a730995b9d024960970670af
added the nonnull attribute to this argument.

Resolves: #900
(cherry picked from commit b29776a5b0518264333c4e78afe6dcbe226ff273)

8 months agochannel: Preserve CHANNEL(userfield) on masquerade.
Peter Jannesen [Fri, 20 Sep 2024 20:13:08 +0000 (22:13 +0200)] 
channel: Preserve CHANNEL(userfield) on masquerade.

In certain circumstances a channel may undergo an operation
referred to as a masquerade. If this occurs the CHANNEL(userfield)
value was not preserved causing it to get lost. This change makes
it so that this field is now preserved.

Fixes: #882
(cherry picked from commit e522eb63572ac8aed07afc09be0a99ab0de65abe)

8 months agocel_custom: Allow absolute filenames.
Peter Jannesen [Fri, 20 Sep 2024 20:26:35 +0000 (22:26 +0200)] 
cel_custom: Allow absolute filenames.

If a filename starts with a '/' in cel_custom [mappings] assume it is
a absolute file path and not relative filename/path to
AST_LOG_DIR/cel_custom/

(cherry picked from commit 9e76533f9076d44efec188209e4c60f29426acf7)

8 months agoapp_voicemail: Fix ill-formatted pager emails with custom subject.
Naveen Albert [Tue, 24 Sep 2024 11:44:25 +0000 (07:44 -0400)] 
app_voicemail: Fix ill-formatted pager emails with custom subject.

Add missing end-of-headers newline to pager emails with custom
subjects, since this was missing from this code path.

Resolves: #902
(cherry picked from commit 44a6349b69d5688bfcb8093db9529a9347e0f305)

8 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

(cherry picked from commit a6db5455acdf3b2798419ee742af97329bec445f)

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

(cherry picked from commit 29d6a627686a8c8b0d2208d8fa1779b54639edcd)

8 months agomanager.conf.sample: Fix mathcing typo
George Joseph [Tue, 24 Sep 2024 17:11:07 +0000 (11:11 -0600)] 
manager.conf.sample: Fix mathcing typo

(cherry picked from commit 18058015880bb7effc30def70f2d05173e581fd4)

8 months agomanager: Enhance event filtering for performance
George Joseph [Wed, 31 Jul 2024 22:05:45 +0000 (16:05 -0600)] 
manager: Enhance event filtering for performance

UserNote: You can now perform more granular filtering on events
in manager.conf using expressions like
`eventfilter(name(Newchannel),header(Channel),method(starts_with)) = PJSIP/`
This is much more efficient than
`eventfilter = Event: Newchannel.*Channel: PJSIP/`
Full syntax guide is in configs/samples/manager.conf.sample.

(cherry picked from commit a9f16f23ae08de00adf18241d9281fe609bdd228)

8 months agomanager.c: Split XML documentation to manager_doc.xml
George Joseph [Thu, 1 Aug 2024 20:52:53 +0000 (14:52 -0600)] 
manager.c: Split XML documentation to manager_doc.xml

(cherry picked from commit 539009cbedb0820439119713c5a534b777bcc991)

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

(cherry picked from commit 5c25f268c8b556f4f814669887c76cbe17ace6bc)

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

(cherry picked from commit 43c4d2537a854a9b377cd843a6514f48725ee4a9)

8 months agodb.c: Remove limit on family/key length
George Joseph [Wed, 11 Sep 2024 16:06:17 +0000 (10:06 -0600)] 
db.c: Remove limit on family/key length

Consumers like media_cache have been running into issues with
the previous astdb "/family/key" limit of 253 bytes when needing
to store things like long URIs.  An Amazon S3 URI is a good example
of this.  Now, instead of using a static 256 byte buffer for
"/family/key", we use ast_asprintf() to dynamically create it.

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

Resolves: #881

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

(cherry picked from commit 01aa84e42f4f7497617ca3bb71634b70590b9a72)

8 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

(cherry picked from commit c535a1d2cd11e9431a3353b89d04adfa9154f0f5)

9 months agoUpdate for 18.25.0 18.25.0
Asterisk Development Team [Thu, 17 Oct 2024 16:03:29 +0000 (16:03 +0000)] 
Update for 18.25.0

10 months agoUpdate for 18.25.0-rc2 18.25.0-rc2
Asterisk Development Team [Thu, 26 Sep 2024 16:17:15 +0000 (16:17 +0000)] 
Update for 18.25.0-rc2

10 months agostir_shaken: Fix propagation of attest_level and a few other values
George Joseph [Tue, 24 Sep 2024 16:16:16 +0000 (10:16 -0600)] 
stir_shaken: Fix propagation of attest_level and a few other values

attest_level, send_mky and check_tn_cert_public_url weren't
propagating correctly from the attestation object to the profile
and tn.

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

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

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

Resolves: #904

10 months agores_stir_shaken: Remove stale include for jansson.h in verification.c
George Joseph [Tue, 17 Sep 2024 16:03:59 +0000 (10:03 -0600)] 
res_stir_shaken: Remove stale include for jansson.h in verification.c

verification.c had an include for jansson.h left over from previous
versions of the module.  Since res_stir_shaken no longer has a
dependency on jansson, the bundled version wasn't added to GCC's
include path so if you didn't also have a jansson development package
installed, the compile would fail.  Removing the stale include
was the only thing needed.

Resolves: #889

10 months agores_stir_shaken.c: Fix crash when stir_shaken.conf is invalid
George Joseph [Fri, 13 Sep 2024 14:23:08 +0000 (08:23 -0600)] 
res_stir_shaken.c: Fix crash when stir_shaken.conf is invalid

* If the call to ast_config_load() returns CONFIG_STATUS_FILEINVALID,
check_for_old_config() now returns LOAD_DECLINE instead of continuing
on with a bad pointer.

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

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

Resolves: #884

10 months agoUpdate for 18.25.0-rc1 18.25.0-rc1
Asterisk Development Team [Thu, 12 Sep 2024 18:44:42 +0000 (18:44 +0000)] 
Update for 18.25.0-rc1

10 months agores_stir_shaken: Check for disabled before param validation
George Joseph [Wed, 11 Sep 2024 16:19:23 +0000 (10:19 -0600)] 
res_stir_shaken: Check for disabled before param validation

For both attestation and verification, we now check whether they've
been disabled either globally or by the profile before validating
things like callerid, orig_tn, dest_tn, etc.  This prevents useless
error messages.

Resolves: #879
(cherry picked from commit d010dd9752247fe9a60829a29ee9a436bd10d0fd)

10 months agoapp_chanspy.c: resolving the issue writing frame to whisper audiohook.
Tinet-mucw [Tue, 10 Sep 2024 04:01:21 +0000 (12:01 +0800)] 
app_chanspy.c: resolving the issue writing frame to whisper audiohook.

ChanSpy(${channel}, qEoSw): because flags set o, ast_audiohook_set_frame_feed_direction(audiohook, AST_AUDIOHOOK_DIRECTION_READ); this will effect whisper audiohook and spy audiohook, this makes writing frame to whisper audiohook impossible. So add function start_whispering to starting whisper audiohook.

Resolves: #876
(cherry picked from commit 03983b2ff9af730fb00141b27f9986c4a54d427c)

10 months agoautoservice: Do not sleep if autoservice_stop is called within autoservice thread
Alexei Gradinari [Wed, 4 Sep 2024 14:28:57 +0000 (10:28 -0400)] 
autoservice: Do not sleep if autoservice_stop is called within autoservice thread

It's possible that ast_autoservice_stop is called within the autoservice thread.
In this case the autoservice thread is stuck in an endless sleep.

To avoid endless sleep ast_autoservice_stop must check that it's not called
within the autoservice thread.

Fixes: #763
(cherry picked from commit 9b3d3a7f0ead3132ba1ee47f80ad6b01c968e1e6)

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
(cherry picked from commit 83b378349945ba5de0c2dfdc19a7dd4c6aed0102)

10 months agores_pjsip_sdp_rtp: Use negotiated DTMF Payload types on bitrate mismatch
Mike Bradeen [Wed, 21 Aug 2024 16:11:31 +0000 (10:11 -0600)] 
res_pjsip_sdp_rtp: Use negotiated DTMF Payload types on bitrate mismatch

When Asterisk sends an offer to Bob that includes 48K and 8K codecs with
matching 4733 offers, Bob may want to use the 48K audio codec but can not
accept 48K digits and so negotiates for a mixed set.

Asterisk will now check Bob's offer to make sure Bob has indicated this is
acceptible and if not, will use Bob's preference.

Fixes: #847
(cherry picked from commit cf5a6435c2b135dd38413ded04cbd9ed9ff6fb53)

10 months agoapp_chanspy.c: resolving the issue with audiohook direction read
Tinet-mucw [Fri, 30 Aug 2024 05:45:32 +0000 (13:45 +0800)] 
app_chanspy.c: resolving the issue with audiohook direction read

ChanSpy(${channel}, qEoS): When chanspy spy the direction read, reading frame is often failed when reading direction read audiohook. because chanspy only read audiohook direction read; write_factory_ms will greater than 100ms soon, then ast_slinfactory_flush will being called, then direction read will fail.

Resolves: #861
(cherry picked from commit 4263f7b58da60af35f03064d7f93a922901b720d)

10 months agosecurity_agreements.c: Refactor the to_str functions and fix a few other bugs
George Joseph [Sat, 17 Aug 2024 18:13:40 +0000 (12:13 -0600)] 
security_agreements.c: Refactor the to_str functions and fix a few other bugs

* A static array of security mechanism type names was created.

* ast_sip_str_to_security_mechanism_type() was refactored to do
  a lookup in the new array instead of using fixed "if/else if"
  statments.

* security_mechanism_to_str() and ast_sip_security_mechanisms_to_str()
  were refactored to use ast_str instead of a fixed length buffer
  to store the result.

* ast_sip_security_mechanism_type_to_str was removed in favor of
  just referencing the new type name array.  Despite starting with
  "ast_sip_", it was a static function so removing it doesn't affect
  ABI.

* Speaking of "ast_sip_", several other static functions that
  started with "ast_sip_" were renamed to avoid confusion about
  their public availability.

* A few VECTOR free loops were replaced with AST_VECTOR_RESET().

* Fixed a meomry leak in pjsip_configuration.c endpoint_destructor
  caused by not calling ast_sip_security_mechanisms_vector_destroy().

* Fixed a memory leak in res_pjsip_outbound_registration.c
  add_security_headers() caused by not specifying OBJ_NODATA in
  an ao2_callback.

* Fixed a few ao2_callback return code misuses.

Resolves: #845
(cherry picked from commit 53c76478f228dc9a9227331acd07207c1f6401cc)

10 months agores_pjsip_sdp_rtp fix leaking astobj2 ast_format
Alexei Gradinari [Fri, 23 Aug 2024 20:28:24 +0000 (16:28 -0400)] 
res_pjsip_sdp_rtp fix leaking astobj2 ast_format

PR #700 added a preferred_format for the struct ast_rtp_codecs,
but when set the preferred_format it leaks an astobj2 ast_format.
In the next code
ast_rtp_codecs_set_preferred_format(&codecs, ast_format_cap_get_format(joint, 0));
both functions ast_rtp_codecs_set_preferred_format
and ast_format_cap_get_format increases the ao2 reference count.

Fixes: #856
(cherry picked from commit 8b39a956e70cc438372bb89f735c0d2202641e02)

10 months agostir_shaken.conf.sample: Fix bad references to private_key_path
George Joseph [Thu, 22 Aug 2024 18:03:56 +0000 (12:03 -0600)] 
stir_shaken.conf.sample: Fix bad references to private_key_path

They should be private_key_file.

Resolves: #854
(cherry picked from commit 0284099a9830436167fea5b1f8566c7bebf03bb8)

10 months agores_pjsip_logger.c: Fix 'OPTIONS' tab completion.
Sean Bright [Mon, 19 Aug 2024 18:12:47 +0000 (14:12 -0400)] 
res_pjsip_logger.c: Fix 'OPTIONS' tab completion.

Fixes #843

(cherry picked from commit fe4394ebfea76d31f1224e40ea1a762dcd9468be)

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

(cherry picked from commit fad7a7525bb6f39b6130f19ff9196fd6f7ec7c9c)

10 months agochan_mobile: decrease CHANNEL_FRAME_SIZE to prevent delay
Cade Parker [Wed, 7 Aug 2024 21:11:16 +0000 (16:11 -0500)] 
chan_mobile: decrease CHANNEL_FRAME_SIZE to prevent delay

On modern Bluetooth devices or lower-powered asterisk servers, decreasing the channel frame size significantly improves latency and delay on outbound calls with only a mild sacrifice to the quality of the call (the frame size before was massive overkill to begin with)

(cherry picked from commit 5840e55bb50dc025a5f023cf07fe78005faabfe7)

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

(cherry picked from commit e94c5f0d3bfa965a794f07666dc9d291f85b4179)

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

(cherry picked from commit 2da5559482c8ed2521f11b51e9601a72954f7558)

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

(cherry picked from commit 027127246eb91b10bf1ecf3d430092d1823c808d)

10 months agoconfigure: Use . file rather than source file.
Jaco Kroon [Mon, 5 Aug 2024 14:50:01 +0000 (16:50 +0200)] 
configure:  Use . file rather than source file.

source is a bash concept, so when /bin/sh points to another shell the
existing construct won't work.

Reference: https://bugs.gentoo.org/927055
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
(cherry picked from commit 7fb7e2b9fdba26812f5909b6ac157344ce5b5aae)

10 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
(cherry picked from commit 25c38db9a4cc50bdd31b7f7b3ee66390ccab9508)

10 months agores_pjsip_sdp_rtp.c: Fix DTMF Handling in Re-INVITE with dtmf_mode set to auto
Tinet-mucw [Fri, 2 Aug 2024 08:49:58 +0000 (16:49 +0800)] 
res_pjsip_sdp_rtp.c: Fix DTMF Handling in Re-INVITE with dtmf_mode set to auto

When the endpoint dtmf_mode is set to auto, a SIP request is sent to the UAC, and the SIP SDP from the UAC does not include the telephone-event. Later, the UAC sends an INVITE, and the SIP SDP includes the telephone-event. In this case, DTMF should be sent by RFC2833 rather than using inband signaling.

Resolves: asterisk#826
(cherry picked from commit 4aae8194b4389c4570368ea42152d2f1eff1e1b2)

10 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

(cherry picked from commit a393a7812e0d3c7d37e88ddcccb1306ff779ae5d)

10 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

(cherry picked from commit 453d50c21a591379c38af5488264113122e44bef)

10 months agostir_shaken: CRL fixes and a new CLI command
George Joseph [Fri, 19 Jul 2024 14:46:31 +0000 (08:46 -0600)] 
stir_shaken: CRL fixes and a new CLI command

* Fixed a bug in crypto_show_cli_store that was causing asterisk
to crash if there were certificate revocation lists in the
verification certificate store.  We're also now prefixing
certificates with "Cert:" and CRLs with "CRL:" to distinguish them
in the list.

* Added 'untrusted_cert_file' and 'untrusted_cert_path' options
to both verification and profile objects.  If you have CRLs that
are signed by a different CA than the incoming X5U certificate
(indirect CRL), you'll need to provide the certificate of the
CRL signer here.  Thse will show up as 'Untrusted" when showing
the verification or profile objects.

* Fixed loading of crl_path.  The OpenSSL API we were using to
load CRLs won't actually load them from a directory, only a file.
We now scan the directory ourselves and load the files one-by-one.

* Fixed the verification flags being set on the certificate store.
  - Removed the CRL_CHECK_ALL flag as this was causing all certificates
    to be checked for CRL extensions and failing to verify the cert if
    there was none.  This basically caused all certs to fail when a CRL
    was provided via crl_file or crl_path.
  - Added the EXTENDED_CRL_SUPPORT flag as it is required to handle
    indirect CRLs.

* Added a new CLI command...
`stir_shaken verify certificate_file <certificate_file> [ <profile> ]`
which will assist troubleshooting certificate problems by allowing
the user to manually verify a certificate file against either the
global verification certificate store or the store for a specific
profile.

* Updated the XML documentation and the sample config file.

Resolves: #809
(cherry picked from commit 96cf337cc9c8ac5525947a77091d095ce6abd8d5)

10 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.
(cherry picked from commit c9e23c46b0849ea257dfb5da6d53923162c36ee3)

10 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
(cherry picked from commit 591c1c77c7c4f8ad5856fe8c3bccd5db91e89665)

10 months agoUpdate for 18.24.3 18.24.3
Asterisk Development Team [Thu, 5 Sep 2024 16:57:24 +0000 (16:57 +0000)] 
Update for 18.24.3

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

11 months agoUpdate for 18.24.2 18.24.2
Asterisk Development Team [Thu, 8 Aug 2024 13:27:35 +0000 (13:27 +0000)] 
Update for 18.24.2

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

12 months agoUpdate for 18.24.1 18.24.1
Asterisk Development Team [Thu, 25 Jul 2024 15:23:44 +0000 (15:23 +0000)] 
Update for 18.24.1

12 months agortp_engine.c: Prevent segfault in ast_rtp_codecs_payloads_unset()
George Joseph [Thu, 25 Jul 2024 12:53:43 +0000 (06:53 -0600)] 
rtp_engine.c: Prevent segfault in ast_rtp_codecs_payloads_unset()

There can be empty slots in payload_mapping_tx corresponding to
dynamic payload types that haven't been seen before so we now
check for NULL before attempting to use 'type' in the call to
ast_format_cmp.

Note: Currently only chan_sip calls ast_rtp_codecs_payloads_unset()

Resolves: #822

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 agoUpdate for 18.24.0 18.24.0
Asterisk Development Team [Thu, 18 Jul 2024 14:58:41 +0000 (14:58 +0000)] 
Update for 18.24.0

12 months agoUpdate for 18.24.0-rc1 18.24.0-rc1
Asterisk Development Team [Thu, 11 Jul 2024 13:22:21 +0000 (13:22 +0000)] 
Update for 18.24.0-rc1

12 months agores_pjsip_path.c: Fix path when dialing using PJSIP_DIAL_CONTACTS()
Igor Goncharovsky [Sun, 12 May 2024 08:36:05 +0000 (14:36 +0600)] 
res_pjsip_path.c: Fix path when dialing using PJSIP_DIAL_CONTACTS()

When using the PJSIP_DIAL_CONTACTS() function for use in the Dial()
command, the contacts are returned in text form, so the input to
the path_outgoing_request() function is a contact value of NULL.
The issue was reported in ASTERISK-28211, but was not actually fixed
in ASTERISK-30100. This fix brings back the code that was previously
removed and adds code to search for a contact to extract the path
value from it.

(cherry picked from commit caa1820d2bb643ec9e891d082d9f6f1a85b05108)

12 months agores_pjsip_sdp_rtp: Add support for default/mismatched 8K RFC 4733/2833 digits
Mike Bradeen [Fri, 21 Jun 2024 22:56:11 +0000 (16:56 -0600)] 
res_pjsip_sdp_rtp: Add support for default/mismatched 8K RFC 4733/2833 digits

After change made in 624f509 to add support for non 8K RFC 4733/2833 digits,
Asterisk would only accept RFC 4733/2833 offers that matched the sample rate of
the negotiated codec(s).

This change allows Asterisk to accept 8K RFC 4733/2833 offers if the UAC
offfers 8K RFC 4733/2833 but negotiates for a non 8K bitrate codec.

A number of corresponding tests in tests/channels/pjsip/dtmf_sdp also needed to
be re-written to allow for these scenarios.

Fixes: #776
(cherry picked from commit ac9c510d991a3dc95dbd12261da8f992c80ced29)

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

(cherry picked from commit ff3190890626c138713dcf88c20ba0d3da228c29)

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

(cherry picked from commit 947dc2cd78ff63fb913a65304c6a0a318b264fb0)

12 months agoast-db-manage: Remove duplicate enum creation
George Joseph [Tue, 9 Jul 2024 02:07:25 +0000 (20:07 -0600)] 
ast-db-manage: Remove duplicate enum creation

Remove duplicate creation of ast_bool_values from
2b7c507d7d12_add_queue_log_option_log_restricted_.py.  This was
causing alembic upgrades to fail since the enum was already created
in fe6592859b85_fix_mwi_subscribe_replaces_.py back in 2018.

Resolves: #797
(cherry picked from commit 614d71fa19b0a89856db6326fee0833e70f206ca)

12 months agosecurity_agreement.c: Always add the Require and Proxy-Require headers
George Joseph [Wed, 3 Jul 2024 20:50:47 +0000 (14:50 -0600)] 
security_agreement.c: Always add the Require and Proxy-Require headers

The `Require: mediasec` and `Proxy-Require: mediasec` headers need
to be sent whenever we send `Security-Client` or `Security-Verify`
headers but the logic to do that was only in add_security_headers()
in res_pjsip_outbound_register.  So while we were sending them on
REGISTER requests, we weren't sending them on INVITE requests.

This commit moves the logic to send the two headers out of
res_pjsip_outbound_register:add_security_headers() and into
security_agreement:ast_sip_add_security_headers().  This way
they're always sent when we send `Security-Client` or
`Security-Verify`.

Resolves: #789
(cherry picked from commit 1d9f43b5a56fcc0cdaaf0ec8235b7c7f53a97707)

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

(cherry picked from commit 0bcee9de5d198c733ccc99e0c20eabffd9d2198a)

12 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

(cherry picked from commit df8fbe222a3cb72459e8f9df3dab0084b590bd78)

12 months agostasis_channels: Use uniqueid and name to delete old snapshots
George Joseph [Wed, 8 May 2024 17:32:36 +0000 (11:32 -0600)] 
stasis_channels: Use uniqueid and name to delete old snapshots

Whenver a new channel snapshot is created or when a channel is
destroyed, we need to delete any existing channel snapshot from
the snapshot cache.  Historically, we used the channel->snapshot
pointer to delete any existing snapshots but this has two issues.

First, if something (possibly ast_channel_internal_swap_snapshots)
sets channel->snapshot to NULL while there's still a snapshot in
the cache, we wouldn't be able to delete it and it would be orphaned
when the channel is destroyed.  Since we use the cache to list
channels from the CLI, AMI and ARI, it would appear as though the
channel was still there when it wasn't.

Second, since there are actually two caches, one indexed by the
channel's uniqueid, and another indexed by the channel's name,
deleting from the caches by pointer requires a sequential search of
all of the hash table buckets in BOTH caches to find the matching
snapshots.  Not very efficient.

So, we now delete from the caches using the channel's uniqueid
and name.  This solves both issues.

This doesn't address how channel->snapshot might have been set
to NULL in the first place because although we have concrete
evidence that it's happening, we haven't been able to reproduce it.

Resolves: #783
(cherry picked from commit 6f67835b4fb383a9caafc9076287a0ca3cf6c8bc)

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

(cherry picked from commit 2cb20b4bac7f0f1909d6d6f1eb9b70e894cd7552)

12 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

(cherry picked from commit 08080d3b603e1a76367742f5f7c599802a6440a9)

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.

(cherry picked from commit 2b9dc329bd9dd9ba8bb3063c077e082c91f3352a)

12 months agobridge_basic.c: Make sure that ast_bridge_channel is not destroyed while iterating...
Tinet-mucw [Fri, 14 Jun 2024 02:16:36 +0000 (19:16 -0700)] 
bridge_basic.c: Make sure that ast_bridge_channel is not destroyed while iterating over bridge->channels.
From the gdb information, we can see that while iterating over bridge->channels, the ast_bridge_channel reference count is 0, indicating it has already been destroyed.Additionally, when ast_bridge_channel is removed from bridge->channels, the bridge is first locked. Therefore, locking the bridge before iterating over bridge->channels can resolve the race condition.

Resolves: https://github.com/asterisk/asterisk/issues/768
(cherry picked from commit a1d0dac6c681e7cd2a15634907f729a9fd76259c)

12 months agoapp_queue: Add option to not log Restricted Caller ID to queue_log
Alexei Gradinari [Wed, 12 Jun 2024 21:18:05 +0000 (17:18 -0400)] 
app_queue:  Add option to not log Restricted Caller ID to queue_log

Add a queue option log-restricted-caller-id to strip the Caller ID when storing the ENTERQUEUE event
in the queue log if the Caller ID is restricted.

Resolves: #765

UpgradeNote: Add a new column to the queues table:
queue_log_option_log_restricted ENUM('0','1','off','on','false','true','no','yes')
to control whether the Restricted Caller ID will be stored in the queue log.

UserNote: Add a Queue option log-restricted-caller-id to control whether the Restricted Caller ID
will be stored in the queue log.
If log-restricted-caller-id=no then the Caller ID will be stripped if the Caller ID is restricted.

(cherry picked from commit 624c23310ec48031565bf28984c704aa4c9db77f)

12 months agopbx.c: expand fields width of "core show hints"
Alexei Gradinari [Thu, 13 Jun 2024 16:09:08 +0000 (12:09 -0400)] 
pbx.c: expand fields width of "core show hints"

The current width for "extension" is 20 and "device state id" is 20, which is too small.
The "extension" field contains "ext"@"context", so 20 characters is not enough.
The "device state id" field, for example for Queue pause state contains Queue:"queue_name"_pause_PSJIP/"endpoint", so the 20 characters is not enough.

Increase the width of "extension" field to 30 characters and the width of the "device state id" field to 60 characters.

Resolves: #770

UserNote: The fields width of "core show hints" were increased.
The width of "extension" field to 30 characters and
the width of the "device state id" field to 60 characters.

(cherry picked from commit dcdda4688e4d6d879021a92f14320bab0f726f00)

12 months agopjsip: Add PJSIP_PARSE_URI_FROM dialplan function.
Sean Bright [Sun, 2 Jun 2024 16:51:07 +0000 (12:51 -0400)] 
pjsip: Add PJSIP_PARSE_URI_FROM dialplan function.

Various SIP headers permit a URI to be prefaced with a `display-name`
production that can include characters (like commas and parentheses)
that are problematic for Asterisk's dialplan parser and, specifically
in the case of this patch, the PJSIP_PARSE_URI function.

This patch introduces a new function - `PJSIP_PARSE_URI_FROM` - that
behaves identically to `PJSIP_PARSE_URI` except that the first
argument is now a variable name and not a literal URI.

Fixes #756

(cherry picked from commit 5068cc814ffc14bdad39e6ecdbfeae92c7b797bf)

12 months agomanager.c: Properly terminate `CoreShowChannelMap` event.
Sean Bright [Mon, 10 Jun 2024 16:54:05 +0000 (12:54 -0400)] 
manager.c: Properly terminate `CoreShowChannelMap` event.

Fixes #761

(cherry picked from commit 87278c087a063e4cfb348d756141aabf816fc13d)

12 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

(cherry picked from commit 126cb5a20dfb6fe633fcab5f5f6f82ac383c2dfd)

12 months agocdr_pgsql: Fix crash when the module fails to load multiple times.
chrsmj [Thu, 16 May 2024 20:12:51 +0000 (14:12 -0600)] 
cdr_pgsql: Fix crash when the module fails to load multiple times.

Missing or corrupt cdr_pgsql.conf configuration file can cause the
second attempt to load the PostgreSQL CDR module to crash Asterisk via
the Command Line Interface because a null CLI command is registered on
the first failed attempt to load the module.

Resolves: #736
(cherry picked from commit 4fea8a433b398f869ce438b9211730538d42ecb6)

12 months agoasterisk.c: Don't log an error if .asterisk_history does not exist.
Sean Bright [Mon, 27 May 2024 13:43:12 +0000 (09:43 -0400)] 
asterisk.c: Don't log an error if .asterisk_history does not exist.

Fixes #751

(cherry picked from commit e9fb27f8045bd2064002d3255611924fe5fa525c)

12 months agochan_ooh323: Fix R/0 typo in docs
Walter Doekes [Mon, 27 May 2024 13:50:37 +0000 (15:50 +0200)] 
chan_ooh323: Fix R/0 typo in docs

Change-Id: I00d79a807dd0fea9e42fca919aa2fb0b71cdf20e
(cherry picked from commit 4f998eb5aaf17b3f37c02c766ba1065a56c04a50)