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.
Alexander Traud [Mon, 12 Mar 2018 09:22:43 +0000 (10:22 +0100)]
res_srtp: Add support for libsrtp2.x on openSUSE.
Since ASTERISK-26976, libSRTP 2.x can be used for sRTP. However, that change
added a private header which is not available on openSUSE for example. To
remain compatibility with very old libSRTP versions, the affected/missing
symbols AES_128_ICM and HMAC_SHA1 are defined manually.
Corey Farrell [Sat, 10 Mar 2018 09:33:33 +0000 (04:33 -0500)]
core: Remove non-critical cleanup from startup aborts.
When built-in components of Asterisk fail to start they cause the
Asterisk startup to abort. In these cases only the most critical
cleanup should be performed - closing databases and terminating
proceses. These cleanups are registered using ast_register_atexit, all
other cleanups should not be run during startup abort.
The main reason for this change is that these cleanup procedures are
untestable from the partially initialized states, if they fail it could
prevent us from ever running the critical cleanup with ast_run_atexits.
Alexander Traud [Fri, 9 Mar 2018 09:23:53 +0000 (10:23 +0100)]
BuildSystem: For consistency, avoid double-checking via if clauses.
In the script ./configure, AST_EXT_LIB_CHECK and AST_PKG_CONFIG_CHECK first test
whether parameter 1 was already found. Consequently, an if-test on PBX_ just a
line below is redundant, if exactly the same parameter 1 is used again.
No performance gain is expected by this change. However, because this strategy
is used all over in ./configure except for two places, this change aims to
create more consistency: Only do something different if there is a reason to do
so.
Alexander Traud [Thu, 8 Mar 2018 11:32:31 +0000 (12:32 +0100)]
BuildSystem: Instead of $PJPROJECT_LIBS with s, use $PJPROJECT_LIB everywhere.
In the script ./configure,
xyz_LIB is set by AST_PKG_CONFIG_CHECK and
xyz_LIBS is set by PKG_CHECK_MODULES within
AST_PKG_CONFIG_CHECK. Both are the same. In Asterisk normally the former and
only three times the latter was used. Let us use xyz_LIB without s, for
consistency with AST_EXT_LIB_CHECK. That eases understanding because now readers
do not have to know that xyz_LIB equals xyz_LIBS.
Alexander Traud [Tue, 6 Mar 2018 12:28:15 +0000 (13:28 +0100)]
BuildSystem: Enable PortAudio in NetBSD.
In NetBSD, PortAudio 1 is still the default version. PortAudio 2 can be
installed side by side but gets placed in a 'portaudio2' subdirectory. To
find PortAudio 2 even in a subdirectory, the tool pkg-config is queried via
AST_PKG_CONFIG_CHECK. For those platforms, which do not list PowerAudio 2
via pkg-config, the previous check remains and is executed thereafter.
Corey Farrell [Wed, 7 Mar 2018 06:29:13 +0000 (01:29 -0500)]
Replace direct checks of option_debug with DEBUG_ATLEAST macro.
Checking option_debug directly is incorrect as it ignores file/module
specific debug settings. This system-wide change replaces nearly all
direct checks for option_debug with the DEBUG_ATLEAST macro.
Richard Mudgett [Wed, 7 Mar 2018 19:13:42 +0000 (13:13 -0600)]
BuildSystem regression: Fix errors reported by clean targets.
Doing a 'make clean', 'make distclean', or 'make dist-clean' gets errors
about an invalid shell option: "/bin/sh: 0: Illegal option -".
The clean targets do not include the makeopts file which defines GREP and
LDCONFIG because the file may not exist and the distclean/dist-clean
targets will delete it anyway.
Jean Aunis [Wed, 14 Feb 2018 13:33:18 +0000 (14:33 +0100)]
chan_sip: Fix improper RTP framing on outgoing calls
The "ptime" SDP parameter received in a SIP response was not honoured.
Moreover, in the abscence of this "ptime" parameter, locally configured
framing was lost during response processing.
This patch systematically stores the framing information in the
ast_rtp_codecs structure, taking it from the response or from the
configuration as appropriate.
Alexander Traud [Wed, 7 Mar 2018 15:32:05 +0000 (16:32 +0100)]
utils: In Solaris, avoid a warning about an unused variable.
When HAVE_GETHOSTBYNAME_R_5 was set by the script ./configure, GCC 7.3.0 found
an unused variable. Actually, the variable was used (set to a dummy value) but
the compiler optimization might have removed that. Instead, this change ensures
that the variable 'res' is only used when it is really required.