Commit Graph

30232 Commits

Author SHA1 Message Date
Jenkins2
9792bb0aa9 Merge "cdr: Missing NULL check and unlock." into 13 2017-12-28 10:32:29 -06:00
Sean Bright
bae301c18c cdr_mysql: Make sure connection charset is always set
When the MYSQL_OPT_RECONNECT option is enabled, the MySQL client API
will transparently reconnect when it needs to. Ideally this simplifies
our code, but when this reconnection occurs all connection state is
lost. Because we are not notified that this has happened, we don't know
to set our character set again (with "SET NAMES 'xyz'").

Rather than calling SET NAMES, we instead set the MYSQL_SET_CHARSET_NAME
option which will do it for us under the hood on each connect. This
option has been present in the MySQL C API for at least 15 years, so it
should be safe for most installations.

I also snuck a few other changes into this patch:

* Default the MySQL port to MYSQL_PORT (3306) instead of 0 if it's not
  defined.

* Fix some erroneous and/or silly checks on the contents of the
  configuration ast_str values.

ASTERISK-27366 #close
Reported by: Halil İbrahim YILDIZ

Change-Id: I36bf8dc5d5f83584e803b3b1a151dea9396ab8f5
2017-12-28 10:38:01 -05:00
Richard Mudgett
5de8f49294 manager.c: Update AMI Status event documentation
The AMI Status event had linkedid listed twice and was missing the
effective connected line name and number headers.

NOTE: The linkedid and other standard channel snapshot fields in the XML
documentation are part of the <channel_snapshot/> XML template defined in
doc/appdocsxml.xslt.

* Cached the effective connected line party id so it doesn't get
calculated four times.

Change-Id: I004c4c4f9e7b40ef55035c831702721bec82496c
2017-12-28 09:15:54 -06:00
Richard Mudgett
9f1cfbafca bridge_native_rtp.c: Fix reentrancy framehook crash.
If two channels enter different native rtp bridges at the same time it is
possible that the framehook interface data pointer can be corrupted
because the struct variable was declared static.

* Fixed the reentrancy corruption by changing the framehook interface
struct static variable to a stack local variable.

* Moved the hook.data assignment outside of the channel lock.  It did not
need the lock's protection.  It probably was giving a false sense of
security.

The testsuite
channels/pjsip/basic_calls/two_parties/nominal/alice_initiated/bob_hangs_up
test caught this with MALLOC_DEBUG and DO_CRASH enabled.

Change-Id: If9e35b97d19209b0f984941c1d8eb5f7c55eea91
2017-12-27 23:16:21 -06:00
Richard Mudgett
eead5d0c30 func_channel.c: Update MASTER_CHANNEL documentation
Be more explicit in what is meant by the master channel to eliminate
misunderstanding.

ASTERISK-23133

Change-Id: I453bcaf4b99404a5a3e345dbf093ac6c1afcfc72
2017-12-27 21:15:06 -06:00
Corey Farrell
0bdddbe526 menuselect: Fix check for running configure.
menuselect/Makefile checks that autoconfig.h and makeopts were newer
than the '.in' files.  Unfortunately running ./configure does not touch
autoconfig.h unless the contents will change.

Instead of looking at autoconfig.h we just need to ensure that makeopts
is newer than configure.

Also make change to configure.ac so bootstrap.sh doesn't re-add the
extra trailing line-feed.

Change-Id: Ief1f831d6717007f9cebb668c14e92782cd2b794
2017-12-27 20:17:06 -06:00
Corey Farrell
d62c87bb8d cdr: Missing NULL check and unlock.
* handle_dial_message: Missing a check for NULL peer.
* ast_cdr_register: Missing unlock on allocation failure.

ast_cdr_register is fixed by reordering so the new structure is
allocated and initialized before locking the list.

