4 years agores_rtp: Fix regression when IPv6 is not available.
Guido Falsi [Tue, 22 Nov 2016 17:20:06 +0000 (18:20 +0100)]
res_rtp: Fix regression when IPv6 is not available.

The latest Release candidate fails to create RTP streams when IPv6
is not available. Due to the changes made in September the ast_sockaddr
structure passed around to create these streams is always of AF_INET6
type, causing failure when used for IPv4. This patch adds a utility
function to check for availability of IPv6 and applies such check
at startup to determine how to create the ast_sockaddr structures.

ASTERISK-26617 #close

Change-Id: I627a4e91795e821111e1cda523f083a40d0e0c3e

4 years agoMerge "chan_pjsip: fix switching sending codec when asymmetric_rtp_codec=no"
zuul [Wed, 30 Nov 2016 16:49:14 +0000 (10:49 -0600)]
Merge "chan_pjsip: fix switching sending codec when asymmetric_rtp_codec=no"

4 years agoMerge "chan_sip: Fix segfault during module unload"
Joshua Colp [Wed, 30 Nov 2016 15:21:34 +0000 (09:21 -0600)]
Merge "chan_sip: Fix segfault during module unload"

4 years agochan_pjsip: fix switching sending codec when asymmetric_rtp_codec=no
Alexei Gradinari [Tue, 15 Nov 2016 21:01:27 +0000 (16:01 -0500)]
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

4 years agoMerge "res/res_pjsip: Fix documentation whitespace issues"
Joshua Colp [Tue, 29 Nov 2016 01:00:32 +0000 (19:00 -0600)]
Merge "res/res_pjsip: Fix documentation whitespace issues"

4 years agoMerge "build_tools: Fix download_externals to handle certified branches"
zuul [Mon, 28 Nov 2016 22:07:20 +0000 (16:07 -0600)]
Merge "build_tools:  Fix download_externals to handle certified branches"

4 years agores/res_pjsip: Fix documentation whitespace issues
Matt Jordan [Mon, 28 Nov 2016 21:12:08 +0000 (15:12 -0600)]
res/res_pjsip: Fix documentation whitespace issues

Tabs > Spaces.

Change-Id: If1e43a71822615a898e958e0f8b2e882606f0bd0

4 years agoMerge "autoconf: more variants for OSARCH linux-gnu"
Joshua Colp [Mon, 28 Nov 2016 17:33:47 +0000 (11:33 -0600)]
Merge "autoconf: more variants for OSARCH linux-gnu"

4 years agobuild_tools: Fix download_externals to handle certified branches
George Joseph [Mon, 28 Nov 2016 17:03:23 +0000 (10:03 -0700)]
build_tools:  Fix download_externals to handle certified branches

download_externals wasn't handling the "certified/13.x" version

Change-Id: I124d195bb117ca36fd7bf1150c630f3b474a9d9a

4 years agoMerge "codec_dahdi: Fix poll.h include."
Joshua Colp [Mon, 28 Nov 2016 16:24:24 +0000 (10:24 -0600)]
Merge "codec_dahdi: Fix poll.h include."

4 years agoMerge "ast_format: Adds an identifier for interleaved audio formats to the ast_format"
Joshua Colp [Mon, 28 Nov 2016 14:57:44 +0000 (08:57 -0600)]
Merge "ast_format: Adds an identifier for interleaved audio formats to the ast_format"

4 years agoiostream: Move include of asterisk.h
Joshua Colp [Mon, 28 Nov 2016 13:36:18 +0000 (13:36 +0000)]
iostream: Move include of asterisk.h

The asterisk.h header file needs to be included first or else
some things go awry, such as:

implicit declaration of function 'vasprintf'

Change-Id: I981dc2a77a1ba791888e4f1726644d4656c0407c

4 years agochan_sip: Fix segfault during module unload
Michael Kuron [Sat, 26 Nov 2016 16:57:03 +0000 (17:57 +0100)]
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 776a14386a55b5425c7e9617eff8af8b45427144.

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 5d313f51b982a18f7321adcf7c7a4e822d8b2714.

ASTERISK-26586 #close

