If processing an XInclude results in new <xi:include> elements, we
need to run XInclude processing again. This continues until no
replacement occurs or an error is encountered.
There is a separate issue with dynamic strings (ast_str) that will be
addressed separately.
Resolves: #65
The current AST_CEL_LOCAL_OPTIMIZE event is and has been
triggered on a local optimization end to serve as a flag
indicating the event occurred. This change adds a second
AST_CEL_LOCAL_OPTIMIZE_BEGIN event for further detail.
Resolves: #52
UpgradeNote: The existing AST_CEL_LOCAL_OPTIMIZE can continue
to be used as-is and the AST_CEL_LOCAL_OPTIMIZE_BEGIN event
can be ignored if desired.
UserNote: The new AST_CEL_LOCAL_OPTIMIZE_BEGIN can be used
by itself or in conert with the existing
AST_CEL_LOCAL_OPTIMIZE to book-end local channel optimizaion.
The current STIR/SHAKEN signing process is inconsistent with the
RFCs in a couple ways that can cause interoperability issues.
RFC8225 specifies that the keys must be ordered lexicographically, but
currently the fields are simply ordered according to the order
in which they were added to the JSON object, which is not
compliant with the RFC and can cause issues with some carriers.
To fix this, we now leverage libjansson's ability to dump a JSON
object sorted by key value, yielding the correct field ordering.
Additionally, telephone numbers must have any leading + prefix removed
and must not contain characters outside of 0-9, *, and # in order
to comply with the RFCs. Numbers are now properly formatted as such.
ASTERISK-30407 #close
Change-Id: Iab76d39447c4b8cf133de85657dba02fda07f9a2
The unit test XML output was counting all registered tests as "run"
even when only a subset were actually requested to be run and
the "failures" attribute was missing.
* The "tests" attribute of the "testsuite" element in the
output XML now reflects only the tests actually requested
to be executed instead of all the tests registered.
* The "failures" attribute was added to the "testsuite"
element.
Also added 2 new unit tests that just pass and fail to be
used for CI testing.
Change-Id: Ia137814b5aeb0e1a44c75034bd3615c26021da69
Various changes to ensure that the lexers and parsers can be correctly
generated when REBUILD_PARSERS is enabled.
Some notes:
* Because of the version of flex we are using to generate the lexers
(2.5.35) some post-processing in the Makefile is still required.
* The generated lexers do not contain the problematic C99 check that
was being replaced by the call to sed in the respective Makefiles so
it was removed.
* Since these files are generated, they will include trailing
whitespace in some places. This does not need to be corrected.
Change-Id: Ibbd343606fcf5c0d285b1599e6e8e59f514f2e4e
Add periodic beep option to one-touch recording by setting
the touch variable TOUCH_MONITOR_BEEP or
TOUCH_MIXMONITOR_BEEP to the desired interval in seconds.
If the interval is less than 5 seconds, a minimum of 5
seconds will be imposed. If the interval is set to an
invalid value, it will default to 15 seconds.
A new test event PERIODIC_HOOK_ENABLED was added to the
func_periodic_hook hook_on function to indicate when
a hook is started. This is so we can test that the touch
variable starts the hook as expected.
ASTERISK-30446
Change-Id: I800e494a789ba7a930bbdcd717e89d86040d6661
While it is possible to create multiple mixmonitor instances
on a channel, it was not previously possible to mute individual
instances.
This change includes the ability to specify the MixMonitorID
when calling the manager action: MixMonitorMute. This will
allow an individual MixMonitor instance to be muted via id.
This id can be stored as a channel variable using the 'i'
MixMonitor option.
As part of this change, if no MixMonitorID is specified in
the manager action MixMonitorMute, Asterisk will set the mute
flag on all MixMonitor spy-type audiohooks on the channel.
This is done via the new audiohook function:
ast_audiohook_set_mute_all.
ASTERISK-30464
Change-Id: Ibba8c7e750577aa1595a24b23316ef445245be98
For 'core show channels', the Channel name field is increased
to 64 characters and the Location name field is increased to
32 characters.
For 'core show channels verbose', the Channel name field is
increased to 80 characters, the Context is increased to 24
characters and the Extension is increased to 24 characters.
ASTERISK-30455
Change-Id: Ibec3742ce360ffc93bc56e9984c2a21dabc4d5e1
Fix the following build failure with libressl by using SSL_is_server
which is available since version 2.7.0 and
d7ec516916:
iostream.c: In function 'ast_iostream_close':
iostream.c:559:41: error: invalid use of incomplete typedef 'SSL' {aka 'struct ssl_st'}
559 | if (!stream->ssl->server) {
| ^~
ASTERISK-30107 #close
Fixes: - http://autobuild.buildroot.org/results/ce4d62d00bb77ba5b303cacf6be7e350581a62f9
Change-Id: Iea7f34970297f2fb50285d73462d0174ba7e9587
* Added a new function ast_utf8_replace_invalid_chars() to
utf8.c that copies a string replacing any invalid UTF-8
sequences with the Unicode specified U+FFFD replacement
character. For example: "abc\xffdef" becomes "abc\uFFFDdef".
Any UTF-8 compliant implementation will show that character
as a � character.
* Updated res_pjsip:set_id_from_hdr() to use
ast_utf8_replace_invalid_chars and print a warning if any
invalid sequences were found during the copy.
* Updated stasis_channels:ast_channel_publish_varset to use
ast_utf8_replace_invalid_chars and print a warning if any
invalid sequences were found during the copy.
ASTERISK-27830
Change-Id: I4ffbdb19c80bf0efc675d40078a3ca4f85c567d8
This avoids buffer overflow errors when running tests that capture
output from child processes.
This also corrects a copypasta in an off-nominal error message.
Change-Id: Ib482847a3515364f14c7e7a0c0a4213851ddb10d
-----------------
This commit reinstates MES with some casting fixes to the
functions in time.h that convert between doubles and timeval
structures. The casting issues were causing incorrect
timestamps to be calculated which caused transcoding from/to
G722 to produce bad or no audio.
ASTERISK-30391
-----------------
This module has been updated to provide additional
quality statistics in the form of an Asterisk
Media Experience Score. The score is avilable using
the same mechanisms you'd use to retrieve jitter, loss,
and rtt statistics. For more information about the
score and how to retrieve it, see
https://wiki.asterisk.org/wiki/display/AST/Media+Experience+Score
* Updated chan_pjsip to set quality channel variables when a
call ends.
* Updated channels/pjsip/dialplan_functions.c to add the ability
to retrieve the MES along with the existing rtcp stats when
using the CHANNEL dialplan function.
* Added the ast_debug_rtp_is_allowed and ast_debug_rtcp_is_allowed
checks for debugging purposes.
* Added several function to time.h for manipulating time-in-samples
and times represented as double seconds.
* Updated rtp_engine.c to pass through the MES when stats are
requested. Also debug output that dumps the stats when an
rtp instance is destroyed.
* Updated res_rtp_asterisk.c to implement the calculation of the
MES. In the process, also had to update the calculation of
jitter. Many debugging statements were also changed to be
more informative.
* Added a unit test for internal testing. The test should not be
run during normal operation and is disabled by default.
Change-Id: I4fce265965e68c3fdfeca55e614371ee69c65038
Currently, if a module declines to load, dlopen is called
to register the module but dlclose never gets called.
Furthermore, loader.c currently doesn't allow dlclose
to ever get called on the module, since it declined to
load and the unload function bails early in this case.
This can be problematic if a module is updated, since the
new module cannot be loaded into memory since we haven't
closed all references to it. To fix this, we now allow
modules to be unloaded, even if they never "loaded" in
Asterisk itself, so that dlclose is called and the module
can be properly cleaned up, allowing the updated module
to be loaded from scratch next time.
ASTERISK-30345 #close
Change-Id: Ifc743aadfa85ebe3284e02a63e124dafa64988d5
If native HTTP is disabled but HTTPS is enabled and status page enabled
too, Core/HTTP crashes while loading. 'global_http_server' references
to NULL, but the status page tries to dereference it.
The patch adds a check for HTTP is enabled.
ASTERISK-30379 #close
Change-Id: I11b02fc920b72aaed9c809fc43210523ccfdc249
The if statement here is always false after the for
loop finishes, so variables are never appended.
This removes that to properly append to the end
of the variable list.
ASTERISK-30351 #close
Reported by: Sebastian Gutierrez
Change-Id: I1b7f8b85a8918f6a814cb933a479d4278cf16199
pbx_exec makes a channel snapshot before executing applications.
This doesn't cause an issue during normal dialplan execution
where pbx_exec is called over and over again in succession.
However, if pbx_exec is called "one off", e.g. using
ast_pbx_exec_application, then a channel snapshot never ends
up getting made after the executed application returns, and
inaccurate snapshot information will linger for a while, causing
"core show channels", etc. to show erroneous info.
This is fixed by manually making a channel snapshot at the end
of ast_pbx_exec_application, since we anticipate that pbx_exec
might not get called again immediately.
ASTERISK-30367 #close
Change-Id: I2a5131053aa9d11badbc0ef2ef40b1f83d0af086
This module has been updated to provide additional
quality statistics in the form of an Asterisk
Media Experience Score. The score is avilable using
the same mechanisms you'd use to retrieve jitter, loss,
and rtt statistics. For more information about the
score and how to retrieve it, see
https://wiki.asterisk.org/wiki/display/AST/Media+Experience+Score
* Updated chan_pjsip to set quality channel variables when a
call ends.
* Updated channels/pjsip/dialplan_functions.c to add the ability
to retrieve the MES along with the existing rtcp stats when
using the CHANNEL dialplan function.
* Added the ast_debug_rtp_is_allowed and ast_debug_rtcp_is_allowed
checks for debugging purposes.
* Added several function to time.h for manipulating time-in-samples
and times represented as double seconds.
* Updated rtp_engine.c to pass through the MES when stats are
requested. Also debug output that dumps the stats when an
rtp instance is destroyed.
* Updated res_rtp_asterisk.c to implement the calculation of the
MES. In the process, also had to update the calculation of
jitter. Many debugging statements were also changed to be
more informative.
* Added a unit test for internal testing. The test should not be
run during normal operation and is disabled by default.
ASTERISK-30280
Change-Id: I458cb9a311e8e5dc1db769b8babbcf2e093f107a
When ast_stream_and_wait returns an error (for example, when attempting
to stream to a channel after hangup) the stream is not closed, and
callers typically do not check the return code. This results in leaking
file descriptors, leading to resource exhaustion.
This change ensures that the stream is closed in case of error.
ASTERISK-30198 #close
Reported-by: Julien Alie
Change-Id: Ie46b67314590ad75154595a3d34d461060b2e803
The XML docs are currently only loaded on
startup with no way to update them during runtime.
This makes it impossible to load modules that
use ACO/Sorcery (which require documentation)
if they are added to the source tree and built while
Asterisk is running (e.g. external modules).
This adds a CLI command to reload the XML docs
during runtime so that documentation can be updated
without a full restart of Asterisk.
ASTERISK-30289 #close
Change-Id: I4f265b0e5517e757c5453a0f241201a5788d3a07
Add live_dangerously flag to manager and use this flag to
determine if a configuation file outside of AST_CONFIG_DIR
should be read.
ASTERISK-30176
Change-Id: I46b26af4047433b49ae5c8a85cb8cda806a07404
This PR contains two relatively separate changes in channel.c and
res_pjsip_session.c which ensure that topology changes are not ignored
in cases where they should be handled.
For channel.c:
The function ast_channel_request_stream_topology_change only triggers a
stream topology request change indication, if the channel's topology
does not equal the requested topology. However, a channel could be in a
state where it is currently "negotiating" a new topology but hasn't
updated it yet, so the topology request change would be lost. Channels
need to be able to handle such situations internally and stream
topology requests should therefore always be passed on.
In the case of chan_pjsip for example, it queues a session refresh
(re-INVITE) if it is currently in the middle of a transaction or has
pending requests (among other reasons).
Now, ast_channel_request_stream_topology_change always indicates a
stream topology request change even if the requested topology equals the
channel's topology.
For res_pjsip_session.c:
The function resolve_refresh_media_states does not process stream state
changes if the delayed active state differs from the current active
state. I.e. if the currently active stream state has changed between the
time the sip session refresh request was queued and the time it is being
processed, the session refresh is ignored. However, res_pjsip_session
contains logic that ensures that session refreshes are queued and
re-queued correctly if a session refresh is currently not possible. So
this check is not necessary and led to some session refreshes being
lost.
Now, a session refresh is done even if the delayed active state differs
from the current active state and it is checked whether the delayed
pending state differs from the current active - because that means a
refresh is necessary.
Further, the unit test of resolve_refresh_media_states was adapted to
reflect the new behavior. I.e. the changes to delayed pending are
prioritized over the changes to current active because we want to
preserve the original intention of the pending state.
ASTERISK-30184
Change-Id: Icd0703295271089057717006730b555b9a1d4e5a
The Answer application currently waits for up to 500ms
for media, even if users specify a different timeout.
This adds an option to not wait for media on the channel
by doing a raw answer instead. The default 500ms threshold
is also documented.
ASTERISK-30308 #close
Change-Id: Id59cd340c44b8b8b2384c479e17e5123e917cba4
The ModuleCheck XML documentation falsely
claims that the module's version number is returned.
This has not been the case since 14, since the version
number is not available anymore, but the documentation
was not changed at the time. It is now updated to
reflect this.
ASTERISK-30285 #close
Change-Id: Idde2d1205a11f2623fa1ddab192faa3dc4081e91
write_openssl_error_to_log has been erroneously
using ast_free instead of free, which will
cause a crash when MALLOC_DEBUG is enabled since
the memory was not allocated by Asterisk's memory
manager. This changes it to use the actual free
function directly to avoid this.
ASTERISK-30278 #close
Change-Id: Iac8b6468b718075809c45d8ad16b101af21a474d
race condition: ast_dial_join() may not cancel outgoing call, if
function is called just after called party answer and before
application execution (bit is_running_app not yet set).
This fix adds ast_softhangup() calls in addition to existing
pthread_kill() when is_running_app is not set.
ASTERISK-30258
Change-Id: Idbdd5c15122159661aa8e996a42d5800083131e4
Some logic in say.c for determining if we need
to also add an ampersand for file seperation was faulty,
as non-successful files would increment the count, causing
a leading ampersand to be added improperly.
This is fixed, and a unit test that captures this regression
is also added.
ASTERISK-30248 #close
Change-Id: I02c1d3a11d82fe4ea8b462070cbd1effb5834d2b
Add enum to allow setting optional direction. If set to only one
direction, only feed matching-direction frames to the associated
slin factory.
This prevents mangling the transcoder on non-mixed frames when the
READ and WRITE frames would have otherwise required it. Also
removes the need to mute or discard the un-wanted frames as they
are no longer added in the first place.
res_stasis_snoop is changed to use this addition to set direction
on audiohook based on spy direction.
If no direction is set, the ast_audiohook_init will init this enum
to BOTH which maintains existing functionality.
ASTERISK-30252
Change-Id: If8716bad334562a5d812be4eeb2a92e4f3be28eb
Allows bridging, parking, and dial messages to be globally
ignored for all CDRs such that only a single CDR record
is generated per channel.
This is useful when CDRs should endure for the lifetime of
an entire channel and bridging and dial updates in the
dialplan should not result in multiple CDR records being
created for the call. With the ignore bridging option,
bridging changes have no impact on the channel's CDRs.
With the ignore dial state option, multiple Dials and their
outcomes have no impact on the channel's CDRs. The
last disposition on the channel is preserved in the CDR,
so the actual disposition of the call remains available.
These two options can reduce the amount of "CDR hacks" that
have hitherto been necessary to ensure that CDR was not
"spoiled" by these messages if that was undesired, such as
putting a dummy optimization-disabled local channel between
the caller and the actual call and putting the CDR on the channel
in the middle to ensure that CDR would persist for the entire
call and properly record start, answer, and end times.
Enabling these options is desirable when calls correspond
to the entire lifetime of channels and the CDR should
reflect that.
Current default behavior remains unchanged.
ASTERISK-30091 #close
Change-Id: I393981af42732ec5ac3ff9266444abb453b7c832
The DBGetTree AMI action's ListItem previously
always reported 1, regardless of the count. This
is corrected to report the actual count.
ASTERISK-30245 #close
patches:
gettreecount.diff submitted by Birger Harzenetter (license 5870)
Change-Id: I46d8992710f1b8524426b1255f57d1ef4a4934d4
Adds the n "no answer" option to the Bridge application
so that answer supervision can not automatically
be provided when Bridge is executed.
Additionally, a mechanism (dialplan variable)
is added to prevent bridge targets (typically the
target of a masquerade) from answering the channel
when they enter the bridge.
ASTERISK-30223 #close
Change-Id: I76f73fcd8e403bcd18f2abb40c658f537ac1ba6d
If we find that n_max (currently hard wired to 1) sessions were purged,
schedule the next purge for 1ms into the future rather than 5000ms (as
per current). This way we will purge up to 1000 sessions per second
rather than 1 every 5 seconds.
This mitigates a build-up of sessions should http sessions gets
established faster than 1 per 5 seconds.
Change-Id: I9820d39aa080109df44fe98c1325cafae48d54f5
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
Fixed a segfault caused by var_list_from_loc_info() encountering
an empty location info element.
Fixed an issue in ast_strsep() where a value with only whitespace
wasn't being preserved.
Fixed an issue in ast_variable_list_from_quoted_string() where
an empty value was considered a failure.
ASTERISK-30215
Reported by: Dan Cropp
Change-Id: Ieca64e061a6d9298f0196c694b60d986ef82613a
Adds an AMI event to indicate that a deadlock
has likely started, when Asterisk is compiled
with DETECT_DEADLOCKS enabled. This can make
it easier to perform automated deadlock detection
and take appropriate action (such as doing a core
dump). Unlike the deadlock warnings, the AMI event
is emitted only once per deadlock.
ASTERISK-30161 #close
Change-Id: Ifc6ed3e390f8b4cff7f8077a50e4d7a5b54e42fb
If "core show channels" is run before startup has completed, it
is possible for bad ao2 refs to occur because the system is not
yet fully initialized. This will lead to an assertion failing.
To prevent this, initialization of CLI builtins is moved to be
later along in the main load sequence. Core CLI commands are
loaded at the same time, but channel-related commands are loaded
later on.
ASTERISK-29846 #close
Change-Id: If6b3cde802876bd738c1b4cf2683bea6ddc615b6
Adds additional control options over the transfer
feature functionality to give users more control
in how the transfer feature sounds and works.
First, the "transfer" sound that plays when a transfer is
initiated can now be customized by the user in
features.conf, just as with the other transfer sounds.
Secondly, the user can now specify the transfer extension
in advance by using the TRANSFER_EXTEN variable. If
a valid extension is contained in this variable, the call
will automatically be transferred to this destination.
Otherwise, it will fall back to collecting the extension
from the user as is always done now.
ASTERISK-29899 #close
Change-Id: Ibff309caa459a2b958706f2ed0ca393b1ef502e3
Fixes a few coding guideline violations:
* Use of C99 comments
* Opening brace on same line as function prototype
ASTERISK-30163 #close
Change-Id: I07771c4c89facd41ce8d323859f022ddbddf6ca7
* Added processing for the 'confidence' element.
* Added documentation to some APIs.
* removed a lot of complex code related to the very-off-nominal
case of needing to process multiple location info sources.
* Create a new 'ast_geoloc_eprofile_to_pidf' API that just takes
one eprofile instead of a datastore of multiples.
* Plugged a huge leak in XML processing that arose from
insufficient documentation by the libxml/libxslt authors.
* Refactored stylesheets to be more efficient.
* Renamed 'profile_action' to 'profile_precedence' to better
reflect it's purpose.
* Added the config option for 'allow_routing_use' which
sets the value of the 'Geolocation-Routing' header.
* Removed the GeolocProfileCreate and GeolocProfileDelete
dialplan apps.
* Changed the GEOLOC_PROFILE dialplan function as follows:
* Removed the 'profile' argument.
* Automatically create a profile if it doesn't exist.
* Delete a profile if 'inheritable' is set to no.
* Fixed various bugs and leaks
* Updated Asterisk WiKi documentation.
ASTERISK-30167
Change-Id: If38c23f26228e96165be161c2f5e849cb8e16fa0
The manager XML documentation documents a "FilterList"
action, but there is no such action. Therefore, this can
lead to confusion when people try to use a documented
action that does not, in fact, exist. This is removed
as the action never did exist in the past, nor would it
be trivial to add since we only store the regex_t
objects, so the filter list can't actually be provided
without storing that separately. Most likely, the
documentation was originally added (around version 10)
in anticipation of something that never happened.
ASTERISK-29917 #close
Change-Id: I846b16fd6f80a91d4ddc5d8a861b522d7c6f8f97
Adjusts some logging levels to be more or less important,
that is more prominent when actual problems occur and less
prominent for less noteworthy things.
ASTERISK-30153 #close
Change-Id: Ifc8f7df427aa018627db462125ae744986d3261b
When ast_func_read2 is used to read a function using
its read function (as opposed to a native ast_str read2
function), the result is copied directly by the function
into the ast_str buffer. As a result, the ast_str length
remains initialized to 0, which is a bug because this is
not the real string length.
This can cascade and have issues elsewhere, such as when
reading substrings of functions that only register read
as opposed to read2 callbacks. In this case, since reading
ast_str_strlen returns 0, the returned substring is empty
as opposed to the actual substring. This has caused
the ast_str family of functions to behave inconsistently
and erroneously, in contrast to the pbx_variables substitution
functions which work correctly.
This fixes this issue by manually updating the ast_str length
when the result is copied directly into the ast_str buffer.
Additionally, an assertion and a unit test that previously
exposed these issues are added, now that the issue is fixed.
ASTERISK-29966 #close
Change-Id: I4e2dba41410f9d4dff61c995d2ca27718248e07f
The global event filtering code was only in one
possible execution path, so not all events were
being properly filtered out if requested. This moves
that into the universal AMI handling code so all
events are properly handled.
Additionally, the CLI listing of disabled events can
also get truncated, so we now print out everything.
ASTERISK-30137 #close
Change-Id: If8c42edcb2abc5158552da7eba2a8ff6b20e1959