Commit Graph

29164 Commits

Author SHA1 Message Date
George Joseph
2c5aaeed09 modules: change module LOAD_FAILUREs to LOAD_DECLINES (14)
Change-Id: If99e3b4fc2d7e86fc3e61182aa6c835b407ed49e
2017-04-12 16:53:48 -05:00
George Joseph
cc668bd522 modules: change module LOAD_FAILUREs to LOAD_DECLINES
In all non-pbx modules, AST_MODULE_LOAD_FAILURE has been changed
to AST_MODULE_LOAD_DECLINE.  This prevents asterisk from exiting
if a module can't be loaded.  If the user wishes to retain the
FAILURE behavior for a specific module, they can use the "require"
or "preload-require" keyword in modules.conf.

A new API was added to logger: ast_is_logger_initialized().  This
allows asterisk.c/check_init() to print to the error log once the
logger subsystem is ready instead of just to stdout.  If something
does fail before the logger is initialized, we now print to stderr
instead of stdout.

Change-Id: I5f4b50623d9b5a6cb7c5624a8c5c1274c13b2b25
2017-04-12 15:47:56 -06:00
zuul
0986618c94 Merge "bridging: Ensure successful T.38 negotation" into 14 2017-04-12 15:34:28 -05:00
Joshua Colp
443da32d49 Merge "res_rtp_asterisk.c: Add stun_blacklist option" into 14 2017-04-12 09:03:08 -05:00
Torrey Searle
443058f154 bridging: Ensure successful T.38 negotation
When a T.38 happens immediatly after call establishment, the control
frame can be lost because the other leg is not yet in the bridge.

This patch detects this case an makes sure T.38 negotation happens
when the 2nd leg is being made compatible with the negotating
first leg

ASTERISK-26923 #close

Change-Id: If334125ee61ed63550d242fc9efe7987e37e1d94
2017-04-12 07:56:58 -05:00
Joshua Colp
c4bbf0c0db Merge changes from topic 'ASTERISK-26890' into 14
* changes:
  stun.c: Fix ast_stun_request() erratic timeout.
  sorcery.c: Speed up ast_sorcery_retrieve_by_id()
  res_pjsip: Fix pointer use after unref.
2017-04-12 04:54:54 -05:00
Joshua Colp
26081c5417 Merge "res_pjsip_sdp_rtp.c: Don't use deprecated transport struct member." into 14 2017-04-12 04:53:40 -05:00
Richard Mudgett
f592947b98 res_rtp_asterisk.c: Add stun_blacklist option
Added the stun_blacklist option to rtp.conf.  Some multihomed servers have
IP interfaces that cannot reach the STUN server specified by stunaddr.
Blacklist those interface subnets from trying to send a STUN packet to
find the external IP address.  Attempting to send the STUN packet
needlessly delays processing incoming and outgoing SIP INVITEs because we
will wait for a response that can never come until we give up on the
response.  Multiple subnets may be listed.

ASTERISK-26890 #close

Change-Id: I3ff4f729e787f00c3e6e670fe6435acce38be342
2017-04-11 13:00:06 -05:00
Richard Mudgett
3408561eb7 stun.c: Fix ast_stun_request() erratic timeout.
If ast_stun_request() receives packets other than a STUN response then we
could conceivably never exit if we continue to receive packets with less
than three seconds between them.

* Fix poll timeout to keep track of the time when we sent the STUN
request.  We will now send a STUN request every three seconds regardless
of how many other packets we receive while waiting for a response until we
have completed three STUN request transmission cycles.

Change-Id: Ib606cb08585e06eb50877f67b8d3bd385a85c266
2017-04-11 13:00:06 -05:00
Richard Mudgett
797dfc13a9 res_pjsip_sdp_rtp.c: Don't use deprecated transport struct member.
* create_rtp(): Eliminate use of deprecated transport struct member.  That
member and several others in the transport structure were deprecated
because of an infinite loop created when using realtime configuration.
See 2451d4e455

