Commit Graph

29326 Commits

Author SHA1 Message Date
Mark Michelson 5d0371d743 res_http_websocket: Fix faulty read logic.
When doing some WebRTC testing, I found that the websocket would
disconnect whenever I attempted to place a call into Asterisk. After
looking into it, I pinpointed the problem to be due to the iostreams
change being merged in.

Under certain circumstances, a call to ast_iostream_read() can return a
negative value. However, in this circumstance, the websocket code was
treating this negative return as if it were a partial read from the
websocket. The expected length would get adjusted by this negative
value, resulting in the expected length being too large.

This patch simply adds an if check to be sure that we are only updating
the expected length of a read when the return from a read is positive.

ASTERISK-26842 #close
Reported by Mark Michelson

Change-Id: Ib4423239828a013d27d7bc477d317d2f02db61ab
2017-03-07 13:38:17 -06:00
Jean Aunis d51ca4b406 chan_sip: Call not cancelled after receiving a 422 response
When receiving a 422 response, the invitestate variable must be reset to
INV_CALLING.

ASTERISK-26841

Change-Id: Ia0502d6b02192664cefa4e75bafdd2645ce56099
2017-03-07 15:26:54 +01:00
Joshua Colp 3ed05badb9 core: Add stream topology changing primitives with tests.
This change adds a few things to facilitate stream topology changing:

1. Control frame types have been added for use by the channel driver
to notify the application that the channel wants to change the stream
topology or that a stream topology change has been accepted. They are
also used by the indicate interface to the channel that the application
uses to indicate it wants to do the same.

2. Legacy behavior has been adopted in ast_read() such that if a
channel requests a stream topology change it is denied automatically
and the current stream topology is preserved if the application is
not capable of handling streams.

Tests have also been written which confirm the multistream and
non-multistream behavior.

ASTERISK-26839

Change-Id: Ia68ef22bca8e8457265ca4f0f9de600cbcc10bc9
2017-03-07 12:08:51 +00:00
Daniel Journo 272259a2c6 Saynumber is trying to get "and" from "digits/" subfolder
* say.c Changed 'digits/and' to 'vm-and' for en_GB

ASTERISK-26598 #close

Change-Id: If1b713e5daea6f952b339f139178d292a6c4fcfe
2017-03-06 15:59:49 -06:00
Sean Bright 5a74abc53b pbx_spool: Gracefully handle long lines in call files
Per the linked issue, we aren't checking the buffer filled by fgets()
to determine if it contains a newline, so we will fail to correctly
parse the trailing portion of a long line.

This patch increases the buffer size from 256 to 1024, and skips any
line that exceeds that length, logging a warning in the process.

ASTERISK-17067 #close
Reported by: Dave Olszewski

Change-Id: I51bcf270c1b4347ba05b43f18dc2094c76f5d7b0
2017-03-06 15:29:52 -06:00
Richard Mudgett c9296b23d1 core: Cleanup ast_get_hint() usage.
* manager.c:manager_state_cb() Fix potential use of uninitialized hint[]
if a hint does not exist for the requested extension.  Ran into this when
developing a testsuite test.  The AMI event ExtensionStatus came out with
the hint header value containing garbage.  The AMI event PresenceStatus
also had the same issue.

* manager.c:action_extensionstate() no need to completely initialize the
hint[].  Only initialize the first element.

* pbx.c:ast_add_hint() Remove unnecessary assignment.

* chan_sip.c: Eliminate an unneeded hint[] local variable.  We only care
about the return value of ast_get_hint() there.

Change-Id: Ia9a8786f01f93f1f917200f0a50bead0319af97b
2017-03-02 21:46:51 -06:00
Joshua Colp e9b2360d17 Merge "res_pjsip WebRTC/websockets: Fix usage of WS vs WSS." 2017-03-01 17:24:43 -06:00
Joshua Colp fb11f038a3 Merge "stream: Unit tests for stream read and tweaks framework" 2017-03-01 14:58:45 -06:00
Joshua Colp 9b0e142a6a Merge "res_config_pgsql: Make 'require' return consistent with other backends" 2017-03-01 11:24:22 -06:00
Jørgen H 7922f26cb0 res_pjsip WebRTC/websockets: Fix usage of WS vs WSS.
According to the RFC[1] WSS should only be used in the Via header
for secure Websockets.

* Use WSS in Via for secure transport.

