Commit Graph

28598 Commits

Author SHA1 Message Date
Tzafrir Cohen
b0c9f07f04 OpenSSL 1.1.0 support
OpenSSL 1.1.0 includes some major changes in the interface. See
https://wiki.openssl.org/index.php/1.1_API_Changes .

Status: Right now there are still a few deprecation notes with OpenSSL
1.1.0. But it's a start.

Changes:
* CRYPTO_LOCK is no longer available. Replace it with its value for now.
  I don't completely understand what it is used for there.
* Remove several functions from libasteriskssl that seem to no longer be
  needed.
* Structures have become opaque and are accesses with accessors.
* ERR_remove_thread_state() no longer needed.
* SSLv2 code now could no longer be used in 1.1.

ASTERISK-26109 #close

Change-Id: I5e29d477d486ca29b6aae0dc2f5dff960c1cb82b
2016-11-30 08:09:21 -05:00
Matt Jordan
a33ed3327a res/res_pjsip: Fix documentation whitespace issues
Tabs > Spaces.

Change-Id: If1e43a71822615a898e958e0f8b2e882606f0bd0
2016-11-28 15:12:45 -06:00
Mark Michelson
2bae7f4ed9 Merge "build_tools: Fix download_externals to handle certified branches" into 13 2016-11-28 14:44:28 -06:00
zuul
e6ecbdf001 Merge "autoconf: more variants for OSARCH linux-gnu" into 13 2016-11-28 14:38:55 -06:00
Matt Jordan
09c36a6535 res_pjsip/chan_sip: Advertise 'ws' in the SIP URI transport parameter
Per RFC 7118 5.2, the SIP URI 'transport' parameter should advertise
'ws' when WebSockets are to be used as the transport. This applies to
both secure and insecure WebSockets.

There were two bugs in Asterisk with respect to this:

(1) The most egregious occurs in res_pjsip. There, we advertise 'ws' for
    insecure websockets and 'wss' for secure websockets. While this
    would seem to make sense - since 'WS' and 'WSS' are used for the Via
    Transport parameter - this is not the case for the SIP URI. This
    patch corrects that by registering the secure websockets with
    pjproject using the shorthand 'WS', and by returning 'ws' when asked
    for the transport parameter. Note that in pjproject, it is perfectly
    valid to have multiple transports use the same shorthand.

(2) In chan_sip, we return an upper-case version of the transport 'WS'
    instead of 'ws'. Since we should be strict in what we send and
    liberal in what we accept (within reason), this patch lower-cases
    the transport before appending it to the parameter.

ASTERISK-24330 #close
Reported by: cervajs, Inaki Baz Castillo

Change-Id: Iff77b645f8cc3b7cd35168a6676c26b147f22f42
2016-11-28 13:36:17 -06:00
George Joseph
29e887e9e1 build_tools: Fix download_externals to handle certified branches
download_externals wasn't handling the "certified/13.x" version
correctly.

Change-Id: I124d195bb117ca36fd7bf1150c630f3b474a9d9a
2016-11-28 10:06:51 -07:00
Tzafrir Cohen
bfb8c962c4 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-28 08:01:01 -05:00
Timo Teräs
a1fa909033 codec_dahdi: Fix poll.h include.
POSIX defines poll.h. sys/poll.h should not be used as it is c-library
internal header which may or may not exist. Notably in musl including
sys/poll.h generates warning of being incorrect.

Change-Id: Ib318c1c7142a737bcf3caa4d8d72560bebe39252
2016-11-28 07:57:12 -05:00
Michael Kuron
0cc8351484 chan_sip: Fix segfault during module unload
If a TCP/TLS connection was pending (not accepted and not timed out) during
unload of chan_sip, Asterisk would segfault when trying to send a signal to
a thread whose thread ID hadn't been recorded yet. This commit fixes that by
recording the thread ID before calling the blocking connect() syscall.
This was a regression introduced by 776a14386a.