Change-Id: I76fd9d47d56e4264e2629bce8ec15fecba673e7b

4 years agores_rtp_asterisk: RTT miscalculation in RTCP
gestoip2 [Fri, 11 Nov 2016 14:16:50 +0000 (14:16 +0000)]
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

* 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

4 years agoMerge "addons/chan_mobile: do not use strerror_r"
Joshua Colp [Tue, 22 Nov 2016 18:03:35 +0000 (12:03 -0600)]
Merge "addons/chan_mobile: do not use strerror_r"

4 years agoMerge "Add support for older name resolving version libraries like openBSD"
Joshua Colp [Tue, 22 Nov 2016 17:54:35 +0000 (11:54 -0600)]
Merge "Add support for older name resolving version libraries like openBSD"

4 years agopjproject_bundled: Use $(LIB_RT) for link of libasteriskpj
George Joseph [Mon, 21 Nov 2016 15:49:45 +0000 (08:49 -0700)]
pjproject_bundled:  Use $(LIB_RT) for link of libasteriskpj

libasteriskpj was hard coded to use -lrt but librt is linux specific
so we now use the LIB_RT variable which gets set by configure.

Change-Id: I41148884517e3031f7675a413d524c86e8614694

4 years agoMerge "pjproject_bundled: Improve reliability of pjproject download"
zuul [Mon, 21 Nov 2016 12:22:07 +0000 (06:22 -0600)]
Merge "pjproject_bundled:  Improve reliability of pjproject download"

4 years agoMerge "main/app.c: Transmit Silence on ControlPlayback pause"
Joshua Colp [Mon, 21 Nov 2016 10:46:37 +0000 (04:46 -0600)]
Merge "main/app.c: Transmit Silence on ControlPlayback pause"

4 years agoMerge "Add support for building RADIUS with radcli"
zuul [Mon, 21 Nov 2016 04:57:12 +0000 (22:57 -0600)]
Merge "Add support for building RADIUS with radcli"

4 years agoAdd support for older name resolving version libraries like openBSD
snuffy [Sat, 19 Nov 2016 22:19:18 +0000 (09:19 +1100)]
Add support for older name resolving version libraries like openBSD

Fix support of OS's like openBSD that use an older nameser.h,
this change reverts the defines to the older style which on other
systems is found in nameser_compat.h

Tested on openBSD 6.0, Debian 8

ASTERISK-26608 #close

Change-Id: Iffb36caab8c5aa9dece0ce2d009041f7b56cc86a

4 years agoBump ARI version to 2.0.0
Mark Michelson [Fri, 18 Nov 2016 15:46:48 +0000 (09:46 -0600)]
Bump ARI version to 2.0.0

In order to not have version number overlap between different versions
of Asterisk, each new major version of Asterisk will mean we also bump
the ARI major version number.

This particular change does NOT introduce any known breaking changes to

For discussion relating to this topice, see:

Change-Id: I712ee0df177a8fe1252da2bc029705268b97b665

4 years agoMerge "build: Various OpenBSD issues"
zuul [Fri, 18 Nov 2016 14:31:46 +0000 (08:31 -0600)]
Merge "build:  Various OpenBSD issues"

4 years agopjproject_bundled: Improve reliability of pjproject download
George Joseph [Wed, 16 Nov 2016 18:05:43 +0000 (11:05 -0700)]
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

4 years agoMerge "manager: update minor version"
Joshua Colp [Fri, 18 Nov 2016 12:58:11 +0000 (06:58 -0600)]
Merge "manager: update minor version"

4 years agomain/app.c: Transmit Silence on ControlPlayback pause
misha [Fri, 11 Nov 2016 13:13:30 +0000 (14:13 +0100)]
main/app.c: Transmit Silence on ControlPlayback pause

ASTERISK-26562 #close

Change-Id: Ie6cb0ffc2b8c775639ce7784fe96f4ea00cfa2f8

4 years agoMerge "Implement internal abstraction for iostreams"
Joshua Colp [Thu, 17 Nov 2016 17:07:06 +0000 (11:07 -0600)]
Merge "Implement internal abstraction for iostreams"

