Fixes four misuses of the parameter 'name'. Additionally, for
consistency and to avoid such an issue in future, those few other
places, which used '\file name', were changed just to '\file'. Then,
Doxygen uses the name of the current file.
ASTERISK-29733
Change-Id: I0c18b4c863c6988b138c77448057349a9ee7052d
Currently, when the t option is specified with no arguments,
the # character is still treated as a terminator, even though
no character should be treated as a terminator.
This is because a previous regression fix was modified to
remove the use of NULL as a default altogether. However,
NULL and an empty string actually refer to different
arrangements and should be treated differently. NULL is the
default terminator (#), while an empty string removes the
terminator altogether. This is the behavior being used by
the rest of the core.
Additionally, since S_OR catches empty strings as well as
NULL (not intended), this is changed to a ternary operator
instead, which fixes the behavior.
ASTERISK-29705 #close
Change-Id: I9b6b72196dd04f5b1e0ab5aa1b0adf627725e086
When reloading dialplan, hints created dynamically would lose any dash
characters. Now we ignore those dashes if we are dealing with a hint
during a reload.
ASTERISK-28040 #close
Change-Id: I95e48f5a268efa3c6840ab69798525d3dce91636
* Initialize some variables that are never used anyway.
* Use valid pointers instead of integers cast to void pointers when
calling pthread_setspecific().
ASTERISK-29711 #close
ASTERISK-29713 #close
Change-Id: I8728cd6f2f4b28e0e48113c5da450b768c2a6683
Add a function to check if there is an exact match a one string between
delimiters in another string.
Add a function that will create an ast_json object out of a list of
Asterisk variables. An excludes string can also optionally be passed
in.
Also, add a macro to make it easier to get object integers.
Change-Id: I5f34f18e102126aef3997f19a553a266d70d6226
Some ast_stun_request users do not provide a destination address when
sending to a connection-mode socket.
ASTERISK-29691
Change-Id: Idd9114c3380216ba48abfc3c68619e79ad37defc
The current versions do not support future dates in all say application when using the 'Q' or 'q' format parameter and says "today" for everything that is greater than today
ASTERISK-29637
Change-Id: I1fb1cef0ce3c18d87b1fc94ea309d13bc344af02
The MessageSend AMI action has been updated to allow the Destination
and the To addresses to be provided separately. This brings the
MessageSend manager command in line with the capabilities of the
MessageSend dialplan application.
ASTERISK-29663 #close
Change-Id: I8513168d3e189a9fed88aaab6f5547ccb50d332c
Adds the ability for users to log to custom log levels
by providing custom log level names in logger.conf. Also
adds a logger show levels CLI command.
ASTERISK-29529
Change-Id: If082703cf81a436ae5a565c75225fa8c0554b702
Up until now, all of the logic used to translate
arguments to the Say applications has been
directly coupled to playback, preventing other
modules from using this logic.
This refactors code in say.c and adds a SAYFILES
function that can be used to retrieve the file
names that would be played. These can then be
used in other applications or for other purposes.
Additionally, a SayMoney application and a SayOrdinal
application are added. Both SayOrdinal and SayNumber
are also expanded to support integers greater than
one billion.
ASTERISK-29531
Change-Id: If9718c89353b8e153d84add3cc4637b79585db19
dsp.c contains arbitrary tone detection functionality
which is currently only used for fax tone recognition.
This change makes this functionality publicly
accessible so that other modules can take advantage
of this.
Additionally, a WaitForTone and TONE_DETECT app and
function are included to allow users to do their
own tone detection operations in the dialplan.
ASTERISK-29546
Change-Id: Ie38c395000f4fd4d04e942e8658e177f8f499b26
ncurses 6.1 introduced an extended number format for terminfo files
which the terminfo parsing in Asterisk is not able to parse. This
results in some TERM values that do support color (screen-256color on
Ubuntu 20.04 for example) to not get a color console.
ASTERISK-29630 #close
Change-Id: I27a4fcfab502219924af2d6b1c46feba92903cb3
IPv6 nameserver addresses are stored in different part of the
__res_state structure, so look there if we appear to have support for
it.
ASTERISK-28004 #close
Change-Id: I67067077d8a406ee996664518d9c8fbf11f6977d
There are 3 separate changes here but they are all closely related:
* Only try to set matchfield attributes on 'field' nodes
* We need to adjust how we treat the category pointer based on the
value of the category_match, to avoid memory corruption. We now
generate a regex-like string when match types other than
ACO_WHITELIST and ACO_BLACKLIST are used.
* Switch app_agent_pool from ACO_BLACKLIST_ARRAY to
ACO_BLACKLIST_EXACT since we only have one category we need to
ignore, not two.
ASTERISK-29614 #close
Change-Id: I7be7bdb1bb9814f942bc6bb4fdd0a55a7b7efe1e
Allows for the digit # to be read as a digit,
just like any other DTMF digit, as opposed to
forcing it to be used as an end of input
indicator. The default behavior remains
unchanged.
ASTERISK-18454 #close
Change-Id: I3033432adb9d296ad227e76b540b8b4a2417665b
This allows the STUN server to change its IP address without having to
reload the res_rtp_asterisk module.
The refresh of the name resolution occurs first when the module is
loaded, then recurringly, slightly after the previous DNS answer TTL
expires.
ASTERISK-29508 #close
Change-Id: I7955a046293f913ba121bbd82153b04439e3465f
The attended transfer feature will emit a warning if the user
cancels the transfer or the attended transfer doesn't complete
for any reason. Changes the warning to a verbose message,
since nothing is actually wrong here.
ASTERISK-29612 #close
Change-Id: I64c93cdb21360a0a8d45e9cb6db3af8168f66e6d
When playing a remote sound file, which is not in cache, first we need
to download it with ast_bucket_file_retrieve.
This can take a while if the remote host is slow. The current CURL
timeout is 180secs, so in extreme situations, it can take 3 minutes to
return.
Because ast_media_cache_retrieve has a lock on all function, while we
are waiting for the delayed download, Asterisk is not able to play any
more files, even the files already cached locally.
ASTERISK-29544 #close
Change-Id: I8d4142b463ae4a1d4c41bff2bf63324821567408
With Asterisk 1.6.0, in the main parser for the configuration file
extensions.conf, the separator was changed from vertical bar to comma.
However, the first separator was not changed in aelparse; it still had
to be a vertical bar, and no comma was allowed.
Additionally, this change allows the vertical bar for the first and
last parameter again, even in the main parser, because the vertical bar
was still accepted for the other parameters.
ASTERISK-29540
Change-Id: I882e17c73adf4bf2f20f9046390860d04a9f8d81
If Asterisk gets G.729 6-byte VAD frames inbound, then at outbound Asterisk sends this G.729 stream with non-continuous timestamps.
This makes the audio stream not-playable at the receiver side.
Linphone isn't able to play such an audio - lots of disruptions are heard.
Also I had complains of bad audio from users which use other types of phones.
After debugging, I found this is a regression connected with RTP Smoother (main/smoother.c).
Smoother has a special code to handle G.729 VAD frames (search for AST_SMOOTHER_FLAG_G729 in smoother.c).
However, this flag is never set in Asterisk-12 and newer.
Previously it has been set (see Asterisk-11).
ASTERISK-29526 #close
Change-Id: I6f51ecb1a3ecd9c6d59ec5a6811a27446e17065d
Use the URI parsing functions to parse playback URLs in order to find
their file extensions.
For backwards compatibility, we first look at the full URL, then at
any Content-Type header, and finally at just the path portion of the
URL.
ASTERISK-27871 #close
Change-Id: I16d0682f6d794be96539261b3e48f237909139cb
This appears to just have been a copy/paste error from 6258bbe7. Fix
suggested by Ross Beer in ASTERISK~29166.
Change-Id: I51e0de92042e53f37597c6f83a75621ef0d1ae37
If the system time has stepped backwards because of a time
adjustment between the time a frame is timestamped and the
time we check the timestamps in abstract_jb:hook_event_cb(),
we get a negative interval, but we don't check for that there.
abstract_jb:hook_event_cb() then calls
fixedjitterbuffer:fixed_jb_get() (via abstract_jb:jb_get_fixed)
and the first thing that does is assert(interval >= 0).
There are several issues with this...
* abstract_jb:hook_event_cb() saves the interval in a variable
named "now" which is confusing in itself.
* "now" is defined as an unsigned int which converts the negative
value returned from ast_tvdiff_ms() to a large positive value.
* fixed_jb_get()'s parameter is defined as a signed int so the
interval gets converted back to a negative value.
* fixed_jb_get()'s assert is NOT an ast_assert but a direct define
that points to the system assert() so it triggers even in
production mode.
So...
* hook_event_cb()'s "now" was renamed to "relative_frame_start" and
changed to an int64_t.
* hook_event_cb() now checks for a negative value right after
retrieving both the current and framedata timestamps and just
returns the frame if the difference is negative.
* fixed_jb_get()'s local define of ASSERT() was changed to call
ast_assert() instead of the system assert().
ASTERISK-29480
Reported by: Dan Cropp
Change-Id: Ic469dec73c2edc3ba134cda6721a999a9714f3c9
When using the Busy() and Congestion() applications the
function ast_safe_sleep is used by wait_for_hangup to safely
wait on the channel. This function may send silence if Asterisk
is configured to do so using the transmit_silence option.
In a scenario where an answered channel dials a Local channel
either directly or through call forwarding and the Busy()
or Congestion() dialplan applications were executed with the
transmit_silence option enabled the busy or congestion
tone would not be heard.
This is because inband generation of tones (such as busy
and congestion) is stopped when other audio is sent to
the channel they are being played to. In the given
scenario the transmit_silence option would result in
silence being sent to the channel, thus stopping the
inband generation.
This change adds a variant of ast_safe_sleep which can be
used when silence should not be played to the channel. The
wait_for_hangup function has been updated to use this
resulting in the tones being generated as expected.
ASTERISK-29485
Change-Id: I066bfc987a3ad6f0ccc88e0af4cd63f6a4729133
Previously, SayNumber always emitted a warning if the caller hung up
during execution. Usually this isn't correct, so check if the channel
hung up and, if so, don't emit a warning.
ASTERISK-29475
Change-Id: Ieea4a67301c6ea83bbc7690c1d4808d79a704594
Although Asterisk can receive and propogate flash events, it currently
provides no mechanism for doing anything with them itself.
This AMI event allows flash events to be processed by Asterisk.
Additionally, AST_CONTROL_FLASH is included in a switch statement
in channel.c to avoid throwing a warning when we shouldn't.
ASTERISK-29380
Change-Id: Ie17ffe65086e0282c88542e38eed6a461ec79e81
AST_CONTROL_FLASH isn't accounted for in a switch statement in file.c
where it should be ignored. Adding this to the switch ensures a
warning isn't thrown on RFC2833 flash events, since nothing's amiss.
ASTERISK-29372
Change-Id: I4fa549bfb7ba1894a4044de999ea124877422fbc
STIR/SHAKEN encodes using base64 URL format. Currently, we just use
base64. New functions have been added that convert to and from base64
encoding.
The origid field should also be an UUID. This means there's no reason to
have it as an option in stir_shaken.conf, as we can simply generate one
when creating the Identity header.
https://wiki.asterisk.org/wiki/display/AST/OpenSIPit+2021
Change-Id: Icf094a2a54e87db91d6b12244c9f5ba4fc2e0b8c
Enhancements:
* The MessageSend dialplan application now takes an optional
third argument that can set the message's "To" field on
outgoing messages. It's an alternative to using the
MESSAGE(to) dialplan function.
NOTE: No channel driver currently implements this field. A
follow-on commit for res_pjsip_messaging will implement it for
the chan_pjsip channel driver.
* To prevent confusion with the first argument, currently named
"to", it's been renamed to "destination". Its function,
creating the request URI, hasn't changed.
* The documentation for MessageSend was updated to be
more clear about the parameters and how they interact
the MESSAGE() dialplan function.
* With the rename of MessageSend's first parameter, and the fact
that message.c references <info> elements in chan_sip.c,
res_pjsip_messaging.c and res_xmpp, they each needed
documentation updates to use MessageDestinationInfo instead of
MessageToInfo.
* appdocsxml.dtd was updated to include a missing element
declaration for "dataType". This was showing up as an error
in Eclipse's dtd editor.
* Despite the changes in this commit, there should be
no impact to current users of MessageSend.
Change-Id: I6fb5b569657a02866a66ea352fd53d30d8ac965a
When a stream topology is provided to chan_local when dialing
it filters the audio formats down. This operation did not skip
streams which were removed (that have no formats) resulting in
calling being aborted.
This change causes such streams to be skipped.
ASTERISK-29407
Change-Id: I1de8b98727cb2d10f4bc287da0b5fdcb381addd6
Up/down sampling changes the number of samples produced by a translation.
This must be taken into account when checking the codec's buffer size.
ASTERISK-29328
Change-Id: I9aebe2f8788e00321a7f5c47aa97c617f39e9055
There is a possibility, when bridge_channel_write_frame() is
called, that the bridge_channel->chan will be NULL. The first
thing bridge_channel_write_frame() does though is call
ast_channel_is_multistream() which had no check for a NULL
channel and therefore caused a segfault. Since it's still
possible for bridge_channel_write_frame() to write the frame to
the other channels in the bridge, we don't want to bail before we
call ast_channel_is_multistream() but we can just skip the
multi-channel stuff. So...
bridge_channel_write_frame() only calls ast_channel_is_multistream()
if bridge_channel->chan is not NULL.
As a safety measure, ast_channel_is_multistream() now returns
false if the supplied channel is NULL.
ASTERISK-29379
Reported-by: Vyrva Igor
Reported-by: Ross Beer
Change-Id: Idfe62dbea8c69813ecfd58e113a6620dc42352ce
Using the information from the MODULEINFO XML we can
now output useful information at the end of module
loading for deprecated modules. This includes the
version it was deprecated in, the version it will be
removed in, and the replacement if available.
ASTERISK-29339
Change-Id: I2080dab97d2186be94c421b41dabf6d79a11611a
Added a TIME_UNIT enumeration, and a function that converts a
string to one of the enumerated values. Also, added functions
that create and initialize a timeval object using a specified
value, and unit type.
Change-Id: Ic31a1c3262a44f77a5ef78bfc85dcf69a8d47392
The 'core' console (ie: asterisk -c) does read logger.conf and does
use the dateformat= option.
Whereas 'remote' consoles (ie: asterisk -r -T) does not read logger.conf
and uses a hard coded dateformat option for printing received verbose messages:
main/logger.c: static char dateformat[256] = "%b %e %T"
This change will load logger.conf for each remote console session and
use the dateformat= option to set the per-line timestamp for verbose messages
Change-Id: I3ea10990dbd920e9f7ce8ff771bc65aa7f4ea8c1
ASTERISK-25358: #close
Reported-by: Igor Liferenko
When using the ast_unreal_lock_all function no channel
locks can be held before calling it.
This change unlocks the channel that indicate was
called on before doing so and then relocks it afterwards.
ASTERISK-29035
Change-Id: Id65016201b5f9c9519a216e250f9101c629e19e9
There exists an inconsistency with framehook usage
such that it is only on reads that the frame should
be freed, not on writes as well.
ASTERISK-29071
Change-Id: I5ef918ebe4debac8a469e8d43bf9d6b673e8e472
Some sorcery objects actually contain dynamic content
that can change despite the underlying configuration
itself not changing. A good example of this is the
res_pjsip_endpoint_identifier_ip module which allows
specifying hostnames. While the configuration may not
change between reloads the DNS information of the
hostnames can.
This change adds the ability for a sorcery object to be
marked as having dynamic contents which is then taken
into account when reloading by the sorcery file based
config module. If there is an object with dynamic content
then a reload will be forced while if there are none
then the existing behavior of not reloading occurs.
ASTERISK-29321
Change-Id: I9342dc55be46cc00204533c266a68d972760a0b1
A frame suppression API exists as part of channels
which allows audio frames to or from a channel to
be dropped. The MuteAudio AMI action uses this
API to perform its job.
This API uses a framehook to intercept flowing
audio and drop it when appropriate. It is the
responsibility of the framehook to free the
frame it is given if it changes the frame. The
suppression API failed to do this resulting in
a leak of audio frames.
This change adds the freeing of these frames.
ASTERISK-29071
Change-Id: Ie50acd454d672d36af914050c327d2e120d8ba7b
Implemented the english way of saying the year in ast_say_date_with_format_nl.
Currently the numbers are spoken correctly until 2020 and stopped working
this year.
ASTERISK-29297 #close
Reported-by: Jacek Konieczny
Change-Id: If5918eed5ab05df31df4dd23f08a909a60f6aba4
Instead of looking for pass-through formats in the list of transcodable
formats (which is going to find nothing), go through the result which
is going to be the jointcaps of the tech_pvt of the channel. Finally,
only with that list, ast_format_cap_remove(.) is going to succeed.
This restores the behaviour of Asterisk 1.8. However, it does not fix
ASTERISK_29282 because that issue report is about chan_sip and PJSIP.
Here, only chan_sip is fixed because PJSIP does not even call
ast_rtp_instance_available_formats -> ast_translate_available_format.
Change-Id: Icade2366ac2b82935b95a9981678c987da2e8c34
After some changes to streams and topologies, receiving fax through
local channels stopped working. This change adds a stream topology with
a stream of type IMAGE to the local channel pair and allows fax to be
received.
ASTERISK-29035 #close
Change-Id: Id103cc5c9295295d8e68d5628e76220f8f17e9fb
When a Transfer/REFER is executed, TRANSFERSTATUSPROTOCOL variable is
0 when no protocl specific error
SIP example of failure, 3xx-6xx for the SIP error code received
This allows applications to perform actions based on the failure
reason.
ASTERISK-29252 #close
Reported-by: Dan Cropp
Change-Id: Ia6a94784b4925628af122409cdd733c9f29abfc4
Rename check_manager_enabled() and check_webmanager_enabled() to begin
with ast_ so that the symbols are automatically exported by the
linker.
ASTERISK~29184
Change-Id: I85762b9a5d14500c15f6bad6507138c8858644c9
The documentation in the wiki says there should be spyee-channel
information elements in the ChanSpyStop AMI event.
https://wiki.asterisk.org/wiki/x/Xc5uAg
However, this is not the case in Asterisk <= 16.10.0 Version. We're
using these Spyee* arguments since Asterisk 11.x, so these arguments
vanished in Asterisk 12 or higher.
For maximum compatibility, we still send the ChanSpyStop event even if
we are not able to find any 'Spyee' information.
ASTERISK-28883 #close
Change-Id: I81ce397a3fd614c094d043ffe5b1b1d76188835f
Scope tracing allows you to not specify a format string or
variable, in which case it just prints the indent, file,
function, and line number. The trace output automatically
adds a newline to the end in this case. If you also have
debugging turned on for the module, a debug message is
also printed but the standard log functionality which
prints it doesn't add the newline so you have messages
that don't break correctly.
* format_log_message_ap(), which is the common log
message formatter for all channels, now adds a
newline to the end of format strings that don't
already have a newline.
ASTERISK-29209
Reported by: Alexander Traud
Change-Id: I994a7df27f88df343b7d19f3e81a4b562d9d41da
As described in the issue, /tmp is not a suitable location for a
large amount of cached media files, since most distributions make
/tmp a RAM-based tmpfs mount with limited capacity.
I opted for a location that can be configured separately, as opposed
to using a subdirectory of spooldir, given the different storage
profile (transient files vs files that might stay there indefinitely).
This commit just makes the cache directory configurable, but leaves
it at /tmp by default, to ensure backwards compatibility.
A future commit that only targets master could change the default
location to something more sensible such as /var/tmp/asterisk. At
that point, the cachedir could be created and cleaned up during
uninstall by the Makefile script.
ASTERISK-29143
Change-Id: Ic54e95199405abacd9e509cef5f08fa14c510b5d
Fixed a bug (like a typo) in retransfer_enter()
at main/bridge_basic.c:2641. common_recall_channel_setup() setups
common things on the recalled transfer target, but used same target
as source instead trasfered.
ASTERISK-29161 #close
Change-Id: Ieb549654a621c38b1ad5e9d15b9f18823d9cc31f
Version: gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
Warning:
say.c:2371:24: error: ‘%d’ directive output may be truncated writing
between 1 and 11 bytes into a region of size 10
[-Werror=format-truncation=]
2371 | snprintf(buf, 10, "%d", num);
say.c:2371:23: note: directive argument in the range [-2147483648, 9]
That's not possible though, as the if() starts out checking for (num < 0),
making this Warning a false positive.
(Also replaced some else<TAB>if with else<SP>if while in the vicinity.)
Change-Id: Ic7a70120188c9aa525a6d70289385bfce878438a
Added debug logging categories that allow a user to output debug
information based on a specified category. This lets the user limit,
and filter debug output to data relevant to a particular context,
or topic. For instance the following categories are now available for
debug logging purposes:
dtls, dtls_packet, ice, rtcp, rtcp_packet, rtp, rtp_packet,
stun, stun_packet
These debug categories can be enable/disable via an Asterisk CLI command.
While this overrides, and outputs debug data, core system debugging is
not affected by this patch. Statements still output at their appropriate
debug level. As well backwards compatibility has been maintained with
past debug groups that could be enabled using the CLI (e.g. rtpdebug,
stundebug, etc.).
ASTERISK-29054 #close
Change-Id: I6e6cb247bb1f01dbf34750b2cd98e5b5b41a1849
(cherry picked from commit 56028426de)
In the event that the desired extension already exists,
ast_add_extension2_lockopt() will free the 'data' it is passed before
returning an error, so we should not be freeing it ourselves.
Additionally, there were two places where ast_add_extension2_lockopt()
could return an error without also freeing the 'data' pointer, so we
add that.
ASTERISK-29097 #close
Change-Id: I904707aae55169feda050a5ed7c6793b53fe6eae
app_confbridge now has the ability to set the estimated bitrate on an
SFU bridge. To use it, set a bridge profile's remb_behavior to "force"
and set remb_estimated_bitrate to a rate in bits per second. The
remb_estimated_bitrate parameter is ignored if remb_behavior is something
other than "force".
Change-Id: Idce6464ff014a37ea3b82944452e56cc4d75ab0a
Added to:
* bridges/bridge_softmix.c
* channels/chan_pjsip.c
* include/asterisk/res_pjsip_session.h
* main/channel.c
* res/res_pjsip_session.c
There NO functional changes in this commit.
Change-Id: I06af034d1ff3ea1feb56596fd7bd6d7939dfdcc3
When both Asterisk and a UA send re-invites at the same time, both
send 491 "Transaction in progress" responses to each other and back
off a specified amount of time before retrying. When Asterisk
prepares to send its re-invite, it sets up the session's pending
media state with the new topology it wants, then sends the
re-invite. Unfortunately, when it received the re-invite from the
UA, it partially processed the media in the re-invite and reset
the pending media state before sending the 491 losing the state it
set in its own re-invite.
Asterisk also was not tracking re-invites received while an existing
re-invite was queued resulting in sending stale SDP with missing
or duplicated streams, or no re-invite at all because we erroneously
determined that a re-invite wasn't needed.
There was also an issue in bridge_softmix where we were using a stream
from the wrong topology to determine if a stream was added. This also
caused us to erroneously determine that a re-invite wasn't needed.
Regardless of how the delayed re-invite was triggered, we need to
reconcile the topology that was active at the time the delayed
request was queued, the pending topology of the queued request,
and the topology currently active on the session. To do this we
need a topology resolver AND we need to make stream named unique
so we can accurately tell what a stream has been added or removed
and if we can re-use a slot in the topology.
Summary of changes:
* bridge_softmix:
* We no longer reset the stream name to "removed" in
remove_all_original_streams(). That was causing multiple streams
to have the same name and wrecked the checks for duplicate streams.
* softmix_bridge_stream_sources_update() was checking the old_stream
to see if it had the softmix prefix and not considering the stream
as "new" if it did. If the stream in that slot has something in it
because another re-invite happened, then that slot in old might
have a softmix stream but the same stream in new might actually
be a new one. Now we check the new_stream's name instead of
the old_stream's.
* stream:
* Instead of using plain media type name ("audio", "video", etc) as
the default stream name, we now append the stream position to it
to make it unique. We need to do this so we can distinguish multiple
streams of the same type from each other.
* When we set a stream's state to REMOVED, we no longer reset its
name to "removed" or destroy its metadata. Again, we need to
do this so we can distinguish multiple streams of the same
type from each other.
* res_pjsip_session:
* Added resolve_refresh_media_states() that takes in 3 media states
and creates an up-to-date pending media state that includes the changes
that might have happened while a delayed session refresh was in the
delayed queue.
* Added is_media_state_valid() that checks the consistency of
a media state and returns a true/false value. A valid state has:
* The same number of stream entries as media session entries.
Some media session entries can be NULL however.
* No duplicate streams.
* A valid stream for each non-NULL media session.
* A stream that matches each media session's stream_num
and media type.
* Updated handle_incoming_sdp() to set the stream name to include the
stream position number in the name to make it unique.
* Updated the ast_sip_session_delayed_request structure to include both
the pending and active media states and updated the associated delay
functions to process them.
* Updated sip_session_refresh() to accept both the pending and active
media states that were in effect when the request was originally queued
and to pass them on should the request need to be delayed again.
* Updated sip_session_refresh() to call resolve_refresh_media_states()
and substitute its results for the pending state passed in.
* Updated sip_session_refresh() with additional debugging.
* Updated session_reinvite_on_rx_request() to simply return PJ_FALSE
to pjproject if a transaction is in progress. This stops us from
creating a partial pending media state that would be invalid later on.
* Updated reschedule_reinvite() to clone both the current pending and
active media states and pass them to delay_request() so the resolver
can tell what the original intention of the re-invite was.
* Added a large unit test for the resolver.
ASTERISK-29014
Change-Id: Id3440972943c611a15f652c6c569fa0e4536bfcb
Currently, it was not possible to create bridge with video_mode single.
This made hard to put the bridge in a vidoe_single mode.
So, added video_single option for Bridge creation using the ARI.
This allows create a bridge with video_mode single.
ASTERISK-29055
Change-Id: I43e720e5c83fc75fafe10fe22808ae7f055da2ae
There's a race condition with bridging where a bridge can be torn down
causing the bridge_channel's ast_channel to become NULL when it's still
needed. This particular case happened with attended transfers, but the
crash occurred when trying to publish a stasis message. Now, the
bridge_channel is locked, a ref to the ast_channel is obtained, and that
ref is passed down the chain.
Change-Id: Ic48715c0c041615d17d286790ae3e8c61bb28814
When the ExtensionState AMI action is executed on a pattern matched
hint it can end up adding a new hint if one does not already exist.
This results in a locking order of contexts -> hints -> contexts.
If at the same time a reload is occurring and adding its own hint
it will have a locking order of hints -> contexts.
This results in a deadlock as one thread wants a lock on contexts
that the other has, and the other thread wants a lock on hints
that the other has.
This change enforces a hints -> contexts locking order by explicitly
locking hints in the places where a hint is added when queried for.
This matches the order seen through normal adding of hints.
ASTERISK-29046
Change-Id: I49f027f4aab5d2d50855ae937bcf5e2fd8bfc504
Added a new log formatter called "plain" that always prints
file, function and line number if available (even for verbose
messages) and never prints color control characters. It also
doesn't apply any special formatting for verbose messages.
Most suitable for file output but can be used for other channels
as well.
You use it in logger.conf like so:
debug => [plain]debug
console => [plain]error,warning,debug,notice,pjsip_history
messages => [plain]warning,error,verbose
Change-Id: I4fdfe4089f66ce2f9cb29f3005522090dbb5243d
T.140 data in RTP is not zero terminated, so when we are queuing a text
frame on a bridge we need to ensure that we are passing a zero
terminated string.
ASTERISK-28974 #close
Change-Id: Ic10057387ce30b2094613ea67e3ae8c5c431dda3
The SCOPE_ENTER and SCOPE_EXIT* macros now print debug messages
at the same level as the scope level. This allows the same
messages to be printed to the debug log when AST_DEVMODE
isn't enabled.
Also added a few variants of the SCOPE_EXIT macros that will
also call ast_log instead of ast_debug to make it easier to
use scope tracing and still print error messages.
Change-Id: I7fe55f7ec28069919a0fc0b11a82235ce904cc21
* Added ast_stream_to_stra and ast_stream_topology_to_stra() macros
which are shortcuts for
ast_str_tmp(256, ast_stream_to_str(stream, &STR_TMP))
* Added the stream position to the string representation of the
stream.
* Fixed some formatting in ast_stream_to_str().
Change-Id: Idaf4cb0affa46d4dce58a73a111f35435331cc4b
Allow passing a topology from the called channel back to the
calling channel.
* Added a new function ast_queue_answer() that accepts a stream
topology and queues an ANSWER CONTROL frame with it as the
data. This allows the called channel to indicate its resolved
topology.
* Added a new virtual function to the channel tech structure
answer_with_stream_topology() that allows the calling channel
to receive the called channel's topology. Added
ast_raw_answer_with_stream_topology() that invokes that virtual
function.
* Modified app_dial.c and features.c to grab the topology from the
ANSWER frame queued by the answering channel and send it to
the calling channel with ast_raw_answer_with_stream_topology().
* Modified frame.c to automatically cleanup the reference
to the topology on ANSWER frames.
Added a few debugging messages to stream.c.
Change-Id: I0115d2ed68d6bae0f87e85abcf16c771bdaf992c
With the addition of STIR/SHAKEN, the function ast_base64decode_string
was added for convenience since there is a lot of converting done during
the STIR/SHAKEN process. This function returned the decoded string for
you, but did not NULL terminate it, causing some issues (specifically
with MALLOC_DEBUG). Now, the returned string is NULL terminated, and the
documentation has been updated to reflect this.
Change-Id: Icdd7d05b323b0c47ff6ed43492937a03641bdcf5
There are various places in Asterisk - specifically in regards to
database integration - where having some kind of UTF-8 validation would
be beneficial. This patch adds:
* Functions to validate that a given string contains only valid UTF-8
sequences.
* A function to copy a string (similar to ast_copy_string) stopping when
an invalid UTF-8 sequence is encountered.
* A UTF-8 validator that allows for progressive validation.
All of this is based on the excellent UTF-8 decoder by Björn Höhrmann.
More information is available here:
https://bjoern.hoehrmann.de/utf-8/decoder/dfa/
The API was written in such a way that should allow us to replace the
implementation later should we determine that we need something more
comprehensive.
Change-Id: I3555d787a79e7c780a7800cd26e0b5056368abf9
Currently, if the bridge has created by the ARI, the video_mode
parameter was
not shown in the BridgeCreated event correctly.
Fixed it and added video_mode shown in the 'bridge show <bridge id>'
cli.
ASTERISK-28987
Change-Id: I8c205126724e34c2bdab9380f523eb62478e4295
If an ACL is misconfigured in the realtime database (for instance, the
"rule" is blank) and Asterisk attempts to read the ACL, Asterisk will
crash.
ASTERISK-28978 #close
Change-Id: Ic1536c4df856231bfd2da00128f7822224d77610
Prior to making any modifications to the pjsip infrastructure
for ACN, I've added the tracing functions to the existing code.
This should make the final commit easier to review, but we can also
now run a "before and after" trace.
No functional changes were made with this commit.
Change-Id: Ia83a1a2687ccb96f2bc8a2a3928a5214c4be775c
* ast_frame_subclass2str() and ast_frame_type2str() now return
a pointer to the buffer that was passed in instead of void.
This makes it easier to use these functions inline in
printf-style debugging statements.
* Added many missing control frame entries in
ast_frame_subclass2str.
Change-Id: Ifd0d6578e758cd644c96d17a5383ff2128c572fc
Tracing through synchronous tasks was a little troublesome because
the new thread's stack counter reset to 0. This change allows
a synchronous task to set its trace level to be the same as the
thread that pushed the task. For now, the task's level has to be
passed in the task's data structure but a future enhancement to the
taskprocessor subsystem could automatically set the trace level
of the servant to be that of the caller.
This doesn't really make sense for async tasks because you never
know when they're going to run anyway.
Change-Id: Ib8049c0b815063a45d8c7b0cb4e30b7b87b1d825
This patch allows a user of AMI to now specify the type of message
content contained within by setting the 'Content-Type' parameter.
Note, the AMI version has been bumped for this change.
ASTERISK-28945 #close
Change-Id: Ibb5315702532c6b954e1498beddc8855fabdf4bb
The Streams API becomes the home for the core ACN capabilities.
These include...
* Parsing and formatting of codec negotation preferences.
* Resolving pending streams and topologies with those configured
using configured preferences.
* Utility functions for creating string representations of
streams, topologies, and negotiation preferences.
For codec negotiation preferences:
* Added ast_stream_codec_prefs_parse() which takes a string
representation of codec negotiation preferences, which
may come from a pjsip endpoint for example, and populates
a ast_stream_codec_negotiation_prefs structure.
* Added ast_stream_codec_prefs_to_str() which does the reverse.
* Added many functions to parse individual parameter name
and value strings to their respectrive enum values, and the
reverse.
For streams:
* Added ast_stream_create_resolved() which takes a "live" stream
and resolves it with a configured stream and the negotiation
preferences to create a new stream.
* Added ast_stream_to_str() which create a string representation
of a stream suitable for debug or display purposes.
For topology:
* Added ast_stream_topology_create_resolved() which takes a "live"
topology and resolves it, stream by stream, with a configured
topology stream and the negotiation preferences to create a new
topology.
* Added ast_stream_topology_to_str() which create a string
representation of a topology suitable for debug or display
purposes.
* Renamed ast_format_caps_from_topology() to
ast_stream_topology_get_formats() to be more consistent with
the existing ast_stream_get_formats().
Additional changes:
* A new function ast_format_cap_append_names() appends the results
to the ast_str buffer instead of replacing buffer contents.
Change-Id: I2df77dedd0c72c52deb6e329effe057a8e06cd56
Integrated STIR/SHAKEN support with outgoing INVITEs. When an INVITE is
sent, the caller ID will be checked to see if there is a certificate
that corresponds to it. If so, that information will be retrieved and an
Identity header will be added to the SIP message. The format is:
header.payload.signature;info=<public_key_url>alg=ES256;ppt=shaken
Header, payload, and signature are all BASE64 encoded. The public key
URL is retrieved from the certificate. Currently the algorithm and ppt
are ES256 and shaken, respectively. This message is signed and can be
used for verification on the receiving end.
Two new configuration options have been added to the certificate object:
attestation and origid. The attestation is required and must be A, B, or
C. origid is the origination identifier.
A new utility function has been added as well that takes a string,
allocates space, BASE64 encodes it, then returns it, eliminating the
need to calculate the size yourself.
Change-Id: I1f84d6a5839cb2ed152ef4255b380cfc2de662b4
When requesting a Local channel the requested stream topology
or a converted stream topology will now be placed onto the
resulting channels.
Frames written in on streams will now also preserve the stream
identifier as they are queued on the opposite channel.
Finally when a stream topology change is requested it is
immediately accepted and reflected on both channels. Each
channel also receives a queued frame to indicate that the
topology has changed.
ASTERISK-28938
Change-Id: I4e9d94da5230d4bd046dc755651493fce1d87186
This patch fixes a few compile warnings/errors that now occur when using gcc
10+.
Also, the Makefile.rules check to turn off partial inlining in gcc versions
greater or equal to 8.2.1 had a bug where it only it only checked against
versions with at least 3 numbers (ex: 8.2.1 vs 10). This patch now ensures
any version above the specified version is correctly compared.
Change-Id: I54718496eb0c3ce5bd6d427cd279a29e8d2825f9
Integrated STIR/SHAKEN support with incoming INVITES. Upon receiving an
INVITE, the Identity header is retrieved, parsing the message to verify
the signature. If any of the parsing fails,
AST_STIR_SHAKEN_VERIFY_NOT_PRESENT will be added to the channel for this
caller ID. If verification itself fails,
AST_STIR_SHAKEN_VERIFY_SIGNATURE_FAILED will be added. If anything in
the payload does not line up with the SIP signaling,
AST_STIR_SHAKEN_VERIFY_MISMATCH will be added. If all of the above steps
pass, then AST_STIR_SHAKEN_VERIFY_PASSED will be added, completing the
verification process.
A new config option has been added to the general section for
stir_shaken.conf. "signature_timeout" is the amount of time a signature
will be considered valid. If an INVITE is received and the amount of
time between when it was received and when it was signed is greater than
signature_timeout, verification will fail.
Some changes were also made to signing and verification. There was an
error where the whole JSON string was being signed rather than the
header combined with the payload. This has been changed to sign the
correct thing. Verification has been changed to do this as well, and the
unit tests have been updated to reflect these changes.
A couple of utility functions have also been added. One decodes a BASE64
string and returns the decoded string, doing all the length calculations
for you. The other retrieves a string value from a header in a rdata
object.
Change-Id: I855f857be3d1c63b64812ac35d9ce0534085b913
If a frame is written to a channel in a bridge we
would normally queue this frame up and the channel
thread would then act upon it. If this frame had no
stream mapping on the channel it would then be
discarded.
This change adds a check before the queueing occurs
to determine if a mapping exists. If it does not
exist then the frame is not even queued at all. This
stops a frame duplication from happening and from
the channel thread having to wake up and deal with
it.
Change-Id: I17189b9b1dec45fc7e4490e8081d444a25a00bda
If the bridge show all command could not get the bridge snapshot, it causes null pointer exception.
Fixed it to check the snapshot is null.
ASTERISK-28920
Change-Id: I3521fc1b832bfc69644d0833f2c78177e1e51f58
What's wrong with ast_debug?
ast_debug is fine for general purpose debug output but it's not
really geared for scope tracing since it doesn't present its
output in a way that makes capturing and analyzing flow through
Asterisk easy.
How is scope tracing better?
Scope tracing uses the same "cleanup" attribute that RAII_VAR
uses to print messages to a separate "trace" log level. Even
better, the messages are indented and unindented based on a
thread-local call depth counter. When output to a separate log
file, the output is uncluttered and easy to follow.
Here's an example of the output. The leading timestamps and
thread ids are removed and the output cut off at 68 columns for
commit message restrictions but you get the idea.
--> res_pjsip_session.c:3680 handle_incoming PJSIP/1173-00000001
--> res_pjsip_session.c:3661 handle_incoming_response PJSIP/1173
--> res_pjsip_session.c:3669 handle_incoming_response PJSIP/
--> chan_pjsip.c:3265 chan_pjsip_incoming_response_after
--> chan_pjsip.c:3194 chan_pjsip_incoming_response P
chan_pjsip.c:3245 chan_pjsip_incoming_respon
<-- chan_pjsip.c:3194 chan_pjsip_incoming_response P
<-- chan_pjsip.c:3265 chan_pjsip_incoming_response_after
<-- res_pjsip_session.c:3669 handle_incoming_response PJSIP/
<-- res_pjsip_session.c:3661 handle_incoming_response PJSIP/1173
<-- res_pjsip_session.c:3680 handle_incoming PJSIP/1173-00000001
The messages with the "-->" or "<--" were produced by including
the following at the top of each function:
SCOPE_TRACE(1, "%s\n", ast_sip_session_get_name(session));
Scope isn't limited to functions any more than RAII_VAR is. You
can also see entry and exit from "if", "for", "while", etc blocks.
There is also an ast_trace() macro that doesn't track entry or
exit but simply outputs a message to the trace log using the
current indent level. The deepest message in the sample
(chan_pjsip.c:3245) was used to indicate which "case" in a
"select" was executed.
How do you use it?
More documentation is available in logger.h but here's an overview:
* Configure with --enable-dev-mode. Like debug, scope tracing
is #ifdef'd out if devmode isn't enabled.
* Add a SCOPE_TRACE() call to the top of your function.
* Set a logger channel in logger.conf to output the "trace" level.
* Use the CLI (or cli.conf) to set a trace level similar to setting
debug level... CLI> core set trace 2 res_pjsip.so
Summary Of Changes:
* Added LOG_TRACE logger level. Actually it occupies the slot
formerly occupied by the now defunct "event" level.
* Added core asterisk option "trace" similar to debug. Includes
ability to specify global trace level in asterisk.conf and CLI
commands to turn on/off and set levels. Levels can be set
globally (probably not a good idea), or by module/source file.
* Updated sample asterisk.conf and logger.conf. Tracing is
disabled by default in both.
* Added __ast_trace() to logger.c which keeps track of the indent
level using TLS. It's #ifdef'd out if devmode isn't enabled.
* Added ast_trace() and SCOPE_TRACE() macros to logger.h.
These are all #ifdef'd out if devmode isn't enabled.
Why not use gcc's -finstrument-functions capability?
gcc's facility doesn't allow access to local data and doesn't
operate on non-function scopes.
Known Issues:
The only know issue is that we currently don't know the line
number where the scope exited. It's reported as the same place
the scope was entered. There's probably a way to get around it
but it might involve looking at the stack and doing an 'addr2line'
to get the line number. Kind of like ast_backtrace() does.
Not sure if it's worth it.
Change-Id: Ic5ebb859883f9c10a08c5630802de33500cad027
fork before exec
Posix does only allow async-signal-safe syscalls after fork before exec.
As asterisk ignores this, functions like TrySystem or System sometimes
end up in a deadlocked child process. The patch prevents the use of
non-async-signal-safe syscalls.
ASTERISK-28776
Change-Id: Idc76365c0592ee3f3b3bd72a4f48f7a098978e8e
ast_stream_topology_create_from_format_cap() was setting the
stream->formats directly but not freeing the default formats. This
causes a memory leak.
* ast_stream_topology_create_from_format_cap() now calls
ast_stream_set_formats() which properly cleans up the existing
stream formats.
When cloning a stream, the source stream's format caps _pointer_ is
copied to the new stream and it's reference count bumped. If
either stream is set to "removed", this will cause _both_ streams
to have their format caps cleared.
* ast_stream_clone() now creates a new format caps object and copies
the formats from the source stream instead of just copying the
pointer.
ASTERISK-28870
Change-Id: If697d81c3658eb7baeea6dab413b13423938fb53
Add a new "masquarade" channel event, and use it in app_queue to track unique id's.
Testcase is submitted as https://gerrit.asterisk.org/c/testsuite/+/14210
ASTERISK-28829 #close
ASTERISK-25844 #close
Change-Id: Ifc5f9f9fd70903f3c6e49738d3bc632b085d2df6
In a Dialplan, the channel drivers 'chan_sip' and 'chan_iax2' support
the channel items 'secure_bridge_media' and 'secure_bridge_signaling'.
That way, a channel can be forced to use encryption even if not
specified in its configuration.
However, when the Local Proxy kicks in, for example, in case of a
forwarding (SIP status 302), Local Proxy stated it does not know those
items. Consequently, such a call could not be proxied how clever your
Dialplan was. Because local calls within Asterisk are always secure,
Local Proxy accepts such a request now.
ASTERISK-22920
Change-Id: I4c143bb70f686790953cc04c5a4b810bbb03636c
While testing the latest RC on FreeBSD I noticed this new file fails to build. On FreeBSD inlcuding resolv.h requires sockaddr_in to be defined, and it's defined in netinet/in.h. So I added this include.
ASTERISK-28853 #close
Change-Id: I6997daf3956e6eb70ab6cb358628d162fad80079
Some places in Asterisk did not treat the formats on a stream
as immutable when they are.
The ast_stream_get_formats function is now const to enforce this
and parts of Asterisk have been updated to take this into account.
Some violations of this were also fixed along the way.
An additional minor tweak is that streams are now allocated with
an empty format capabilities structure removing the need in various
places to check that one is present on the stream.
ASTERISK-28846
Change-Id: I32f29715330db4ff48edd6f1f359090458a9bfbe
When in a conference bridge it may be necessary to have
text messages disabled for specific participants or for
all. This change adds a configuration option, "text_messaging",
which can be used to enable or disable this on the
user profile. By default existing behavior is preserved
as it defaults to "yes".
ASTERISK-28841
Change-Id: I30b5d9ae6f4803881d1ed9300590d405e392bc13
When the ast_data_buffer_put rejects to add a packet, for example because
the buffer already contains a packet with the same sequence number, the
payload will never be freed, resulting in a memory leak.
The data buffer will now return an error if this situation occurs
allowing the caller to free the payload. The res_rtp_asterisk module
has also been updated to do this.
ASTERISK-28826
Change-Id: Ie6c49495d1c921d5f997651c7d0f79646f095cf1
Based on this new endpoint setting, a joint list of preferred codecs
between those received from the Asterisk core (remote), and those
specified in the endpoint's "allow" parameter (local) is created and
is used to create the outgoing SDP offer.
* Add outgoing_call_offer_pref to pjsip_configuration (endpoint)
* Add "call_direction" to res_pjsip_session.
* Update pjsip_session_caps.c to make the functions more generic
so they could be used for both incoming and outgoing.
* Update ast_sip_session_create_outgoing to create the
pending_media_state->topology with the results of
ast_sip_session_create_joint_call_stream().
* The endpoint "preferred_codec_only" option now automatically sets
AST_SIP_CALL_CODEC_PREF_FIRST in incoming_call_offer_pref.
* A helper function ast_stream_get_format_count() was added to
streams to return the current count of formats.
ASTERISK-28777
Change-Id: Id4ec0b4a906c2ae5885bf947f101c59059935437
If a frame handling routine returns a list of frames (vs. a single frame)
those frames are never passed to a tech's write_stream handler even if one is
available. For instance, if a codec translation occurred and that codec
returned multiple frames then those particular frames were always only sent
to the tech's "write" handler. If that tech (pjsip for example) was stream
capable then those frames were essentially ignored. Thus resulting in bad
audio.
This patch makes it so the "write_stream" handler is appropriately called
for all cases, and for all frames if available.
ASTERISK-28795 #close
Change-Id: I868faea0b73a07ed5a32c2b05bb9cf4b586f739d
The dial application had 80 characters of destination length
limitation. But this limitation causes unexpected dial string
cut if the dial string is long.
Removed unnecessary limited buffer to support longer dial
destination.
ASTERISK-27946
Change-Id: I72c8f0319a4b47e8180817a66a7e9bde063cb330
named_acl.c (which is really a named_ha) now uses ast_ha_output.
I've also updated main/manager.c to output the actual ACL on "manager
show user <username>" if one is set. If this works then we can add
similar to other modules as required.
Change-Id: I0ec9876a90dddd379c80ec078d48e3ee6991eb0f
binutils 2.34 merged this commit:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;\
h=fd3619828e94a24a92cddec42cbc0ab33352eeb4
Which effectively does things like:
-#define bfd_section_size(bfd, ptr) ((ptr)->size)
-#define bfd_get_section_size(ptr) ((ptr)->size)
+#define bfd_section_size(sec) ((sec)->size)
So in order to remain backwards compatible we need to detect this API
change, and adjust accordingly. The simplest is to notice that the
bfd_get_section_size and bfd_get_section_vma MACROs are no longer
defined, and define then onto the new API. The alternative is to litter
the code with a number of #ifdef #else #endif splatters right through
the code.
Change-Id: I3efe0f8e8f3e338d16fcbc2b26a505367b6e172f
Given a scenario where MixMonitor was initiated over AMI it
was possible for the channel and MixMonitor thread to remain
alive past hang up of the channel. This scenario required
the AMI initiated MixMonitor to retrieve the channel, a
hangup to occur on the channel in another thread, and then
for MixMonitor to actually start. If this occurred the
MixMonitor thread would remain alive indefinitely and
the channel reference would remain.
This change ensures that audiohooks are never able to
be attached to channels that have been hung up. An
additional fix has also been done in app_mixmonitor to
properly release the channel reference if this occurs.
ASTERISK-28780
Change-Id: I8044c06daa06f0f16607788c596f55623be26f58
A regular expression in a NAPTR response record can have a trailing
'i' flag to indicate that the expression should be evaluated in a
case-insensitive way. We were not checking for that flag which caused
the record parsing to fail on otherwise valid input.
Although this change will initially go into Asterisk 13, 16, and 17,
it is my intention to replace the majority of this code in 16 and up -
including this fix - by changing enum.c to consume the new DNS API
which duplicates most of this logic already. Asterisk 13 doesn't have
the DNS API, so this fix will be as good as it gets.
ASTERISK-26711 #close
Reported by: Vitold
Change-Id: I33943a5b3e7539c6dca3a5079982ee15a08186f0
The ast_get_txt() API function (and by extension, the TXTCIDNAME
dialplan function) were broken in
65b8381550 such that we would never
actually make a DNS TXT query as described.
This patch restores the documented behavior.
ASTERISK-19460 #close
Reported by: George Joseph
Change-Id: I1b19aea711488cb1ecd63843cddce05010e39376
When a text message was received any associated variable was not written to
the ARI TextMessageReceived event. This occurred because Asterisk only wrote
out "send" variables. However, even those "send" variables would fail ARI
validation due to a TextMessageVariable formatting bug.
Since it seems the TextMessageReceived event has never been able to include
actual variables it was decided to remove the TextMessageVariable object type
from ARI, and simply return a JSON object of key/value pairs for variables.
This aligns more with how the ARI sendMessage handles variables, and other
places in ARI.
ASTERISK-28755 #close
Change-Id: Ia6051c01a53b30cf7edef84c27df4ed4479b8b6f
There were a couple places where the format cap function parameter was not
'const' when it should have been. This patch makes them 'const'.
Change-Id: Ife753fb16a962d842a6b44f45363a61a66bfdb2e
There are exceptions for plural objects, but they are detected using the
supplied NUMBER, not using an extra option.
Change-Id: I95d1d1b2796b1aba92048a2dbae8a3856ed8a113
This change extends the Sorcery API to allow a wizard to be
told to explicitly reload objects or a specific object type
even if the wizard believes that nothing has changed.
This has been leveraged by res_pjsip and res_pjsip_acl to
reload endpoints and PJSIP ACLs when a named ACL changes.
ASTERISK-28697
Change-Id: Ib8fee9bd9dd490db635132c479127a4114c1ca0b
Dump OpenSSL's error stack to the error log when things fail.
ASTERISK-28750 #close
Reported by: Martin Zeh
Change-Id: Ib63cd0df20275586e68ac4c2ddad222ed7bd9c0a
This change adds support to bridge_softmix to allow the addition
and removal of additional video source streams. When such a change
occurs each participant is renegotiated as needed to reflect the
update. If another video source is added then each participant
gets another source. If a video source is removed then it is
removed from each participant. This functionality allows you to
have both your webcam and screenshare providing video if you
desire, or even more streams. Mapping has been changed to use
the topology index on the source channel as a unique identifier
for outgoing participant streams, this will never change and
provides an easy way to establish the mapping.
The bridge_simple and bridge_native_rtp modules have also been
updated to renegotiate when the stream topology of a party changes
allowing the same behavior to occur as added to bridge_softmix.
If a screen share is added then the opposite party is renegotiated.
If that screen share is removed then the opposite party is
renegotiated again.
Some additional fixes are also included in here. Stream state is
now conveyed in SDP so sendonly/recvonly/inactive streams can
be requested. Removed streams now also remove previous state
from themselves so consumers don't get confused.
ASTERISK-28733
Change-Id: I93f41fb41b85646bef71408111c17ccea30cb0c5
When opening a file for writing, Asterisk silently converts filenames
ending with 'wav49' to 'WAV.' We aren't taking that in to account when
setting the MIXMONITOR_FILENAME variable in MixMonitor.
* If the user wants to write to a wav49 file, make sure that it is
reflected properly in MIXMONITOR_FILENAME.
* Add a note to the documentation describing this behavior.
* Add a note in main/file.c indicating that app_mixmonitor needs to be
changed if the logic in build_filename was changed.
ASTERISK-24798 #close
Reported by: xrobau
Change-Id: I384691ce624eb55c80a125b9ca206d2d691c574c
In order to reduce the amount of AMI and ARI events generated,
the global "Message/ast_msg_queue" channel can be set to suppress
it's normal channel housekeeping events such as "Newexten",
"VarSet", etc. This can greatly reduce load on the manager
and ARI applications when the Digium Phone Module for Asterisk
is in use. To enable, set "hide_messaging_ami_events" in
asterisk.conf to "yes" In Asterisk versions <18, the default
is "no" preserving existing behavior. Beginning with
Asterisk 18, the option will default to "yes".
NOTE: This change does not affect UserEvents or the ARI
TextMessageReceived events.
* Added the "hide_messaging_ami_events" option to asterisk.conf.
* Changed message.c to set the AST_CHAN_TP_INTERNAL property on
the "Message/ast_msg_queue" channel if the option is set in
asterisk.conf. This suppresses the reporting of the events.
Change-Id: Ia2e3516d43f4e0df994fc6598565d6bba2d7018b
When Alice calls Bob and Bob does a blind transfer to Charlie,
Bob's bridge leave event generates a finalize on both the party_a
and party_b CDRs but while the party_a CDR has the correct end time
set from the event time, party_b's leg did not. This caused that
CDR's end time to be equal to the answered time and resulted in a
billsec of 0.
* We now pass the bridge leave message event time to
cdr_object_party_b_left_bridge_cb() and set it on that CDR before
calling cdr_object_finalize() on it.
NOTE: This issue affected transfers using chan_sip most of the
time but also occasionally affected chan_pjsip probably due to
message timing.
ASTERISK-28677
Reported by: Maciej Michno
Change-Id: I790720f1e7326f9b8ce8293028743b0ef0fb2cca
Add a new configuration option 'enable_status' which allows the
/httpstatus URI handler to be administratively disabled.
We also no longer unconditionally register the /static and /httpstatus
URI handlers, but instead do it based upon configuration.
Behavior change: If enable_static was turned off, the URI handler was
still installed but returned a 403 when it was accessed. Because we
now register/unregister the URI handlers as appropriate, if the
/static URI is disabled we will return a 404 instead.
Additionally:
* Change 'enablestatic' to 'enable_static' but keep the former for
backwards compatibility.
* Improve some internal variable names
ASTERISK-28710 #close
Change-Id: I647510f796473793b1d3ce1beb32659813be69e1
SILK @ 24kHz is not shown in the 'core show translation' output because of an
off-by-one-error. Discovered while looking into ASTERISK~19871.
ASTERISK-28706
Reported by: Sean Bright
Change-Id: Ie1a551a8a484e07b45c8699cc0c90f1061029510
In af90afd90c, Japanese language support
was added to app_voicemail and main/say.c, but the leading whitespace
is not consistent with Asterisk coding guidelines. This patch fixes
that.
Whitespace only, no functional change.
ASTERISK~23324
Reported by: Kevin McCoy
Change-Id: I72c725f5930084673749bd7c9cc426a987f08e87
Adds source port matching support when IP matching is used:
[example]
type = identify
match = 1.2.3.4:5060/32, 1.2.3.4:6000/32, asterisk.org:4444
If the IP matches but the source port does not, we reject and search for
alternatives. SRV lookups are still performed if enabled (srv_lookups = yes),
unless the configured FQDN includes a port number in which case just a host
lookup is performed.
ASTERISK-28639 #close
Reported by: Mitch Claborn
Change-Id: I256d5bd5d478b95f526e2f80ace31b690eebba92
When a topic is created for an object, its name is only
<object>:<uniqueid>
For example:
bridge:cb68b3a8-fce7-4738-8a17-d7847562f020
When a topic is added to a pool, its name has the pool's topic
name prepended. For example:
bridge:all/bridge:cb68b3a8-fce7-4738-8a17-d7847562f020
The topic_pool_entry's name however, is only what was passed
in to stasis_topic_pool_get_topic which is
bridge:cb68b3a8-fce7-4738-8a17-d7847562f020
That's actually correct because the entry is qualified by the
pool that's in.
When you're ready to delete the entry from the pool, you retrieve
the tropic name from the object but since it now has the pool's
topic name prepended, it won't be found in the pool container.
Fix:
* Modified stasis_topic_pool_delete_topic() to skip past the
pool topic's name, if it was prepended to the topic name,
before searching the container for a pool entry.
ASTERISK-28633
Reported by: Joeran Vinzens
Change-Id: I4396aa69dd83e4ab84c5b91b39293cfdbcf483e6
The Bridge application was inconsistent if the channel to bridge with is
not specified. If no parameters are given then a warning is issued and
the current channel is hung up. If options are given but no channel is
specified then a warning is issued and the current channel is not hung up.
* Made the Bridge application give a verbose message instead of a warning
if the channel to bridge with is not specified and made not hang up the
current channel. As a result dialplan no longer needs to check if a
channel name is passed before calling Bridge and simply needs to check the
BRIDGERESULT channel variable instead. This is something you likely want
your dialplan to do anyway.
* Fixed up L() option warning message. It is up to the caller to
determine if the channel is hung up because of the warning. Dial() hangs
up the current channel while Bridge() does not.
Change-Id: I44349a8dc3912397f28852777de04f19e7bb9c73
When TLS is in use, checking the readiness of the underlying FD is insufficient
for determining if there is data available to be read. So before polling the
FD, check if there is any buffered data in the TLS layer and use that first.
ASTERISK-28562 #close
Reported by: Robert Sutton
Change-Id: I95fcb3e2004700d5cf8e5ee04943f0115b15e10d
The db_init() function ultimately calls db_sync() which signals the
condition before it is initialized.
Change-Id: Id4a4e025b637bc4ac7d90557fcb71d56598892ab
When testing for the existance of a file, the media cache is searched even if
the file has no chance of being in it. This can cause performance issues
as the media cache size increases.
As a result, calls to applications like Read and Playback using local files
must scan through the media cache before playing. Under load and with a
large cache, this can delay the playback of those files.
This patch updates the function that checks for the existance of a file to
only consult the media cache database if the requested file is a remote path.
It introduces a new is_remote_path() function in main/file.c.
ASTERISK-28625 #close
Reported-by: kevin@phoneburner.com
Change-Id: If91137493732d9034dafa381c081c69274a7dcc9
ConfBridge has the ability to move between different sample
rates for mixing the conference bridge. Up until now there has
only been the ability to set the conference bridge to mix at
a specific sample rate, or to let it move between sample rates
as necessary. This change adds the ability to configure a
conference bridge with a maximum sample rate so it can move
between sample rates but only up to the configured maximum.
ASTERISK-28658
Change-Id: Idff80896ccfb8a58a816e4ce9ac4ebde785963ee
Due to use in res_rtp_asterisk there is a need to be able to apply an
ACL without logging any invalid/denies. It's probably sensible to at
least validate the ACL once directly after load and report invalid ACLs.
Change-Id: I256169229d945ca7c1bbf228fc492d91df345843
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
The problem is essentially the same as in ASTERISK~28245. Besides
the direct media scenario we have an additional scenario where a
special client is involved. This device mutes audio by default in
transmit direction (no rtp frames) and activates audio only by a
foot switch. In this situation dtmf input (pin for conferences,
transfer features codes , etc) using SIP INFO mode is not
understood properly especially when SIP INFO messages are sent
quickly.
This patch ensures that SIP INFO frames are properly queued and
processed in the above scenario. The patch also corrects situations
where successive dtmf events are received quicker than the
signalled event duration (plus minimum gap/pause) allows, i.e. DTMF
events have to be buffered in the ast channel read queue and
emulation has to be processed asynchronously at slower speed.
Reported by: Thomas Arimont
patches:
trigger_dtmf_emulation.patch submitted by Thomas Arimont (license 5525)
Change-Id: I309bf61dd065c9978c8e48f5b9a936ab47de64c2
* Use ast_cli_completion_add() to improve performance when large number of
cached items are present.
* Only complete one URI for commands that only accept a single URI.
* Change command documentation to wrap at 80 characters to improve
readability.
Change-Id: Iedb0a2c3541e49561bc231dca2dcc0ebd8612902
If an AMI user without the "system" authorization calls the
Originate AMI command with the Originate application,
the second Originate could run the "System" command.
Action: Originate
Channel: Local/1111
Application: Originate
Data: Local/2222,app,System,touch /tmp/owned
If the "system" authorization isn't set, we now block the
Originate app as well as the System, Exec, etc. apps.
ASTERISK-28580
Reported by: Eliel Sardañons
Change-Id: Ic4c9dedc34c426f03c8c14fce334a71386d8a5fa
The current code sets alert levels starting from index 1.
Need to set on whole pool starting from index 0.
Change-Id: I5decbb43160954fb9a512f04302637fc666b6f5d
This patch fixes several issues reported by the lgtm code analysis tool:
https://lgtm.com/projects/g/asterisk/asterisk
Not all reported issues were addressed in this patch. This patch mostly fixes
confirmed reported errors, potential problematic code points, and a few other
"low hanging" warnings or recommendations found in core supported modules.
These include, but are not limited to the following:
* innapropriate stack allocation in loops
* buffer overflows
* variable declaration "hiding" another variable declaration
* comparisons results that are always the same
* ambiguously signed bit-field members
* missing header guards
Change-Id: Id4a881686605d26c94ab5409bc70fcc21efacc25
* Pass caller information to frame allocation functions.
* Disable caching as it interfers with MALLOC_DEBUG reporting.
* Stop using ast_calloc_cache.
Change-Id: Id343cd80a3db941d2daefde2a060750fea8cd260
Here's the basic scenario that occurred when executing an AMI fast originate
while at the same time something else locks the channels container, and also
wants a lock on the dialed channel:
1. pbx_outgoing_attempt obtains a lock on a dialed channel
2. concurrently another thread obtains a lock on the channels container, and
subsequently requests a lock on the dialed channel. It waits on #1. For
instance, "core show channel <dialed channel"
3. the outgoing call does not fail, but ends before the pbx_outgoing_attempt
function exits
4. pbx_outgoing_attempt function exits, the outgoing structure destructs, and
attempts to hang up the dialed channel
5. hang up tries to obtain the channels container lock, but can't due to #2.
6. Asterisk is deadlocked.
The solution was to allow the pbx_outgoing_exec function to "steal" ownership
of the dialed channel, and handle hanging it up. The channel now is either hung
up prior to it being potentially locked by the initiating thread, or if locked
the hang up takes place in a different thread, thus alleviating the deadlock.
ASTERISK-28561
patches:
iliketrains.diff submitted by Joshua Colp (license 5000)
Change-Id: I51b42b92dde8f2215b69bb509e28667ee3a3853a
Serializer pools have previously existed in Asterisk. However, for the most
part the code has been duplicated across modules. This patch abstracts the
code into an 'ast_serializer_pool' object. As well the code is now centralized
in serializer.c/h.
In addition serializer pools can now optionally be monitored by a shutdown
group. This will prevent the pool from being destroyed until all serializers
have completed.
Change-Id: Ib1e906144b90ffd4d5ed9826f0b719ca9c6d2971
This avoids use of the global variable and ensures topic_all remains
active until all topics are freed.
ASTERISK-28553
patches:
ASTERISK-28553.patch by coreyfarrell (license 5909)
Change-Id: I9a8cd8977f3c3a6aa00783f8336d2cfb9c2820f1
pbx_extension_helper takes two 'context' arguments. One (con) is a
pointer directly to a 'struct ast_context' and the other (context) is
the name of the context. In all cases, one of these arguments is NULL
and the other is non-NULL.
Functions that are ultimately called by pbx_extension_helper expect that
'context' will be non-NULL, so we set it unconditionally on entry into
this function.
ASTERISK-28534 #close
Change-Id: Ifbbc5e71440afd80efd441f7a9d72e8b10b6f47d
Added "like" support for 'core show taskprocessors'. Now you
can specify a specific set of taskprocessors (or just one) by
adding the keyword "like" to the above command, followed by
your search criteria.
Change-Id: I021e740201e9ba487204b5451e46feb0e3222464
This improves the way which stasis_state reference counting works.
Since manager->states holds onto the proxy object instead of the real
object this allows stasis_state objects to be freed when appropriate
without use of a special state_remove function. Additionally each
distinct eid associated with the state holds a reference to the state to
prevent early release and potentially allow easier debug of leaks.
Change-Id: I400e0db4b9afa3d5cb4ac7dad60907897e73f9a9
Added two new CLI commands to reset stats for taskprocessors. You can
reset stats for a single, specific taskprocessor ('core reset
taskprocessor <taskprocessor>'), or you can reset all taskprocessors
('core reset taskprocessors'). These commands will reset the counter for
the number of tasks processed as well as the max queue size.
Change-Id: Iaf17fc4ae29396ab0c6ac92408fc7bdc2f12362d
Previous to this patch passing a NULL tag to ao2_alloc or ao2_ref based
functions would result in the reference not being logged under
REF_DEBUG. This could sometimes cause inaccurate logging if NULL was
accidentally passed to a reference action. Now reference logging is
only disabled by option passed to the allocation method.
Change-Id: I3c17d867d901d53f9fcd512bef4d52e342637b54
You can currently capture backtraces of memory allocations but they
only get displayed when you stop asterisk and the atexit hooks
are enabled. Now, if memory backtrace is on and you issue a
"memory show allocations" CLI command for a specific file, then
a backtrace will show for each allocation that occurred after
you turned "memory backtrace on". The backtrace display is shown
only when a specific file's allocations are displayed to prevent
a massive CLI dump of every file's allocations.
Change-Id: Ic657afc1fc6ec7205e16eb36a97a611d235a2b4f
astobj2.c declares DEBUG_THREADS_LOOSE_ABI to avoid overhead of debug
threads tracking information in the internal structures of astobj2.
Unfortunately this means that ao2_global_obj contains the statically
allocated debug threads tracking fields which are used by initialization
and cleanup but main/astobj2.c believed those fields and associated
space did not exist.
Change-Id: Icef41ad97d88a8c1d1515e034ec8133cab3b1527
It is possible for topic->name to be NULL, this causes the allocation
reference to not be logged. Use the name variable instead which has
been verified to be a non-empty.
Change-Id: I3d0031d03c8356e4808f00cdf2d5428712575883
* Release reference returned by cache_remove
* state_alloc unconditionally bumped state_topic even when it was
locally allocated.
Change-Id: I51101bf7d07b8dc8ce8fc46b6cb31fbbd213fbc7
This change adds support to the JITTERBUFFER dialplan function
for audio and video synchronization. When enabled the RTCP SR
report is used to produce an NTP timestamp for both the audio and
video streams. Using this information the video frames are queued
until their NTP timestamp is equal to or behind the NTP timestamp
of the audio. The audio jitterbuffer acts as the leader deciding
when to shrink/grow the jitterbuffer when adaptive is in use. For
both adaptive and fixed the video buffer follows the size of the
audio jitterbuffer.
ASTERISK-28533
Change-Id: I3fd75160426465e6d46bb2e198c07b9d314a4492
This change adds H.265/HEVC as a known codec and creates a cached
"h265" media format for use.
Note that RFC 7798 section 7.2 also describes additional SDP
parameters. Handling of these is not yet supported.
ASTERISK-28512
Change-Id: I26d262cc4110b4f7e99348a3ddc53bad0d2cd1f2
When modifying an already defined variable in some channel drivers they
add a new variable with the same name to the list, but that value is
never used, only the first one found.
Introduce ast_variable_list_replace() and use it where appropriate.
ASTERISK-23756 #close
Patches:
setvar-multiplie.patch submitted by Michael Goryainov
Change-Id: Ie1897a96c82b8945e752733612ee963686f32839
Added unit tests for RTCP video stats. These tests include NACK, REMB,
FIR/FUR/PLI, SR/RR/SDES, and packet loss statistics. The REMB and FIR
tests are currently disabled due to a bug. We expect to receive a
compound packet, but the code sends this out as a single packet, which
the browser accepts, but makes Asterisk upset.
While writing these tests, I noticed an issue with NACK as well. Where
it is handling a received NACK request, it was reading in only the first
8 bits of following packets that were also lost. This has been changed
to the correct value of 16 bits.
Also made a minor fix to the data buffer unit test.
Change-Id: I56107c7411003a247589bbb6086d25c54719901b
This change removes the assumption that a frame will always have
a src set on it. This assumption is incorrect.
Given a scenario where an RTP packet is received with no payload
the resulting audio frame will have no samples. If this frame goes
through a signed linear translation path an interpolated frame can
be created (if generic packet loss concealment is enabled) that has
minimal data on it, including no src. If this frame is given to a
translation path a crash will occur due to the lack of src.
ASTERISK-28499
Change-Id: I024d10dd98207eb8a6b35b59880bcdf1090538f8
The new function takes in a pointer to an ast_sockaddr structure,
a hostname and an optional port and then dispatches parallel
"AAAA" and "A" record queries. If an "AAAA" record is returned,
it's parsed into the ast_sockaddr structure along with the port
if it was supplied. If no "AAAA" record was returned, the
first "A" record returned (if any) is parsed instead.
This is a synchronous call. If you need asynchronous lookups,
use ast_dns_query_set_resolve_async and roll your own.
Change-Id: I194b0b0e73da94b35cc35263a868ffac3a8d0a95
There are 4 scenarios to consider when capturing audio from a channel
with an audiohook:
1. There is no rx and no tx audio, so return nothing.
2. There is rx but no tx audio, so return rx.
3. There is tx but no rx audio, so return tx.
4. There is rx and tx audio, so mix them and return.
The file passed as the primary argument to MixMonitor will be written to
in scenarios 2, 3, and 4. However, if you pass the r() and t() options
to MixMonitor, a frame will only be written to the r() file if there was
rx audio and a frame will only be written to the t() file if there was
tx audio.
If you subsequently take the r() and t() files and try to mix them, the
sides of the conversation will 'drift' and be non-representative of the
user experience.
This patch adds a new 'S' option to MixMonitor that injects a frame of
silence on either the r() side or the t() side of the channel so that
when later mixed, there is no such drift.
Change-Id: Ibf5ed73a811087727bd561a89a59f4447b4ee20e