Commit Graph

29332 Commits

Author SHA1 Message Date
Joshua Colp
e50df8ac81 res_pjsip_session: Allow BYE to be sent on disconnected session.
It is perfectly acceptable for a BYE to be sent on a disconnected
session. This occurs when we respond to a challenge to the BYE
for authentication credentials.

ASTERISK-26363

Change-Id: I6ef0ddece812fea6665a1dd2549ef44fb9d90045
2017-04-01 06:01:50 -05:00
George Joseph
d4b2710e7f Merge "build: Fix deb build issues with fakeroot" into 14 2017-03-31 08:20:14 -05:00
Joshua Colp
feaec397cf Merge "cdr_pgsql: Fix buffer overflow calling libpq" into 14 2017-03-31 07:23:21 -05:00
Corey Farrell
56f9193e6b Forward declare 'struct ast_json' in asterisk.h
The ast_json structure is used in many Asterisk headers and is often the
only part of json.h used.  This adds a forward declaration to asterisk.h
and removes the include of json.h from many headers.  The declaration
has been left in endpoints.h and stasis.h to avoid problems with source
files that use ast_json functions without directly including json.h.

ari.h continues to include json.h as it uses enum
ast_json_encoding_format.

Change-Id: Id766aabce6bed56626d27e8d29f559b5e687b769
2017-03-30 22:59:47 -05:00
zuul
a53c22e181 Merge "CEL: Remove header declarations of non-existant functions." into 14 2017-03-30 18:50:04 -05:00
Sean Bright
c9707febe3 cdr_pgsql: Fix buffer overflow calling libpq
Implement the same buffer size checking done in cel_pgsql.

ASTERISK-26896 #close
Reported by: twisted

Change-Id: Iaacfa1f1de7cb1e9414d121850d2d8c2888f3f48
2017-03-30 18:47:51 -04:00
zuul
f99ef618b4 Merge "res_pjsip_config_wizard: Add 2 new parameters to help with proxy config" into 14 2017-03-30 17:11:23 -05:00
Walter Doekes
e6087296c3 build: Fix deb build issues with fakeroot
If DESTDIR is set, don't call ldconfig. Assume that DESTDIR is used to
create a binary archive. The ldconfig call should be delegated to the
archive postinst script. This fixes the case where fakeroot wraps 'make
install' causing $EUID to be 0 even though it doesn't have permission to
call ldconfig.

The previous logic in configure.ac to detect and correct libdir
has been removed as it was not completely accurate.  CentOS 64-bit
users should again specifiy --libdir=/usr/lib64 when configuring
to prevent install to /usr/lib.

Updated Makefile:check-old-libdir to check for orphans in
lib64 when installing to lib as well as orphans in lib when installing
to lib64.

Updated Makefile and main/Makefile uninstall targets to remove the
orphans using the new logic.

ASTERISK-26705

Change-Id: I51739d4a03e60bff38be719b8d2ead0007afdd51
2017-03-30 17:10:13 -05:00
Sean Bright
b3fe94e4ca astobj2: Prevent potential deadlocks with ao2_global_obj_release
The ao2_global_obj_release() function holds an exclusive lock on the
global object while it is being dereferenced. Any destructors that
run during this time that call ao2_global_obj_ref() will deadlock
because a read lock is required.

Instead, we make the global object inaccessible inside of the write
lock and only dereference it once we have released the lock. This
allows the affected destructors to fail gracefully.

While this doesn't completely solve the referenced issue (the error
message about not being able to create an IQ continues to be shown)
it does solve the backtrace spew that accompanied it.

ASTERISK-21009 #close
Reported by: Marcello Ceschia

Change-Id: Idf40ae136b5070dba22cb576ea8414fbc9939385
2017-03-30 13:57:16 -04:00
Corey Farrell
451f7e00a6 CEL: Remove header declarations of non-existant functions.
ast_cel_alloc and ast_cel_destroy do not exist in code, remove them from
the headers.

