Commit Graph

700 Commits

Author SHA1 Message Date
Alexander Traud c5f2332953 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.

Change-Id: I4a6f48127b7af3a48168c917e888be1f70625027
2018-03-09 10:13:20 +01:00
Alexander Traud 36c8885c66 BuildSystem: Enable dladdr on non-Linux platforms like FreeBSD.
ASTERISK-27641

Change-Id: I587e8ba0123c70fc10cfd8b0ac3299551f61d84b
2018-03-09 09:44:23 +01:00
Alexander Traud 75cebc3e71 BuildSystem: Re-check for another UUID library only when previous check failed.
As a side-effect, this avoids the ambiguous output:
 checking for uuid_generate_random... no
which was printed always previously.

ASTERISK-25586
Reported by: John Nemeth

Change-Id: I6d541dfcf453932a9856c5e251aa22e0e6c233c9
2018-03-08 16:04:29 +01:00
Alexander Traud fc64a0e2b3 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.

Change-Id: I7359860a5d730cdc784c2c48e501a082196434d3
2018-03-08 12:28:37 +01:00
Alexander Traud 16f6e94033 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.

ASTERISK-27721

Change-Id: I4175500126909ad1b181fff8e11bb4a3a6ae4fa9
2018-03-08 11:00:40 +01:00
Alexander Traud ef79e583ec BuildSystem: Enable Lua in NetBSD.
luaL_openlib got removed with Lua 5.2.
luaL_newstate is available in all versions.

ASTERISK-27718

Change-Id: I9c8c8880315ee36ab740d7c40153306c0bfd6f71
2018-03-06 17:58:55 +01:00
Joshua Colp 0072f75650 Merge "BuildSystem: Avoid == for comparison in ./configure." 2018-03-05 12:14:44 -06:00
Alexander Traud 9749524520 BuildSystem: Detect whether uselocale(.) is available.
ASTERISK-27712
Reported by: Joerg Sonnenberger, D'Arcy Cain

Change-Id: Idf1c9d43617a3e13028b95b313415903d80ef807
2018-03-03 13:56:03 +01:00
Alexander Traud a9c02e484a BuildSystem: Avoid == for comparison in ./configure.
ASTERISK-27709
Reported by: John Nemeth

Change-Id: I11b1ae8fd404c04066f1458f5d71f9536359d58d
2018-03-02 12:12:17 +01:00
Joshua Colp 7baaed0d3f Merge "BuildSystem: Fix a typo related to ./configure --prefix=<path> on OpenBSD." 2018-02-20 05:11:14 -06:00
Jenkins2 699403e4a3 Merge "BuildSystem: Enable IMAP storage on OpenBSD." 2018-02-19 18:09:11 -06:00
Jenkins2 bb723711a6 Merge "BuildSystem: Enable system provided libedit on OpenBSD." 2018-02-16 08:02:30 -06:00
Alexander Traud dda73c5018 BuildSystem: Fix a typo related to ./configure --prefix=<path> on OpenBSD.
Reported by: Stuart Henderson

Change-Id: Ieae8624f48b6ae78cf29930b9a45a3c842c7a764
2018-02-16 14:52:36 +01:00
Alexander Traud c674efa996 BuildSystem: Enable IMAP storage on OpenBSD.
ASTERISK-27681
Reported by: Stuart Henderson

Change-Id: Ifb6b614acb251b695b9417d76510e73eb335b679
2018-02-16 13:41:35 +01:00
Alexander Traud 2c814afb86 BuildSystem: Enable system provided libedit on OpenBSD.
ASTERISK-27677

Change-Id: I0854e3616d1361ae9b6907d3d3444a02784ac62b
2018-02-16 11:57:18 +01:00
Alexander Traud 8ac198aff3 BuildSystem: Remove chan_h323 leftovers.
ASTERISK-27670

Change-Id: I07a8ef8bbd6001e25711fa1bff152eb6c9efa729
2018-02-14 09:28:29 +01:00
Corey Farrell 9fddc8b4dc core: Remove embedded editline.
This removes the embedded copy of editline from the Asterisk source
tree, making a system copy of libedit mandatory in Asterisk 16+.

ASTERISK-27634 #close

Change-Id: Iedb64ad92acb78419f3caefedaa2bb7cd2a1a33f
2018-02-12 04:44:26 -05:00
Jenkins2 d592adf623 Merge "BuildSystem: Raise autoconf version requirement to 2.60a." 2018-02-01 10:30:21 -06:00
Alexander Traud 6da970bfb9 BuildSystem: Raise autoconf version requirement to 2.60a.
AC_COMPUTE_INT requires at least autoconf 2.60a.

This affects only those who contribute to Asterisk, only those who had to use
the script ./bootstrap.sh. Furthermore, this change just makes sure nobody is
using a too old autoconf.

ASTERISK-16951

Change-Id: Ibca850e2fe0e77d935207bd959bacf7197d7f637
2018-01-26 14:13:12 +01:00
Corey Farrell 23381d2c5e Build System: Require __sync or __atomic functions.
This change causes the configure script to throw an error if neither
__sync nor __atomic builtin functions are available.

ASTERISK-27619

Change-Id: Ie01a281e0f5c41dfeeb5f250c1ccea8752f56ef9
2018-01-25 10:38:45 -05:00
Corey Farrell 6fbd855228 Build System: Add support for __atomic built-in operators.
Add a check to configure.ac for __atomic_fetch_add support.  If found
use the __atomic built-in operators for ast_atomic_dec_and_test and
ast_atomic_fetchadd_int.

ASTERISK~27619

Change-Id: I65b4feb02bae368904ed0fb03f585c05f50a690e
2018-01-24 20:00:48 -05:00
Alexander Traud d427bb84a2 BuildSystem: Remove AC_CONFIG_AUX_DIR.
ASTERISK-27602

Change-Id: I9f4d3d2bc1481748e39ad1e2b0a364d38e38978b
2018-01-20 19:58:35 +01:00
Jenkins2 1376aa3f29 Merge "BuildSystem: Detect external library Lua in version 5.3." 2018-01-20 01:24:24 -06:00
Alexander Traud 7e7a20642c BuildSystem: In OpenBSD, xmlstarlet is xml.
ASTERISK-27593

Change-Id: I1c7087f7f7582e40b3312c690d912c9a86466805
2018-01-17 13:52:25 +01:00
Alexander Traud 8f31b70246 BuildSystem: Detect external library Lua in version 5.3.
On some platforms, you decide to go for one specific version of Lua, for
example in OpenBSD. On other platforms, you are able to install several versions
side-by-side, for example in Ubuntu and Fedora. Asterisk already works with
Lua 5.3. Asterisk failed to detect Lua 5.3 on those platforms which allow
several versions.

ASTERISK-27592

Change-Id: If7a4b395d844a464e9a1f4f626c5bff4ee67eed8
2018-01-17 09:51:29 +01:00
Alexander Traud 645297614e BuildSystem: Resolve resolv.h not via Generic but Particular Header-Check.
ASTERISK-27585

Change-Id: I27c67563788e6f67eeda5fb51a741823a50a95e2
2018-01-15 17:57:11 +01:00
Alexander Traud 512286e3c8 BuildSystem: Really do not pass unknown-warning options to the compiler.
When an older GCC version is called with a too new warning option, GCC exited
with an error and Asterisk was not built. Therefore, the configure script tests
the installed compiler whether it supports that warning option. If not, Asterisk
does not pass it to the installed compiler. However, some compilers (like clang)
do not exit (error) but give just a warning in such a case. Because the compiler
did not exit, Asterisk passed the unknown-warning option.

ASTERISK-27560

Change-Id: Ia9b7747f649b27ff5e9f75c3db3fee4fe7a29621
2018-01-06 22:40:46 +01:00
Corey Farrell 87a57e8d46 autoconf: Fix call to AC_CONFIG_AUX_DIR.
The `pwd` parameter to AC_CONFIG_AUX_DIR is unnecessary, the default
value is $srcdir.

Additionally remove the AC_REVISION call.  It only added a comment and
is pointless without SVN tag replacements.

Change-Id: I99299a3217f095bddcb2edefb3b9af0ab147bc29
2017-11-28 10:36:41 -05:00
Joshua Colp d8c6852bdc Merge "BuildSystem: pjsip_evsub_set_uas_timeout was not used." 2017-11-21 10:33:28 -06:00
Alexander Traud 7397961b02 BuildSystem: pjsip_evsub_set_uas_timeout was not used.
ASTERISK-27435

Change-Id: Id318a7ae6d7d69b53f911d30bf3eece64852f15c
2017-11-20 16:49:04 +01:00
Corey Farrell b4f7f8250f Build: Fix OSX build issues.
OSX does not support 'readlink -f' or 'sed -r'.  Replace readlink with
the GNU make macro 'realpath'.  Replace sed with grep in one place, cut
in the other.

ASTERISK-27332

Change-Id: I5d34ecca905384decb22ead45c913ae5e8aff748
2017-11-19 14:33:26 -06:00
Joshua Colp 4dac92b99a Merge "Build: Make function constructor/destructor attributes mandatory." 2017-11-17 09:26:33 -06:00
Jenkins2 b5ac9c8a78 Merge "This patch adds a beanstalk CDR backend." 2017-11-16 09:36:41 -06:00
Corey Farrell e9f8b317c3 Build: Make function constructor/destructor attributes mandatory.
This change causes the configure script to fail if the C compiler does
not support both function attributes constructor and destructor.  These
were already required as modules cannot function without these attributes
and Asterisk requires modules.

This also has AST_GCC_ATTRIBUTE set a variable
ax_cv_have_func_attribute_$1.  This is the same variable name used by
autoconf-archive's AX_GCC_FUNC_ATTRIBUTE, used for the same purpose.

Change-Id: Id68e8a1447f2a6d707c54b56350e7bfdb33fb663
2017-11-10 13:32:06 -05:00
Corey Farrell 4013bfa52b configure: Add autoconf check for libopusfile.
This check is being added to make it easier for end-users of third party
open source Opus modules.  This was removed by ASTERISK-26426 but only
the module needed to be removed.

Change-Id: I62b9cd0c4fa8a77596ab0e042948a643a1152677
2017-11-06 04:34:34 -05:00
Corey Farrell 5553adb8ba Build System: Fix --disable-xmldoc option.
The configure option to disable XML documentation does not currently
work.  This patch makes it effective, but also causes an ABI change by
removing the ast_xmldoc_* symbols.  Disabling xmldoc also prevents docs
from being automatically generated, but they can still be manually
generated with 'make doc/core-en_US.xml'.

