Commit Graph

31164 Commits

Author SHA1 Message Date
Friendly Automation
7bcfcd3433 Merge "app_amd: Fixed timeout issue" into 13 2019-11-20 10:34:25 -06:00
Friendly Automation
243c1af2b9 Merge "func_curl.c: Support custom http headers" into 13 2019-11-20 09:55:01 -06:00
George Joseph
95213b01d2 CI: Fix missing script block in jenkinsfiles
Change-Id: I9f44a3d5085ea7880fad1a3883a4820907e29ea3
2019-11-19 11:11:06 -07:00
George Joseph
d60f23ecbd CI: Fix missing script block in jenkinsfiles
Change-Id: Ib4b6e4887695f230ea7a5b0c879b29fc5a13be4f
2019-11-19 10:41:22 -07:00
George Joseph
7702ea986e CI: Increase clone depth and do better cleanup
The original clone depth of 10 was causing the need to rebase
changes whose parent was older than the 10 commits.  The clone
depth has been increased to 100.

Workspace cleanup was only happening for successful builds which
wasn't enough to keep the 8G workspace in-memory drives on the
docker slaves from filling up.  Now the workspaces are cleaned up
after every build regardless of success/failure.  If you need to
preserve builds temporarily, you can log into Jenkins/Manage
Jenkins/Configure System and change the CLEANUP_WS_* environment
variable for the job type you're troubleshooting to "FALSE".

Change-Id: I0d7366e87cea714e5dbc9488caf718802fce75ca
2019-11-19 11:58:41 -05:00
Friendly Automation
8508a06706 Merge "serializer: set high/low alert levels on whole pool" into 13 2019-11-19 10:10:23 -06:00
George Joseph
c79db42573 Merge "parking: Fix case where we can't get the parker." into 13 2019-11-19 09:23:05 -06:00
Alexei Gradinari
26fc3a3127 serializer: set high/low alert levels on whole pool
The current code sets alert levels starting from index 1.
Need to set on whole pool starting from index 0.

Change-Id: I5decbb43160954fb9a512f04302637fc666b6f5d
2019-11-18 11:06:20 -05:00
George Joseph
ab28da7c9d Merge "func_env: Prevent FILE() from reading garbage at end-of-file" into 13 2019-11-18 09:54:16 -06:00
Friendly Automation
a42f3ff3b7 Merge "res_rtp_asterisk: Always return provided DTLS packet length." into 13 2019-11-18 09:13:10 -06:00
Friendly Automation
803bc786f6 Merge "various files - fix some alerts raised by lgtm code analysis" into 13 2019-11-18 09:12:57 -06:00
Friendly Automation
e82a91ee1c Merge "bridge_softmix: clear hold when joining a softmix bridge" into 13 2019-11-18 09:12:17 -06:00
Martin Tomec
f032b8c158 func_curl.c: Support custom http headers
When user wants to send json data, the default Content-Type header
is incorect (application/x-www-form-urlencoded). This patch allows
to set any custom headers so the Content-Type header can be
overriden. User can set multiple headers by multiple calls of
curlopt(). This approach is not consistent with other parameters,
but is more readable in dialplan than one call with multiple
headers.

ASTERISK-28613

Change-Id: I4dd68c3f4e25362ef941d73a3861f58348dcfbf9
2019-11-15 13:54:52 +00:00
Joshua Colp
eb3b49928e parking: Fix case where we can't get the parker.
ASTERISK-28616

Change-Id: Iabe31ae38d01604284fcc5c2438d44e29a32ea4d
2019-11-15 06:46:37 -04:00
George Joseph
7a236ed20d stasis: Don't hold app_registry and session locks unnecessarily
resource_events:app_handler() was locking the session, then
attempting to determine if the app had debug enabled which
locked the app_registry container.  res_stasis:__stasis_app_register
was locking the app_registry container then calling app_update
which caused app_handler (which locks the session) to run.
The result was a deadlock.

* Updated resource_events:app_handler() to determine if debug was
  set (which locks the app_registry) before obtaining the session lock.

* Updated res_stasis:__stasis_app_register to release the app_registry
  container lock before calling app_update (which locks the sesison).

ASTERISK-28423
Reported by Ross Beer

Change-Id: I58c69d08cb372852a63933608e4d6c3e456247b4
2019-11-14 17:22:58 -06:00
Michael Cargile
9361e32bed app_amd: Fixed timeout issue
ASTERISK_28143 attempted to fix an issue where calls with no audio would never
timeout. It did so by adding AST_FRAME_NULL as a frame type to process in its
calculations. Unfortunately these frames seem to show up at irregular time
intervals. This resulted in app_amd returning prematurely most of the time.