4 years agomanager: update minor version
Mark Michelson [Thu, 17 Nov 2016 16:52:45 +0000 (10:52 -0600)]
manager: update minor version

Based on bridge video AMI event changes, bump the minor version of AMI.

Change-Id: Idf84507354170400813cda780906c94c9f1b60b4

4 years agocodec_dahdi: Fix poll.h include.
Timo Teräs [Thu, 17 Nov 2016 14:25:41 +0000 (16:25 +0200)]
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

4 years agoMerge "res_pjsip_outbound_authenticator_digest.c: Fix memory pool leak."
Joshua Colp [Thu, 17 Nov 2016 10:56:34 +0000 (04:56 -0600)]
Merge "res_pjsip_outbound_authenticator_digest.c: Fix memory pool leak."

4 years agoMerge "codec_opus: Fix warning when Opus negotiated but codec_opus not loaded."
Joshua Colp [Thu, 17 Nov 2016 10:56:16 +0000 (04:56 -0600)]
Merge "codec_opus: Fix warning when Opus negotiated but codec_opus not loaded."

4 years agoMerge "res_format_attr_opus: Fix fmtp generation."
zuul [Thu, 17 Nov 2016 05:20:04 +0000 (23:20 -0600)]
Merge "res_format_attr_opus: Fix fmtp generation."

4 years agobuild: Various OpenBSD issues
George Joseph [Thu, 17 Nov 2016 02:24:08 +0000 (19:24 -0700)]
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 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.


Change-Id: I926ec95b0b69633231e3ad1d6e803b977272c49c

4 years agoMerge "channel: Fix issues in hangup scenarios caused by frame deferral"
George Joseph [Wed, 16 Nov 2016 23:45:16 +0000 (17:45 -0600)]
Merge "channel:  Fix issues in hangup scenarios caused by frame deferral"

4 years agoMerge "Revert "Revert "channel: Use frame deferral API for safe sleep."""
George Joseph [Wed, 16 Nov 2016 23:45:05 +0000 (17:45 -0600)]
Merge "Revert "Revert "channel: Use frame deferral API for safe sleep."""

4 years agoMerge "Revert "Revert "autoservice: Use frame deferral API"""
George Joseph [Wed, 16 Nov 2016 23:44:21 +0000 (17:44 -0600)]
Merge "Revert "Revert "autoservice: Use frame deferral API"""

4 years agoMerge "Revert "Revert "AGI: Only defer frames when in an interception routine."""
George Joseph [Wed, 16 Nov 2016 23:44:12 +0000 (17:44 -0600)]
Merge "Revert "Revert "AGI: Only defer frames when in an interception routine."""

4 years agoMerge "Revert "Revert "Add API for channel frame deferral."""
George Joseph [Wed, 16 Nov 2016 23:43:46 +0000 (17:43 -0600)]
Merge "Revert "Revert "Add API for channel frame deferral."""

4 years agoMerge "res/ari/resource_bridges: Add the ability to manipulate the video source"
zuul [Wed, 16 Nov 2016 22:48:09 +0000 (16:48 -0600)]
Merge "res/ari/resource_bridges: Add the ability to manipulate the video source"

4 years agores_format_attr_opus: Fix fmtp generation.
Mark Michelson [Wed, 16 Nov 2016 21:42:39 +0000 (15:42 -0600)]
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


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

4 years agoMerge "apps/app_echo: Only relay a single video source change frame"
Joshua Colp [Wed, 16 Nov 2016 20:59:50 +0000 (14:59 -0600)]
Merge "apps/app_echo: Only relay a single video source change frame"

4 years agoMerge "file.c/__ast_file_read_dirs: Fix issues on filesystems without d_type"
George Joseph [Wed, 16 Nov 2016 20:17:34 +0000 (14:17 -0600)]
Merge "file.c/__ast_file_read_dirs:  Fix issues on filesystems without d_type"

4 years agocodec_opus: Fix warning when Opus negotiated but codec_opus not loaded.
Richard Mudgett [Tue, 15 Nov 2016 22:23:35 +0000 (16:23 -0600)]
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