ASTERISK-26639

Change-Id: Ifac562340c09f80c83e0203de098fcac93bf8c44
2017-10-25 11:26:22 -04:00
Nir Simionovich 4559cd0e28 This patch adds a beanstalk CDR backend.
Beanstalkd is a simple to use job queue. It provides a means to
create multiple job queues called "tubes". Each tube can store
multiple jobs, with varying priorities with the queue. Queue
processing is available via a simple TCP socket or via well defined
libraries, avaialble at
https://github.com/kr/beanstalkd/wiki/client-libraries

This module is based upon the beanstalk-client library, available
for download at: https://github.com/deepfryed/beanstalk-client

Change-Id: I5fe4089a34ab3b39230786d9bbfddafa56715f48
2017-10-20 10:08:05 -04:00
Alexander Traud 95b45d1c46 res_srtp: Add support for libsrtp2 with AES-GCM.
Beside allowing AES-GCM again, this adds AES-192 again.

ASTERISK-27356

Change-Id: Ia97a435faf26300335d9552fa676b5d17e5f7233
2017-10-18 03:34:56 -05:00
Matt Jordan f4798faacc res_corosync: Fix linking issue with Corosync 2.x
At some point in time in the history of Corosync (certainly within the
2.x branch), the corosync_cfg_state_track function was removed.
Unfortunately, the cfg library is only linked if this function is
present. Without the cfg library being linked to res_corosync, loading
of res_corosync will fail.

This patch makes it so that detecting corosync's core libraries,
determined by the COROSYNC external library checks, links both the cpg
and cfg libraries with res_corosync.

Change-Id: I674e9e1c8fea11c3bf81154aaa7c1fd43f945465
2017-10-06 15:47:41 -05:00
George Joseph 305bd0d99f Make --with-pjproject-bundled the default for Asterisk 15
'--with-pjproject-bundled' is now the default when running
./configure. It can be disabled with '--without-pjproject-bundled'.

To make building without an internet connection easier, a new
./configure option '--with-download-cache' was added that sets
the cache for externals (like pjproject, the codecs and the DPMA),
AND the sounds files.  It can also be specified as an environment
variable named "AST_DOWNLOAD_CACHE".  The existing
'--with-sounds-cache' option / SOUNDS_CACHE_DIR env variable and
'--with-externals-cache' option / EXTERNALS_CACHE_DIR env variable
remain and if specified, will override '--with-downloads-cache'.

ASTERISK-27189

Change-Id: Ifa9783fddf44aafadb060c9feba713dfa81d38ce
2017-08-08 16:43:00 -05:00
Jenkins2 e0aed61e96 Merge "Support GMIME 3.0" 2017-08-07 07:33:03 -05:00
Tzafrir Cohen 123c93a77c Support GMIME 3.0
Support building the Asterisk httpd with version 3.0 of gmime as
well as earlier versions of that library.

ASTERISK-27173

Change-Id: I7e13dd05a3083ccb0df2dabf83110223f6a9fa8f
2017-08-03 14:15:26 -04:00
Corey Farrell 4b03eb5c38 Fix compile error for old versions of GCC.
Use -Wno-format-truncation only if supported by compiler.

ASTERISK-27171 #close

Change-Id: Iac0aed7a5bcaa16c21b7d62c4e4678d244c4ccb6
2017-08-02 18:10:57 -04:00
Sean Bright 25c9464325 corosync: Fix corosync library name in configure.ac
Also add new corosync packages to install_prereq.

Reported by Travis Ryan in #asterisk-dev

Change-Id: Ib861c95ba630fed62dc54e56784ad8446ed9d2db
2017-07-20 10:40:28 -05:00
Joshua Colp c33168c147 Merge "CFLAGS for BIND8 support" 2017-06-14 11:07:04 -05:00
David M. Lee fcb1a0d7e8 CFLAGS for BIND8 support
Some systems (like macOS) require BIND_8_COMPAT to be defined so that
the nameser libraries are, well, BIND8 compatible.

Change-Id: If79fc27a64f90de1835b5aa3aadfa9be22bd16b0
2017-06-08 17:09:33 -05:00
Sean Bright e497a76d24 eventfd: Disable during cross compilation
Reported by Lonnie Abelbeck <lonnie@abelbeck.com> via private e-mail.

Change-Id: Icc80f12b8d8d591e14a8e0ed9f1c02cbd193a89b
2017-06-07 14:36:37 -05:00
Sean Bright 1f136fe885 res_srtp: Add support for libsrtp2
ASTERISK-25294 #close
Reported by: Tzafrir Cohen

ASTERISK-26976 #close
Reported by: Alex

Change-Id: I789b1c3d1ed31365bbd9339fa58ef36f48833c40
2017-05-26 12:15:42 -04:00
Sean Bright 59203c51cc core: Use eventfd for alert pipes on Linux when possible
The primary win of switching to eventfd when possible is that it only
uses a single file descriptor while pipe() will use two. This means for
each bridge channel we're reducing the number of required file
descriptors by 1, and - if you're using timerfd - we also now have 1
less file descriptor per Asterisk channel.

The API is not ideal (passing int arrays), but this is the cleanest
approach I could come up with to maintain API/ABI.

I've also removed what I believe to be an erroneous code block that
checked the non-blocking flag on the pipe ends for each read. If the
file descriptor is 'losing' its non-blocking mode, it is because of a
bug somewhere else in our code.

In my testing I haven't seen any measurable difference in performance.

Change-Id: Iff0fb1573e7f7a187d5211ddc60aa8f3da3edb1d
2017-04-24 11:50:09 -05:00
Joshua Colp 0e7d29501d Merge "core: Improve/simplify handling of required headers." 2017-04-07 14:48:36 -05:00
George Joseph 01e9eaf3a6 pjproject_bundled: Add 3 upstream patches
0035-r5572-svn-backport-dialog-transaction-deadlock.patch
0036-r5573-svn-backport-ua-pjsua-transaction-deadlock.patch
0037-r5576-svn-backport-session-timer-crash.patch

Also removed the progress bar from wget download to stdout.

ASTERISK-26905 #close
Reported-by: Ross Beer

Change-Id: I268fb3cf71a3bb24283ff0d24bd8b03239d81256
2017-04-05 17:17:24 -05:00
Corey Farrell 8e36064109 core: Improve/simplify handling of required headers.
* Report failures if configure finds a required header is missing.
* Deduplicate includes between asterisk.h, astmm.h and compat.h.
* Unconditionally include headers in compat.h if required elsewhere.

Change-Id: Ie67d0185ca71fbfb81c9bdfaebe46a49e3c56dc5
2017-04-03 16:16:09 -04:00
Walter Doekes a7d94f504f build: Fix deb build issues with fakeroot
If DESTDIR is set, don't call ldconfig. Assume that DESTDIR is used to
create a binary archive. The ldconfig call should be delegated to the
archive postinst script. This fixes the case where fakeroot wraps 'make
install' causing $EUID to be 0 even though it doesn't have permission to
call ldconfig.

The previous logic in configure.ac to detect and correct libdir
has been removed as it was not completely accurate.  CentOS 64-bit
users should again specifiy --libdir=/usr/lib64 when configuring
to prevent install to /usr/lib.

Updated Makefile:check-old-libdir to check for orphans in
lib64 when installing to lib as well as orphans in lib when installing
to lib64.

Updated Makefile and main/Makefile uninstall targets to remove the
orphans using the new logic.

ASTERISK-26705

Change-Id: I51739d4a03e60bff38be719b8d2ead0007afdd51
2017-03-30 17:10:32 -05:00
Sean Bright cf6a6226ab core: Remove embedded module support
This has not worked for some time and is no longer actively maintained.

Change-Id: I5110b0db69c152761b58fa025cb0a53b0e544d99
2017-03-27 10:36:08 -04:00
Matt Jordan 59130260e7 configure: Don't use the progress bar with curl when downloading to stdout
In some scenarios, such as when there may not be a terminal (such as
inside a Docker container), curl will apparently direct the progress bar
to stdout. This can cause extra data to be appended to a file curl'd
down to stdout, resulting in md5 verification failures.

This patch removes the progress bar, and tells curl to download the file
silently.

ASTERISK-26872 #close

Change-Id: Ie860b020f627d4372b3e7ce9453de5faafeebe6c
2017-03-14 14:14:15 -06:00
Joshua Colp 6ac33bfe3e Merge "Binaural synthesis (confbridge): Adds binaural synthesis to bridge_softmix." 2017-02-24 12:49:00 -06:00
George Joseph b0067bcf2c build: Execute ldconfig to build cache. (take two)
On some platforms a multiarch approach is used for libraries.
The build system does not take this into account and still
places libraries into the lib directory if no --libdir is
specified to configure. On initial startup this results in
libasteriskssl.so not being found, as it is not in the multiarch
lib directory.  To make matters worse, options were being passed
to ldconfig on both Linux and FreeBSD that actually prevented
the rebuild of the cache.

 * Fedora has a /usr/share/config.site that automatically tells
   autoconf to use /usr/lib64 but CentOS does not. This logic was
   copied to configure.ac and modified so systems like Ubuntu,
   which still use /usr/lib for 64-bit systems, aren't affected.

Now that we have them in the correct directory...

In order for the system loader to find libasteriskssl and
libasteriskpj, one of 3 things has to happen...

  - The linker cache must be rebuilt including the directory
    where the libasterisk* libraries were installed.  Only root
    can rebuild the cache.  This was busted.
  - We have to link the asterisk binary with an rpath pointing
    to the directrory where the libasterisk* libraries were
    installed.  This makes things very complicated and will happen
    over the collective dead bodies of everyone who's had to
    package a distribution with an rpath.
  - Finally, you can start asterisk with LD_LIBRARY_PATH set to the
    directrory where the libasterisk* libraries were installed.

There are no other options. So...

 * The invokation of ldconfig has been moved from main/Makefile
   to ASTTOPDIR/Makefile, the options have been removed, and
   DESTDIR/ASTLIBDIR appended.  If you aren't root, you will be
   warned after the "Asterisk Installation Compete" banner that
   you must re-run 'make install' as root, manually run
   'ldconfig DESTDIR/ASTLIBDIR' as root, or run asterisk with
   LD_LIBRARY_PATH.

ASTERISK-26705

Change-Id: I2a64b7c33a7d3e9bde20f47e3d3ab771977af982
2017-02-23 16:07:29 -06:00
frahaase 094c26aa68 Binaural synthesis (confbridge): Adds binaural synthesis to bridge_softmix.
Adds binaural synthesis to bridge_softmix (via convolution using libfftw3).
Binaural synthesis is conducted at 48kHz.
For a conference, only one spatial representation is rendered.
The default rendering is applied for mono-capable channels.