ASTERISK-26851

Change-Id: I0533aa13c9ce3c6cc394e0fd2b5bf1cd1b2ef3bc
2017-04-11 13:00:06 -05:00
Richard Mudgett
5bf425840e sorcery.c: Speed up ast_sorcery_retrieve_by_id()
Return early if ast_sorcery_retrieve_by_id() is not passed an id to find.
Also eliminated the RAII_VAR() usage in the function.

Change-Id: I871dbe162a301b5ced8b4393cec27180c7c6b218
2017-04-11 13:00:06 -05:00
Richard Mudgett
63560ae9b2 res_pjsip: Fix pointer use after unref.
Change-Id: I4b6e1b0070563eeaee223cb58326f1b962ed5bc1
2017-04-11 13:00:06 -05:00
Richard Mudgett
866510d85b tcptls.c: Cleanup TCP/TLS listener thread on abnormal exit.
Temporarily running out of file descriptors should not terminate the
listener thread.  Otherwise, when there becomes more file descriptors
available, nothing is listening.

* Added EMFILE exception to abnormal thread exit.

* Added an abnormal TCP/TLS listener exit error message.

* Closed the TCP/TLS listener socket on abnormal exit so Asterisk does not
appear dead if something tries to connect to the socket.

ASTERISK-26903 #close

Change-Id: I10f2f784065136277f271159f0925927194581b5
2017-04-11 11:15:01 -05:00
Walter Doekes
09252e9d59 samples: Undo removal of include from canonicalize-app-names commit.
This include was accidentally removed in changeset
Ia79aea64de89531362e993e34230c2044a70aa93. My bad.

Change-Id: I1d716c7f9590b4e97909fb8bca1f2ed9bd0e4082
2017-04-08 03:16:14 -05:00
Joshua Colp
2112bd6d71 Merge "pjproject_bundled: Crash on pj_ssl_get_info() while ioqueue_on_read_complete()." into 14 2017-04-07 16:19:48 -05:00
Joshua Colp
2bedb0f996 Merge "pjsip: Add Alembic for PUBLISH support." into 14 2017-04-07 15:01:11 -05:00
Joshua Colp
7942378c55 pjsip: Add Alembic for PUBLISH support.
This change adds database tables for the PUBLISH support so it
can be configured using realtime. A minor fix to the
res_pjsip_publish_asterisk module was done so that it read the
sorcery configuration from the correct section. Finally the
sample configuration files have been updated.

ASTERISK-26928

Change-Id: I81991ae5c75af98d247f7eacd1c0b0a763675952
2017-04-07 08:44:42 -05:00
Alexander Traud
884bc5f76d pjproject_bundled: Crash on pj_ssl_get_info() while ioqueue_on_read_complete().
When the Asterisk channel driver res_pjsip offers SIP-over-TLS, sometimes, not
reproducible, Asterisk crashed in pj_ssl_sock_get_info() because a NULL pointer
was read. This change avoids this crash.

ASTERISK-26927 #close

Change-Id: I24a6011b44d1426d159742ff4421cf806a52938b
2017-04-07 08:09:29 -05:00
Walter Doekes
c5533488cc samples: Canonicalize app names in extensions.conf.sample.
This takes care of warnings by ossobv/asterisklint.

Change-Id: Ia79aea64de89531362e993e34230c2044a70aa93
2017-04-06 15:57:08 -05:00
Joshua Colp
f3a435b52e Merge "chan_sip: Session Timers required but refused wrongly." into 14 2017-04-06 10:49:36 -05:00
George Joseph
7ceefcfa99 Merge "pjproject_bundled: Add 3 upstream patches" into 14 2017-04-06 10:24:51 -05:00
Joshua Colp
5bdc535e7a Merge "sample_config: Add samples for pubsub to pjsip.conf.sample" into 14 2017-04-06 08:29:48 -05:00
Joshua Colp
ad9b764abf Merge "Unused realtime MOH classes not purged on 'moh reload'" into 14 2017-04-05 19:20:32 -05:00
Joshua Colp
a83e94a803 Merge "res_pjsip_session: Allow BYE to be sent on disconnected session." into 14 2017-04-05 19:08:09 -05:00
George Joseph
e8cace12ba pjproject_bundled: Add 3 upstream patches
0035-r5572-svn-backport-dialog-transaction-deadlock.patch
0036-r5573-svn-backport-ua-pjsua-transaction-deadlock.patch
0037-r5576-svn-backport-session-timer-crash.patch