4 years agoMerge "cli: Fix ast_el_read_char to work with libedit >= 3.1"
Joshua Colp [Wed, 16 Nov 2016 18:18:27 +0000 (12:18 -0600)]
Merge "cli:  Fix ast_el_read_char to work with libedit >= 3.1"

4 years agores_pjsip_outbound_authenticator_digest.c: Fix memory pool leak.
Richard Mudgett [Mon, 14 Nov 2016 20:36:52 +0000 (14:36 -0600)]
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. 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

ASTERISK-26516 #close

Change-Id: I4473141b8c3961d0dc91c382beb3876b3efb45c8

4 years agoMerge "pjproject: Use a much higher limit for PJ_ICE_MAX_CHECKS"
Joshua Colp [Wed, 16 Nov 2016 11:33:42 +0000 (05:33 -0600)]
Merge "pjproject: Use a much higher limit for PJ_ICE_MAX_CHECKS"

4 years agofile.c/__ast_file_read_dirs: Fix issues on filesystems without d_type
George Joseph [Tue, 15 Nov 2016 18:01:04 +0000 (11:01 -0700)]
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

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

4 years agoMerge "manager: Bump AMI version number."
Joshua Colp [Wed, 16 Nov 2016 01:23:08 +0000 (19:23 -0600)]
Merge "manager: Bump AMI version number."

4 years agoMerge "res_ari: Add support for channel variables in ARI events."
Joshua Colp [Tue, 15 Nov 2016 20:49:15 +0000 (14:49 -0600)]
Merge "res_ari: Add support for channel variables in ARI events."

4 years agoImplement internal abstraction for iostreams
Timo Teräs [Thu, 2 Jun 2016 19:10:06 +0000 (22:10 +0300)]
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

4 years agomanager: Bump AMI version number.
Joshua Colp [Tue, 15 Nov 2016 14:07:03 +0000 (14:07 +0000)]
manager: Bump AMI version number.

During the development of Asterisk 14 the behavior of
the Command AMI action was altered such that the result
was returned on lines with a prefix of "Output: ". While
this was documented in the UPGRADE.txt file it is also
reasonable that this should bump the AMI version number.


Change-Id: Idf1bf01608e53f7bfdf43ddb4d0683e53f74ee42

4 years agopjproject: Use a much higher limit for PJ_ICE_MAX_CHECKS
Matt Jordan [Mon, 14 Nov 2016 21:57:08 +0000 (15:57 -0600)]
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

Change-Id: Icd4f17de0ac9d3a83dddfc8bf1cb7616bc107d55

4 years agoapps/app_echo: Only relay a single video source change frame
Matt Jordan [Mon, 14 Nov 2016 21:32:14 +0000 (15:32 -0600)]
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

4 years agores/ari/resource_bridges: Add the ability to manipulate the video source
Matt Jordan [Tue, 8 Nov 2016 16:11:41 +0000 (10:11 -0600)]
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

ASTERISK-26595 #close

Change-Id: I98e455d5bffc08ea5e8d6b84ccaf063c714e6621

4 years agochannel: Fix issues in hangup scenarios caused by frame deferral
George Joseph [Mon, 14 Nov 2016 20:03:46 +0000 (13:03 -0700)]
channel:  Fix issues in hangup scenarios caused by frame deferral


Change-Id: I06dbf7366e26028251964143454a77d017bb61c8
(cherry picked from commit 0be46aaf6b8b9eb5b0160ec591cdc2c6e1802a6d)

4 years agoRevert "Revert "channel: Use frame deferral API for safe sleep.""
George Joseph [Mon, 14 Nov 2016 19:55:45 +0000 (14:55 -0500)]
Revert "Revert "channel: Use frame deferral API for safe sleep.""

This reverts commit e5365dada5052b87275c048f6e29ac7d5e2b2415.

Change-Id: Icc40cf0c7687454760762912dd29e4ae79e8e9ee

4 years agoRevert "Revert "autoservice: Use frame deferral API""
George Joseph [Mon, 14 Nov 2016 19:55:25 +0000 (14:55 -0500)]
Revert "Revert "autoservice: Use frame deferral API""

This reverts commit edca6911f392f47c1a5a25d1d3a357c72b04a78a.

Change-Id: I76030b87333a2c390cd05392b74b75678d78ddfa