ASTERISK-26292

Change-Id: Iecdb381b6adc17c961049658678f6219adae1ddf
2017-02-23 10:34:58 -07:00
Joshua Colp fe88f2e5ca Merge "Binaural synthesis (confbridge): Adds utils/conf_bridge_binaural_hrir_importer" 2017-02-20 10:24:55 -06:00
Sean Bright 51e3b11989 pjproject-bundled: Fix checksum verification when using cURL
ASTERISK-26802 #close
Reported by: Michael L. Young

Change-Id: Iad293080f55d4d69ab615717a15211d916eed613
2017-02-17 17:08:20 -06:00
George Joseph 4bdf5d329f res_pjsip_pubsub: Correctly implement persisted subscriptions
This patch fixes 2 original issues and more that those 2 exposed.

* When we send a NOTIFY, and the client either doesn't respond or
  responds with a non OK, pjproject only calls our
  pubsub_on_evsub_state callback, no others.  Since
  pubsub_on_evsub_state (which does the sub_tree cleanup) does not
  expect to be called back without the other callbacks being called
  first, it just returns leaving the sub_tree orphaned.  Now
  pubsub_on_evsub_state checks the event for PJSIP_EVENT_TSX_STATE
  which is what pjproject will set to tell us that it was the
  transaction that timed out or failed and not the subscription
  itself timing our or being terminated by the client. If is
  TSX_STATE, pubsub_on_evsub_state now does the proper cleanup
  regardless of the state of the subscription.

* When a client renews a subscription, we don't update the
  persisted subscription with the new expires timestamp.  This causes
  subscription_persistence_recreate to prune the subscription if/when
  asterisk restarts.  Now, pubsub_on_rx_refresh calls
  subscription_persistence_update to apply the new expires timestamp.
  This exposed other issues however...

* When creating a dialog from rdata (which sub_persistence_recreate
  does from the packet buffer) there must NOT be a tag on the To
  header (which there will be when a client refreshes a
  subscription).  If there is one, pjsip_dlg_create_uas will fail.
  To address this, subscription_persistence_update now accepts a flag
  that indicates that the original packet buffer must not be updated.
  New subscribes don't set the flag and renews do.  This makes sure
  that when the rdata is recreated on asterisk startup, it's done
  from the original subscribe packet which won't have the tag on To.

* When creating a dialog from rdata, we were setting the dialog's
  remote (SUBSCRIBE) cseq to be the same as the local (NOTIFY) cseq.
  When the client tried to resubscribe after a restart with the
  correct cseq, we'd reject the request with an Invalid CSeq error.

* The acts of creating a dialog and evsub by themselves when
  recreating a subscription does NOT restart pjproject's subscription
  timer.  The result was that even if we did correctly recreate the
  subscription, we never removed it if the client happened to go away
  or send a non-OK response to a NOTIFY.  However, there is no
  pjproject function exposed to just set the timer on an evsub that
  wasn't created by an incoming subscribe request.  To address this,
  we create our own timer using ast_sip_schedule_task.  This timer is
  used only for re-establishing subscriptions after a restart.

  An earlier approach was to add support for setting pjproject's
  timer (via a pjproject patch) and while that patch is still included
  here, we don't use that call at the moment.

While addressing these issues, additional debugging was added and
some existing messages made more useful.  A few formatting changes
were also made to 'pjsip show scheduled tasks' to make displaying
the subscription timers a little more friendly.

ASTERISK-26696
ASTERISK-26756

Change-Id: I8c605fc1e3923f466a74db087d5ab6f90abce68e
2017-02-15 13:11:46 -06:00
Dennis Guse b58de2fab7 Binaural synthesis (confbridge): Adds utils/conf_bridge_binaural_hrir_importer
Adds the import tool for converting a HRIR database to hrirs.h

ASTERISK-26292

Change-Id: I51eb31b54c23ffd9b544bdc6a09d20c112c8a547
2017-02-15 10:44:47 -06:00
David M. Lee 147b8e636e configure: fix with-pjproject-bundled
The AC_ARG_WITH macro's shell variable is withval; not enableval. Purely
coincidentally, the option would work when --enable-dev-mode is given.

Also fixed a portability problem with bootstrap.sh, since -printf is not
a portable option for find.

Change-Id: I0f0e5b1a934b5af5737713834361e9c95b96b376
2016-12-16 01:36:04 -06:00
Joshua Colp 606ab90c25 Merge "autoconf: more variants for OSARCH linux-gnu" 2016-11-28 11:33:47 -06:00
zuul aa9d91c290 Merge "pjproject_bundled: Improve reliability of pjproject download" 2016-11-21 06:22:07 -06:00
zuul 120a4999f0 Merge "Add support for building RADIUS with radcli" 2016-11-20 22:57:12 -06:00
George Joseph d3f070c7a2 pjproject_bundled: Improve reliability of pjproject download
The download process now has a timeout which will cause wget to retry
if it stops retrieving data for 5 seconds and fetch and curl to timeout
if the whole retrieval take smore than 30 seconds.

If the tarball retrieval works, the MD5SUM file is retrieved from
the downloads site and the md5 checksum is verified.

If either the tarball retrieval or MD5SUM retrieval fails, or the
checksums don't match, the entire process is retried once.  If it
fails again, any incomplete tarball is deleted.

.DELETE_ON_ERROR: was also added to the Makefile.  Not only does
this delete the tarball on failure, it till also delete corrupted
library files from the pjproject source directory should they
fail to build correctly.

Tested all the way back to FreeBSD 9, CentOS 6, Debian 6 and
Ubuntu 14.

Change-Id: Iea7d33b96a31622ab1b6e54baebaf271959514e1
2016-11-18 08:01:36 -05:00
Joshua Colp d3dba74017 Merge "Implement internal abstraction for iostreams" 2016-11-17 11:07:06 -06:00
Joshua Colp ed143a3b7c Merge "res_pjsip_outbound_authenticator_digest.c: Fix memory pool leak." 2016-11-17 04:56:34 -06:00
Richard Mudgett 0cd0e70c16 res_pjsip_outbound_authenticator_digest.c: Fix memory pool leak.
Responding to authentication challenges leaks PJSIP memory pools.

The leak was introduced with a pjproject 2.5.5 API change.
https://trac.pjsip.org/repos/ticket/1929 changed the API usage of
pjsip_auth_clt_init() to require the new API pjsip_auth_clt_deinit() to
clean up cached authentication allocations that get allocated with
pjsip_auth_clt_reinit_req().

ASTERISK-26516 #close

Change-Id: I4473141b8c3961d0dc91c382beb3876b3efb45c8
2016-11-16 13:03:25 -05:00
Timo Teräs 070a51bf7c Implement internal abstraction for iostreams
fopencookie/funclose is a non-standard API and should not be used
in portable software. Additionally, the way FILE's fd is used in
non-blocking mode is undefined behaviour and cannot be relied on.

This introduces internal abstraction for io streams, that allows
implementing the desired virtualization of read/write operations
with necessary timeout handling.

ASTERISK-24515 #close
ASTERISK-24517 #close

Change-Id: Id916aef418b665ced6a7489aef74908b6e376e85
2016-11-15 22:25:14 +02:00
George Joseph 72da2ef9ff cli: Fix ast_el_read_char to work with libedit >= 3.1
Libedit 3.1 is not build with unicode on as a default and so the
prototype for the el_gets callback changed from expecting a char buffer
to accepting a wchar buffer.  If ast_el_read_char isn't changed,
the cli reads garbage from teh terminal.

Added a configure test for (*el_rfunc_t)(EditLine *, wchar_t *) and
updated ast_el_read_char to use the HAVE_ define to detemrine whether
to use char or wchar.

ASTERISK-26592 #close

Change-Id: I9099b46f68e06d0202ff80e53022a2b68b08871a
2016-11-14 13:20:38 -05:00
Tzafrir Cohen 97a75e3829 Add support for building RADIUS with radcli
Radcli is yet another RADIUS client library, generally compatible with
freeradius and radiusclient-ng.

This commit adds autoconf option for detecting it as well and changes
cdr_radius and cel_radius to use its header file in that case.

ASTERISK-26540 #close

Change-Id: I271f0715406334874865ffbce0b354b3a2ca148f
2016-11-14 19:40:03 +02:00
George Joseph edea41126b build: Fix default values for some SANITIZER options
2 of the sanitizers didn't have default values so in systems that
don't support sanitizers menuselect would spit out warnings.  They
were harmless but confusing.  They've now been set to "0".

Change-Id: I08dc495e3b83f1feac3160b421f538c375fc5d58
2016-11-09 19:26:27 -05:00
Tzafrir Cohen 6a99f007d6 autoconf: more variants for OSARCH linux-gnu
There are quite a few odd GNU/Linux platforms. Just call all of them
linux-gnu.

Specifically this fixes building the Debian platforms mips64el and x32.
And maybe also others.

ASTERISK-26546 #close

Change-Id: I06ec4bd7f0ee1c84b6b24d81538223b07c4174b1
2016-11-02 12:05:18 +02:00
Corey Farrell aa39a87697 Fix issues with bundled pjproject cached download.
Previously when testing I had a preexisting makeopts in ASTTOPDIR.  The
ordering of configure.ac causes --with-externals-cache to be processed
after third-party configure.  In cases where the Asterisk clone is
cleaned it would cause pjproject to be downloaded to /tmp.  This
moves processing of the externals cache and sounds cache to happen
before third-party configure.

This also addresses a possible issue with the third-party Makefile.  If
TMPDIR is set by the environment it would override the path given to
--with-externals-cache.

ASTERISK-26416

Change-Id: Ifab7f35bfcd5a31a31a3a4353cc26a68c8c6592d
2016-10-14 07:48:59 -05:00
frahaase dd6fc1bb7d Binaural synthesis (confbridge): Adds libfftw3 as dependency.
Adds libfftw3 to the build chain that is is going to be used for binaural
synthesis by bridge_softmix.

ASTERISK-26292

Change-Id: Iedc2f174e4ccb39ae5d9e698e339c6a17155867b
2016-10-12 11:43:38 -05:00
George Joseph 5fb848eebd bundled_pjproject: Add tests for programs used by the Makefile, et al.
Added tests for bzip2, tar, patch, sed and nm to configure.ac.

Set DOWNLOAD_TO_STDOUT to a working command line regardless of
whether the download program is wget, curl or fetch.

