Commit Graph

356 Commits

Author SHA1 Message Date
Naveen Albert bf6a367955 configure: Rerun bootstrap on modern platform.
The last time configure was run, it was run on a system that
did not enable -std=gnu11 by default, which meant that the
restrict qualifier would not be recognized on certain platforms.
This regenerates the configure files from running bootstrap.sh,
so that these should be recognized on all supported platforms.

Resolves: #586
(cherry picked from commit 54b804fc3b)
2024-03-07 14:17:22 +00:00
Brad Smith afe0fb310d main/utils: Simplify the FreeBSD ast_get_tid() handling
FreeBSD has had kernel threads for 20+ years.

(cherry picked from commit 57ea2912e2)
2024-03-07 14:17:22 +00:00
George Joseph 393d8cb947 Add libjwt to third-party
The current STIR/SHAKEN implementation is not currently usable due
to encryption issues. Rather than trying to futz with OpenSSL and
the the current code, we can take advantage of the existing
capabilities of libjwt but we first need to add it to the
third-party infrastructure already in place for jansson and
pjproject.

A few tweaks were also made to the third-party infrastructure as
a whole.  The jansson "dest" install directory was renamed "dist"
to better match convention, and the third-party Makefile was updated
to clean all product directories not just the ones currently in
use.

Resolves: #349
(cherry picked from commit a9d4175e1d)
2024-01-12 18:29:18 +00:00
Sean Bright e05f51a8ae res_pjsip: Enable TLS v1.3 if present.
Fixes #221

UserNote: res_pjsip now allows TLS v1.3 to be enabled if supported by
the underlying PJSIP library. The bundled version of PJSIP supports
TLS v1.3.

(cherry picked from commit b5762cd54e)
2023-09-06 16:55:59 +00:00
Sean Bright 5497b1abe3 configure: Remove obsolete and deprecated constructs.
These were uncovered when trying to run `bootstrap.sh` with Autoconf
2.71:

* AC_CONFIG_HEADER() is deprecated in favor of AC_CONFIG_HEADERS().
* AC_HEADER_TIME is obsolete.
* $as_echo is deprecated in favor of AS_ECHO() which requires an update
  to ax_pthread.m4.

Note that the generated artifacts in this commit are from Autoconf 2.69.

Resolves #139