4 years agoRevert "Revert "AGI: Only defer frames when in an interception routine.""
George Joseph [Mon, 14 Nov 2016 19:55:13 +0000 (14:55 -0500)]
Revert "Revert "AGI: Only defer frames when in an interception routine.""

This reverts commit 6bce938c2fcb60b7a77a0e997a6518860c0bfa39.

Change-Id: Iadbf462bf2a52e8b2fa9ebc75b37b1f688ba51d9

4 years agoRevert "Revert "Add API for channel frame deferral.""
George Joseph [Mon, 14 Nov 2016 19:54:36 +0000 (14:54 -0500)]
Revert "Revert "Add API for channel frame deferral.""

This reverts commit fa749866c17f91860d3e9f89742eab3e6f03ecbc.

Change-Id: Idcd1b88fa0766b1326dcc87d8905dbc314c71bd7

4 years agoMerge "res_pjsip.c: Rework endpt_send_request() req_wrapper code."
Joshua Colp [Mon, 14 Nov 2016 19:21:21 +0000 (13:21 -0600)]
Merge "res_pjsip.c: Rework endpt_send_request() req_wrapper code."

4 years agores_ari: Add support for channel variables in ARI events.
Sebastien Duthil [Fri, 11 Nov 2016 16:45:37 +0000 (11:45 -0500)]
res_ari: Add support for channel variables in ARI events.

This works the same as for AMI manager variables. Set
"channelvars=foo,bar" in your ari.conf general section, and then the
channel variables "foo" and "bar" (along with their values), will
appear in every Stasis websocket channel event.

ASTERISK-26492 #close
  ari_vars.diff submitted by Mark Michelson

Change-Id: I5609ba239259577c0948645df776d7f3bc864229

4 years agocli: Fix ast_el_read_char to work with libedit >= 3.1
George Joseph [Mon, 14 Nov 2016 18:16:03 +0000 (11:16 -0700)]
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

4 years agoAdd support for building RADIUS with radcli
Tzafrir Cohen [Sat, 12 Nov 2016 18:15:12 +0000 (20:15 +0200)]
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

4 years agoMerge "res_pjsip: Fix tdata leaks in off nominal paths."
Joshua Colp [Mon, 14 Nov 2016 12:47:37 +0000 (06:47 -0600)]
Merge "res_pjsip: Fix tdata leaks in off nominal paths."

4 years agoMerge "Fix closing rtp ports after call finished in chan_unistim."
Joshua Colp [Mon, 14 Nov 2016 12:38:18 +0000 (06:38 -0600)]
Merge "Fix closing rtp ports after call finished in chan_unistim."

4 years agores_pjsip_sdp_rtp: Reject offer of required SRTP without res_srtp.
Joshua Colp [Thu, 10 Nov 2016 16:57:49 +0000 (16:57 +0000)]
res_pjsip_sdp_rtp: Reject offer of required SRTP without res_srtp.

When optimistic SRTP was on it was possible for us to still
set up a call without an audio stream if an offer was received
with required SRTP.

This change makes it so this scenario will now fail with a 488


Change-Id: I7d14187037681f48879bd20319ac79d0877318f3

4 years agoMerge "res_pjsip: Perform resolution when explicit IPv6 transport is used."
Joshua Colp [Fri, 11 Nov 2016 10:37:15 +0000 (04:37 -0600)]
Merge "res_pjsip: Perform resolution when explicit IPv6 transport is used."

4 years agoMerge "build: Fix default values for some SANITIZER options"
Joshua Colp [Fri, 11 Nov 2016 10:36:44 +0000 (04:36 -0600)]
Merge "build:  Fix default values for some SANITIZER options"

4 years agoFix closing rtp ports after call finished in chan_unistim.
Igor Goncharovskiy [Fri, 11 Nov 2016 08:41:36 +0000 (11:41 +0300)]
Fix closing rtp ports after call finished in chan_unistim.

Fix ASTERISK-26565 by adding ast_rtp_instance_stop before
rtp instance destroy for chan_unistim. Also several fixes
for displayed text translation.

Change-Id: If42a03eea09bd1633471406bdc829cf98bf6affc

