Commit Graph

28544 Commits

Author SHA1 Message Date
Joshua Colp
2b675ce122 Merge "chan_dahdi.c: Fix bounds check regression." into 13 2016-12-19 18:27:48 -06:00
Joshua Colp
4a8766f490 Merge "chan_sip: Reorder unload_module to deal with stuck TCP threads." into 13 2016-12-19 16:19:11 -06:00
zuul
c8aff2c51b Merge "app_queue: Ensure member is removed from pending when hanging up." into 13 2016-12-19 12:41:09 -06:00
Martin Tomec
d13be4eff6 app_queue: Ensure member is removed from pending when hanging up.
In some cases member is added to pending_members, and the channel
is hung up before any extension state change. So the member would
stay in pending_members forever. So when we call do_hang, we
should also remove member from pending.

ASTERISK-26621 #close

Change-Id: Iae476b5c06481db18ebe0fa594b3e80fdc9a7d54
2016-12-19 10:38:53 +01:00
George Joseph
815f755155 pjproject_bundled: Make build single threaded
There were just too many issues in various environments with
multi threaded building of pjproject.  It doesn't really speed
things up anyway since asterisk is already being compiled in
parallel.

Change-Id: Ie5648fb91bb89b4224b6bf43a0daa1af793c4ce1
2016-12-18 14:23:17 -07:00
Corey Farrell
493849dcd7 chan_sip: Reorder unload_module to deal with stuck TCP threads.
In some situations TCP threads may become frozen.  This creates the
possibility that Asterisk could segfault if they become unfrozen after
chan_sip has been dlclose'd.  This reorders the unload_module process to
allow abort if threads do not exit within 5 seconds.

High level order as follows:
1) Unregister from the core to stop new requests.
2) Signal threads to stop
3) Clear config based tables (but do not free the table itself).
4) Verify that threads have shutdown, cancel unload if not.
5) Clean all remaining resources.

ASTERISK-26586

Change-Id: Ie23692041d838fbd35ece61868f4c640960ff882
2016-12-17 11:32:14 -05:00
David M. Lee
ab447f8a6a configure: fix with-pjproject-bundled
The AC_ARG_WITH macro's shell variable is withval; not enableval. Purely
coincidentally, the option would work when --enable-dev-mode is given.

Also fixed a portability problem with bootstrap.sh, since -printf is not
a portable option for find.

Change-Id: I0f0e5b1a934b5af5737713834361e9c95b96b376
2016-12-16 07:53:11 -06:00
Richard Mudgett
35736d419a autosupport: Add 'pjproject show buildopts'
Change-Id: I8aa55a7c3fb175235ddc7f85e9457d5102d06fa7
2016-12-15 13:26:43 -06:00
Richard Mudgett
4b285d226d chan_dahdi.c: Fix bounds check regression.
Caused by ASTERISK-25494

Change-Id: I1fc408c1a083745ff59da5c4113041bbfce54bcb
2016-12-14 14:22:56 -06:00
Richard Mudgett
9114574188 res_pjsip: Add/update ERROR msg if invalid URI.
ASTERISK-24499

Change-Id: Ie305153e47e922233b2ff24715e0e326e5fa3a6c
2016-12-14 11:30:58 -06:00
Richard Mudgett
75a6afbec5 MESSAGE: Flush Message/ast_msg_queue channel alert pipe.
ASTERISK-25083

Change-Id: Id54baa57a8dbca84e29f28bcd2ffc0a5ac12d8b2
2016-12-14 11:30:58 -06:00
George Joseph
91485734a4 res_sorcery_memory_cache: Change an error to a debug message
When a sorcery user calls ast_sorcery_delete on an object that
may have already expired from the cache, res_sorcery_memory_cache
spits out an ERROR.  Since this can happen frequently and validly when
an inbound registration expires after the cache entry expired, the
errors are unnecessary and misleading.  Changed to a debug/1.

Change-Id: Idf3a67038c16e3da814cf612ff4d6d18ad29ecd7
2016-12-14 08:26:37 -06:00
George Joseph
cd46e86491 pjproject_bundled: Retry download if previously saved tarball is bad
If a tarball is corrupted during download, the makefile will attempt to
download it again. If the tarball somehow gets corrupted after it's
downloaded however, the makefile was just failing.  We now
retry the download.

ASTERISK-26653 #close