Change-Id: I5799b99270d1a7a716a555c31ac85f4b00ce8686
2017-12-25 20:53:02 -06:00
Corey Farrell
92fb393cab loader: Add volatile to resource_being_loaded.
Some compiler optimizers seem to assume that dlopen will not use
__attribute__((constructor)) functions to call back to the program.
This was causing resource_being_loaded to be optimized away completely.

ASTERISK-27531 #close
Tested By: abelbeck

Change-Id: If17a3b889e06811a0e7119f0539d052494d6ece9
2017-12-24 00:34:58 -05:00
Kevin Harwell
53799318bc AST-2017-014: res_pjsip - Missing contact header can cause crash
Those SIP messages that create dialogs require a contact header to be present.
If the contact header was missing from the message it could cause Asterisk to
crash.

This patch checks to make sure SIP messages that create a dialog contain the
contact header. If the message does not and it is required Asterisk now returns
a "400 Missing Contact header" response. Also added NULL checks when retrieving
the contact header that were missing as a "just in case".

ASTERISK-27480 #close

Change-Id: I1810db87683fc637a9e3e1384a746037fec20afe
2017-12-22 15:38:56 -06:00
Sean Bright
ce3d56920b Remove as much trailing whitespace as possible.
Change-Id: I873c1c6d00f447269bd841494459efccdd2c19c0
2017-12-22 09:14:07 -05:00
Jenkins2
35a2e09c65 Merge "Fix some invalid Unicode characters" into 13 2017-12-22 07:45:52 -06:00
Jenkins2
29b10b42bb Merge "app_voicemail: Fix file copy error handling." into 13 2017-12-22 07:26:22 -06:00
Sean Bright
b4ae112e3a Fix some invalid Unicode characters
configs/samples/minivm.conf.sample contains invalid UTF-8, but that
appears to be intentional.

Change-Id: I7b1e0d332f3380fd0425962a3c9c55f9b200c8cc
2017-12-21 11:18:17 -05:00
Jenkins2
d85290ca48 Merge "Fix Common Typo's." into 13 2017-12-21 08:34:31 -06:00
Joshua Colp
e94962ce63 Merge "docs: Remove old API changes documentation" into 13 2017-12-21 06:35:22 -06:00
Jenkins2
2ca8095691 Merge "app_festival: Fix fd leak on connection failure." into 13 2017-12-21 06:11:47 -06:00
Jenkins2
0097ad91ef Merge "bridge: Old channel video source not set to NULL after unref." into 13 2017-12-21 05:47:18 -06:00
Joshua Colp
8030309a2f Merge "core: Fix unused variable error in handle_show_sysinfo." into 13 2017-12-21 05:46:32 -06:00
Corey Farrell
719e8eee03 app_voicemail: Fix file copy error handling.
Fix error where input/output file descriptors would be closed multiple
times.

Change-Id: Iba5140b60cb7de79e3d5d92be3c256947aa99da9
2017-12-20 21:39:53 -06:00
Sean Bright
6892c13a2c docs: Remove old API changes documentation
Change-Id: I1bc7957121cc7ae27dca04acc3613f4e1858476a
2017-12-20 15:54:24 -05:00
Corey Farrell
82b6ba976f Fix Common Typo's.
Fix instances of:
* Retreive
* Recieve
* other then
* different then
* Repeated words ("the the", "an an", "and and", etc).
* othterwise, teh

ASTERISK-24198 #close

Change-Id: I3809a9c113b92fd9d0d9f9bac98e9c66dc8b2d31
2017-12-20 12:54:13 -05:00
Richard Mudgett
4f45748f52 manager.h: Bump AMI version
Change-Id: I62e6ddeb261ef012687e1fb6734c554e2499b6bf
2017-12-20 11:30:54 -06:00
Corey Farrell
6b3188fb8c app_festival: Fix fd leak on connection failure.
Change-Id: If5efaddcf735ff7d17e55c36cc1388946cee9e0f
2017-12-20 10:59:50 -06:00
Corey Farrell
be3800c49d bridge: Old channel video source not set to NULL after unref.
The bridge holds onto the old channel video source after it's been
released.  This can lead to use after free errors.