4 years agoaddons/chan_mobile: do not use strerror_r
Timo Teräs [Fri, 11 Nov 2016 06:29:40 +0000 (08:29 +0200)]
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

4 years agoMerge "chan_sip: Fix typo and re-wrap surrounding docs"
zuul [Fri, 11 Nov 2016 05:46:23 +0000 (23:46 -0600)]
Merge "chan_sip: Fix typo and re-wrap surrounding docs"

4 years agores_pjsip.c: Rework endpt_send_request() req_wrapper code.
Richard Mudgett [Fri, 23 Sep 2016 22:54:07 +0000 (17:54 -0500)]
res_pjsip.c: Rework endpt_send_request() req_wrapper code.

* Don't hold the req_wrapper lock too long in endpt_send_request().  We
could block the PJSIP monitor thread if the timeout timer expires.
sip_get_tpselector_from_endpoint() does a sorcery access that could take
awhile accessing a database.  pjsip_endpt_send_request() might take awhile
if selecting a transport.

* Shorten the time that the req_wrapper lock is held in the callback

* Simplify endpt_send_request() req_wrapper->timeout code.

* Removed some redundant req_wrapper->timeout_timer->id assignments.

Change-Id: I3195e3a8e0207bb8e7f49060ad2742cf21a6e4c9

4 years agores_pjsip: Fix tdata leaks in off nominal paths.
Richard Mudgett [Wed, 21 Sep 2016 20:10:29 +0000 (15:10 -0500)]
res_pjsip: Fix tdata leaks in off nominal paths.

Change-Id: Ie83e06e88c2d60157775263b07e40b61718ac97b

4 years agores_pjsip_registrar_expire.c: Remove extra linefeed in debug message.
Richard Mudgett [Mon, 24 Oct 2016 17:41:38 +0000 (12:41 -0500)]
res_pjsip_registrar_expire.c: Remove extra linefeed in debug message.

Change-Id: I1f9adb911f23376503396ec8867e8005b755eb94

4 years agochan_sip: Fix typo and re-wrap surrounding docs
C.J. Collier [Thu, 10 Nov 2016 19:38:25 +0000 (11:38 -0800)]
chan_sip: Fix typo and re-wrap surrounding docs

Correct typo of end-pints to end-points
Re-wrap session timer parameter docs to max 80 chars wide; this
eases reading on terminals with lower resolution, commonly the case
for those with visual impairments.


Change-Id: I22c94459f4bb6b8a2f6713cfd22e87c32f204e6b
Signed-off-by: C.J. Collier <>

4 years agoMerge "app_queue: Add mention of 'ABANDON' variable to CHANGES."
Joshua Colp [Thu, 10 Nov 2016 16:21:54 +0000 (10:21 -0600)]
Merge "app_queue: Add mention of 'ABANDON' variable to CHANGES."

4 years agoMerge "app_queue: new variable set when abandoned"
Joshua Colp [Thu, 10 Nov 2016 16:21:28 +0000 (10:21 -0600)]
Merge "app_queue: new variable set when abandoned"

4 years agores_pjsip: Perform resolution when explicit IPv6 transport is used.
Joshua Colp [Wed, 9 Nov 2016 21:14:09 +0000 (21:14 +0000)]
res_pjsip: Perform resolution when explicit IPv6 transport is used.

This change fixes the SIP resolver such that if an IPv6 transport
is explicitly used it will resolve NAPTR, SRV, and AAAA records.

You can explicitly use one by specifying it on an endpoint.


Change-Id: I2ed3ce81b43a6a8a937c0ebc1b8ed2da5ac2ef36

4 years agoapp_queue: Add mention of 'ABANDON' variable to CHANGES.
Joshua Colp [Thu, 10 Nov 2016 14:33:41 +0000 (14:33 +0000)]
app_queue: Add mention of 'ABANDON' variable to CHANGES.


Change-Id: I1127010181e79c8ac291f72f036cb8e430dc7f7e

4 years agoMerge "Revert "Add API for channel frame deferral.""
George Joseph [Thu, 10 Nov 2016 13:35:19 +0000 (07:35 -0600)]
Merge "Revert "Add API for channel frame deferral.""