Change-Id: I1b24d454852d80186f60c5a65dc4624ea8a1c359
2016-12-09 07:14:09 -07:00
Joshua Colp
791c15942b Merge "Fix typo in chan_sip" into 13 2016-12-09 05:33:16 -06:00
Joshua Colp
c7eb439953 Merge "chan_sip: Delete unneeded check" into 13 2016-12-09 05:32:09 -06:00
zuul
5f9316e143 Merge "Small code cleanup in chan_sip" into 13 2016-12-09 03:25:12 -06:00
zuul
949a4a443a Merge "res_pjsip: Fix 'A = B != C' kind." into 13 2016-12-08 21:54:37 -06:00
Joshua Colp
939010fc15 Merge "res_pjsip_registrar: AMI Add RegistrationInboundContactStatuses command" into 13 2016-12-08 18:42:06 -06:00
Badalyan Vyacheslav
22820e10fe chan_sip: Delete unneeded check
P is always true. We check it before

Change-Id: Iee61cda002a9f61aee26b9f66c5f9b59e3389efb
2016-12-08 16:55:51 -06:00
Badalyan Vyacheslav
6aa2c5e5f9 Small code cleanup in chan_sip
The conditional expressions of the 'if' operators situated
alongside each other are identical.

Change-Id: I2cf7c317b106ec14440c7f1b5dcfbf03639f748a
2016-12-08 16:54:47 -06:00
Badalyan Vyacheslav
b596fac838 Fix typo in chan_sip
The conditional expressions of the 'if' operators
situated alongside each other are identical.

Change-Id: I652b6dcddb3be007e669a6aa8107edb31a1ddafb
2016-12-08 16:54:06 -06:00
Badalyan Vyacheslav
483ed9f1aa res_pjsip: Fix 'A = B != C' kind.
Consider reviewing the expression of the 'A = B != C' kind.
The expression is calculated as following: 'A = (B != C)'

Change-Id: Ibaa637dfda47d51a20e26069d3103e05ce80003d
2016-12-08 13:22:13 -06:00
Kevin Harwell
f9644de0bd Merge "res_format_attr_opus: Fix crash when fmtp contains spaces." into 13 2016-12-08 11:07:12 -06:00
Walter Doekes
41c6319c4e chan_sip: Do not allow non-SP/HTAB between header key and colon.
RFC says SIP headers look like:

    HCOLON  =  *( SP / HTAB ) ":" SWS
    SWS     =  [LWS]                    ; sep whitespace
    LWS     =  [*WSP CRLF] 1*WSP        ; linear whitespace
    WSP     =  SP / HTAB                ; from rfc2234

chan_sip implemented this:

    HCOLON  =  *( LOWCTL / SP ) ":" SWS
    LOWCTL  = %x00-1F                   ; CTL without DEL

This discrepancy meant that SIP proxies in front of Asterisk with
chan_sip could pass on unknown headers with \x00-\x1F in them, which
would be treated by Asterisk as a different (known) header.  For
example, the "To\x01:" header would gladly be forwarded by some proxies
as irrelevant, but chan_sip would treat it as the relevant "To:" header.

Those relying on a SIP proxy to scrub certain headers could mistakenly
get unexpected and unvalidated data fed to Asterisk.

This change fixes so chan_sip only considers SP/HTAB as valid tokens
before the colon, making it agree on the headers with other speakers of
SIP.

ASTERISK-26433 #close
AST-2016-009

Change-Id: I78086fbc524ac733b8f7f78cb423c91075fd489b
2016-12-08 08:18:28 -06:00
Joshua Colp
888142e891 res_format_attr_opus: Fix crash when fmtp contains spaces.
When an opus offer or answer was received that contained an
fmtp line with spaces between the attributes the module would
fail to properly parse it and crash due to recursion.

This change makes the module handle the space properly and
also removes the recursion requirement.

ASTERISK-26579

Change-Id: I01f53e5d9fa9f1925a7365f8d25071b5b3ac2dc3
2016-12-08 11:46:30 +00:00
George Joseph
ebc67d3053 res_pjsip_registrar: AMI Add RegistrationInboundContactStatuses command
The PJSIPShowRegistrationsInbound AMI command was just dumping out
all AORs which was pretty useless and resource heavy since it had
to get all endpoints, then all aors for each endpoint, then all
contacts for each aor.