* Only register one transport with the WS name because it would be
ambiguous.  Outgoing requests may try to find the transport by name and
pjproject only finds the first one registered.  This may mess up unsecure
websockets but the impact should be minimal.  Firefox and Chrome do not
support anything other than secure websockets anymore.

* Added and updated some debug messages concerning websockets.

* security_events.c: Relax case restriction when determining security
transport type.

* The res_pjsip_nat module has been updated to not touch the transport
on Websocket originating messages.

[1] https://tools.ietf.org/html/rfc7118

ASTERISK-26796 #close

Change-Id: Ie3a0fb1a41101a4c1e49d875a8aa87b189e7ab12
2017-03-01 09:53:18 -06:00
George Joseph 0560c32375 stream: Unit tests for stream read and tweaks framework
* Removed the AST_CHAN_TP_MULTISTREAM tech property.  We now rely
  on read_stream being set to indicate a multi stream channel.
* Added ast_channel_is_multistream convenience function.
* Fixed issue where stream and default_stream weren't being set on
  a frame retrieved from the queue.
* Now testing for NULL being returned from the driver's read or
  read_stream callback.
* Fixed issue where the dropnondefault code was crashing on a
  NULL f.
* Now enforcing that if either read_stream or write_stream are
  set when ast_channel_tech_set is called that BOTH are set.
* Added the unit tests.

ASTERISK-26816

Change-Id: If7792b20d782e71e823dabd3124572cf0a4caab2
2017-03-01 07:30:49 -07:00
Sean Bright 1dacf317f3 res_config_pgsql: Make 'require' return consistent with other backends
res_config_pgsql should match the behavior of other realtime backend
drivers so that queue_log can disable adaptive logging.

ASTERISK-25628 #close
Reported by: Dmitry Wagin

Change-Id: Ic1fb1600c7ce10fdfb1bcdc43c5576b7e0014372
2017-03-01 07:27:50 -06:00
Mark Michelson 9c55a71798 SDP: Add initial SDP state machine.
This introduces and documents the various states in the state machine.
This also introduces API functions that induce state changes, and places
TODO comments telling what needs to be done in addition to what is
already there. Those TODOs will be replaced with real code in upcoming
changes.

Change-Id: I871c0eb480b4c84d83e91ac5628e7a673e8b89ed
2017-03-01 12:12:46 +00:00
Joshua Colp 26bf1846e2 Merge "media_cache: Mark cache entry stale if cache file is removed" 2017-03-01 04:47:59 -06:00
Joshua Colp 10d12b277c Merge "res_config_pgsql: Release table locks where appropriate" 2017-02-28 19:37:36 -06:00
Joshua Colp 063af910eb Merge "res_pjsip_outbound_registration: Subscribe to network change events" 2017-02-28 19:25:04 -06:00
Joshua Colp 6d3c1a4a21 Merge "build: Warn if asterisk is installed in both 32 and 64 bit sys dirs" 2017-02-28 17:47:46 -06:00
Joshua Colp 5e5aff04ec Merge "res_pjsip_pubsub: Remove unneeded endpoint unref" 2017-02-28 17:32:25 -06:00
zuul f41ace9042 Merge "bridge_native_rtp: Handle case where channel joins already suspended." 2017-02-28 17:14:25 -06:00
Sean Bright 60e9e4fcc0 media_cache: Mark cache entry stale if cache file is removed
In the event that a cache file is removed out from under us, we should
treat the cache entry as stale and force a refresh.

ASTERISK-26774 #close
Reported by: Igor Gamayunov

Change-Id: I3b1bd0c999d59d18664ef73a29823bc5b431dc52
2017-02-28 16:09:54 -06:00
Joshua Colp 0986998f2f Merge "config: Improve documentation and behavior of outbound_proxy option." 2017-02-28 14:44:29 -06:00
Joshua Colp 9c714b03f9 Merge "res_pjsip: Fix crash when contact has no status" 2017-02-28 10:24:45 -06:00
Sean Bright e5b44c26b4 res_config_pgsql: Release table locks where appropriate
The find_table() functions NULL or a locked table pointer. We are
not consistently calling release_table() in failure paths.

Change-Id: I6f665b455799c84b036e5b34904b82b05eab9544
2017-02-28 09:44:09 -06:00
Tzafrir Cohen 6ebdcfe27d pjsip.conf.sample: user_agent: not a specific version
Use the description of useragent from sip.conf here.