Change-Id: I99ce848e2e109e7d61771559f559b9e57973e45c
2017-03-30 10:20:50 -05:00
Joshua Colp
a047b25f93 Merge "cel_pgsql.c: Fix buffer overflow calling libpq" into 14 2017-03-30 05:12:28 -05:00
Joshua Colp
1c99716423 Merge "srtp: Allow zero as tag value for a sRTP Crypto Suite." into 14 2017-03-29 17:50:12 -05:00
Joshua Colp
478d5603f6 Merge "Add DTLS sanity check." into 14 2017-03-29 17:50:04 -05:00
George Joseph
0cec000628 Merge "res_musiconhold: Don't chdir() when scanning MoH files" into 14 2017-03-29 14:41:58 -05:00
zuul
c4ff80d56f Merge "core: Remove embedded module support" into 14 2017-03-29 12:46:20 -05:00
zuul
a9c0ddb989 Merge "alembic: Turn off execute bit on non-executable python scripts" into 14 2017-03-29 11:26:42 -05:00
Josh Roberson
43c785545b cel_pgsql.c: Fix buffer overflow calling libpq
PQEscapeStringConn() expects the buffer passed in to be an
adequitely sized buffer to write out the escaped SQL value string
into.  It is possible, for large values (such as large values to
Dial with a lot of devices) to have more than our 512+1 byte
allocation and thus cause libpq to create a buffer overrun.

glibc will nicely ABRT asterisk for you, citing a stack smash.

Let's only allocate it to be as large as needed:
If we have a value, then (strlen(value) * 2) + 1 (as recommended
by libpq), and if we have none, just one byte to hold our null
will do.

ASTERISK-26896 #close

Change-Id: If611c734292618ed68dde17816d09dd16667dea2
2017-03-29 07:53:43 -06:00
Alexander Traud
60ff37fcb8 srtp: Allow zero as tag value for a sRTP Crypto Suite.
ASTERISK-25490 #close

Change-Id: I1c5fc0942c33c96d62b24203aad0f1e1a1a0131f
2017-03-29 07:27:17 -06:00
zuul
f719c661a2 Merge "res_xmpp: Fix ref counting issue" into 14 2017-03-29 06:39:22 -05:00
George Joseph
27344675be res_pjsip_config_wizard: Add 2 new parameters to help with proxy config
Two new parameters have been added to the pjsip config wizard.

 * Setting 'sends_line_with_registrations' to true will cause the wizard
   to skip the creation of an identify object to match incoming request
   to the endpoint and instead add the line and endpoint parameters to
   the outbound registration object.

 * Setting 'outbound_proxy' is a shortcut for adding individual
   endpoint/outbound_proxy, aor/outbound_proxy and
   registration/outbound_proxy parameters.

Change-Id: I678e5f80765734c056620528a6d40d82736ceeb0
(cherry picked from commit a827892ff7)
2017-03-28 15:47:45 -06:00
Joshua Colp
89c479a35c Merge "res_xmpp: Use incremental backoff when a read error occurs" into 14 2017-03-28 15:41:25 -05:00
Sean Bright
b409d49273 alembic: Turn off execute bit on non-executable python scripts
Change-Id: I744c986da4a38aeff8c00837eb89de7841fbc86c
2017-03-28 08:31:26 -06:00
Richard Mudgett
11f3b6e17f Add DTLS sanity check.
Change-Id: Ib32612cf6c7ce9213a11b9cba82f630f8cd3564b
2017-03-27 15:42:51 -06:00
Sean Bright
63a79e395a res_musiconhold: Document the 'format' option
ASTERISK-26086 #close
Reported by: Jens Bürger

Change-Id: I6aab666c0bf01fd0c64d7a5bcb22fa7f5d41335e
2017-03-27 08:36:22 -06:00
Sean Bright
b033b74118 core: Remove embedded module support
This has not worked for some time and is no longer actively maintained.

Change-Id: I5110b0db69c152761b58fa025cb0a53b0e544d99
2017-03-27 10:36:15 -04:00
Sean Bright
0a8026072b res_musiconhold: Don't chdir() when scanning MoH files
There doesn't appear to be any reason that we are chdir'ing in
moh_scan_files, and in the event of an Asterisk crash, the core files
may not get written because we have changed into a read-only directory.

ASTERISK-23996 #close
Reported by: Walter Doekes