PJSIPShowRegistrationInboundContactStatuses sends ContactStatusDetail
events which meets the intended purpose of the other command and has
significantly less overhead.  Also, some additional fields that were
added to Contact since the original creation of the ContactStatusDetail
event have been added to the end of the event.

For compatibility purposes, PJSIPShowRegistrationsInbound is left
intact.

ASTERISK-26644 #close

Change-Id: I326f12c9ecb52bf37ba03f0748749de4da01490a
2016-12-07 18:11:11 -06:00
Joshua Colp
738203f6e6 Merge "Bundled pjproject: Fix finding SIP transactions." into 13 2016-12-07 13:38:10 -06:00
Richard Mudgett
d506874477 Bundled pjproject: Fix finding SIP transactions.
Occasionally SIP message transactions are not found when they should be.
In the particular case an incoming INVITE transaction is CANCELed but the
INVITE transaction cannot be found so a 481 response is returned for the
CANCEL.  The problematic calls have a '_' character in the Via branch
parameter.

The problem is in the pjproject PJ_HASH_USE_OWN_TOLOWER feature's code.
The problem with the "own tolower" code is that it does not calculate the
same hash value as when the pj_tolower() function is used.  The "own
tolower" code will erroneously modify the ASCII characters '@', '[', '\\',
']', '^', and '_'.  Calls to pj_hash_calc_tolower() can use the
PJ_HASH_USE_OWN_TOLOWER substitute algorithm when enabled.  Calls to
pj_hash_get_lower(), pj_hash_set_lower(), and pj_hash_set_np_lower() call
find_entry() which never uses the PJ_HASH_USE_OWN_TOLOWER algorithm.  As a
result you may not be able to find a hash tabled entry because the
calculated hash values would differ.

* Simply disable PJ_HASH_USE_OWN_TOLOWER.

ASTERISK-26490 #close

Change-Id: If89bfdb5f301b8b685881a9a2a6e0c3c5af32253
2016-12-07 06:15:52 -06:00
George Joseph
4b233675d8 pjproject_bundled: Fix missing inclusion of symbols
Added back in a -g3, and an -O3 when DONT_OPTIMIZE is not set, to
the CFLAGS.  Not sure how they went missing.

Also fixed an uninstall problem where we weren't removing the
symlink from libasteriskpj.so.2 to libasteriskpj.so.  While I was
there, I fixed it for libasteriskssl as well.

Change-Id: I9e00873b1e9082d05b5549d974534b48a2142556
2016-12-06 11:19:27 -07:00
Joshua Colp
f08095ef18 Merge "res_pjsip_outbound_registration.c: Filter redundant statsd reporting." into 13 2016-12-06 05:34:38 -06:00
Joshua Colp
b9a79a56c7 Merge "Remove files that got merged in error somehow to the 13 branch." into 13 2016-12-05 11:43:21 -06:00
Richard Mudgett
580f83dac7 Remove files that got merged in error somehow to the 13 branch.
Change-Id: Id79e2226c31084f9252d5aede9050d3cf13322c8
2016-12-02 12:05:44 -06:00
Richard Mudgett
61ba2a014a res_pjsip_outbound_registration.c: Filter redundant statsd reporting.
Increasing the testsuite shutdown timeout before forcibly killing
Asterisk allowed more events to be sent out.  Some tests failed as
a result.  The tests/channels/pjsip/statsd/registrations failed
because we now get the statsd events that a comment in the test
configuration stated couldn't be intercepted.  Unfortunately, we
get a variable number of events because of internal status state
transition races generating redundant statsd events.

We were reporting redundant statsd PJSIP.registrations.state changes
for internal state changes that equated to the same thing publicly.

* Made update_client_state_status() filter out redundant statsd
updates.

ASTERISK-26527