Added a 'configure.m4' file to the third-party directory which takes
care of calling any third-party project setup.  Had to move some
pjproject_bundled stuff up in configure.ac so it was called before
the third-party configure macro.

The pjproject tarball is now downloaded to the externals_cache_dir if
it was specified on the ./configure command line

Removed regeneration of the pjproject aconfigure file.  It was only
needed for an old patch that no longer applies.

Converted the tests for symbols to explicit tests since we know that
they're now available in the bundled version.  Saves a little time
during configure.

ASTERISK-26416 #close
Reported-by: Corey Farrell

Change-Id: Id1d94251c0155f8dd41b7de7067f35cfbaafbb9b
(cherry picked from commit e6b0053d75)
(cherry picked from commit a0d02f3832)
2016-10-09 21:25:20 -06:00
Kevin Harwell d31ffb421c Remove "format_ogg_opus: New format"
This reverts commit 40aa28131b.

ASTERISK-26426 #close

Change-Id: I81e55c3c512f1dd6f49896f0c6b97a07d74fd8f5
2016-09-29 14:30:22 -05:00
George Joseph 40aa28131b format_ogg_opus: New format
Add Ogg/Opus playback support.

This uses libopusfile in order to be able to read .opus files and play
them back.

Writing/recording support is not present at this time.

ASTERISK-26409

Change-Id: I8815d23345108d8ca7c0bd640f6a1ce6b4f56955
(cherry picked from commit daee8bbd5209b4158bc1785eede845a26e6cbeaa)
2016-09-27 13:42:02 -05:00
Tzafrir Cohen 07b95f7c65 sd_notify (systemd status notifications) support
sd_notify() is used to notify systemd of changes to the status of the
process. This allows the systemd daemon to know when the process
finished loading (and thus only start another program after Asterisk has
finished loading).

To use this, use a systemd unit with 'Type=notify' for Asterisk.

This commit also adds the function ast_sd_notify(), a wrapper around
sd_notify that does nothing if not built with systemd support.

Also adds support for libsystemd detection in the configure script.

Change-Id: Ied6a59dafd5ef331c5c7ae8f3ccd2dfc94be7811
2016-09-15 10:31:31 +03:00
zuul 51ec782372 Merge "res_pjsip_session: segfault on already disconnected session" 2016-09-07 14:41:27 -05:00
George Joseph 6caf6bcdad build: Add download capability for external packages
The DPMA and g729a, silk, siren7 and siren14 codecs hosted at
http://downloads.digium.com/pub/telephony/ are now listed in the
"External" sections of the "Resource Modules" and "Codec Translators"
pages in menuselect.  Any that are selected will automatically be
downloaded and installed when "make install" is run.  Their LICENSE and
README (if avaialble) files will be installed to
ASTVARLIBDIR/documentation/thirdparty/<product_name>.

Example use with codecs:

The codecs/codecs.xml file is a menuselect style xml file that lists
the codecs to be included.  Their support levels are 'external', which
triggers the download and install, and defaultenabled is no.  Also
because codec_g729a is actually in a directory named codec_g729 on the
download server, the newly added 'member_data' element is used to
override the default of the directory name being the package name.  You
can use the 'directory_name' attribute to keep default base URL
(http://downloads.digium.com/pub/telephony/) but use the new directory,
or you use the 'remote_url' attribute to specify a full URL to the
download directory.  In this case, you must still follow the same
subdirectory naming conventions as that used for the packages located
at 'http://downloads.digium.com/pub/telephony'.

A new configure option '--with-externals-cache' was added and like
'--with-sounds-cache' it allows the installer to cache tarballs so
they're not downloaded every time.

To assist with the download and install process, each external package
now has a manifest.xml file that, among other things, contains a package
version and checksums for each file in the tarball.  The manifest is
saved to both the cache directory and ASTMODDIR and together with the
manifest.xml on the downloads site, tells the install scripts whether
a download and/or update is needed.

bash and xmlstarlet are required for downloader operation.  If they're
not installed, the external items in menuselect will be unavailable.

Change-Id: Id3dcf1289ffd3cb0bbd7dfab3cafbb87be60323a
2016-09-06 10:39:28 -05:00
Alexei Gradinari 7bb7f7b9d5 res_pjsip_session: segfault on already disconnected session
On heavy loaded system the TCP/TLS incoming calls could be
disconnected by pjproject while these calls are being
processed by asterisk which could use the session's memory pools.
If the session in the disconnected state then the session memory
pools were already freed, so we get segfault.

This patch adds a lifetime control on an INVITE session to pjproject.
The lifetime of the session is manipulated by calling
pjsip_inv_add_ref/pjsip_inv_dec_ref.
This patch uses these functions to inform pjproject that the
session is in use.

This patch adds check if the session state is not disconnected
and also checks if the memory pool is not NULL.

This patch also places tasks 'session_end' and 'session_end_completion'
into session's serializer to avoid race condition.

ASTERISK-26291 #close

Change-Id: I4d28b1fb3b91f0492a911d110049d670fdc3c8d7
2016-09-06 08:58:42 -05:00
Joshua Colp e34f299a96 Merge "codecs: Add Codec 2 mode 2400." 2016-09-04 14:11:34 -05:00
Alexander Traud 2e79f52d71 codecs: Add Codec 2 mode 2400.
ASTERISK-26217 #close

Change-Id: I1e45d8084683fab5f2b272bf35f4a149cea8b8d6
2016-08-24 10:41:58 +02:00
Alexander Traud 57f4e4428a BuildSystem: Detect ca_list_path capabilities in external PJProject.
Since Asterisk 13.8, pj_ssl_cert_load_from_files2 got detected only in the
bundled PJProject but not in an external PJProject. Therefore, ca_list_path
could not be used in pjsip.conf. With this change, pj_ssl_cert_load_from_files2
is detected again to enable ca_list_path again.

ASTERISK-26303 #close

Change-Id: I4a4a0cdc5cdff33730911fb4cfc0498c069043d0
2016-08-17 13:12:19 +02:00
George Joseph 8d42ff784d res_resolver_unbound: Allow compilation with libunbound version < 1.5
libunbound at version 1.4.20 (which CentOS still uses) declared all
of their string function parameters as as 'char *'.  1.4.21 changed
them all to 'const char *'.  Thankfully 1.4.21 also introduced the
UNBOUND_VERSION_MAJOR define so configure now checks for that and
sets HAVE_UNBOUND_CONST_PARAMS.  res_resolver_unbound then checks
that and casts away the 'const' if it's not set.

Tested compile and testsuite on CentOS6 (1.4.20), Ubuntu14 (1.4.22) and
Fedora24 (1.5.4).  There are a few failing tests to be addressed though.

ASTERISK-26283 #close

Change-Id: Ib708b19b706c5d0ba7b7d5473e6df339d9ae4148
2016-08-10 12:09:51 -05:00
zuul 9473818659 Merge "res_srtp: Enable AES-256 and AES-GCM." 2016-07-21 21:11:07 -05:00
Alexander Traud 1d2173c7ae res_srtp: Enable AES-256 and AES-GCM.
ASTERISK-26190 #close

Change-Id: I11326d80edd656524a51a19450e586c583aa0a0b
2016-07-21 16:25:41 +02:00
Corey Farrell 8f6e9ffcc6 Add conditional support for noreturn functions.
This adds support for tagging functions with the noreturn attribute.
If DO_CRASH is enabled then ast_do_crash never returns.  If AST_DEVMODE
and DO_CRASH are enabled then failed assertions never return.  This can
resolve a large number of false positives with static analyzers.

ASTERISK-26220 #close

Change-Id: Icfb61e5fe54574eced4c3e88b317244f467ec753
2016-07-19 22:45:10 -05:00
zuul bea3e9b6fb Merge "BuildSystem: Avoid obsolete warning with pthread.m4 on autoconf." 2016-07-14 12:05:19 -05:00
Alexander Traud 85212f2799 res_rtp_asterisk: Enable Forward Secrecy (PFS) for DTLS.
Since July 2014, TLS based protocols (SIP over TLS, Secure WebSockets, HTTPS)
support PFS thanks to ASTERISK-23905. In July 2015, the same feature was added
for DTLS. The source code from main/tcptls.c should have been re-used to ease
security audits. Therefore, this change rolls back the change from July 2015 and
re-uses the code from July 2014. This has the additional benefits to work under
CentOS 7 and enabling not just ECDHE but DHE based cipher suites as well.

ASTERISK-25659 #close
Reported by: StefanEng86, urbaniak, pay123
Tested by: sarumjanuch, traud
patches:
res_rtp_asterisk.patch submitted by sarumjanuch
dtls_centos_step_1.patch submitted by traud
dtls_centos_step_2.patch submitted by traud

Change-Id: I537cadf4421f092a613146b230f2c0ee1be28d5c
2016-07-13 18:46:59 +02:00
Alexander Traud a3f4141f6f BuildSystem: Avoid obsolete warning with pthread.m4 on autoconf.
Updated the macro-set autoconf/ax_pthread.m4 to its latest upstream version.

ASTERISK-26046 #close

Change-Id: I11abc11d17acd2b6a8a5a5be8ae8e0949dab9cc7
2016-07-13 16:00:29 +02:00
Alexander Traud 110b01a0bc BuildSystem: Allow own CFLAGS on ./configure.
Before this change, make failed with the error
Unknown value '' found in build_tools/menuselect-deps for NATIVE_ARCH
when CFLAGS were supplied to the configure script. This was introduced with
<https://reviewboard.asterisk.org/r/1852/> which disabled BUILD_NATIVE when
CFLAGS were supplied. Those who need different -march= values, please, go for
./configure
make menuselect.makeopts or make menuselect
./menuselect/menuselect --disable BUILD_NATIVE

ASTERISK-25289 #close

Change-Id: Ic6365d5a97bb9b3556858f06432a8d1cfa83eebc
2016-07-12 10:59:07 +02:00
George Joseph 5ad7e1c09a configure: Fix HAVE_PJSIP_EVSUB_GRP_LOCK not set with external pjproject
There was a typo in configure.ac preventing HAVE_PJSIP_EVSUB_GRP_LOCK
from getting set when using an external pjproject.

ASTERISK-26099 #close
Reported-by: Ross Beer

Change-Id: I709af70428e125fb5ccd44b171d25dd29141f0ae
2016-06-30 08:29:21 -05:00
zuul 6aaba96aca Merge "BuildSystem: Avoid obsolete warning with AC_TYPE_SIGNAL on autoconf." 2016-06-29 11:16:05 -05:00
Alexander Traud 6e87bf746a BuildSystem: Avoid obsolete warning with AC_TYPE_SIGNAL on autoconf.
Removed the obsolete macro AC_TYPE_SIGNAL because Asterisk does not use K&R C
but requires ANSI C anyway.

ASTERISK-26046

Change-Id: I914c014385e1862102d90fe7650621def78db02e
2016-06-23 11:33:06 +02:00
zuul 0da2e6525b Merge "BuildSystem: Avoid obsolete warning with AC_FUNC_SETVBUF_REVERSED on autoconf." 2016-06-22 18:50:48 -05:00
Alexander Traud 5f23aacda4 BuildSystem: Avoid obsolete warning with AC_FUNC_SETVBUF_REVERSED on autoconf.
Removed the obsolete macro AC_FUNC_SETVBUF_REVERSED because Asterisk does not
support the platform SVR2 from the year 1987 anymore.

ASTERISK-26046

Change-Id: I28161b037feb2d29ab46ed20e785928460226c22
2016-06-22 17:55:05 +02:00
George Joseph b57cd01404 res_pjsip_pubsub: Address SEGV when attempting to terminate a subscription
Occasionally under load we'll attempt to send a final NOTIFY on a
subscription that's already been terminated and a SEGV will occur
down in pjproject's evsub_destroy function.  This is a result of a
race condition between all the paths that can generate a notify
and/or destroy the underlying pjproject evsub object:

 * The client can send a SUBSCRIBE with Expires: 0.
 * The client can send a SUBSCRIBE/refresh.
 * The subscription timer can expire.
 * An extension state can change.
 * An MWI event can be generated.
 * The pjproject transaction timer (timer_b) can expire.

Normally when our pubsub_on_evsub_state is called with a terminate,
we push a task to the serializer and return at which point the dialog
is unlocked.  This is usually not a problem because the task runs
immediately and locks the dialog again.  When the system is heavily
loaded though, there may be a delay between the unlock and relock
during which another event may occur such as the subscription timer
or timer_b expiring, an extension state change, etc.  These may also
cause a terminate to be processed and if so, we could cause pjproject
to try to destroy the evsub structure twice.  There's no way for us to
tell that the evsub was already destroyed and the evsub's group lock
can't tolerate this and SEGVs.

The remedy is twofold.

 * A patch has been submitted to Teluu and added to the bundled
   pjproject which adds add/decrement operations on evsub's group lock.

 * In res_pjsip_pubsub:
   * configure.ac and pjproject-bundled's configure.m4 were updated
     to check for the new evsub group lock APIs.
   * We now add a reference to the evsub group lock when we create
     the subscription and remove the reference when we clean up the
     subscription.  This prevents evsub from being destroyed before
     we're done with it.
   * A state has been added to the subscription tree structure so
     termination progress can be tracked through the asyncronous tasks.
   * The pubsub_on_evsub_state callback has been split so it's not doing
     double duty.  It now only handles the final cleanup of the
     subscription tree.  pubsub_on_rx_refresh now handles both client
     refreshes and client terminates.  It was always being called for
     both anyway.
   * The serialized_on_server_timeout task was removed since
     serialized_pubsub_on_rx_refresh was almost identical.
   * Missing state checks and ao2_cleanups were added.
   * Some debug levels were adjusted to make seeing only off-nominal
     things at level 1 and nominal or progress things at level 2+.

ASTERISK-26099 #close
Reported-by: Ross Beer.

Change-Id: I779d11802cf672a51392e62a74a1216596075ba1
2016-06-21 13:50:24 -05:00
Alexander Traud 9e222efbf2 BuildSystem: Avoid obsolete warning with HELP_STRING on autoconf.
Some configure scripts used both AC_HELP_STRING and its replacement
AS_HELP_STRING. For consistency and to avoid obsolete warnings, those were
changed to AS_HELP_STRING.

ASTERISK-26046

Change-Id: I8aad4fd2bdee40aa2a31ce3339a1eb33ff4f5b0f
2016-06-21 15:08:06 +02:00
Timo Teräs 72d190eb69 Detect and use proper libraries for musl toolchains
Change-Id: I8d9b212f70813404b82918a3f99439e500d4bfcb
2016-06-08 20:37:14 +03:00
Matt Jordan 5236ffed97 configure: Fix errors with AST_UNDEFINED_SANITIZER/AST_LEAK_SANITIZER
When running on a system that does not support or use AST_UNDEFINED_SANITIZER
or AST_LEAK_SANITIZER, the configure script would incorrectly set those
constants to a blank value, e.g., 'AST_UNDEFINED_SANITIZER='. This would
cause menuselect to error out, complaining that a blank value is not a
valid option. This patch corrects the issue by setting the value to 0 if
the options that those constants enable/disable is not found.

Change-Id: Ib39814aaf940f308d500c1e026edb3d70de47fba
2016-05-11 14:10:17 -05:00
George Joseph facce6f632 pjproject_bundled: Check for python-dev and TEST_FRAMEWORK
The pjsua and pjsystest apps are now built only if TEST_FRAMEWORK is set.
The python bindings are now built only if TEST_FRAMEWORK is set and a
python development package is installed.

libresample was also disabled.

ASTERISK-25993 #close
Reported-by: Joshua Colp

Change-Id: If4e91c503a02f113d5b71bc8b972081fa3ff6f03
2016-05-08 20:34:42 -05:00
George Joseph 392341ba37 pjproject-bundled: Cleanups for reported issues
PortAudio should no longer be required
PJSIP_MAX_PKT_LEN is now 6000
Older autoconf issue fixed. (CentOS 6)

Change-Id: I463fa9586cbe7c6b3b603289f535bd8e361611dd
2016-03-23 09:11:24 -05:00
Joshua Colp 4df7b3ae80 build: Add configure check for proto field of PJSIP TLS transport setting.
Older versions of PJSIP do not have the proto field on the TLS transport
setting structure. This change adds a configure check so even if it is
not present we will still be able to build.

Change-Id: Ibf3f47befb91ed1b8194bf63888baa6fee05aba9
2016-03-14 09:37:42 -06:00
George Joseph 3173e91bab build-system: Allow building with static pjproject
Background here:
http://lists.digium.com/pipermail/asterisk-dev/2016-January/075266.html

From CHANGES:
 * To help insure that Asterisk is compiled and run with the same known
   version of pjproject, a new option (--with-pjproject-bundled) has been
   added to ./configure.  When specified, the version of pjproject specified
   in third-party/versions.mak will be downloaded and configured.  When you
   make Asterisk, the build process will also automatically build pjproject
   and Asterisk will be statically linked to it.  Once a particular version
   of pjproject is configured and built, it won't be configured or built
   again unless you run a 'make distclean'.

   To facilitate testing, when 'make install' is run, the pjsua and pjsystest
   utilities and the pjproject python bindings will be installed in
   ASTDATADIR/third-party/pjproject.

   The default behavior remains building with the shared pjproject
   installation, if any.

Building:

   All you have to do is include the --with-pjproject-bundled option on
   the ./configure command line (and remove any existing --with-pjproject
   option if specified).  Everything else is automatic.

Behind the scenes:

   The top-level Makefile was modified to include 'third-party' in the
   list of MOD_SUBDIRS.

   The third-party directory was created to contain any third party
   packages that may be needed in the future.  Its Makefile automatically
   iterates over any subdirectories passing on targets.

   The third-party/pjproject directory was created to house the pjproject
   source distribution.  Its Makefile contains targets to download, patch
   configure, generate dependencies, compile libs, apps and python bindings,
   sanitized build.mak and generate a symbols list.

   When bootstrap.sh is run, it automatically includes the configure.m4
   file in third-party/pjproject.  This file has a macro to download and
   conifgure pjproject and get and set PJPROJECT_INCLUDE, PJPROJECT_DIR
   and PJPROJECT_BUNDLED.  It also tests for the capabilities like
   PJ_TRANSACTION_GRP_LOCK by parsing preprocessor output as opposed to
   trying to compile.  Of course, bootstrap.sh is only run once and the
   configure file is incldued in the patch.

   When configure is run with the new options, the macro in configure.m4
   triggers the download, patch, conifgure and tests.  No compilation is
   performed at this time.  The downloaded tarball is cached in /tmp so
   it doesn't get downloaded again on a distclean.

   When make is run in the top-level Asterisk source directory, it will
   automatically descend all the subdirectories in third_party just as it
   does for addons, apps, etc.  The top-level Makefile makes sure that
   the 'third-party' is built before 'main' so that dependencies from the
   other directories are built first.

   When main does build, a new shared library (libasteriskpj) is created that
   links statically to the pjproject .a files and exports all their symbols.
   The asterisk binary links to that, just as it does with libasteriskssl.

   When Asterisk is installed, the pjsua and pjsystest apps, and the pjproject
   python bindings are installed in ASTDATADIR/third-party/pjproject.  This
   will facilitate testing, including running the testsuite which will be
   updated to check that directory for the pjsua module ahead of the system
   python library.

Modules should continue to depend on pjproject if they use pjproject APIs
directly.  They should not care about the implementation.  No changes to any
res_pjsip modules were made.

Change-Id: Ia7a60c28c2e9ba9537c5570f933c1ebcb20a3103
2016-03-01 09:30:43 -07:00
George Joseph 168c18737f res_pjsip: Handle pjsip_dlg_create_uas deprecation
Pjproject has deprecated pjsip_dlg_create_uas in 2.5 and replaced it with
pjsip_dlg_create_uas_and_inc_lock which, as the name implies, automatically
increments the lock on the returned dialog.  To account for this, configure.ac
now detects the presence of pjsip_dlg_create_uas_and_inc_lock and res_pjsip.c
has an #ifdef HAVE_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK to decide whether to use
the original call or the new one.  If the new one was used, the ref count is
decremented before returning.

ASTERISK-25751 #close
Reported-by Josh Colp

Change-Id: I1be776b94761df03bd0693bc7795a75682615ca8
2016-02-10 15:28:08 -07:00
Badalyan Vyacheslav a23d01e943 Build: Added testing compiler to support the system sanitizes
In older versions of the compiler was not sanitizes.
Compilers other than GCC can not support the Usan and TSAN
or have other options for *FLAGS.

ASTERISK-25767 #close
Reported by: Badalyan Vyacheslav
Tested by: Badalyan Vyacheslav

Change-Id: Iefce6608221fa87884b82ae3cb5649b7b1804916
2016-02-10 05:40:32 +00:00
Mark Michelson 3b426a8b09 Check for OpenSSL defines before trying to use them.
The SSL_OP_NO_TLSv1_1 and SSL_OP_NO_TLSv1_2 defines did not exist prior
to OpenSSL version 1.0.1. A recent commit attempts to, by default, set
these options, which can cause problems on systems with older OpenSSL
installations.

This commit adds a configure script check for those defines and will not
attempt to make use of those if they do not exist. We will print a
warning urging the user to upgrade their OpenSSL installation if those
defines are not present.

Change-Id: I6a2eb9a43fd0738b404d8f6f2cf4b5c22d9d752d
2016-02-04 16:57:46 -06:00
Corey Farrell 5dde111719 Build System: Add support for checking alembic branches.
* Add 'check-alembic' target to root Makefile.
* Create build_tools/make_check_alembic to do the actual checks.

ASTERISK-25685

Change-Id: Ibb3cae7d1202ac23dc70b0f3b5801571ad46b004
2016-01-21 17:15:35 -06:00
Alexander Traud 270f7be54f Build System: Support include-what-you-use.
ASTERISK-25591 #close

Change-Id: I8d3efa0826142ece9cbed2fd0d46f3b607fee6ae
2015-11-30 13:31:21 +01:00
Richard Mudgett ca030845ff configure: Fix check for libunbound to require v1.5.0 as minimum.
Versions of libunbound before v1.4.21 do not compile with Asterisk.
However, since v1.4.21 has a configure script bug that fails to detect the
ldns library (which is fixed in v1.4.22) and v1.4.22 is not an easily
detectable version we will require v1.5.0 as a minimum version of the
library to work with Asterisk.

ASTERISK-25108 #close
Reported by: Richard Mudgett

Change-Id: Ieb228bfb01467573fc121c7356a9dde27128894d
2015-10-08 16:43:10 -05:00
Joshua Colp ff36b5482b Merge "Replaces clock_gettime() with ast_tsnow()" 2015-08-10 11:27:12 -05:00
David M. Lee 40caf0ad9b Replaces clock_gettime() with ast_tsnow()
clock_gettime() is, unfortunately, not portable. But I did like that
over our usual `ts.tv_nsec = tv.tv_usec * 1000` copy/paste code we
usually do when we want a timespec and all we have is ast_tvnow().

This patch adds ast_tsnow(), which mimics ast_tvnow(), but returns a
timespec. If clock_gettime() is available, it will use that. Otherwise
ast_tsnow() falls back to using ast_tvnow().

Change-Id: Ibb1ee67ccf4826b9b76d5a5eb62e90b29b6c456e
2015-08-07 19:35:13 -05:00
Mark Duncan 1d081ec970 res/res_rtp_asterisk: Add ECDH support
This will add ECDH support to Asterisk. It will
detect auto ECDH support in OpenSSL
(1.0.2b and above) during ./configure. If this is
available, it will use it,
otherwise it will fall back to prime256v1 (this
behavior is consistent with
other projects such as Apache and nginx).

This fixes WebRTC being broken in Firefox 38+ due
to Firefox now only supporting
ciphers with perfect forward secrecy.

ASTERISK-25265 #close

Change-Id: I8c13b33a2a79c0bde2e69e4ba6afa5ab9351465b
2015-07-29 11:24:49 +09:00
Diederik de Groot 305ce3defd Update configure.ac/Makefile for clang
Created autoconf/ast_check_raii.m4: contains AST_CHECK_RAII which
checks compiler requirements for RAII:
gcc: -fnested-functions support
clang: -fblocks (and if required -lBlocksRuntime)
The original check was implemented in configure.ac and now has it's
own file. This function also sets C_COMPILER_FAMILY to either gcc or
clang for use by makefile

Created autoconf/ast_check_strsep_array_bounds.m4 (contains
AST_CHECK_STRSEP_ARRAY_BOUNDS):
which checks if clang is able to handle the optimized strsep & strcmp
functions (linux). If not, the standard libc implementation should be
used instead. Clang + the optimized macro's work with:
strsep(char *, char []), but not with strsepo(char *, char *).
Instead of replacing all the occurences throughout the source code,
not using the optimized macro version seemed easier

See 'define __strcmp_gc(s1, s2, l2) in bits/string2.h':
llvm-comment: Normally, this array-bounds warning are suppressed for
macros, so that unused paths like the one that accesses __s1[3] are
not warned about.  But if you preprocess manually, and feed the
result to another instance of clang, it will warn about all the
possible forks of this particular if statement. Instead of switching
of this optimization, another solution would be to run the preproces-
sing step with -frewrite-includes, which should preserve enough
information so that clang should still be able to suppress the diag-
nostic at the compile step later on.

See also "https://llvm.org/bugs/show_bug.cgi?id=20144"
See also "https://llvm.org/bugs/show_bug.cgi?id=11536"

Makefile.rules: If C_COMPILER_FAMILY=clang then add two warning
suppressions:
-Wno-unused-value
-Wno-parentheses-equality
In an earlier review (reviewboard: 4550 and 4554), they were deemed a
nuisace and less than benefitial.

configure.ac:
Added AST_CHECK_RAII() see earlier
Added AST_CHECK_STRSEP_ARRAY_BOUNDS() see earlier
Removed moved content

ASTERISK-24917
Change-Id: I12ea29d3bda2254ad3908e279b7effbbac6a97cb
2015-05-03 10:05:07 -05:00
Joshua Colp a3cec44a0a res_pjsip: Add external PJSIP resolver implementation using core DNS API.
This change adds the following:

1. A query set implementation. This is an API that allows queries to be executed in parallel and once all have completed a callback is invoked.
2. Unit tests for the query set implementation.
3. An external PJSIP resolver which uses the DNS core API to do NAPTR, SRV, AAAA, and A lookups.

For the resolver it will do NAPTR, SRV, and AAAA/A lookups in parallel. If NAPTR or SRV
are available it will then do more queries. And so on. Preference is NAPTR > SRV > AAAA/A,
with IPv6 preferred over IPv4. For transport it will prefer TLS > TCP > UDP if no explicit
transport has been provided. Configured transports on the system are taken into account to
eliminate resolved addresses which have no hope of completing.

ASTERISK-24947 #close
Reported by: Joshua Colp

Change-Id: I56cb03ce4f9d3d600776f36928e0b3e379b5d71e
2015-04-15 10:47:53 -03:00
Joshua Colp abf3e40902 dns: Add core DNS API + unit tests and res_resolver_unbound module + unit tests.
This change adds an abstracted core DNS API which resembles the API described
here[1]. The API provides a pluggable mechanism for resolvers and also a
consistent view for records. Both synchronous and asynchronous queries are
supported.

This change also adds a res_resolver_unbound module which uses the libunbound
library to provide resolution.

Unit tests have also been written for all of the above to confirm the API and
functionality.

ASTERISK-24834 #close
Reported by: Matt Jordan

ASTERISK-24836 #close
Reported by: Matt Jordan

Review: https://reviewboard.asterisk.org/r/4474/
Review: https://reviewboard.asterisk.org/r/4512/

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+DNS+API


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433370 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-25 12:32:26 +00:00
Matthew Jordan 29304d10a0 Add support for the clang compiler; update RAII_VAR to use BlocksRuntime
RAII_VAR, which is used extensively in Asterisk to manage reference counted
resources, uses a GCC extension to automatically invoke a cleanup function
when a variable loses scope. While this functionality is incredibly useful
and has prevented a large number of memory leaks, it also prevents Asterisk
from being compiled with clang.

This patch updates the RAII_VAR macro such that it can be compiled with clang.
It makes use of the BlocksRuntime, which allows for a closure to be created
that performs the actual cleanup.

Note that this does not attempt to address the numerous warnings that the clang
compiler catches in Asterisk.

Much thanks for this patch goes to:
* The folks on StackOverflow who asked this question and Leushenko for
  providing the answer that formed the basis of this code:
  http://stackoverflow.com/questions/24959440/rewrite-gcc-cleanup-macro-with-nested-function-for-clang
* Diederik de Groot, who has been extremely patient in working on getting this
  patch into Asterisk.

Review: https://reviewboard.asterisk.org/r/4370/

ASTERISK-24133
ASTERISK-23666
ASTERISK-20399
ASTERISK-20850 #close
Reported by: Diederik de Groot
patches:
  RAII_CLANG.patch uploaded by Diederik de Groot (License 6600)
........

Merged revisions 432807 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 432808 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432809 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-12 12:40:23 +00:00
Matthew Jordan ced84d7e62 configure: Promote SQLite3 "not installed" warning to error
Since Asterisk won't build without the library, not having it is definitely
an error. Thanks to Kyle Kurz for pointing this out.
........

Merged revisions 432280 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 432281 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432282 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-25 23:09:51 +00:00
David M. Lee 965777ccfc Various fixes for OS X
This patch addresses compilation errors on OS X. It's been a while, so
there's quite a few things.

 * Fixed __attribute__ decls in route.h to be portable.
 * Fixed htonll and ntohll to work when they are defined as macros.
 * Replaced sem_t usage with our ast_sem wrapper.
 * Added ast_sem_timedwait to our ast_sem wrapper.
 * Fixed some GCC 4.9 warnings using sig*set() functions.
 * Fixed some format strings for portability.
 * Fixed compilation issues with res_timing_kqueue (although tests still fail
   on OS X).
 * Fixed menuconfig /sbin/launchd detection, which disables res_timing_kqueue
   on OS X).

