Commit Graph

30304 Commits

Author SHA1 Message Date
Corey Farrell 999e0c17d7 Build: Fix issues building without SSL.
* Fix conditional in libasteriskssl.
* Use variables produced by configure to link the SSL and uuid libraries
  into libasteriskpj.so instead of hard-coding them.

ASTERISK-27431

Change-Id: I3977931fd3ef8c4e4376349ccddb354eb839b58d
2017-11-19 14:27:25 -06:00
Corey Farrell 53f42cc052 res_pjsip: Fix warning by deferring implicit type cast.
Mac doesn't like the comparison of -1 to an enum, so store the result of
ast_sip_str_to_dtmf to an int so we can check for the negative return
value.  ast_sip_str_to_dtmf returns an int so this is only delaying the
implicit type cast.

Change-Id: I0c262c1719ee951aae1f437d733a301cf5f8ad29
2017-11-19 13:31:58 -06:00
Corey Farrell 75cb403775 tests: Fix warnings found on Mac.
test_pbx used raise without explicitly including signal.h.  On Mac for
some reason nothing else includes it.

test_logger checked if an unsigned int was negative.  Switch the
variable to 'int' so that error check can be effective.

Change-Id: Ie1db5dd1818ac25cc2ae41b644f848b5865b1362
2017-11-18 22:13:32 -05:00
Corey Farrell 83a2c4d2ae res_snmp: Declare RONLY if net-snmp headers do not.
Some net-snmp builds do not provide the RONLY declare, only
NETSNMP_OLDAPI_RONLY.  Map RONLY to NETSNMP_OLDAPI_RONLY to get around
this error.

Change-Id: Ida5c7ad9406515825485c4d3b4a34fd6ad0da577
2017-11-18 21:25:50 -05:00
Corey Farrell 5a899fc503 res_fax: Remove checks for unsigned values being >= 0.
It's impossible for gwtimeout or fdtimeout to be less than 0 because
they are unsigned int's.  Remove checks and unreachable branches.

Change-Id: Ib2286960621e6ee245e40013c84986143302bc78
2017-11-18 21:02:17 -05:00
Corey Farrell b4862e463c iostream: Fix ast_iostream_printf declaration.
This adds the printf attribute and changes 'fmt' from 'const void *' to
'const char *'.  This resolves a warning from some compiler for
vsnprintf needing a literal string for format.

Change-Id: I71c33a8262590042ee451e1146760c10bb22fb78
2017-11-18 20:50:48 -05:00
Corey Farrell 2fab3aacd6 app_minivm: Fix possible uninitialized return value.
Declare 'res' initialized to -1 to deal with earlier error paths that
could cause 'res' to be returned uninitialized.

Change-Id: I8ac2a5755bf4174d89ef893e924c940f702b104e
2017-11-18 20:29:16 -05:00
Pirmin Walthert 0ca406c202 res_rtp_asterisk.c: Fix rtp source address learning for broken clients
Some clients do not send rtp packets every ptime ms. This can lead to
situations in which the rtp source learning algorithm will never learn
the address of the client. This has been discovered on a Mac mini with
a pjsip based softphone after updating to Sierra: as soon as USB
headsets are involved, the softphone will send the second packet 30ms
after the first, the third 30ms after the second and the fourth 1ms
after the third. So in the old implmentation the rtp source learning
algorithm was repeatedly reset on the fourth packet.

The patch changes the algorithm in a way that doesn't take the arrival
time between two consecutive packets into account but the time between
the first and the last packet of a learning sequence.

The patch also fixes a second problem: when a user was using a wrong
value for the probation setting there was a LOG_WARNING output stating
that the value had been set to the default value instead. However
the code for setting the value back to defaults was missing.

ASTERISK-27421 #close

Change-Id: If778fe07678a6fd2041eaca7cd78267d0ef4fc6c
2017-11-18 03:53:50 -05:00
Corey Farrell 9316a064fd README: Send people to secure websites where available.
We should be sending people to secure web URL's where available.
Update README's and docs.

Change-Id: Id5b1e049b0b18b49a784f1254605aefa244ce19a
2017-11-17 21:10:55 -05:00
Corey Farrell 5d0529c4d9 doxygen: Remove obsolete contents.
Remove doxygen contents that have nothing to do with the current state
of Asterisk.