* Removed AST_FRAME_NULL from the calculations
* Added a check to see how much time has actually passed since app_amd began

ASTERISK-28608

Change-Id: I642a21b02d389b17e40ccd5357754b034c3daa42
2019-11-14 11:03:05 -05:00
Joshua Colp
6856cdc6ba res_rtp_asterisk: Always return provided DTLS packet length.
OpenSSL can not tolerate if the packet sent out does not
match the length that it provided to the sender. This change
lies and says that each time the full packet was sent. If
a problem does occur then a retransmission will occur as
appropriate.

ASTERISK-28576

Change-Id: Id42455b15c9dc4eb987c8c023ece6fbf3c22a449
2019-11-14 06:20:17 -04:00
Kevin Harwell
300e21662c bridge_softmix: clear hold when joining a softmix bridge
MOH continues to play to a channel if that channel was on hold prior to
entering a softmix bridge. MOH will not stop even if the original "holder"
attempts an unhold.

For the most part a softmix bridge ignores holds, so a participating channel
shouldn't join while on hold. This patch checks to see if the channel joining
the softmix bridge is currently on hold. If so then it indicates an unhold.

ASTERISK-28618

Change-Id: I66ccd4efc80f5b4c3dd68186b379eb442916392b
2019-11-13 18:54:26 -05:00
Joshua Colp
3b94982b4f parking: Use channel snapshot instead of channel.
There exists a scenario where a thread can hold a lock on the
channels container while trying to lock a bridge. At the same
time another thread can hold the lock for said bridge while
attempting to retrieve a channel. This causes a deadlock.

This change fixes this scenario by retrieving a channel snapshot
instead of a channel, as information present in the snapshot
is all that is needed.

ASTERISK-28616

Change-Id: I68ceb1d62c7378addcd286e21be08a660a7cecf2
2019-11-13 19:17:43 -04:00
Sean Bright
e5d0add8c6 func_env: Prevent FILE() from reading garbage at end-of-file
If the last line of a file does not have a terminating EOL sequence, we
potentially add garbage to the value returned from the FILE() function.

There is no overflow potential here as we are reading from a buffer of a
known size, we are just reading too much of it.

ASTERISK-26481 #close

Change-Id: I50dd4fcf416fb3c83150040a1a79a59d9eb1ae01
2019-11-13 15:38:40 -05:00
Kevin Harwell
6ca76798e1 various files - fix some alerts raised by lgtm code analysis
This patch fixes several issues reported by the lgtm code analysis tool:

https://lgtm.com/projects/g/asterisk/asterisk

Not all reported issues were addressed in this patch. This patch mostly fixes
confirmed reported errors, potential problematic code points, and a few other
"low hanging" warnings or recommendations found in core supported modules.
These include, but are not limited to the following:

* innapropriate stack allocation in loops
* buffer overflows
* variable declaration "hiding" another variable declaration
* comparisons results that are always the same
* ambiguously signed bit-field members
* missing header guards

Change-Id: Id4a881686605d26c94ab5409bc70fcc21efacc25
2019-11-11 18:11:27 -06:00
George Joseph
7a85a947af cdr_mysql: Fix missing use of 'my_bool' with MySql >= 8.0.1
MySql 8.0.1 replaced the "my_bool" type with "bool" so an #if
was added to use "bool" with MYSQL_VERSION_ID >= 80001.

ASTERISK-28604

Change-Id: I66a28d8f0011e33774edee13a6f8efd2302bb920
2019-11-07 07:30:36 -06:00
Joshua Colp
9c8424a97b res_pjsip_outbound_registration: Extend documentation for "max_retries".
If the "max_retries" option is set to 0 then upon failure no
further attemps are made, so explicitly document the behavior.

ASTERISK-28602

Change-Id: I1e30daae9dd6c49ce18744164214d3def505acbf
2019-10-31 11:52:43 -05:00
Friendly Automation
854a8014ce Merge "res_calendar: Resolve memory leak on calendar destruction" into 13 2019-10-29 09:37:27 -05:00
Sean Bright
27fc662cf2 res_calendar: Resolve memory leak on calendar destruction
Calling ne_uri_parse allocates memory that needs to be freed with a
corresponding call to ne_uri_free.

ASTERISK-28572 #close