(cherry picked from commit 21d3c4ae58)
2023-07-10 11:49:48 +00:00
Sean Bright bbf47fefab res_pjsip_pubsub.c: Use pjsip version for pending NOTIFY check. (#77)
The functionality we are interested in is present only in pjsip 2.13
and newer.

Resolves: #45
(cherry picked from commit 2d18fb6e9d)
2023-07-10 11:49:47 +00:00
Mike Bradeen 58636a6ea6 res_pjsip: Upgraded bundled pjsip to 2.13
Removed multiple patches.

Code chages in res_pjsip_pubsub due to changes in evsub.

Pjsip now calls on_evsub_state() before on_rx_refresh(),
so the sub tree deletion that used to take place in
on_evsub_state() now must take place in on_rx_refresh().

Additionally, pjsip now requires that you send the NOTIFY
from within on_rx_refresh(), otherwise it will assert
when going to send the 200 OK. The idea is that it will
look for this NOTIFY and cache it until after sending the
response in order to deal with the self-imposed message
mis-order. Asterisk previously dealt with this by pushing
the NOTIFY in on_rx_refresh(), but pjsip now forces us
to use it's method.

Changes were required to configure in order to detect
which way pjsip handles this as the two are not
compatible for the reasons mentioned above.

A corresponding change in testsuite is required in order
to deal with the small interal timing changes caused by
moving the NOTIFY send.

ASTERISK-30325

Change-Id: I50b00cac89d950d3511d7b250a1c641965d9fe7f
2023-02-06 18:15:35 -07:00
Joshua C. Colp a0713a9f70 pjsip: Add TLS transport reload support for certificate and key.
This change adds support using the pjsip_tls_transport_restart
function for reloading the TLS certificate and key, if the filenames
remain unchanged. This is useful for Let's Encrypt and other
situations. Note that no restart of the transport will occur if
the certificate and key remain unchanged.

ASTERISK-30186

Change-Id: I9bc95a6bf791830a9491ad9fa43c17d4010028d0
2022-09-09 18:41:12 -05:00
Sean Bright ce91a0fdbc build: Rebuild configure and autoconfig.h.in
autoconfigh.h.in was missed in the original review for this
issue. Additionally it looks like I have newer pkg-config autoconf
macros on my development machine.

ASTERISK-29817

Change-Id: I3c85a4de82c5d7d6e0e23dad4c33bb650a86a57b
2022-01-31 07:17:35 -06:00
George Joseph bc59b66de3 bundled_pjproject: Make it easier to hack
There are times when you need to troubleshoot issues with bundled
pjproject or add new features that need to be pushed upstream
but...

* The source directory created by extracting the pjproject tarball
  is not scanned for code changes so you have to keep forcing
  rebuilds.
* The source directory isn't a git repo so you can't easily create
  patches, do git bisects, etc.
* Accidentally doing a make distclean will ruin your day by wiping
  out the source directory, and your changes.
* etc.

This commit makes that easier.
See third-party/pjproject/README-hacking.md for the details.

ASTERISK-29824

Change-Id: Idb1251040affdab31d27cd272dda68676da9b268
2022-01-07 08:45:02 -06:00
George Joseph 0adcdbd118 BuildSystem: Check for alternate openssl packages
OpenSSL is one of those packages that often have alternatives
with later versions.  For instance, CentOS/EL 7 has an
openssl package at version 1.0.2 but there's an openssl11
package from the epel repository that has 1.1.1.  This gets
installed to /usr/include/openssl11 and /usr/lib64/openssl11.
Unfortunately, the existing --with-ssl and --with-crypto
./configure options expect to point to a source tree and
don't work in this situation.  Also unfortunately, the
checks in ./configure don't use pkg-config.

In order to make this work with the existing situation, you'd
have to run...
./configure --with-ssl=/usr/lib64/openssl11 \
    --with-crypto=/usr/lib64/openssl11 \
    CFLAGS=-I/usr/include/openssl11

BUT...  those options don't get passed down to bundled pjproject
so when you run make, you have to include the CFLAGS again
which is a big pain.

Oh...  To make matters worse, although you can specify
PJPROJECT_CONFIGURE_OPTS on the ./configure command line,
they don't get saved so if you do a make clean, which will
force a re-configure of bundled pjproject, those options
don't get used.

So...

* In configure.ac... Since pkg-config is installed by install_prereq
  anyway, we now use it to check for the system openssl >= 1.1.0.
  If that works, great.  If not, we check for the openssl11
  package. If that works, great.  If not, we fall back to just
  checking for any openssl.  If pkg-config isn't installed for some
  reason, or --with-ssl=<dir> or --with-crypto=<dir> were specified
  on the ./configure command line, we fall back to the existing
  logic that uses AST_EXT_LIB_CHECK().

* The whole OpenSSL check process has been moved up before
  THIRD_PARTY_CONFIGURE(), which does the initial pjproject
  bundled configure, is run.  This way the results of the above
  checks, which may result in new include or library directories,
  is included.

* Although not strictly needed for openssl, We now save the value of
  PJPROJECT_CONFIGURE_OPTS in the makeopts file so it can be used
  again if a re-configure is triggered.

ASTERISK-29693

Change-Id: I341ab7603e6b156aa15a66f43675ac5029d5fbde
2021-10-20 13:24:19 -05:00
Sean Bright 44fd75fae2 configure: Remove unused OpenSSL SRTP check.
Discovered while looking at ASTERISK~29684. Usage was removed in change
I3c77c7b00b2ffa2e935632097fa057b9fdf480c0.

Change-Id: Iaf2f7a16ea5a7eee6375319347e4b40b8e7b10e3
2021-10-15 10:51:05 -05:00
Sean Bright 695fc3dbd7 dns.c: Load IPv6 DNS resolvers if configured.
IPv6 nameserver addresses are stored in different part of the
__res_state structure, so look there if we appear to have support for
it.

ASTERISK-28004 #close

Change-Id: I67067077d8a406ee996664518d9c8fbf11f6977d
2021-09-08 18:18:28 -05:00
Joshua C. Colp 800fd84af6 res_config_sqlite: Remove deprecated module.
ASTERISK-29598

Change-Id: I8ef17023f55bf01f2e309b06f4778a8ca7252c91
2021-08-17 10:38:34 -03:00
Joshua C. Colp 20b2741232 chan_vpb: Remove deprecated module.
ASTERISK-29597

Change-Id: I19bb39eed0257ddfef453eb2df5646d073d50fe1
2021-08-17 10:38:05 -03:00
Joshua C. Colp 1eb2d85c99 chan_misdn: Remove deprecated module.
ASTERISK-29596

Change-Id: Ibae9490c1b35cadbf7028d24610f745277c8535e
2021-08-17 10:37:40 -03:00
Joshua C. Colp 6ecc48086c chan_nbs: Remove deprecated module.
ASTERISK-29595

Change-Id: Ib5c7d43a780f2fb94cee90738e4c1af211ae4a33
2021-08-17 10:36:19 -03:00
Joshua C. Colp 95f3a4a9ad chan_oss: Remove deprecated module.
ASTERISK-29593

Change-Id: Ib53a42ad974c63871344b95078c61c188e43da99
2021-08-17 10:35:43 -03:00
Ben Ford 168637cc0c RTP/ICE: Send on first valid pair.
When handling ICE negotiations, it's possible that there can be a delay
between STUN binding requests which in turn will cause a delay in ICE
completion, preventing media from flowing. It should be possible to send
media when there is at least one valid pair, preventing this scenario
from occurring.

A change was added to PJPROJECT that adds an optional callback
(on_valid_pair) that will be called when the first valid pair is found
during ICE negotiation. Asterisk uses this to start the DTLS handshake,
allowing media to flow. It will only be called once, either on the first
valid pair, or when ICE negotiation is complete.

ASTERISK-28716

Change-Id: Ia7b68c34f06d2a1d91c5ed51627b66fd0363d867
2020-02-18 09:55:12 -06:00
Joshua C. Colp ed394ce5b1 configure: Add check for MySQL client bool and my_bool type usage.
Instead of trying to use the defined MySQL client version from the
header use a configure check to determine whether the bool or my_bool
type should be used for defining a boolean.

ASTERISK-28604

Change-Id: Id2225b3785115de074c50c123ff1a68005b4a9c7
2019-12-16 10:36:25 -06:00
Joshua Colp a8e5cf557d res_rtp_asterisk: Add support for DTLS packet fragmentation.
This change adds support for larger TLS certificates by allowing
OpenSSL to fragment the DTLS packets according to the configured
MTU. By default this is set to 1200.

This is accomplished by implementing our own BIO method that
supports MTU querying. The configured MTU is returned to OpenSSL
which fragments the packet accordingly. When a packet is to be
sent it is done directly out the RTP instance.

ASTERISK-28018

Change-Id: If2d5032019a28ffd48f43e9e93ed71dbdbf39c06
2019-06-13 07:51:57 -06:00
Sebastian Kemper ccac55b894
loader: support for permanent dlopen()
Asterisk assumes that dlopen() will always run the constructor of a
shared library and every dlclose() will run its destructor. But dlopen()
may be permanent, meaning the constructor will only be run once, as is
the case with musl libc.

With a permanent dlopen() the Asterisk module loader does not work
correctly, because it's expectations regarding when the constructors and
destructors are run are not met. In fact a segmentation fault will occur
when the first module is "re-opened" that has AST_MODFLAG_GLOBAL_SYMBOLS
set (the dlopen() does not call the constructor, resource_being_loaded
is not set to NULL, then strlen is called with NULL instead of a string,
see issue ASTERISK-28319).

This commit adds code to the loader that will manually run the
constructors/destructors of the (non-builtin) modules where needed. To
achieve this a new ao2 container (linked list) is started and filled
with objects that contain the names of the modules and the pointers to
their respective info structs.

This behavior can be activated when configuring Asterisk
(--enable-permanent-dlopen). By default this is disabled, of course.

ASTERISK-28319 #close

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
Change-Id: I86693a0ecf25d5ba81c73773a03df4abc3426875
2019-04-04 15:14:21 -04:00
Sean Bright 6d69fb3cc2 utils: Wrap socket() and pipe() to reduce syscalls
Some platforms provide an implementation of socket() and pipe2() that allow the
caller to specify that the resulting file descriptors should be non-blocking.

Using these allows us to potentially elide 3 calls into 1 by avoiding extraneous
calls to fcntl() to set the O_NONBLOCK flag afterwards.

In passing, change ast_alertpipe_init() to use pipe2() directly instead of the
wrapper if it is available.

Change-Id: I3ebe654fb549587537161506c6c950f4ab298bb0
2018-12-07 09:06:08 -05:00
Chris-Savinovich 58e50e56cb core: Merge malloc_trim patch
We've had multiple opportunities where Richard Mudgett's
malloc_trim patch has been useful. Let's get it
pushed up to gerrit and merged.

Since malloc_trim is only available in libc, an entry is
added to configure.ac to create a definition for
HAVE_MALLOC_TRIM.

Change-Id: Ia38308c550149d9d6eae4ca414a649957de9700c
2018-12-03 14:01:01 -06:00
Nick French 37b2e68628 res_pjsip: Implement additional SIP RFCs for Google Voice trunk compatability
This change implements a few different generic things which were brought
on by Google Voice SIP.

1.  The concept of flow transports have been introduced.  These are
configurable transports in pjsip.conf which can be used to reference a
flow of signaling to a target.  These have runtime configuration that can
be changed by the signaling itself (such as Service-Routes and
P-Preferred-Identity).  When used these guarantee an individual connection
(in the case of TCP or TLS) even if multiple flow transports exist to the
same target.

2.  Service-Routes (RFC 3608) support has been added to the outbound
registration module which when received will be stored on the flow
transport and used for requests referencing it.

3.  P-Associated-URI / P-Preferred-Identity (RFC 3325) support has been
added to the outbound registration module.  If a P-Associated-URI header
is received it will be used on requests as the P-Preferred-Identity.

4.  Configurable outbound extension support has been added to the outbound
registration module.  When set the extension will be placed in the
Supported header.

5.  Header parameters can now be configured on an outbound registration
which will be placed in the Contact header.

6.  Google specific OAuth / Bearer token authentication
(draft-ietf-sipcore-sip-authn-02) has been added to the outbound
registration module.

All functionality changes are controlled by pjsip.conf configuration
options and do not affect non-configured pjsip endpoints otherwise.

ASTERISK-27971 #close

Change-Id: Id214c2d1c550a41fcf564b7df8f3da7be565bd58
2018-10-24 07:51:25 -05:00
Joshua Colp 02bb329bb5 Merge "configure.ac: Check for unbound version >= 1.5" 2018-10-01 07:08:52 -05:00
George Joseph aa10d6d5eb Merge "jansson: Backport fixes to bundled, use json_vsprintf if available." 2018-09-26 11:09:50 -05:00
George Joseph 1ba51b00cc configure.ac: Check for unbound version >= 1.5
In order to do this and provide good feedback, a new macro was
created (AST_EXT_LIB_EXTRA_CHECK) which does the normal check and
path setups for the library then compiles, links and runs a supplied
code fragment to do the final determination.  In this case, the
final code fragment compares UNBOUND_VERSION_MAJOR
and UNBOUND_VERSION_MINOR to determine if they're greater than or
equal to 1.5.

Since we require version 1.5, some code in res_resolver_unbound
was also simplified.

ASTERISK-28045
Reported by: Samuel Galarneau

Change-Id: Iee94ad543cd6f8b118df8c4c7afd9c4e2ca1fa72
2018-09-25 13:30:09 -06:00
Corey Farrell adf539b2f0 jansson: Backport fixes to bundled, use json_vsprintf if available.
Use json_vsprintf from versions which contain fix for va_copy leak.

Apply fixes from jansson master:
* va_copy leak fix.
* Avoid potential invalid memory read in json_pack.
* Rename variable that shadowed another.

Change-Id: I7522e462d2a52f53010ffa1e7d705c666ec35539
2018-09-24 18:00:26 -05:00
Kevin Harwell 31fba4e869
rtp_engine: rtcp_report_to_json can overflow the ssrc integer value
When writing an RTCP report to json the code attempts to pack the "ssrc" and
"source_ssrc" unsigned integer values as a signed int value type. This of course
means if the ssrc's unsigned value is greater than that which can fit into a
signed integer value it gets converted to a negative number. Subsequently, the
negative value goes out in the json report.

This patch now packs the value as a json_int_t, which is the widest integer type
available on a given system. This should make it so the value no longer
overflows.

Note, this was caught by two failing tests hep/rtcp-receiver/ and
hep/rtcp-sender.

Change-Id: I2af275286ee5e795b79f0c3d450d9e4b28e958b0
2018-09-21 18:06:21 -04:00
Joshua Colp ce9a980be6 pjproject: Upgrade to 2.8.
This change brings in PJSIP 2.8, removes all the patches
that were merged upstream, and makes a minor change to
support a breaking change that was done.

ASTERISK-28059

Change-Id: I5097772b11b0f95c3c1f52df6400158666f0a189
2018-09-18 11:32:18 -05:00
Sean Bright 3d9deb35f0 autoconf: Check for srtp_get_version_string() before using it
Change-Id: Id2a916ff9448706090e72ff2c7fb3f5ba24a05df
2018-09-17 10:48:03 -05:00
Alexander Traud 0a4d58735f BuildSystem: Enable Jansson in Solaris 11.
In Solaris, the header <jansson.h> is in /usr/include/jansson. To find
Jansson even in such a subdirectory, the tool pkg-config is queried via
AST_PKG_CONFIG_CHECK. For those platforms, which do not list Jansson via
pkg-config, the previous check remains and is executed thereafter.

Because the check for the NetBSD Editline library uses the tool pkg-config
the code of PKG_PROG_PKG_CONFIG must be used. Because that check happens
earlier than Jansson, it must be placed in front of that.

ASTERISK-27991

Change-Id: I69ea0f379f87a50049654b2487c76ee1c04fa53a
2018-07-28 14:39:40 +02:00
George Joseph 880fbff6b7 res_pjsip_session: Add ability to accept multiple sdp answers
pjproject by default currently will follow media forked during an INVITE
on outbound calls if the To tag is different on a subsequent response as
that on an earlier response.  We handle this correctly.  There have
been reported cases where the To tag is the same but we still need to
follow the media.  The pjproject patch in this commit adds the
capability to sip_inv and also adds the capability to control it at
runtime.  The original "different tag" behavior was always controllable
at runtime but we never did anything with it and left it to default to
TRUE.

So, along with the pjproject patch, this commit adds options to both the
system and endpoint objects to control the two behaviors, and a small
logic change to session_inv_on_media_update in res_pjsip_session to
control the behavior at the endpoint level.

The default behavior for "different tags" remains the same at TRUE and
the default for "same tag" is FALSE.

Change-Id: I64d071942b79adb2f0a4e13137389b19404fe3d6
ASTERISK-27936
Reported-by: Ross Beer
2018-06-26 07:05:34 -06:00
Alexander Traud 0743ad6422 res_rtp_asterisk: Allow OpenSSL configured with no-deprecated.
Furthermore, allow OpenSSL configured with no-dh. Additionally, this change
allows auto-negotiation of the elliptic curve/group for servers, not only with
OpenSSL 1.0.2 but also with OpenSSL 1.1.0 and newer. This enables X25519
(since OpenSSL 1.1.0) and X448 (since OpenSSL 1.1.1) as a side-effect.

ASTERISK-27910

Change-Id: I5b0dd47c5194ee17f830f869d629d7ef212cf537
2018-06-08 22:02:38 +02:00
Alexander Traud 2228ae3f27 tcptls: Repair ./configure --with-ssl=PATH.
SSL_OP_NO_TLSv1_1 and SSL_OP_NO_TLSv1_2 got discovered without honoring a PATH.

ASTERISK-27865

Change-Id: I8cd358eed7411726d08fa7b01691bef122fbeb71
2018-05-19 15:23:30 +02:00
Alexander Traud d6fda173a4 BuildSystem: With external editline, do not require libs for internal editline.
ASTERISK-27761

Change-Id: Ib17a7415297a210cfcdbf149e4df9b6edadbfab6
2018-03-22 11:43:18 +01:00
Alexander Traud 10a978829e 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.

ASTERISK-27745

Change-Id: Icd315809b8e7978203431f3afb66240dd3a040ba
2018-03-17 11:00:06 +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 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 8ac198aff3 BuildSystem: Remove chan_h323 leftovers.
ASTERISK-27670

Change-Id: I07a8ef8bbd6001e25711fa1bff152eb6c9efa729
2018-02-14 09:28:29 +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 7397961b02 BuildSystem: pjsip_evsub_set_uas_timeout was not used.
ASTERISK-27435

Change-Id: Id318a7ae6d7d69b53f911d30bf3eece64852f15c
2017-11-20 16:49:04 +01:00
Jenkins2 b5ac9c8a78 Merge "This patch adds a beanstalk CDR backend." 2017-11-16 09:36:41 -06: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
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