The above wasn't enough to fix the segfault, which was now delayed to the
point where connect() timed out. Therefore, it was necessary to also remove
the SA_RESTART flag from the SIGURG sigaction so that pthread_kill() could be
used to interruput the connect() syscall.
This was a regression introduced by 5d313f51b9.

ASTERISK-26586 #close

Change-Id: I76fd9d47d56e4264e2629bce8ec15fecba673e7b
2016-11-26 18:16:54 +01:00
zuul
5027b0d5e6 Merge "addons/chan_mobile: do not use strerror_r" into 13 2016-11-23 16:44:01 -06:00
gestoip2
8756ce64b7 res_rtp_asterisk: RTT miscalculation in RTCP
When retrieving RTCP stats for PJSIP channels, RTT values are unreliable.
RTT calculation is correct, but the data representation isn't.  RTT is
represented by a 32-bit fixed-point number with the integer part in the
first 16 bits and the fractional part in the last 16 bits.  In order to
get the RTT value, the fractional part is miscalculated, there is an
unnecessary 16 bit shift that causes overflow.  Besides this there is
another mistake, when transforming the integer value to the fixed point
fractional part via bitwise operation, that loses precision.

* RTT fractional part is no longer shifted, avoiding overflow.

* RTT fractional part is transformed to its fixed-point value more
precisely.

* Fixed timeval2ntp() and ntp2timeval() second fraction conversions.

* Fixed NTP timestamp report logging.  The usec was inexplicably
multiplied by 4096.

ASTERISK-26566 #close
Reported by Hector Royo Concepcion

Change-Id: Ie09bdabfee75afb3f1b8ddfd963e5219ada3b96f
2016-11-22 21:20:17 -06:00
Michael Kuron
8e77d6f520 tcptls: Use new certificate upon sip reload
Previously, a TLS server socket would only be restarted upon sip reload if the
bind address had changed. This commit adds checking for changes to TLS
parameters like certificate, ciphers, etc. so they get picked up without
requiring a reload of the entire chan_sip module. This does not affect open
connections in any way, but new connections will use the new TLS parameters.
The changes also apply to HTTP and Manager.

ASTERISK-26604 #close

Change-Id: I169e86cefc6dcd627c915134015a6a1ab1aadbe6
2016-11-22 20:05:29 +01:00
Timo Teräs
86d824b7ff addons/chan_mobile: do not use strerror_r
The two reasons why it might be used are that some systems do not
implement strerror in thread safe manner, and that strerror_r returns
the error code in the string in case there's no error message.

However, all of asterisk elsewhere uses strerror() and assumes it
to be thread safe. And in chan_mobile the errno is also explicitly
printed so neither of the above reasons are valid.

The reasoning to remove usage is that there are actually two versions
of strerror_r: XSI and GNU. They are incompatible in their return
value, and there's no easy way to figure out which one is being
used. glibc gives you the GNU version if _GNU_SOURCE is defined,
but the same feature test macro is needed for other symbols. On
all other systems you assumedly get XSI symbol, and compilation warnings
as well as non-working error printing.

Thus the easiest solution is to just remove strerror_r and use
strerror as rest of the code. Alternative is to introduce ast_strerror
in separate translation unit so it can request the XSI symbol in
glibc case, and replace all usage of strerror.

Change-Id: I84d35225b5642d85d48bc35fdf399afbae28a91d
2016-11-22 11:23:13 -05:00
George Joseph
425da14927 build: Backport addition of librt check to configure.ac
A while back, a master-only change was made to check for librt which
should probably have been cherry-picked to 13 at that time.  Sometime
between then and now, part of that change did make it into 13 but it
was incomplete and non-functional.  This patch backports the rest
of the librt check and allows the link of libasteriskpj to use the
results.

