George Joseph [Sun, 25 Mar 2018 18:35:12 +0000 (12:35 -0600)]
pjroject_bundled: Add already-destroyed check to tsx_timer_callback
There have been cases that when the transaction timer callback is called
the tsx is already destroyed. This causes a crash. We now check the
tsx state and return if the tsx is already destroyed.
George Joseph [Sun, 25 Mar 2018 18:12:39 +0000 (12:12 -0600)]
pjproject_bundled: Add patch for pj_atomic crashes
There have been some crashes in the past where something attempts
to use a pj_atomic after it's already been destroyed. This patch
tries to prevent it by making sure that pj_atomic_destroy sets
its mutex to NULL when it's done. The pj_mutex functions already check
for a NULL mutex and just return PJ_EINVAL.
Teluu also added some checks to the win32 implementation as well.
Corey Farrell [Wed, 28 Mar 2018 13:18:06 +0000 (09:18 -0400)]
core: Create main/options.c.
This creates a separate source to 'own' symbols related to options.h and
paths.h. This significantly reduces the number of exports created by
main/asterisk.o. This change is required to eventually be able to
link unmodified Asterisk sources to utilities and/or stand-alone tests.
Kevin Harwell [Tue, 20 Mar 2018 20:28:12 +0000 (15:28 -0500)]
bridge_softmix: Clear "talking" when a channel is put on hold
This patch clears the talking flag from the channel (if already set), and
notifies listeners when that channel is put on hold. Note however, if the
endpoint continues to send audio frames and these are received by the bridge
then that channel will be put back into a "talking" state even though they
are on hold.
Ross Beer [Wed, 7 Mar 2018 12:15:05 +0000 (12:15 +0000)]
pjsip_transport_events.c: Fix crash using stale transport pointer.
Apparently it is possible for the transport to be destroyed without
triggering the transport callback logic. As a result the transport gets
destroyed and we have a stale pointer in the active_transports container.
* Invoke the transport monitor callback checks when the transport is
destroyed in addition to when it is disconnected and shutdown.
Alexander Traud [Tue, 20 Mar 2018 16:55:56 +0000 (17:55 +0100)]
BuildSystem: For consistency, avoid extra libs to be empty.
AST_EXT_LIB_CHECK has several optional parameters. When an optional parameter
is left empty, [] is used to indicate this. However, this is done in the script
./configure only then, when a further parameter is not empty. For example, when
no extra libraries are needed to test the checked library, parameter 5 is not
mentioned. Except parameter 6 and higher are used, then parameter 5 must be
empty.
However, this general rule was broken
* three times for parameter 5 (extra libs) and
* three times for parameter 4 (header)
as found via the Regular Expression \[\]\). In case of parameter 5, all cases
were changed, because that happened for no reason. In case of parameter 4, an
[] improves readability actually. Therefore for parameter 4, the only case which
did not do it was changed. All this aims to create more consistency: Only do
something different if there is a reason to do so.
George Joseph [Fri, 16 Mar 2018 15:19:11 +0000 (09:19 -0600)]
channel.c: Allow generic plc then channel formats are equal
If the two formats on a channel are equal, we don't transcode and since
the generic plc needs slin to work, it doesn't get invoked.
* A new configuration option "genericplc_on_equal_codecs" was added
to the "plc" section of codecs.conf to allow generic packet loss
concealment even if no transcoding was originally needed.
Transcoding via SLIN is forced in this case.
Corey Farrell [Sat, 17 Mar 2018 21:41:13 +0000 (17:41 -0400)]
core: Minor cleanup of ast_el_read_char.
* Define CHAR_T_LIBEDIT and CHAR_TO_LIBEDIT based on
HAVE_LIBEDIT_IS_UNICODE. This avoids needing to repeatedly use
conditional blocks, eliminates having multiple function prototypes.
* Remove parenthesis from return values.
* Add missing code block brackets {}.
* Reduce use of 'else' conditional statements where possible.
Alexander Traud [Sat, 17 Mar 2018 15:54:09 +0000 (16:54 +0100)]
BuildSystem: Check for header file of OGG.
Asterisk uses various symbols of the shared library libogg within the module
format_ogg_vorbis. However, the source code of that module did not include the
header file of libogg explicitly but implicitly. Because that header was not
included before Asterisk 14, the script ./configure was told not to check for
it.
Anyway, even Asterisk 13 LTS uses symbols of libogg. Therefore, that header
should be included explicitly. Therefore, ./configure should check for that
header.
Alexander Traud [Fri, 9 Mar 2018 12:26:40 +0000 (13:26 +0100)]
BuildSystem: When no download utility is available, display the explanation.
./configure --with-pjproject-bundled
did not display an explanation, when no download utility like wget, curl, or
fetch was installed beforehand, although an explanation existed in code. This
happened because the code expected the variable DOWNLOAD_TO_STDOUT to be empty.
However, the script ./configure set that variable always.
Alexander Traud [Sat, 17 Mar 2018 10:00:06 +0000 (11:00 +0100)]
BuildSystem: Remove unused dependency on libltdl.
Asterisk does not need the development package of libltdl, because it does not
use any symbol of -lltdl directly. Instead, it uses the runtime package via the
shared library -lodbc. On the supported platforms, that shared library declares
its dependency on -lltdl correctly, otherwise AST_EXT_LIB_CHECK would have
failed.
Alexander Traud [Fri, 16 Mar 2018 14:53:22 +0000 (15:53 +0100)]
BuildSystem: Avoid an extra case for OpenBSD.
Nine years ago with Mantis 13639 (now ASTERISK-12841) an extra case for OpenBSD
was introduced: Vorbis required Ogg to be specified manually, because the shared
library libvorbis.so did not specify its required dependency on -logg itself.
Today with OpenBSD 6.2, all libvorbis*.so declare their dependencies correctly.
Therefore, an extra case is not required anymore.
Alexander Traud [Mon, 5 Mar 2018 16:17:23 +0000 (17:17 +0100)]
BuildSystem: Enable Advanced Linux Sound Architecture (ALSA) in NetBSD.
In the script ./configure, AST_EXT_LIB_CHECK checks for external libraries. Some
libraries do not specify all their dependencies and require additional shared
libraries. In AST_EXT_LIB_CHECK, this is the fifth parameter. However, if a
library is specified there, it must exist on the platform, because ./configure
tries to compile/link/execute a small app using those statements. For example,
the library libdl.so is Linux specific and does not exist on BSD-like platforms.
Furthermore, no supported platform/version was found, which still (ever?)
requires those additional libraries. Therefore, they were simply removed.
Finally, this change adds the error code ESTRPIPE to the channel driver
chan_alsa for those platforms which lack it, again for example NetBSD.
George Joseph [Fri, 16 Mar 2018 14:02:20 +0000 (08:02 -0600)]
app_voicemail: Fix json blob errors
When app_voicemail calls ast_test_suite_notify with the results of
a user keypress, it formats the keypress as '%c'. If the user hung up
or some other error occurrs, the result of the keypress is a non
printable character. This ultimately causes json_vpack_ex to think
it's being passed a non utf-8 string and return an error.
* Keypress results passed to ast_test_suite_notify are now checked with
isprint() and a '?' is substituted if the check fails.
Corey Farrell [Thu, 15 Mar 2018 09:49:49 +0000 (05:49 -0400)]
core: Backport compatible MALLOC_DEBUG changes.
* Add support for MALLOC_DEBUG and DEBUG_CHAOS to be used together.
* Add utils/astmm.c to .gitignore.
* Fix MALLOC_DEBUG variant of __ast_vasprintf. This function called
va_end(ap) upon allocation failure. This is incorrect since ap is
passed as an argument.
Corey Farrell [Tue, 13 Mar 2018 21:37:12 +0000 (17:37 -0400)]
core: Remove incorrect usage of attribute_malloc.
GCC documentation states that when __attribute__((malloc)) is used it
should not return storage which contains any valid pointers. It
specifically mentions that realloc functions should not have the malloc
attribute, but this also means that complex initializers which could
contain initialized pointers should not use this attribute.