Change-Id: I8a6834da27000a6807d89cb7a157b2a88fcb5e61
2019-10-24 10:15:14 -04:00
Joshua Colp
50feafe9b8 res_ari_events: Add module reference when a WebSocket is open.
This change ensures that the module isn't unloaded when a
WebSocket is open. Previously it was possible to unload the
module manually or during shutdown which could cause a crash
when any active WebSockets were terminated.

ASTERISK-28585

Change-Id: I85c71ab112f99875b586419a34c08c8b34c14c5c
2019-10-24 07:21:31 -03:00
Friendly Automation
6f2431cb13 Merge "utils.h: Set lower bound for thread stack size to PTHREAD_STACK_MIN" into 13 2019-10-21 13:21:30 -05:00
Sean Bright
f1e3a13579 utils.h: Set lower bound for thread stack size to PTHREAD_STACK_MIN
ASTERISK-28590 #close

Change-Id: I51abce00c04d0a06550bda5205580705185b9c1c
2019-10-21 08:04:48 -05:00
Friendly Automation
8e42a55ebd Merge "app_voicemail.c: Support multiple file formats for forwarded messages." into 13 2019-10-21 07:19:41 -05:00
Friendly Automation
c56663b2cf Merge "Crash during "pjsip show channelstats" execution" into 13 2019-10-21 07:18:16 -05:00
Sean Bright
0cccfcba9e README-SERIOUSLY.bestpractices.md: Speling correetions.
ASTERISK-28586 #close

Change-Id: I43dc4e8bd9dc685b17695b215a5360314074734f
2019-10-16 17:07:15 -04:00
Salah Ahmed
414eebcbc9 Crash during "pjsip show channelstats" execution
During execution "pjsip show channelstats" cli command by an
external module asterisk crashed. It seems this is a separate
thread running to fetch and print rtp stats. The crash happened on
the ao2_lock method, just before it going to read the rtp stats on
a rtp instance. According to gdb backtrace log, it seems the
session media was already cleaned up at that moment.

ASTERISK-28578

Change-Id: Ia918bfa3c8119060633e39b14852e8d983e0417e
2019-10-16 13:33:03 -05:00
cmaj
c8e38f8550 app_voicemail.c: Support multiple file formats for forwarded messages.
If you specify multiple formats in voicemail.conf, eg. "format = gsm|wav"
and are using realtime ODBC backend, only the first format gets stored
in the database. So when you forward a message later on, there is a bug
generating the email, related to the stored format (GSM) being different
than the desired email format (WAV) specified for the user. Sox can
handle this, but Asterisk needs to tell sox exactly what to do.

ASTERISK-22192

Change-Id: I7321e7f7e7c58adbf41dd4fd7191c887b9b2eafd
2019-10-14 16:18:08 -06:00
Friendly Automation
78ad383837 Merge "res_pjsip_mwi: potential double unref, and potential unwanted double link" into 13 2019-10-14 10:18:23 -05:00
Friendly Automation
59487acfb8 Merge "pbx: deadlock when outgoing dialed channel hangs up too quickly" into 13 2019-10-14 06:49:02 -05:00
Joshua Colp
337e4ed671 Merge "cdr_pgsql cel_pgsql res_config_pgsql: compatibility with PostgreSQL 12" into 13 2019-10-14 06:28:41 -05:00
Christoph Moench-Tegeder
a7749f4fcd cdr_pgsql cel_pgsql res_config_pgsql: compatibility with PostgreSQL 12
PostgreSQL 12 finally removed column adsrc from table pg_catalog.pg_attrdef
(column default values), which has been deprecated since version 8.0.
Since then, the official/correct/supported way to retrieve the column
default value from the catalog is function pg_catalog.pg_get_expr().

This change breaks compatibility with pre-8.0 PostgreSQL servers,
but has reached end-of-support more than a decade ago.
cdr_pgsql and res_config_pgsql still have support for pre-7.3
servers, but cleaning that up is perhaps a topic for a major release,
not this bugfix.

ASTERISK-28571

Change-Id: I834cb3addf1937e19e87ede140bdd16cea531ebe
2019-10-14 05:06:42 -05:00
George Joseph
91d5094464 Merge "pjproject_bundled: Replace earlier reverts with official fixes." into 13 2019-10-11 09:32:04 -05:00
csavinovich
c3a1f2ce91 test_taskprocessor.c: Fix test failure on Ubuntu
Fixes a failure in /main/taskprocesor unit test, only occurring in Ubuntu.
Newer versions of GCC require variable initialization.