Change-Id: I1424008fd8c90f389dda53162ec4a340b253a3c1
2016-11-21 08:44:18 -07:00
Joshua Colp
b83c9ff2ad Merge "pjproject_bundled: Improve reliability of pjproject download" into 13 2016-11-21 06:23:58 -06:00
Joshua Colp
5c9680da9d Merge "main/app.c: Transmit Silence on ControlPlayback pause" into 13 2016-11-21 04:46:42 -06:00
Joshua Colp
9e5f76c1e1 Merge "build: Various OpenBSD issues" into 13 2016-11-18 12:37:59 -06:00
Joshua Colp
51d2d7c359 Merge "Bump ARI version to 1.10.0" into 13 2016-11-18 12:35:45 -06:00
Mark Michelson
cb624b10ae Bump ARI version to 1.10.0
The video-related bridge changes mean that the version needs to be
bumped.

Change-Id: I41c4495068562bef03aa76728f188b8ac4bd393d
2016-11-18 10:56:50 -05:00
George Joseph
2a40c3a867 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:21 -05:00
misha
12c4e664bc main/app.c: Transmit Silence on ControlPlayback pause
ASTERISK-26562 #close

Change-Id: Ie6cb0ffc2b8c775639ce7784fe96f4ea00cfa2f8
2016-11-17 12:28:25 -05:00
Mark Michelson
bde3d022a3 manager: update minor version
Based on bridge video AMI event changes, bump the minor version of AMI.

Change-Id: I02586bd6cafc0baa33ea98c2f75356c0f5e03435
2016-11-17 10:50:58 -06:00
zuul
3135a745e3 Merge "res_pjsip_outbound_authenticator_digest.c: Fix memory pool leak." into 13 2016-11-16 23:20:10 -06:00
George Joseph
d3f921ed51 Merge "res_format_attr_opus: Fix fmtp generation." into 13 2016-11-16 22:41:00 -06:00
George Joseph
b213045fe4 build: Various OpenBSD issues
OpenBSD's 'find' doesn't take the -delete argument so you have to pipe
through 'xargs rm -rf'.

'echo -e' doesn't like \t starting a line. It just prints 't' which
causes the libasteriskpj.exports file to be garbage.  They were just
cosmetic so they were removed.

librt doesn't exist so the link of libasteriskpj.so fails. It's not
actually needed for linux anyway so -lrt was removed from the link.

res_rtp_asterisk was failing to load because of an undefined
DTLS_method. '|| defined(LIBRESSL_VERSION_NUMBER)' was added to the #if
so DTLSv1_method is used instead.

ASTERISK-26608

Change-Id: I926ec95b0b69633231e3ad1d6e803b977272c49c
2016-11-16 19:34:20 -07:00
George Joseph
c877801e5d Merge "channel: Fix issues in hangup scenarios caused by frame deferral" into 13 2016-11-16 17:42:17 -06:00
George Joseph
404596b790 channel: Fix issues in hangup scenarios caused by frame deferral
ASTERISK-26343

Change-Id: I06dbf7366e26028251964143454a77d017bb61c8
2016-11-16 16:41:42 -07:00
Joshua Colp
19ca0e7fc8 Merge "codec_opus: Fix warning when Opus negotiated but codec_opus not loaded." into 13 2016-11-16 17:40:36 -06:00
zuul
b745c326c2 Merge "res/ari/resource_bridges: Add the ability to manipulate the video source" into 13 2016-11-16 16:48:14 -06:00
Mark Michelson
2c031b67d3 res_format_attr_opus: Fix fmtp generation.
res_format_attr_opus assumed that the string being passed into it was
empty. It tried to determine if the only thing it had written was

a=fmtp:<num>

And if it had, it would reset the string. Its calculation was off when
working with chan_sip, though. chan_sip passes the entire built SDP
rather than an empty string. This resulted in always putting an empty
fmtp line in the SDP.

ASTERISK-26520 #close
Reported by scgm11