Change-Id: If851c7d514bb530d9226e4941ba97dcf52000646
2016-12-02 11:49:12 -06:00
Joshua Colp
fdf0a2afb0 Merge "res_pjsip/chan_sip: Advertise 'ws' in the SIP URI transport parameter" into 13 2016-12-02 11:30:09 -06:00
Joshua Colp
8d56016ae4 Merge "tcptls: Use new certificate upon sip reload" into 13 2016-12-02 07:56:51 -06:00
Joshua Colp
28b76ed667 Merge "PJPROJECT logging: Made easier to get available logging levels." into 13 2016-12-02 05:38:05 -06:00
Joshua Colp
c3a509be7e Merge "res_rtp: Fix regression when IPv6 is not available." into 13 2016-12-01 15:51:06 -06:00
Joshua Colp
cd5e9a89d1 Merge "res_calendar_caldav: Add support reading gmail calendar" into 13 2016-12-01 15:28:09 -06:00
Joshua Colp
bddc60df73 Merge "Frame deferral: Re-queue deferred frames one-at-a-time." into 13 2016-12-01 10:38:34 -06:00
Joshua Colp
662a4741e2 Merge "OpenSSL 1.1.0 support" into 13 2016-12-01 05:08:52 -06:00
Guido Falsi
2ceb609edb 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
2016-11-30 20:04:31 +00:00
Eduardo S. Libardi
53459cdaa9 res_calendar_caldav: Add support reading gmail calendar
The response from gmail calendar includes the string name
"caldav:calendar-data". res_calendar_caldav implements
the example included in RFC 4791: string "C:calendar-data".
When reading the calendar, res_calendar_caldav compare the
string and if does not match just discards the event.
This commit compares the response to both strings,
successfully loading gmail calendar events.
Writing to gmail calendar is working prior to this fix.

ASTERISK-26624
Reported by: Eduardo S. Libardi

Change-Id: Ia1eef10552ae616efb645d390f5ffe81260d7d4a
2016-11-30 14:16:10 -05:00
Richard Mudgett
44fe4a5769 PJPROJECT logging: Made easier to get available logging levels.
Use of the new logging is as simple as issuing the new CLI command or
setting the new pjproject.conf option.

Other options that can affect the logging are how you have the pjproject
log levels mapped to Asterisk log types in pjproject.conf and if you have
configured Asterisk to log the DEBUG type messages.  Altering the
pjproject.conf level mapping shouldn't be necessary for most installations
as the default mapping is sensible.  Configuring Asterisk to log the DEBUG
message type is standard practice for collecting debug information.

* Added CLI "pjproject set log level" command to dynamically adjust the
maximum pjproject log message level.

* Added CLI "pjproject show log level" command to see the currently set
maximum pjproject log message level.

* Added pjproject.conf startup section "log_level" option to set the
initial maximum pjproject log message level so all messages could be
captured from initialization.

* Set PJ_LOG_MAX_LEVEL to 6 to compile in all defined logging levels into
bundled pjproject.  Pjproject will use the currently set run time log
level to determine if a log message is generated just like Asterisk
verbose and debug logging levels.

* In log_forwarder(), made always log enabled and mapped pjproject log
messages.  DEBUG mapped log messages are no longer gated by the current
Asterisk debug logging level.

* Removed RAII_VAR() from res_pjproject.c:get_log_level().

ASTERISK-26630 #close

Change-Id: I6dca12979f482ffb0450aaf58db0fe0f6d2e5389
2016-11-30 13:13:58 -06:00
Mark Michelson
17b0b91afa Frame deferral: Re-queue deferred frames one-at-a-time.
The recent change that made frame deferral into an API had a behavior
change to it. When frame deferral was completed, we would take all of
the deferred frames and queue them all onto the channel in one call to
ast_queue_frame_head(). Before frame deferral was API-ized, places that
performed manual frame deferral would actually take each deferred frame
and queue them onto the channel.

This change in behavior caused the confbridge_recording test to start
failing consistently. Without going too crazily deep into the details,
a channel was getting "stuck" in an ast_safe_sleep(). An AMI redirect
was attempting to break it out of the sleep, but because there were more
frames in the channel read queue than expected, the channel ended up
being unable to break from its sleep loop.

By restoring the behavior of individual frame queuing after deferral,
the test starts passing again.

Note, this points to a potential underlying issue pointing to an
"unbalance" that can occur when queuing multiple frames at once,
and so a follow-up issue is being created to investigate that
possibility.

Change-Id: Ied5dacacda06d343dea751ed5814a03364fe5a7d
2016-11-30 10:48:39 -06:00
zuul
eec82c6221 Merge "chan_pjsip: fix switching sending codec when asymmetric_rtp_codec=no" into 13 2016-11-30 10:48:13 -06:00
zuul
3d43e5ed3c Merge "chan_sip: Fix segfault during module unload" into 13 2016-11-30 07:56:43 -06:00
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