Also removed the progress bar from wget download to stdout.

ASTERISK-26905 #close
Reported-by: Ross Beer

Change-Id: I268fb3cf71a3bb24283ff0d24bd8b03239d81256
2017-04-05 17:17:16 -05:00
George Joseph
baf7660c7b sample_config: Add samples for pubsub to pjsip.conf.sample
Added:
 * outbound-publish
 * resource_list
 * inbound-publication
 * asterisk-publication

Change-Id: I65043a896c35483f30a92d30b5b118359af7ba5a
2017-04-05 14:53:10 -05:00
Richard Mudgett
21abdc2d9a res_pjsip_sdp_rtp.c: Don't alter global addr variable.
* create_rtp(): Fix unexpected alteration of global address_rtp if a
transport is bound to an address.

* create_rtp(): Fix use of uninitialized memory if the endpoint RTP media
address is invalid or the transport has an invalid address.

ASTERISK-26851

Change-Id: Icde42e65164a88913cb5c2601b285eebcff397b7
2017-04-04 13:37:52 -05:00
Corey Farrell
b8df68c62d CDR: Protect from data overflow in ast_cdr_setuserfield.
ast_cdr_setuserfield wrote to a fixed length field using strcpy. This could
result in a buffer overrun when called from chan_sip or func_cdr. This patch
adds a maximum bytes written to the field by using ast_copy_string instead.

ASTERISK-26897 #close
patches:
  0001-CDR-Protect-from-data-overflow-in-ast_cdr_setuserfie.patch submitted
    by Corey Farrell (license #5909)

Change-Id: Ib23ca77e9b9e2803a450e1206af45df2d2fdf65c
2017-04-04 10:13:55 +00:00
Daniel Journo
ed3b0cbd2a Unused realtime MOH classes not purged on 'moh reload'
Purge Realtime MOH classes on 'moh reload' even when musiconhold.conf
hasn't changed.

ASTERISK-25974 #close

Change-Id: I42c78ea76528473a656f204595956c9eedcf3246
2017-04-03 17:43:39 -05:00
Richard Mudgett
7ee8ec19fd res_pjsip: Fix transport ref leak.
We were leaking a transport ref in multihomed_on_rx_message() which
resulted in the FRACK about excessive ref counts.

ASTERISK-26916 #close

Change-Id: I7a96658a9614a060565bb9ad51cb1c9c11ee145f
2017-04-03 14:03:17 -05:00
Alexander Traud
65c87a8ea9 chan_sip: Session Timers required but refused wrongly.
SIP user-agents indicate which protocol extensions are allowed in headers
like Supported and Required. Such protocol extensions are Session Timers
(RFC 4028) for example. Session Timers are supported since Mantis-10665.
Since ASTERISK-21721, not only the first but multiple Supported/Required
headers in a message are parsed. In that change, an existing variable was
re-used within a newly added do-loop. Currently, at the end of that loop,
that variable is an empty string always. Previously, that variable was used
within log output. However, the log output was not changed.

ASTERISK-26915 #close

Change-Id: I09315f31b4d78fb214bb2a9fb6c0f5e143eae990
2017-04-03 02:44:05 -05:00
Joshua Colp
25db34f8a1 Merge "Forward declare 'struct ast_json' in asterisk.h" into 14 2017-04-01 07:06:27 -05:00
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