Change-Id: Ib2e8712d26a47067e5f36d5973577added01dbb5
2016-11-16 15:42:39 -06:00
Joshua Colp
4c1b9fbefe Merge "Revert "Revert "channel: Use frame deferral API for safe sleep.""" into 13 2016-11-16 15:39:00 -06:00
Joshua Colp
d0a72d3779 Merge "Revert "Revert "autoservice: Use frame deferral API""" into 13 2016-11-16 15:38:55 -06:00
zuul
36b59ee9c1 Merge "Revert "Revert "AGI: Only defer frames when in an interception routine.""" into 13 2016-11-16 15:06:25 -06:00
zuul
f68790d46a Merge "Revert "Revert "Add API for channel frame deferral.""" into 13 2016-11-16 15:06:24 -06:00
zuul
f4f152f35c Merge "apps/app_echo: Only relay a single video source change frame" into 13 2016-11-16 15:06:23 -06:00
Richard Mudgett
ed0f1afc8c codec_opus: Fix warning when Opus negotiated but codec_opus not loaded.
When Opus is negotiated but not loaded, the log is spammed with messages
because the system does not know how to calculate the number of samples in
a frame.

* Suppress the warning by supplying a function that assumes 20ms of
samples in the frame.  For pass through support it doesn't really seem to
matter what number of samples is returned anyway.

ASTERISK-26605 #close

Change-Id: Icf2273692f040dc2c45b01e72a790d11092f9e0f
2016-11-16 13:49:23 -06:00
Joshua Colp
4c3d25875f Merge "Add X.509 subject alternative name support to TLS certificate verification." into 13 2016-11-16 13:14:42 -06:00
Joshua Colp
6672fd5faa Merge "cli: Fix ast_el_read_char to work with libedit >= 3.1" into 13 2016-11-16 12:50:15 -06:00
Richard Mudgett
e632222bc4 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 12:02:10 -06:00
Joshua Colp
c4baa50f9a Merge "file.c/__ast_file_read_dirs: Fix issues on filesystems without d_type" into 13 2016-11-16 11:12:16 -06:00
Alexei Gradinari
cf6d13180e chan_pjsip: fix switching sending codec when asymmetric_rtp_codec=no
The sending codec is switched to the receiving codec and then
is switched back to the best native codec on EVERY receiving RTP packets.
This is because after call of ast_channel_set_rawwriteformat there is call
of ast_set_write_format which calls set_format which sets rawwriteformat
to the best native format.

This patch adds a new function ast_set_write_format_path which set
specific write path on channel and uses this function to switch
the sending codec.

ASTERISK-26603 #close

Change-Id: I5b7d098f8b254ce8f45546e6c36e5d324737f71d
2016-11-16 10:14:52 -05:00
George Joseph
c92dcc76da file.c/__ast_file_read_dirs: Fix issues on filesystems without d_type
One of the code paths in __ast_file_read_dirs will only get executed if
the OS doesn't support dirent->d_type OR if the filesystem the
particular file is on doesn't support it.  So, while standard Linux
systems support the field, some filesystems like XFS do not.  In this
case, we need to call stat() to determine whether the directory entry
is a file or directory so we append the filename to the supplied
directory path and call stat.  We forgot to truncate path back to just
the directory afterwards though so we were passing a complete file name
to the callback in the dir_name parameter instead of just the directory
name.

The logic has been re-written to only create a full_path if we need to
call stat() or if we need to descend into another directory.

Change-Id: I54e4228bd8355fad65200c6df3ec4c9c8a98dfba
2016-11-15 19:20:16 -07:00
Maciej Szmigiero
7b96e8cc3d Add X.509 subject alternative name support to TLS certificate
verification.

This way one X.509 certificate can be used for hosts that
can be reached under multiple DNS names or for multiple hosts.

Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name>

ASTERISK-25063 #close

Change-Id: I13302c80490a0b44c43f1b45376c9bd7b15a538f
2016-11-15 20:56:43 +01:00
Matt Jordan
0790aa528a pjproject: Use a much higher limit for PJ_ICE_MAX_CHECKS
The PJ_ICE_MAX_CHECKS constant is used by pjproject to determine how
many pairs of local/remote candidates will be made. If for some reason
we reach this upper bound, ICE will generally fail and no media will
flow between the browser and Asterisk.