ASTERISK-26825 #close

Change-Id: I5b33a4aaa0ae1d793289d05e3bc09521affbf755
2017-02-28 13:41:18 +02:00
George Joseph fb68db87b1 res_pjsip_pubsub: Remove unneeded endpoint unref
When a subscription was being recreated and the endpoint wasn't
found, we were trying to unref the endpoint.  This was causing
FRACKs.  Removed the unref.

ASTERISK-26823 #close

Change-Id: If86d2aecff8fe853c7f38a1bfde721fcef3cd164
2017-02-27 20:09:36 -06:00
Jørgen H ee0a123f43 res_pjsip: Fix crash when contact has no status
This change fixes an assumption in res_pjsip that a contact will
always have a status. There is a race condition where this is
not true and would crash. The status will now be unknown when
this situation occurs.

ASTERISK-26623 #close

Change-Id: Id52d3ca4d788562d236da49990a319118f8d22b5
2017-02-27 15:16:57 -06:00
George Joseph 22242fef5d res_pjsip_outbound_registration: Subscribe to network change events
Outbound registration now subscribes to network change events
published by res_stun_monitor and refreshes all registrations
when an event happens.

The 'pjsip send (un)register' CLI commands were updated to accept
'*all' as an argument to operate on all registrations.

The 'PJSIP(Un)Register' AMI commands were also updated to
accept '*all'.

ASTERISK-26808 #close

Change-Id: Iad58a9e0aa5d340477fca200bf293187a6ca5a25
2017-02-27 15:10:48 -06:00
George Joseph 4692a32ed7 build: Warn if asterisk is installed in both 32 and 64 bit sys dirs
... and clean them both up on uninstall.

We've fixed the issue where 'make install' was installing to
/usr/lib on 64-bit systems that use /usr/lib64.  Now we need
to clean up the remnants in /usr/lib.

* 'make install' now prints a warning if DESTDIR/ASTLIBDIR
  contains 'lib64' and libasterisk* shared libraries or modules
  are also found in DESTDIR/ASTLIBDIR with 'lib64' transformed
  to 'lib'.

* 'make uninstall' ALWAYS cleans up both DESTDIR/ASTLIBDIR and
  DESTDIR/ASTLIBDIR with 'lib64' transformed to 'lib'.

ASTERISK-26705

Change-Id: I6edddeb3c07a51e7c7ba7cac3c05e4bf3ec3f01f
2017-02-27 12:57:18 -06:00
Joshua Colp ff2b4308d1 bridge_native_rtp: Handle case where channel joins already suspended.
The bridge_native_rtp module did not properly handle the case where
a smart bridge operation occurs while a channel is suspended. In this
scenario the module would incorrectly set up local or remote RTP
bridging despite the media having to flow through Asterisk. The remote
endpoint would see two media streams and experience wonky audio.

The module has been changed so that it ensures both channels are
not suspended when performing the native RTP bridging and this
requirement has been documented in the bridge technology.

ASTERISK-26781

Change-Id: Id4022d73ace837d4a293106445e3ade10dbc7c7c
2017-02-27 12:12:22 -06:00
George Joseph df22d297a6 Merge "channel: Add ast_read_stream function for reading frames from all streams." 2017-02-27 08:51:26 -06:00
zuul 00d1c7ddd2 Merge "Binaural synthesis (confbridge): DTMF conference management." 2017-02-24 17:35:43 -06:00
frahaase 5b1796f59d Binaural synthesis (confbridge): DTMF conference management.
DTMF configuration options for the binaural softmix bridge:
toggle binaural rendering (per channel).

ASTERISK-26292

Change-Id: Ibfe708b9fe26097c1798fcbfcc4dc461267d8af8
2017-02-24 15:13:56 -06:00
Joshua Colp 2046743938 config: Improve documentation and behavior of outbound_proxy option.
This change updates the documentation for the outbound_proxy option
to ensure it is consistently stated that a full SIP URI must be
provided for the option.

The res_pjsip_outbound_registration module has also been changed so
that the provided outbound_proxy value is checked to ensure it is a
URI and if not an error is output stating so.

ASTERISK-26782