Change-Id: Iac806dce01b3335963fbd62d4b4da9a65c614354
2017-03-27 08:00:50 -06:00
Joshua Colp
3e2cd7c593 Merge "pjproject_bundled: raise timeout value used when downloading" into 14 2017-03-25 06:35:21 -05:00
Joshua Colp
53161cc84c Merge "res_pjsip_sdp_rtp: Set hangup cause for RTP timeouts" into 14 2017-03-25 05:20:17 -05:00
zuul
bec49f517f Merge "cdr: Allow setting of user field from 'h' extension" into 14 2017-03-24 17:48:15 -05:00
Joshua Colp
b872a73e6e Merge "rtp_engine: allocate RTP dynamic payloads per session" into 14 2017-03-24 17:47:36 -05:00
Joshua Colp
6b40e2d00e Merge "res_xmpp: Correct implementation of JABBER_STATUS & JabberStatus" into 14 2017-03-24 17:46:29 -05:00
Sean Bright
cd93488a82 res_xmpp: Use incremental backoff when a read error occurs
If a read error occurs, we immediately attempt a reconnect without any
delay. Instead, let's sleep and backoff up to 60 seconds before we try
again.

ASTERISK-24712 #close
Reported by: Matthias Urlichs

Change-Id: I6fe10ef4734837727437beab715e336777f13f48
2017-03-24 17:10:43 -04:00
zuul
391c412c0e Merge "res_xmpp: Include client name in connection related error messages" into 14 2017-03-24 11:55:44 -05:00
zuul
9830347805 Merge "res_xmpp: Don't crash when trying to send a message without a connection" into 14 2017-03-24 11:49:59 -05:00
Sean Bright
701a03738b res_pjsip_sdp_rtp: Set hangup cause for RTP timeouts
chan_sip sets the hangup cause code to AST_CAUSE_REQUESTED_CHAN_UNAVAIL
(44) when a channel is hung up due to an RTP timeout. So do the same
when it happens with PJSIP for parity.

Change-Id: I3546ebbde6460c22a27c9da1bf321711b5961ab8
2017-03-24 10:31:34 -06:00
Joshua Colp
aa7b60ecc7 Merge "res_xmpp: Correctly check return value of SSL_connect" into 14 2017-03-24 09:54:31 -05:00
zuul
2ca7b2ed76 Merge "res_xmpp: Try to provide useful errors messages from OpenSSL" into 14 2017-03-24 09:13:02 -05:00
zuul
28bb9e7902 Merge "audiohook.c: Lost RTP packets lead to out-of-sync MixMonitor." into 14 2017-03-24 07:17:49 -05:00
Kevin Harwell
74cb069af9 AMI: Updated version
Updated the AMI version for the following reason (see CHANGES for more details):

The 'PJSIPShowEndpoint' command's response event of 'IdentifyDetail' now
contains a new optional parameter, 'MatchHeader'.

Change-Id: Ie206913ef1dcfa6a2ebe3282da2387e52d6f05b9
2017-03-23 14:24:53 -05:00
Kevin Harwell
8df2f481b6 pjproject_bundled: raise timeout value used when downloading
After configuring Asterisk with '--with-pjproject-bundled' the configure/build
process attempts to download pjproject from its download site. Currently, a
timeout of 10 seconds is used that will stop the download process if pjproject
has not been fully downloaded in that time. For some systems this was not enough
time and the process was timing out too early.

This patch raises the download timeout value to '60'. Also, this patch fixes
another bug where the DOWNLOAD_TIMEOUT variable was not being properly exported
due to a naming error. DOWNLOAD_MAX_TIMEOUT is now properly renamed to
DOWNLOAD_TIMEOUT.

ASTERISK-26814 #close

Change-Id: Ia56e4e8a3d39db76bc8a1852b2cf07ec10b39842
2017-03-23 12:16:50 -06:00
Sean Bright
57fcbb8591 res_xmpp: Correct implementation of JABBER_STATUS & JabberStatus
The documentation for JABBER_STATUS (and the deprecated JabberStatus
app) indicate that a return value of 7 indicates that the specified
buddy was not in the roster. It also indicates that you can specify a
"bare" JID (one without a resource). Unfortunately the actual behavior
does not match the documented behavior.

Assuming that our roster includes the buddy online and available
"valid@example.org/Valid" and does *not* include the buddy
"invalid@example.org", the JABBER_STATUS() function returns the
following before this patch:

+------------------------------+------------+--------------------------+
| Buddy                        | Status     | Result                   |
+------------------------------+------------+--------------------------+
| valid@example.org            |  Online    |  7 (Not in roster)       |
| valid@example.org/Valid      |  Online    |  1 (Online)              |
| valid@example.org/Invalid    |  N/A       |  7 (Not in roster)       |
| invalid@example.org          |  N/A       |  Error logged, no return |
| invalid@example.org/Valid    |  N/A       |  Error logged, no return |
+------------------------------+------------+--------------------------+

And after this patch:

+------------------------------+------------+--------------------------+
| Buddy                        | Status     | Result                   |
+------------------------------+------------+--------------------------+
| valid@example.org            |  Online    |  1 (Online)              |
| valid@example.org/Valid      |  Online    |  1 (Online)              |
| valid@example.org/Invalid    |  N/A       |  6 (Offline)             |
| invalid@example.org          |  N/A       |  7 (Not in roster)       |
| invalid@example.org/Valid    |  N/A       |  7 (Not in roster)       |
+------------------------------+------------+--------------------------+

This brings the behavior in line with the documentation.

ASTERISK-23510 #close
Reported by: Anthony Critelli

Change-Id: I9c3241035363ef4a6bdc21fabfd8ffcd9ec657bf
2017-03-23 09:45:43 -06:00
Sean Bright
a48b489de3 res_xmpp: Try to provide useful errors messages from OpenSSL
If any errors occur during the TLS connection setup, we currently dump a
fairly generic error message. So instead we try to pull in something
useful from OpenSSL to report instead.

ASTERISK-24712
Reported by: Matthias Urlichs

Change-Id: I288500991a9681f447d92913b11fedaf426087f4
2017-03-23 08:58:45 -06:00
Sean Bright
606103580f res_xmpp: Fix ref counting issue
The only remaining reference to the endpoint is in the endpoints
container, and because it is unlinked in ast_endpoint_shutdown, we don't
have to explicitly cleanup the endpoint ourselves.

Change-Id: I912a2692e52d3e2ed445b32d8ae3f9004bc2f2e8
2017-03-23 08:58:21 -06:00
Sean Bright
138f2bfa82 res_xmpp: Correctly check return value of SSL_connect
SSL_connect returns non-zero for both success and some error conditions
so simply negating is inadequate.

Change-Id: Ifbf882896e598703b6c615407fa456d3199f95b1
2017-03-23 08:57:57 -06:00
Sean Bright
eed582888f res_xmpp: Don't crash when trying to send a message without a connection
If we never establish a connection to our Jabber server, iksemel never sets up
its internal transport pointer, so attempting to send a message dereferences a
NULL pointer and causes a crash.

ASTERISK-21855 #close
Reported by: Jeremy Kister

Change-Id: I204a568894e4a53ab929783ecc594a000f04d79c
2017-03-23 08:57:02 -06:00
Sean Bright
e771bf9787 res_xmpp: Include client name in connection related error messages
ASTERISK-25622 #close
Reported by: Sean Darcy

Change-Id: I8472cb7bfb58d411a3cfbd482da98cae2d94d1e9
2017-03-23 08:56:35 -06:00
zuul
bdc0514b08 Merge "CHANNEL(callid): Give dialplan access to the callid." into 14 2017-03-22 17:09:33 -05:00
zuul
a6761d2d58 Merge "res_pjsip_session: Enable RFC3578 overlap dialing support." into 14 2017-03-22 15:48:56 -05:00
Kevin Harwell
d0649254b5 rtp_engine: allocate RTP dynamic payloads per session
Dynamic payload types were statically defined in Asterisk. This unfortunately
limited the number of dynamic payloads that could be registered. With this patch
dynamic payload type numbers are now assigned dynamically and per RTP instance.
However, in order to limit any issues where some clients expect the old
statically defined value this patch makes it so the value Asterisk used to pre-
designate is used for the dynamic assignment if available.

An option, "rtp_use_dynamic", has also been added (can be set in asterisk.conf)
that turns the new dynamic behavior on or off. When off it reverts back to using
statically defined payload values. This option defaults to "no" in Asterisk 14.

ASTERISK-26515 #close
patches:
  ASTERISK-26515.diff submitted by jcolp (license 5000)

Change-Id: If282877199b85da8dde7eb9452cdedaa19da586a
2017-03-22 15:46:56 -05:00
zuul
ab0a05716d Merge "res_pjsip_messaging: Check URI type before dereferencing" into 14 2017-03-22 12:36:47 -05:00