4 years agoMerge "Revert "AGI: Only defer frames when in an interception routine.""
George Joseph [Thu, 10 Nov 2016 13:35:08 +0000 (07:35 -0600)]
Merge "Revert "AGI: Only defer frames when in an interception routine.""

4 years agoMerge "Revert "autoservice: Use frame deferral API""
George Joseph [Thu, 10 Nov 2016 13:34:55 +0000 (07:34 -0600)]
Merge "Revert "autoservice: Use frame deferral API""

4 years agoMerge "Revert "channel: Use frame deferral API for safe sleep.""
George Joseph [Thu, 10 Nov 2016 13:34:35 +0000 (07:34 -0600)]
Merge "Revert "channel: Use frame deferral API for safe sleep.""

4 years agoRevert "Add API for channel frame deferral."
George Joseph [Thu, 10 Nov 2016 13:34:10 +0000 (08:34 -0500)]
Revert "Add API for channel frame deferral."

This reverts commit f073f648b87d45e4729969fd2d83695c300757d1.
Multiple testsuite failures were detected after the fact.

Change-Id: I968c380418bf65c7166f6ecff30fe8e247ea6682

4 years agoRevert "AGI: Only defer frames when in an interception routine."
George Joseph [Thu, 10 Nov 2016 13:33:49 +0000 (08:33 -0500)]
Revert "AGI: Only defer frames when in an interception routine."

This reverts commit 28926d1c81540bbeb16802814d3f2e63c2347bd2.
Multiple testsuite failures were detected after the fact.

Change-Id: I8d4f5ccbb421a351d616254844ae7e5a31053edb

4 years agoRevert "autoservice: Use frame deferral API"
George Joseph [Thu, 10 Nov 2016 13:32:50 +0000 (08:32 -0500)]
Revert "autoservice: Use frame deferral API"

This reverts commit afef1b8e4a311d33b3e485b9bab3c6e7fd13fbc9.
Multiple testsuite failures were detected after the fact.

Change-Id: Ib4cb0c0a6475681ce817f71b4050be25640ab67f

4 years agoRevert "channel: Use frame deferral API for safe sleep."
George Joseph [Thu, 10 Nov 2016 13:31:52 +0000 (08:31 -0500)]
Revert "channel: Use frame deferral API for safe sleep."

This reverts commit 392202304d248147378f1e16f1f012285dc1221f.

Multiple testsuite issues were discovered after the fact.

Change-Id: I848c4196dca2994b1a368087004326ea354cff95

4 years agobuild: Fix default values for some SANITIZER options
George Joseph [Thu, 10 Nov 2016 00:18:00 +0000 (17:18 -0700)]
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

4 years agoapp_queue: new variable set when abandoned
Sebastian Gutierrez [Sun, 6 Nov 2016 12:04:00 +0000 (09:04 -0300)]
app_queue: new variable set when abandoned

sets the variable ABANDONED to TRUE if the call was not answered.


Change-Id: I4729af9bff4eba436d8a776afd3374065d0036d3

4 years agores_pjsip_session: Do not call session supplements when it's too late.
Mark Michelson [Tue, 8 Nov 2016 16:48:32 +0000 (10:48 -0600)]
res_pjsip_session: Do not call session supplements when it's too late.

res_pjsip_sesssion was hooking into transaction and invite state
changes. One of the reasons for doing so was due to the
PJSIP_EVENT_TX_MSG event. The idea was that we were hooking into the
message sending process, and so we should call session supplements to
alter the outgoing message.

In reality, this event was meant to indicate that the message either
a) had already been sent, or
b) required a DNS lookup and would be sent when the DNS query

In case (a), this meant we were altering an already-sent
request/response for no reason. In case (b), this potentially meant we
could be trying to alter a request/response at the same time that the
DNS resolution completed. In this case, it meant we might be stomping on
memory being used by the thread actually sending the message. This
caused potential crashes and memory corruption.

This patch removes the calls to session supplements from the case where
the PJSIP_EVENT_TX_MSG event occurs. In all of these cases, trying to
alter the message at this point is too late, and it can cause nothing
but harm to try to do it. Because there were no longer any calls to the
handle_outgoing() function, it has been removed.