ASTERISK-24539 #close
Reported by: George Joseph

ASTERISK-24544 #close
Reported by: George Joseph

Review: https://reviewboard.asterisk.org/r/4327/
........

Merged revisions 431092 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431093 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-26 14:50:40 +00:00
Mark Michelson 023fa0f9e8 Add support for the ca_list_path option for PJSIP transports.
This allows for a path to be specified that has a collection of CA
certificates in it.

ASTERISK-24575 #close
Reported by cloos
Patches:
	pj-ca-path-trunk.diff uploaded by cloos (License #5956)

Review: https://reviewboard.asterisk.org/r/4344
........

Merged revisions 430709 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430713 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-16 21:46:09 +00:00
Matthew Jordan f11fb76205 configure: If cross-compiling, assume we have working semaphores
The Asterisk 13 configure.ac checks for HAS_WORKING_SEMAPHORE but does not have
an option for cross-compiling so it fails with an exit. Since we're cross-
compiling, we can't exactly go looking for the header. The semaphore.h header
is relatively common:
* It's part of the POSIX standard
* It's part of GNU C Library
As such, we assume that it will be present when cross-compiling.

As such, this patch defaults "HAS_WORKING_SEMAPHORE" to "1" if cross-compiling
is detected.

If you're cross-compiling to a platform that doesn't support this, then make
sure you re-define this to 0.

ASTERISK-24663 #close
Reported by: abelbeck
patches:
  asterisk-13-anonymous-semaphores.patch uploaded by abelbeck (License 5903)
........

Merged revisions 430646 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430647 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-15 02:19:49 +00:00
Joshua Colp 0e631a541d chan_pjsip: Add configure check for 'pjsip_get_dest_info' function.
The 'pjsip_get_dest_info' function is used to determine if the signaling transport
of the dialog is secure or not. This function was added in PJSIP 2.3 and does not
exist in earlier versions.

This configure check allows Asterisk to build and run with older versions at the
loss of the 'secure' argument for the PJSIP CHANNEL dialplan function. Usage of
this argument will require upgrading to PJSIP 2.3.

ASTERISK-24665 #close
Reported by: Mark Michelson

Review: https://reviewboard.asterisk.org/r/4329/
........

Merged revisions 430546 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430547 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-13 12:09:45 +00:00
Sean Bright ef8cdd40e5 configure: Add autoconf check for libopus.
Because opus transcoding support cannot be included in the standard Asterisk
distribution, a few codec_opus implementations have popped up.  To make it
easier for people to drop in opus support in their own installations, this
patch adds configure checks for libopus.

Review: https://reviewboard.asterisk.org/r/4106/
........

Merged revisions 426234 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@426235 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-27 17:55:43 +00:00
George Joseph 5e10e369b1 build: Force -fsigned-char on platforms where the default for char is unsigned
gcc on the ARM platform defaults 'char' to 'unsigned char' whereas Intel and
SPARC default to 'signed char'.  This is only an issue in the rare cases where
negative values are assigned to a 'char' but this this patch insures
compatibility by detecting platforms that default to 'unsigned' and adding an
'-fsigned-char' flag to _ASTCFLAGS.

If compiling for ARM (native or cross-compile) be sure to run ./bootstrap.sh
and ./configure to regenerate the build files.  You shouldn't have to do this
for Intel or SPARC.

Tested-by: George Joseph

Review: https://reviewboard.asterisk.org/r/4091/
........

Merged revisions 425964 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 425965 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@425966 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-19 17:09:38 +00:00
Matthew Jordan 98ca5c0b5f configure: Undefine FORTIFY_SOURCE prior to defining it for patched gcc
Some distributions of Linux patch gcc to define FORTIFY_SOURCE when gcc is
executed with optimization. This "help" unfortunately results in re-definition
warnings when FORTIFY_SOURCE is later defined in Asterisk's build system. This
patch undefines FORTIFY_SOURCE prior to defining it to prevent this warning.

Review: https://reviewboard.asterisk.org/r/3912/

ASTERISK-24032 #close
Reported by: Kilburn
Tested by: Kilburn, wdoekes
patches:
  1.8.diff uploaded by cloos (License 5956)
  10.diff uploaded by cloos (License 5956)
  11.diff uploaded by cloos (License 5956)
  12.diff uploaded by cloos (License 5956)
  13.diff uploaded by cloos (License 5956)
........

Merged revisions 421227 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 421228 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 421229 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 421230 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421231 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-17 22:35:27 +00:00
Sean Bright 7677d564e7 Fix build when pjproject is installed in a non-standard location.
When configuring Asterisk to build against a version of pjproject installed
in a non-standard location, the checks for "PJSIP Transaction Group Lock
Support" and "PJSIP Media Stream Replacement Support" fail.  This is
because these secondary checks are not taking the CFLAGS and LIBS returned
by the pkg-config check into account.

Review: https://reviewboard.asterisk.org/r/3830


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419077 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-21 14:49:43 +00:00
Matthew Jordan 3f64ca0c04 configure: Fix libxml2 development library dependency checking
The commit that added libxml2 support didn't fully check for the libxml2
development script in the Asterisk configure file. As a result, Asterisk could
be configured, then fail on menuselect. This patch fixes it so that Asterisk
should detect the libxml2 dependency failure first.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@418850 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-17 19:31:05 +00:00
Matthew Jordan 26c7e684ea menuselect: Add libxml2 support (Patch 3)
This is the final patch in adding menuselect to Asterisk.
 - The first patch (r418832) added menuselect along with mxml
 - The second patch (r418833) removed mxml from menuselect

This patch adds support for libxml2 to menuselect, and makes libxml2 a
required library for Asterisk.

Note that the libxml2 portion of this patch was written by Sean Bright,
and was made available on a team branch:
  http://svn.digium.com/svn/menuselect/team/seanbright/libxml2/

Review: https://reviewboard.asterisk.org/r/3773/

ASTERISK-20703 #close
patches:
  some_mysterious_team_branch uploaded by seanbright (License 5060)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@418834 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-17 19:02:22 +00:00
Matthew Jordan 0e844b7598 configure: Remove last vestiges of h323; DO create menuselect-deps
The previous patch (r418034) fixed the 'glitch' that the channels/h323
Makefile no longer existed. Unfortunately, removing the entire line was a bit
of a blunder, as it meant that build_tools/menuselect-deps was never
generated. Hilarity ensued when actually trying to compile.

But hey! At least configure worked.

This patch fixes *that* glitch, and removes some more of the vestiges of h323.
(It had tendrils in the main Makefile? Crazy.)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@418035 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-04 15:11:51 +00:00
Matthew Jordan 46b00b9c64 configure: Update script to pass if channels/h323/Makefile.in does not exist
This simply removes that check from the configure script, as r418019 removed
chan_h323.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@418034 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-04 14:33:22 +00:00
Matthew Jordan 758b13858b main/tcptls: Add checks for OpenSSL Elliptic Curve support
The patch for ASTERISK-23905 that added PFS support in Asterisk depends on the
elliptic curve library support being present in OpenSSL. As it turns out, some
versions of OpenSSL don't have this library - notably the version running on
our build agents.

This patch fixes the build by providing a configure check for the specific
library calls that the PFS patch relies on.

Review: https://reviewboard.asterisk.org/r/3709/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417900 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-03 16:55:44 +00:00
Richard Mudgett 0c896d8b9b chan_dahdi: Adds support for major update to libss7.
* SS7 support now requires libss7 v2.0 or later.  The new libss7 is not
backwards compatible.

* Added SS7 support for connected line and redirecting.

* Most SS7 CLI commands are reworked as well as new SS7 commands added.
See online CLI help.

* Added several SS7 config option parameters described in
chan_dahdi.conf.sample.

* ISUP timer support reworked and now requires explicit configuration.
See ss7.timers.sample.

Special thanks to Kaloyan Kovachev for his support and persistence in
getting the original patch by adomjan updated and ready for release.

SS7-27 #close
Reported by: adomjan


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416416 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-16 18:27:51 +00:00
Richard Mudgett 8b6ab4782a chan_dahdi/sig_pri: Prevent unnecessary PROGRESS events when overlap dialing is enabled.
When overlap dialing is enabled, the lack of inband audio available
information in the SETUP_ACKNOWLEDGE events causes an interoperability
problem with SIP.  sig_pri doesn't know if there is dialtone present when
a SETUP_ACKNOWLEDGE is received so it assumes it is there and posts an
AST_CONTROL_PROGRESS frame.  The SIP channel driver then sends out a 183
Session Progress and blocks the desired 180 Ringing message when the
ALERTING message comes in.

* Made the configure script detect if the installed version of libpri
supports the SETUP_ACKNOWLEDGE enhancements.

* Using the new API, made generate an AST_CONTROL_PROGRESS frame on an
incoming SETUP_ACKNOWLEDGE message when the message indicates inband audio
is present instead of assuming that dialtone is present.

* Using the new API, made SETUP_ACKNOWLEDGE send out an inband audio
available indication only if dialtone is expected.  The change also makes
the fallback behaviour of sending the PROGRESS message better by sending
it only if dialtone is expected.

* Changed receiving a PROCEEDING message to not generate an
AST_CONTROL_PROGRESS frame if the progress indication ie indicates
non-end-to-end-ISDN.  This helps interoperability with SIP.

* Changed sending a PROCEEDING message in response to an
AST_CONTROL_PROCEEDING frame to not indicate inband audio available.  It
was silly to do so anyway because the channel driver doesn't know if
inband audio is even available.  This helps interoperability with SIP.

This patch and a corresponding change in libpri work together to allow
Asterisk to control the inband audio available progress indication ie on
the SETUP_ACKNOWLEDGE message when dialtone is present.

AST-1338 #close
Reported by: Tyler Stewart

Review: https://reviewboard.asterisk.org/r/3521/
........

Merged revisions 413714 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 413765 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 413771 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413772 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-13 00:35:31 +00:00
George Joseph 64045f0b57 This patch adds support for spinlocks in Asterisk.
There are cases in Asterisk where it might be desirable to lock
a short critical code section but not incur the context switch
and yield penalty of a mutex or rwlock.  The primary spinlock
implementations execute exclusively in userspace and therefore
don't incur those penalties.  Spinlocks are NOT meant to be a
general replacement for mutexes.  They should be used only for
protecting short blocks of critical code such as simple compares
and assignments.  Operations that may block, hold a lock, or
cause the thread to give up it's timeslice should NEVER be
attempted in a spinlock.

The first use case for spinlocks is in astobj2 - internal_ao2_ref.
Currently the manipulation of the reference counter is done with
an ast_atomic_fetchadd_int which works fine.  When weak reference
containers are introduced however, there's an additional comparison
and assignment that'll need to be done while the lock is held.
A mutex would be way too expensive here, hence the spinlock.
Given that lock contention in this situation would be infrequent,
the overhead of the spinlock is only a few more machine instructions
than the current ast_atomic_fetchadd_int call.

ASTERISK-23553 #close
Review: https://reviewboard.asterisk.org/r/3405/
........

Merged revisions 412976 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412977 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-23 20:13:30 +00:00
David M. Lee 38a619af97 Corrected cross-platform stat nanosecond code
When nanosecond time resolution was added for identifying config file
changes, it didn't cover all of the myriad of ways that one might obtain
nanosecond time resolution off of struct stat.

Rather than complicate the #if even further figuring out one system from
the next, this patch directly tests for the three struct members I know
about today, and #ifdef's accordingly.

Review: https://reviewboard.asterisk.org/r/3273/
........

Merged revisions 409833 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 409834 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 409835 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@409836 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-05 16:58:21 +00:00
Kevin Harwell ade5c8a2a4 cdr_radius, cel_radius: build agains libfreeradius-client
Asterisk's RADIUS module currently build against libradiusclient-ng, but this
project has been superseeded by libfreeradius-client. The API is 99% compatible
except that the header name has changed, the library name has changed, and
the configuration file location has changed.

(closes issue ASTERISK-22980)
Reported by: Jeremy Lainé
Patches:
     freeradius-client.patch uploaded by sharky (license 6561)
........

Merged revisions 406801 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 406802 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 406803 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406825 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-28 23:23:15 +00:00
Kinsey Moore 537f4a9dac pbx_lua: Add support for Lua 5.2
This adds support for Lua 5.2 in pbx_lua which is available on newer
operating systems.

(closes issue ASTERISK-23011)
Review: https://reviewboard.asterisk.org/r/3075/
Reported by: George Joseph
Patch by: George Joseph
........

Merged revisions 405090 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 405091 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 405124 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405130 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-08 16:34:24 +00:00
Joshua Colp b8025e789d res_pjsip_session: Add support for PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE flag.
Newer versions of PJSIP have changed to using a flag for the
PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE instead of a define. This adds a
configure check to detect the presence of the flag and use it if found.
........

Merged revisions 403329 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403330 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-03 18:01:36 +00:00
Joshua Colp c321b1f454 Fix a configure issue with PJSIP transaction group lock detection.
The configure check did not use the provided paths for pjproject
if provided when looking for transaction group lock support.
........

Merged revisions 403160 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403161 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-11-26 22:34:08 +00:00
Joshua Colp 1b14a78d14 res_pjsip: Add support for building against pjproject with SIP transaction group lock support.
SIP transaction group lock support has been backported into our pjproject. Since the code
now internally uses a group lock the code is now changed to unlock it if present. Note
that the act of finding the transaction is what actually returns it locked.

For further information about group locks check out the wiki page at:
http://trac.pjsip.org/repos/wiki/Group_Lock

(issue ASTERISK-22818)
Reported by: Matt Jordan
........

Merged revisions 402864 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402865 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-11-16 13:51:04 +00:00
Kinsey Moore 8021958099 Add warning when compiling with iODBC support
When running configure, libiodbc2 development headers will fulfill the
requirement for ODBC development headers, but will not function
properly. This adds a warning when libiodbc2 development headers are
detected instead of unixodbc development headers.

(closes issue ASTERISK-22459)
Reported by: Patrick Maille
Tested by: Walter Doekes
Patches:
    issueA22459_warn_when_using_iodbc.patch uploaded by Walter Doekes (License 5674)
........

Merged revisions 400767 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 400768 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 400769 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400770 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-08 22:33:31 +00:00
Kinsey Moore 3578bc30fd Detect and use xsltCleanupGlobals when available
This introduces usage of an additional libxslt cleanup function,
xsltCleanupGlobals, when the configure script detects that it is
available. Early versions of the library did not include this function.

(closes issue ASTERISK-22570)
Reported by: Corey Farrell
Patches:
    xsltCleanupGlobals.patch uploaded by Corey Farrell (License 5909)
........

Merged revisions 400384 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400385 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-03 18:00:15 +00:00
David M. Lee 2de42c2a25 Multiple revisions 399887,400138,400178,400180-400181
........
  r399887 | dlee | 2013-09-26 10:41:47 -0500 (Thu, 26 Sep 2013) | 1 line
  
  Minor performance bump by not allocate manager variable struct if we don't need it
........
  r400138 | dlee | 2013-09-30 10:24:00 -0500 (Mon, 30 Sep 2013) | 23 lines
  
  Stasis performance improvements
  
  This patch addresses several performance problems that were found in
  the initial performance testing of Asterisk 12.
  
  The Stasis dispatch object was allocated as an AO2 object, even though
  it has a very confined lifecycle. This was replaced with a straight
  ast_malloc().
  
  The Stasis message router was spending an inordinate amount of time
  searching hash tables. In this case, most of our routers had 6 or
  fewer routes in them to begin with. This was replaced with an array
  that's searched linearly for the route.
  
  We more heavily rely on AO2 objects in Asterisk 12, and the memset()
  in ao2_ref() actually became noticeable on the profile. This was
  #ifdef'ed to only run when AO2_DEBUG was enabled.
  
  After being misled by an erroneous comment in taskprocessor.c during
  profiling, the wrong comment was removed.
  
  Review: https://reviewboard.asterisk.org/r/2873/
........
  r400178 | dlee | 2013-09-30 13:26:27 -0500 (Mon, 30 Sep 2013) | 24 lines
  
  Taskprocessor optimization; switch Stasis to use taskprocessors
  
  This patch optimizes taskprocessor to use a semaphore for signaling,
  which the OS can do a better job at managing contention and waiting
  that we can with a mutex and condition.
  
  The taskprocessor execution was also slightly optimized to reduce the
  number of locks taken.
  
  The only observable difference in the taskprocessor implementation is
  that when the final reference to the taskprocessor goes away, it will
  execute all tasks to completion instead of discarding the unexecuted
  tasks.
  
  For systems where unnamed semaphores are not supported, a really
  simple semaphore implementation is provided. (Which gives identical
  performance as the original taskprocessor implementation).
  
  The way we ended up implementing Stasis caused the threadpool to be a
  burden instead of a boost to performance. This was switched to just
  use taskprocessors directly for subscriptions.
  
  Review: https://reviewboard.asterisk.org/r/2881/
........
  r400180 | dlee | 2013-09-30 13:39:34 -0500 (Mon, 30 Sep 2013) | 28 lines
  
  Optimize how Stasis forwards are dispatched
  
  This patch optimizes how forwards are dispatched in Stasis.
  
  Originally, forwards were dispatched as subscriptions that are invoked
  on the publishing thread. This did not account for the vast number of
  forwards we would end up having in the system, and the amount of work it
  would take to walk though the forward subscriptions.
  
  This patch modifies Stasis so that rather than walking the tree of
  forwards on every dispatch, when forwards and subscriptions are changed,
  the subscriber list for every topic in the tree is changed.
  
  This has a couple of benefits. First, this reduces the workload of
  dispatching messages. It also reduces contention when dispatching to
  different topics that happen to forward to the same aggregation topic
  (as happens with all of the channel, bridge and endpoint topics).
  
  Since forwards are no longer subscriptions, the bulk of this patch is
  simply changing stasis_subscription objects to stasis_forward objects
  (which, admittedly, I should have done in the first place.)
  
  Since this required me to yet again put in a growing array, I finally
  abstracted that out into a set of ast_vector macros in
  asterisk/vector.h.
  
  Review: https://reviewboard.asterisk.org/r/2883/
........
  r400181 | dlee | 2013-09-30 13:48:57 -0500 (Mon, 30 Sep 2013) | 28 lines
  
  Remove dispatch object allocation from Stasis publishing
  
  While looking for areas for performance improvement, I realized that an
  unused feature in Stasis was negatively impacting performance.
  
  When a message is sent to a subscriber, a dispatch object is allocated
  for the dispatch, containing the topic the message was published to, the
  subscriber the message is being sent to, and the message itself.
  
  The topic is actually unused by any subscriber in Asterisk today. And
  the subscriber is associated with the taskprocessor the message is being
  dispatched to.
  
  First, this patch removes the unused topic parameter from Stasis
  subscription callbacks.
  
  Second, this patch introduces the concept of taskprocessor local data,
  data that may be set on a taskprocessor and provided along with the data
  pointer when a task is pushed using the ast_taskprocessor_push_local()
  call. This allows the task to have both data specific to that
  taskprocessor, in addition to data specific to that invocation.
  
  With those two changes, the dispatch object can be removed completely,
  and the message is simply refcounted and sent directly to the
  taskprocessor.
  
  Review: https://reviewboard.asterisk.org/r/2884/
........

Merged revisions 399887,400138,400178,400180-400181 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400186 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-30 18:55:27 +00:00
Matthew Jordan 8ddd829b8b Add check for openSUSE when detecting bfd library
In ASTERISK-17842, some additional library checks were added to the configure
script so that the bfd library could be found on CentOS and Fedora systems.

As it turns out, openSUSE requires an additional library. This patch adds
another check to the configure script for openSUSE that will add that library.

Review: https://reviewboard.asterisk.org/r/2885/

(closes issue AST-1169)
Reported by: Guenther Kelleter
........

Merged revisions 400073 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 400075 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 400077 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400078 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-28 22:13:57 +00:00
David M. Lee 9bed50db41 optional_api: Fix linking problems between modules that export global symbols
With the new work in Asterisk 12, there are some uses of the
optional_api that are prone to failure. The details are rather involved,
and captured on [the wiki][1].

This patch addresses the issue by removing almost all of the magic from
the optional API implementation. Instead of relying on weak symbol
resolution, a new optional_api.c module was added to Asterisk core.

For modules providing an optional API, the pointer to the implementation
function is registered with the core. For modules that use an optional
API, a pointer to a stub function, along with a optional_ref function
pointer are registered with the core. The optional_ref function pointers
is set to the implementation function when it's provided, or the stub
function when it's now.

Since the implementation no longer relies on magic, it is now supported
on all platforms. In the spirit of choice, an OPTIONAL_API flag was
added, so we can disable the optional_api if needed (maybe it's buggy on
some bizarre platform I haven't tested on)

The AST_OPTIONAL_API*() macros themselves remained unchanged, so
existing code could remain unchanged. But to help with debugging the
optional_api, the patch limits the #include of optional API's to just
the modules using the API. This also reduces resource waste maintaining
optional_ref pointers that aren't used.

Other changes made as a part of this patch:
 * The stubs for http_websocket that wrap system calls set errno to
   ENOSYS.

 * res_http_websocket now properly increments module use count.

 * In loader.c, the while() wrappers around dlclose() were removed. The
   while(!dlclose()) is actually an anti-pattern, which can lead to
   infinite loops if the module you're attempting to unload exports a
   symbol that was directly linked to.

 * The special handling of nonoptreq on systems without weak symbol
   support was removed, since we no longer rely on weak symbols for
   optional_api.

 [1]: https://wiki.asterisk.org/wiki/x/wACUAQ

(closes issue ASTERISK-22296)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2797/
........

Merged revisions 397989 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397990 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-30 13:40:27 +00:00
Joshua Colp dd33217762 Add the bucket API.
Bucket is a URI based API for the creation, retrieval, updating, and deletion
of "buckets" and files contained within them.

Review: https://reviewboard.asterisk.org/r/2715/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397600 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-23 21:49:47 +00:00