Change-Id: I6c239a32274846fd44e65b44ad9bf6373479b593
2017-02-24 14:05:17 -06:00
Joshua Colp e4ba07f1a6 Merge "pjproject_bundled: Update for pjproject 2.6" 2017-02-24 12:49:07 -06:00
Joshua Colp 6ac33bfe3e Merge "Binaural synthesis (confbridge): Adds binaural synthesis to bridge_softmix." 2017-02-24 12:49:00 -06:00
zuul f943ead12e Merge "build: Execute ldconfig to build cache. (take two)" 2017-02-24 12:12:13 -06:00
zuul 461577b23b Merge "channel: Add support for writing to a specific stream." 2017-02-24 11:16:13 -06:00
Joshua Colp c07c6714f2 channel: Add ast_read_stream function for reading frames from all streams.
This change introduces an ast_read_stream function and callback in
the channel technology which allows reading frames from all streams
and not just the default streams.

The stream number has also been added to frames. This is to allow the
case where frames are queued onto the channel instead of being read
directly from the driver.

This change does impose a restriction on reading though: a chain of
frames can only contain frames from the same stream.

ASTERISK-26816

Change-Id: I5d7dc35e86694df91fd025126f6cfe0453aa38ce
2017-02-24 10:20:33 -06:00
George Joseph a537dae6d0 pjproject_bundled: Update for pjproject 2.6
* Removed all 2.5.5 functional patches.
 * Updated usages of pj_release_pool to be "safe".
 * Updated configure options to disable webrtc.
 * Updated config_site.h to disable webrtc in pjmedia.
 * Added Richard Mudgett's recent resolver patches.

Change-Id: Ib400cc4dfca68b3d07ce14d314e829bfddc252c7
2017-02-23 16:23:53 -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
Sean Bright 0f4b349d37 res_config_pgsql: Fix thread safety problems
* A missing AST_LIST_UNLOCK() in find_table()

* The ESCAPE_STRING() macro uses pgsqlConn under the hood and we were
  not consistently locking before calling it.

* There were a handful of other places where pgsqlConn was accessed
  directly without appropriate locking.

Change-Id: Iea63f0728f76985a01e95b9912c3c5c6065836ed
2017-02-23 14:56:53 -06:00
Joshua Colp 25688ab797 Merge "res_config_ldap: Various code improvements" 2017-02-23 14:47:54 -06:00
Joshua Colp 6cc890b880 channel: Add support for writing to a specific stream.
This change adds an ast_write_stream function which allows
writing a frame to a specific media stream. It also moves
ast_write() to using this underneath by writing media
frames provided to it to the default streams of the channel.
Existing functionality (such as audiohooks, framehooks, etc)
are limited to being applied to the default stream only.

Unit tests have also been added which test the behavior of
both non-multistream and multistream channels to confirm that
the write() and write_stream() callbacks are invoked
appropriately.

ASTERISK-26793

Change-Id: I4df20d1b65bd4d787fce0b4b478e19d2dfea245c
2017-02-23 18:31:15 +00: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
Sean Bright e57961db84 res_config_ldap: Various code improvements
The initial motivation for this patch was to properly handle memory
allocation failures - we weren't checking the return values from the
various LDAP library allocation functions.

In the process, because update_ldap() and update2_ldap() were
substantially the same code, they've been consolidated.

Change-Id: Iebcfe404177cc6860ee5087976fe97812221b822
2017-02-22 17:37:52 -06:00
Michael L. Young 66a35e2451 build_tools: Fix download_externals to allow the use of curl or wget
Not sure if this is really a bug versus an improvement. I can see it being
viewed as a bug though by some.

The current build_tools/download_externals file depends on wget in order to
download external modules.  The current build system is able to discover
which tool to use for fetching remote files - either wget or curl.

This patch takes advantage of this capability by modifying the two calls to
the wget binary to instead use what was discovered by the build system.

ASTERISK-26812 #close

Change-Id: If9411a2554f009274d377445613ae91192d948a1
2017-02-22 15:54:07 -06:00
zuul 9ad1df71b3 Merge "Revert "build: Execute ldconfig to build cache."" 2017-02-22 13:56:48 -06:00
zuul 1052c880ed Merge "pbx_realtime: Prevent premature extension matching" 2017-02-22 12:08:50 -06:00
zuul 6c22d4b320 Merge "core: Show streams in "core show channel"." 2017-02-22 11:40:02 -06:00
Joshua Colp ced73d5b79 Revert "build: Execute ldconfig to build cache."
This reverts commit 28c8e4f58f.

Change-Id: Ie2e1aaf61fd49045994974a4581545ac8348fe4c
2017-02-22 11:12:54 -06:00