ASTERISK-27229 #close

Change-Id: Ib2dab61677dd8a21f7ad53cdc9b8ca93297838b3
2017-12-20 10:26:38 -06:00
Corey Farrell
d05ec48145 core: Fix unused variable error in handle_show_sysinfo.
Apparently in OSX it's possible for OSX to HAVE_SYSCTL but not
HAVE_SYSINFO or HAVE_SWAPCTL.  In this case freeswap caused an unused
variable error.

ASTERISK-26563 #close

Change-Id: I8ec5b1897b786cc1abaf62264aa75039eea05510
2017-12-20 10:16:48 -06:00
Joshua Colp
616659d620 Merge "CLI: Address multiple issues." into 13 2017-12-20 08:34:37 -06:00
Jenkins2
b100233801 Merge "bridge: Stop music on hold on adding an arbitrary channel to a bridge" into 13 2017-12-20 08:11:54 -06:00
Jenkins2
2072057657 Merge "res_rtp_asterisk: Avoid close the rtp/rtcp fd twice." into 13 2017-12-20 07:47:22 -06:00
Joshua Colp
f1d50c0fb0 Merge "core: Fix multiple trivial issues in the core." into 13 2017-12-20 07:01:01 -06:00
Jenkins2
eda4f59656 Merge "chan_sip: Fix memory leaks." into 13 2017-12-19 19:20:39 -06:00
Jenkins2
b539ea2a38 Merge "Remove constant conditionals (dead-code)." into 13 2017-12-19 19:13:20 -06:00
George Joseph
ee62652e2d Merge "chan_console: Use correct parameter for 'set active'" into 13 2017-12-19 16:14:03 -06:00
Corey Farrell
9adffca9c7 CLI: Address multiple issues.
* listen uses the variable `s` for the result from ast_poll() then
  overwrites it with the result of accept().  Create a separate variable
  poll_result to avoid confusion since ast_poll does not return a file
  descriptor.
* Resolve fd leak that would occur if setsockopt failed in listen.
* Reserve an extra byte while processing completion results from remote
  daemon.  This fixes a bug where completion processing used strstr() on
  a string that was not '\0' terminated.  This was no risk to the Asterisk
  daemon, the bug was only reachable the remote console process.
* Resolve leak in handle_showchan when the channel is not found.
* Multiple leaks and a deadlock in pbx_config CLI completion.
* Fix leaks in "manager show command".

Change-Id: I8f633ceb1714867ae30ef4e421858f77c14485a9
2017-12-19 16:43:32 -05:00
Aaron An
c38b750810 res_rtp_asterisk: Avoid close the rtp/rtcp fd twice.
When RTCP-MUX enabled. rtp->s is the same as rtcp->s, check this before
close the file descriptor. Close the FD twice will hangs the asterisk
under heavy load.

ASTERISK-27299 #close
Reported-by: Aaron An
Tested-by: AaronAn

Change-Id: I870a072d73fd207463ac116ef97100addbc0820a
2017-12-19 15:16:02 -05:00
Jenkins2
dba037d422 Merge "main/app: Fix leaks." into 13 2017-12-19 14:10:02 -06:00
Ivan Poddubny
fef23297b7 bridge: Stop music on hold on adding an arbitrary channel to a bridge
When a channel that is on hold gets added to a bridge by
the Bridge AMI action or the dialplan application of the same name,
music continues to play, causing "robotic sound".

This commit adds a call to ast_moh_stop to stop the music.
Also, it makes the AMI Park action use the right MOH class when the
channel gets parked.

Reported by: Zane Conkle

ASTERISK-25079 #close

Change-Id: I4b129c5a20c15e63968842460ac5a1a85903cf9f
2017-12-19 20:52:09 +01:00
Corey Farrell
0e5d8ad09b chan_sip: Fix memory leaks.
In change_redirecting_information variables we use ast_strlen_zero to
see if a value should be saved.  In the case where the value is not NULL
but is a zero length string we leaked.