This patch makes PJ_ICE_MAX_CHECKS set to the total possible number of
pairs of candidates we'd theoretically allow, which is
PJ_ICE_MAX_CAND^2. Prior to this patch, we simply multiplied
PJ_ICE_MAX_CAND by two; on systems with multiple interfaces (I blame
Docker), this is far too low to allow WebRTC calls to succeed.

Setting this to be PJ_ICE_MAX_CAND^2 allowed WebRTC calls to succeed
even when the system Asterisk was running on had quite a few virtual
interfaces.

Change-Id: Icd4f17de0ac9d3a83dddfc8bf1cb7616bc107d55
2016-11-14 17:02:17 -05:00
Matt Jordan
993a6f96c7 apps/app_echo: Only relay a single video source change frame
In 9785e8d0, app_echo was updated to relay video source updates to the
channel for the purposes of displaying video in WebRTC tests.
Unfortunately, this can cause a Kafkaesque nightmare if two or more
Local channels are in a bridge together where their ends are in
app_echo. When this situation occurs, a video update sent into app_echo
will cause the video update to be relayed to the other Local channels,
causing another round of video updates, etc. In not much time at all,
the channel length queues will be overwhelmed, channel alert pipes will
fail, and all hell will break loose as Asterisk merrily continues to
throw more video update requests onto the channels.

This patch updates app_echo to *only* relay a single video update. Once
a video update has been made, all further video updates are dropped.
This meets the intended purpose of the original patch: if we get a video
update and we're in app_echo, go ahead and ask the sender to update
themselves. However, once we've got that video stream sync'd up, don't
keep spamming the world.

Change-Id: I9210780b08d4c17ddb38599d1c64453adfc34f74
2016-11-14 17:02:09 -05:00
Matt Jordan
d23b4af477 res/ari/resource_bridges: Add the ability to manipulate the video source
In multi-party bridges, Asterisk currently supports two video modes:
 * Follow the talker, in which the speaker with the most energy is shown
   to all participants but the speaker, and the speaker sees the
   previous video source
 * Explicitly set video sources, in which all participants see a locked
   video source

Prior to this patch, ARI had no ability to manipulate the video source.
This isn't important for two-party bridges, in which Asterisk merely
relays the video between the participants. However, in a multi-party
bridge, it can be advantageous to allow an external application to
manipulate the video source.

This patch provides two new routes to accomplish this:
(1) setVideoSource: POST /bridges/{bridgeId}/videoSource/{channelId}
    Sets a video source to an explicit channel
(2) clearVideoSource: DELETE /bridges/{bridgeId}/videoSource
    Removes any explicit video source, and sets the video mode to talk
    detection

ASTERISK-26595 #close

Change-Id: I98e455d5bffc08ea5e8d6b84ccaf063c714e6621
2016-11-14 17:02:00 -05:00
George Joseph
404a62eeee Revert "Revert "channel: Use frame deferral API for safe sleep.""
This reverts commit 58c88cfbaa.

Change-Id: I72692e2b2e83ef6da9390075ff20b138b2c374b6
2016-11-14 14:22:43 -06:00
George Joseph
09d8febc91 Revert "Revert "autoservice: Use frame deferral API""
This reverts commit 1df434e2b4.

Change-Id: Id2b8a8bccbb4bbdd82b792275d4cd6f32563e401
2016-11-14 14:22:21 -06:00
George Joseph
ffad2b44df Revert "Revert "AGI: Only defer frames when in an interception routine.""
This reverts commit 6be5d8de0d.

Change-Id: I4b548137f52ae0686d8f09e21496b778d1c6a797
2016-11-14 14:21:58 -06:00
George Joseph
2fefb6187f Revert "Revert "Add API for channel frame deferral.""
This reverts commit 6b5a7ced13.

Change-Id: I61d1dbb2e69e1977f684b7dfc8e98211024e1cd1
2016-11-14 15:21:26 -05:00