Change-Id: Ic072cc8641f9533a202990ccf275ce87e3efd95c
2017-11-17 20:54:33 -05:00
Sean Bright 1b6e4c1175 res_pjsip: Use reasonable buffer lengths for endpoint identification
Domains themselves can be up to 255 characters long (per RFC 1035), so
our current buffer sizes are wholly inadequate for many use cases.

Change-Id: If3f30a68307f1365a1fe06bc4b854c62842c9292
2017-11-17 11:22:04 -05:00
Corey Farrell b9f4bb5988 menuselect: Remove ineffective weak attribute detection.
menuselect detects compiler support for multiple styles of weak
functions.  This is a remnant from 2013 when OPTIONAL_API required weak
functions.  It is no longer correct for menuselect to switch
dependencies from optional to required based on lack of weak function
support.

Note an issue remains - dependencies should switch from optional to
required based on OPTIONAL_API being enabled or disabled.  I don't think
this is possible.  menuselect needs to know at startup if OPTIONAL_API
is enabled or disabled, so the only way to fix this is to remove
OPTIONAL_API from menuselect and create a configure option.  I've left
the code that switches in place but it's preprocessed out.

Additionally removed:
- WEAKREF variable from Asterisk makeopts.in.
- Related disabled code from test_utils.
- Pointless AC_REVISION call from menuselect/configure.ac.

Change-Id: Ifa702e5f98eb45f338b2f131a93354632a8fb389
2017-11-17 10:39:08 -05:00
Joshua Colp 4181b6f377 Merge "DEBUG_FD_LEAKS: Add missing FD creators." 2017-11-17 09:26:48 -06:00
Joshua Colp 4dac92b99a Merge "Build: Make function constructor/destructor attributes mandatory." 2017-11-17 09:26:33 -06:00
Corey Farrell c4f11911ea acl: Fix allocation related issues.
Add checks for allocation errors, cleanup and report failure when they
occur.

* ast_duplicate_acl_list: Replace log warnings with errors, add missing
  line-feed.
* ast_append_acl: Add missing line-feed to logger message.
* ast_append_ha: Avoid ast_strdupa in loop by moving debug message to
  separate function.
* ast_ha_join: Use two separate calls to ast_str_append to avoid using
  ast_strdupa in a loop.

Change-Id: Ia19eaaeb0b139ff7ce7b971c7550e85c8b78ab76
2017-11-17 09:36:14 -05:00
Jenkins2 b2c49d6c07 Merge "aoc: Fix memory management issues." 2017-11-17 06:43:17 -06:00
Joshua Colp 781a520b73 bridge_basic: Ignore answer from transfer target when they've timed out.
This is a fun one.

Given the following attended transfer scenario:

1. Transfer target is called
2. Transferer hangs up
3. Transfer target call attempt reaches timeout
4. Transfer target is told to hang up
5. Transfer target answers before channel is hung up
6. Transferer recall target is called

A crash would occur. This is because the transfer target call
attempt, despite being told to hang up, would raise a recall
target answer before the recall target had been answered. As it
had not answered there would be no recall target channel and it
would implode.

This change makes it so that if the transfer target has been
hung up we don't tell the attended transfer code that it has
answered. We also clear out the stimulus that the recall target
has been answered after telling the transfer target to hang up,
in case it was able to raise the information before we told it
to hangup.

ASTERISK-27361

Change-Id: Ifb8b255a9c4d2c5c1b8ad77bf54f659ed286df99
2017-11-17 07:43:05 -05:00
Corey Farrell a95f2994c6 aoc: Fix memory management issues.
aoc_publish_blob failed to check for msg allocation error and never
released msg.

Change-Id: Ib31a9ffb81056a0d496a49d7eec795005a44bcd5
2017-11-16 20:40:43 -05:00
Sean Bright 7a735d45e2 res_pjsip_transport_websocket: Give transport a meaningful description
We were not \0 terminating this string, so any attempt to print it would
in the best case show an empty string and in the worst case potentially
crash.

Change-Id: I63d96ef8f7516ac02a0f91e22dfa8acdc615042c
2017-11-16 17:29:11 -05:00
Sean Bright 6c53fb5d21 res_pjsip: Use sorcery prefix operation for contact lookup
This improves performance for registrations assuming that
res_config_astdb is not in use.