Change-Id: I2994d8aab9307a8c2c7330584f287a27144a580c
2019-10-10 17:31:31 -05:00
Kevin Harwell
e34651d62c res_pjsip_mwi: potential double unref, and potential unwanted double link
When creating an unsolicited MWI aggregate subscription it was possible for
the subscription object to be double unref'ed. This patch removes the explicit
unref as it is not needed since the RAII_VAR will handle it at function end.

Less concerning there was also a bug that could potentially allow the aggregate
subscription object to be added to the unsolicited container twice. This patch
ensures it is added only once.

ASTERISK-28575

Change-Id: I9ccfdb5ea788bc0c3618db183aae235e53c12763
2019-10-10 15:30:06 -05:00
George Joseph
ba55298891 Merge "Revert "app_voicemail: Cleanup stale lock files on module load"" into 13 2019-10-10 13:45:12 -05:00
George Joseph
6ff5432a07 Merge "res_pjsip_mwi: use an ao2_global object for mwi containers" into 13 2019-10-10 09:12:09 -05:00
George Joseph
1bb0e60e55 Merge "res_pjsip/res_pjsip_mwi: use centralized serializer pools" into 13 2019-10-10 09:11:54 -05:00
George Joseph
46c70c67f9 Merge "serializer: move/add asterisk serializer pool functionality" into 13 2019-10-10 09:11:25 -05:00
George Joseph
164e5372a2 pjproject_bundled: Replace earlier reverts with official fixes.
Issues in pjproject 2.9 caused us to revert some of their changes
as a work around.  This introduced another issue where pjproject
wouldn't build with older gcc versions such as that found on
CentOS 6.  This commit replaces the reverts with the official
fixes for the original issues and allows pjproject to be built
on CentOS 6 again.

ASTERISK-28574
Reported-by: Niklas Larsson

Change-Id: I06f8507bea553d1a01b0b8874197d35b9d47ec4c
2019-10-10 05:34:58 -06:00
Kevin Harwell
a2ddaaac32 pbx: deadlock when outgoing dialed channel hangs up too quickly
Here's the basic scenario that occurred when executing an AMI fast originate
while at the same time something else locks the channels container, and also
wants a lock on the dialed channel:

1. pbx_outgoing_attempt obtains a lock on a dialed channel
2. concurrently another thread obtains a lock on the channels container, and
   subsequently requests a lock on the dialed channel. It waits on #1. For
   instance, "core show channel <dialed channel"
3. the outgoing call does not fail, but ends before the pbx_outgoing_attempt
   function exits
4. pbx_outgoing_attempt function exits, the outgoing structure destructs, and
   attempts to hang up the dialed channel
5. hang up tries to obtain the channels container lock, but can't due to #2.
6. Asterisk is deadlocked.

The solution was to allow the pbx_outgoing_exec function to "steal" ownership
of the dialed channel, and handle hanging it up. The channel now is either hung
up prior to it being potentially locked by the initiating thread, or if locked
the hang up takes place in a different thread, thus alleviating the deadlock.

ASTERISK-28561
patches:
  iliketrains.diff submitted by Joshua Colp (license 5000)

Change-Id: I51b42b92dde8f2215b69bb509e28667ee3a3853a
2019-10-09 16:06:53 -05:00
lvl
bc8d56816d chan_pjsip: Prevent segfault when running PlayDTMF on hungup channel
ASTERISK-28086 #close

Change-Id: Ib3baadc89b9f0477a6f25a63861433812368c5ea
2019-10-09 05:47:09 -06:00
George Joseph
32c52b7dda Merge "cdr_mysql: Don't clean up on unload unless we can unregister from CDRs" into 13 2019-10-08 08:24:15 -05:00
Sean Bright
0834e06673 Revert "app_voicemail: Cleanup stale lock files on module load"
This reverts commit fd2e8d0da7.

Reason for revert: Problematic for users who store their voicemail
on network storage devices, or share voicemail storage between
multiple Asterisk instances.

ASTERISK-28567 #close

Change-Id: I3ff4ca983d8e753fe2971f3439bd154705693c41
2019-10-08 06:34:27 -05:00
Kevin Harwell
3f7f376a68 res_pjsip_mwi: use an ao2_global object for mwi containers
On shutdown it's possible for the unsolicited mwi container to be freed before
other dependent threads are done using it. This patch ensures this can no
longer happen by wrapping the container in an ao2_global object. The solicited
container was also changed too.

ASTERISK-28552

Change-Id: I8f812286dc19a34916acacd71ce2ec26e1042047
2019-10-07 16:48:26 -05:00