handle_response_subscribe leaked a reference to the ccss monitor
instance.

Change-Id: Ib11444de69c3d5b2360a88ba2feb54d2c2e9f05f
2017-12-19 13:48:39 -06:00
Jenkins2
909f41a2e0 Merge "func_callerid: Initialize app argument structures." into 13 2017-12-19 11:34:08 -06:00
Jenkins2
bde7c0420a Merge "rtp_engine.c: Eliminate rtcp_report_to_json() RAII_VAR usage." into 13 2017-12-19 11:04:03 -06:00
Oron Peled
fc86e58a5a chan_console: Use correct parameter for 'set active'
chan_console supports multiple devices but the CLI only works on a
single device. 'console set active' selects this device.

Sadly that CLI picks the wrong command-line parameter and will only
work for a device called 'active'.

ASTERISK-27490 #close

Change-Id: I2f0e5fe63db19845bee862575b739360797dc73d
2017-12-19 10:58:37 -06:00
Jenkins2
c7bdffb281 Merge "ast_json_pack(): Use safer json ref mechanism." into 13 2017-12-19 10:02:19 -06:00
Corey Farrell
d6b2f457d9 Remove constant conditionals (dead-code).
Some variables are set and never changed, making them constant.  This
means that code in the 'false' block of the conditional is unreachable.

In chan_skinny and res_config_ldap I used preprocessor directive `#if 0`
as I'm unsure if the unreachable code could be enabled in the future.

Change-Id: I62e2aac353d739fb3c983cf768933120f5fba059
2017-12-19 08:52:33 -06:00
Corey Farrell
381ed4f1cc core: Fix multiple trivial issues in the core.
* Fix small leaks in from error condition in translate.c.
* Check new file descriptor is less than 0, not less than or equal.

Change-Id: Id7782775486175c739e0c4bf3ea5e17e3f452a99
2017-12-19 09:19:46 -05:00
Corey Farrell
67b5a4e616 main/app: Fix leaks.
* ast_linear_stream would leak a file descriptor if it failed to allocate
  lin.
* ast_control_tone leaked zone and ts if ast_playtones_start failed.

Additionally added whitespace to ast_linear_stream, pulled assignments
out of conditionals for improved readability.

Change-Id: I6d1a10cf9161b1529d939b9b2d63ea36d395b657
2017-12-18 20:36:32 -06:00
Corey Farrell
3782230e00 func_callerid: Initialize app argument structures.
This module uses AST_DEFINE_APP_ARGS_TYPE to define struct's instead of
directly using AST_DECLARE_APP_ARGS.  Initialize the variables declared
in this way.

Change-Id: If97fbdd8d63a204e2efd498a192effc14e90fb31
2017-12-18 19:35:26 -06:00
Corey Farrell
1d636f4afa app_voicemail: Fix memory management issues.
* mwi_sub_event_cb: mwist leaked on separate_mailbox failure.
* add_email_attachment: A reference to sox_gain_tmpdir was used
  after the storage was out of scope.

Change-Id: I6282c542ff7b82fa091177a912d11234a8b00a30
2017-12-18 18:12:31 -06:00
Richard Mudgett
5801917a75 ast_json_pack(): Use safer json ref mechanism.
Change-Id: I49204db2e57ae96eee43909c18ed007c09ac817e
2017-12-18 18:05:32 -06:00
Richard Mudgett
46ed7afdd9 rtp_engine.c: Eliminate rtcp_report_to_json() RAII_VAR usage.
Change-Id: I58a22c2ca82e91d7537409b7b3af2d735827a54d
2017-12-18 18:02:51 -06:00
Joshua Colp
b14d165927 Merge "CLI: Fix 'core set debug channel' completion bug." into 13 2017-12-18 15:58:34 -06:00
Jenkins2
cbb71df228 Merge "CLI: Remove special handling of 'core set verbose' from rasterisk." into 13 2017-12-18 13:41:07 -06:00