Change-Id: I86f37aa9ef07a4fe63448cb881bbadd996834bb1
2017-11-16 16:49:09 -05:00
Joshua Colp ccbf176c30 Merge "ast_coredumper: Add ability to use directory other than /tmp" 2017-11-16 15:44:23 -06:00
Joshua Colp a5918d300b Merge "pjsip / hep: Provide correct local address for Websockets." 2017-11-16 11:53:53 -06:00
Jenkins2 d89dc864eb Merge "sorcery: Add ast_sorcery_retrieve_by_prefix()" 2017-11-16 10:27:00 -06:00
Joshua Colp 936bacda16 Merge "chan_pjsip.c: Improve answer failure log messages." 2017-11-16 10:11:32 -06:00
Nir Simionovich d995064fb7 This patch adds a beanstalk CEL 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

This module currently doesn't support user defined events.

Change-Id: Ic3a087faeeac045d69a2a018e60e29831ddb95ab
2017-11-16 09:47:10 -06:00
Jenkins2 b5ac9c8a78 Merge "This patch adds a beanstalk CDR backend." 2017-11-16 09:36:41 -06:00
Joshua Colp f9661d558b Merge "audiohook.c: Fix freeing a frame and still using it." 2017-11-16 08:27:04 -06:00
Richard Mudgett e793501084 chan_pjsip.c: Improve answer failure log messages.
* Balanced the session->inv_session refs on answer failure.

Change-Id: I33542d639d37e692cb46550b972a5fcfc3b804b8
2017-11-15 17:53:40 -05:00
Richard Mudgett b7b800b689 audiohook.c: Fix freeing a frame and still using it.
Memory corruption happened to the media frame caches when an audio hook
freed a frame when it shouldn't.  I think the freed frame was because a
jitter buffer interpolated a missing frame and the audio hook
unconditionally freed it.

* Made audiohook.c:audio_audiohook_write_list() not free an interpolated
frame if it is the same frame as what was passed into the routine.

* Made plc.c:normalise_history() use memmove() instead of memcpy() on a
memory block that could overlap.  Found by valgrind investigating this
issue.

ASTERISK-27238
ASTERISK-27412

Change-Id: I548d86894281fc4529aefeb9f161f2131ecc6fde
2017-11-15 17:07:07 -05:00
George Joseph f512707362 app_record: Don't set RECORD_STATUS chan var until file is closed
We've been calling pbx_builtin_setvar_helper to set the
RECORD_STATUS variable before actually closing the recorded file.
If a client is watching VarSet events and tries to do something with
the file when a RECORD_STATUS event is seen, they might attempt to
do so while the file it's still open.

We now delay calling pbx_builtin_setvar_helper until after we close
the file.

ASTERISK-27423

Change-Id: I7fe9de99953e46b4bafa2b38cf151fe8f6488254
2017-11-15 15:03:21 -05:00
George Joseph cf1cb3345e ast_coredumper: Add ability to use directory other than /tmp
The OUTPUTDIR environment variable can now be set either in the
environment itself or in ast_debug_tools.conf.  If set, it's used
for all work products instead of /tmp.

Also added the --tarball-config option that includes the contents
of /etc/asterisk when either --tarball-coredumps or --tarball-results
are used.

Change-Id: I66b2553319df61caea5b313d084f51978f730b4c
2017-11-15 10:43:44 -05:00
Jenkins2 aa65be95c0 Merge "bundled_pjproject: Update to 2.7.1" 2017-11-14 16:03:57 -06:00
Joshua Colp 995b8c1a38 Merge "bundled_pjproject: sip_parser: Fix return code in pjsip_find_msg" 2017-11-14 14:49:05 -06:00
Joshua Colp 29e0add14f pjsip / hep: Provide correct local address for Websockets.
Previously for PJSIP the local address of WebSocket connections
was set to the remote address. For logging purposes this is
not particularly useful.

The WebSocket API has been extended to allow the local
address to be queried and this is used in PJSIP to set the
local address to the correct value.

The PJSIP HEP support has also been tweaked so that reliable
transports always use the local address on the transport
and do not try to (wrongly) guess. As they are connection
based it is impossible for the source to be anything else.

ASTERISK-26758
ASTERISK-27363