Change-Id: Ibcc223fb1c3a237927f38754e0429e80ee301e92

4 years agoMerge "automon: restore mixing of the both channels after recording stops"
Joshua Colp [Tue, 8 Nov 2016 19:28:02 +0000 (13:28 -0600)]
Merge "automon: restore mixing of the both channels after recording stops"

4 years agochannel: Use frame deferral API for safe sleep.
Mark Michelson [Thu, 3 Nov 2016 21:46:41 +0000 (16:46 -0500)]
channel: Use frame deferral API for safe sleep.

This is another case where manual frame deferral can be replaced with
centralized routines instead.

Change-Id: I42cdf205f8f29a7977e599751a57efbaac07c30e
(cherry picked from commit d149c4b9e07eeb880d8428ad52c6fdb315cc15f5)

4 years agoautoservice: Use frame deferral API
Mark Michelson [Thu, 3 Nov 2016 21:46:03 +0000 (16:46 -0500)]
autoservice: Use frame deferral API

Rather than use manual frame deferral, just let the channel API do it
for us.


Change-Id: I688386f36e765dbc07be863943a43f26bd5eac49
(cherry picked from commit 8ba3e2fc27f9966b8c7ce75c1eca6208613a9315)

4 years agoAGI: Only defer frames when in an interception routine.
Mark Michelson [Thu, 3 Nov 2016 21:42:40 +0000 (16:42 -0500)]
AGI: Only defer frames when in an interception routine.

AGI recently was modified to defer important frames. This was because
when AGI was used in a connected line interception routine, the
resulting connected line frame would end up getting discarded by the

However, this caused bad behavior in other cases. Specifically, during a
transfer, if someone attempted to manually set the Caller ID on a
channel in an AGI, the deferred connected line frame would end up
overwriting what had been manually set in the AGI.

Since the initial issue was specific to interception routines, this
change removes the manual frame deferral from AGI and instead uses the
new frame deferral API in interception routines.

ASTERISK-26343 #close
Reported by Morton Tryfoss

Change-Id: Iab7d39436d0ee99bfe32ad55ef91e9bd88db4208

4 years agoAdd API for channel frame deferral.
Mark Michelson [Thu, 3 Nov 2016 21:36:13 +0000 (16:36 -0500)]
Add API for channel frame deferral.

There are several places in Asterisk that have duplicated logic
for deferring important frames until later.

This commit adds a couple of API calls to facilitate this automatically.

ast_channel_start_defer_frames(): Future reads of deferrable frames on
this channel will be deferred until later.

ast_channel_stop_defer_frames(): Any frames that have been deferred get
requeued onto the channel.


Change-Id: I3e1b87bc6796f222442fa6f7d1b6a4706fb33641

4 years agoMerge "res_http_websocket: Increase the buffer size for non-LOW_MEMORY systems"
Joshua Colp [Tue, 8 Nov 2016 10:59:53 +0000 (04:59 -0600)]
Merge "res_http_websocket: Increase the buffer size for non-LOW_MEMORY systems"

4 years agoMerge "res_stasis: Don't unsubscribe from a NULL bridge."
Joshua Colp [Tue, 8 Nov 2016 10:59:24 +0000 (04:59 -0600)]
Merge "res_stasis: Don't unsubscribe from a NULL bridge."

4 years agoMerge "chan_ooh323: reset rrq count on gk registration"
Joshua Colp [Tue, 8 Nov 2016 10:59:12 +0000 (04:59 -0600)]
Merge "chan_ooh323: reset rrq count on gk registration"

4 years agoMerge "chan_ooh323: Fixes to work right with Cisco devices"
Joshua Colp [Tue, 8 Nov 2016 10:58:04 +0000 (04:58 -0600)]
Merge "chan_ooh323: Fixes to work right with Cisco devices"

4 years agoMerge "stasis_recording/stored: remove calls to deprecated readdir_r function."
Joshua Colp [Tue, 8 Nov 2016 10:57:55 +0000 (04:57 -0600)]
Merge "stasis_recording/stored: remove calls to deprecated readdir_r function."