Change-Id: Icd305fd038ad755e2682ab2786e381f6bf29e8ca
2017-11-14 11:53:07 -05:00
Joshua Colp a6d2926e5d Merge "core: Fix configuration of remote console socket path." 2017-11-14 10:31:40 -06:00
Jenkins2 69d12bcf3e Merge "pjsip: Add patch to allow all transports to be destroyed." 2017-11-14 09:06:33 -06:00
Joshua Colp 9d7b096023 Merge "core: Use ast_alertpipe for Asterisk signal monitoring thread." 2017-11-14 07:32:24 -06:00
Jenkins2 f616147487 Merge "core: Add cache_media_frames debugging option." 2017-11-14 06:56:54 -06:00
Joshua Colp e63dbac21f Merge "alertpipe: Correct documented return of ast_alertpipe_write." 2017-11-14 05:46:58 -06:00
Corey Farrell 14253f9535 alertpipe: Correct documented return of ast_alertpipe_write.
Change-Id: I4ea49c441890a81384144479dc93ab5a3989486d
2017-11-13 18:47:46 -05:00
Jenkins2 8ae31f7126 Merge "vectors: Add new macro and a string vector definition." 2017-11-13 17:26:23 -06:00
Joshua Colp 52c1d05296 Merge "menuselect: Delete and ignore aclocal.m4." 2017-11-13 17:01:35 -06:00
Corey Farrell edd1016dd8 core: Use ast_alertpipe for Asterisk signal monitoring thread.
Reduce the signal monitoring thread file descriptor use from two to one
on systems that support eventfd.

Change-Id: Id4041a237d481ff699639e153ea6982fee14a462
2017-11-13 17:41:07 -05:00
Corey Farrell cdaaa14a5f core: Fix configuration of remote console socket path.
The remote console socket path is the combination of asterisk.conf
settings astrundir from [directories] and astctl from [files].
Unconditionally combine the two strings after processing all values
to ensure we end up with the correct socket path.

ASTERISK-27415

Change-Id: Ib1e2805d55d6b0955c6430a1a2a93acbf9b091e8
2017-11-13 17:20:27 -05:00
George Joseph f6ebd16bb8 bundled_pjproject: sip_parser: Fix return code in pjsip_find_msg
The default return code for pjsip_find_msg was PJ_SUCCESS so if
a Content-Length header wasn't found at all, pjsip_find_msg was
returning PJ_SUCCESS instead of PJSIP_EMISSINGHDR.

Also added the volatile keyword to a few variables that are used
both inside and outside the PJ_TRY/PJ_CATCH block.

Partial fix for ASTERISK_27408

Change-Id: If82ba9de921e3d57df9c68cf96ee45ccc1491f7a
2017-11-13 16:50:07 -05:00
Ben Ford 2e7f6cd31b bundled_pjproject: Update to 2.7.1
Update from 2.7 to 2.7.1 for bundled pjproject. Changed version
and removed patch files included in the update.

Change-Id: I55cea8e734b318c2df9daf86aa0802c559ec8357
2017-11-13 16:43:38 -05:00
Sean Bright ffccce76d9 sorcery: Add ast_sorcery_retrieve_by_prefix()
Some consumers of the sorcery API use ast_sorcery_retrieve_by_regex
only so that they can anchor the potential match as a prefix and not
because they truly need regular expressions.

Rather than using regular expressions for simple prefix lookups, add
a new operation - ast_sorcery_retrieve_by_prefix - that does them.

Change-Id: I56f4e20ba1154bd52281f995c27a429a854f6a79
2017-11-13 15:15:33 -05:00
Corey Farrell 14d60cee0c CLI: Create ast_cli_completion_vector.
This is a rewrite of ast_cli_completion_matches using a vector to build
the list.  The original function calls the vector version, NULL
terminates the vector and extracts the elements array.

One change in behavior the results are now sorted and deduplicated. This
will solve bugs where some duplicate checking was done before the list
was sorted.

Change-Id: Iede20c5b4d965fa5ec71fda136ce9425eeb69519
2017-11-13 13:37:59 -05:00
Corey Farrell 4930404715 vectors: Add new macro and a string vector definition.
* AST_VECTOR_STEAL_ELEMENTS - steal the array of elements for use
  with non-vector code.
* struct ast_vector_string - a vector of 'char *'.

Change-Id: I104d1b204be03fccf67e02a195596adcb5ab1e42
2017-11-13 13:37:50 -05:00
Joshua Colp 9eacd55c71 Merge "Build System: Disable parallel make in the root Makefile." 2017-11-13 07:47:38 -06:00