Commit Graph

274 Commits

Author SHA1 Message Date
Alexander Traud 9f2eb17005 ooh323c: GCC 8.1 warned about output truncated before terminating nul.
ASTERISK-27901

Change-Id: I5a8e894f4924ef52e3094f6870656a559d67f3d7
2018-06-07 14:19:39 +02:00
George Joseph 13ac76a230 Merge "cdr_mysql: my_connect_db(): reduce indentation" 2018-06-06 08:12:48 -05:00
George Joseph 5978883d13 Merge "cdr_mysql: split mysql init out of my_load_module" 2018-06-06 08:12:38 -05:00
Brian P. Martin 52ed6bcc8f chan_mobile: support handling of caller-id names ("cnam").
Add support to handle caller-ID names ("cnam") in addition to caller-ID
numbers.  The prior code ignored the caller-ID name altogether, and
used the local name for the cell phone (e.g. "my-iphone") in its place.

Note: as of this writing, at least some Android phones don't pass cnam to
us. This can be seen by issuing "core set debug 2" in the CLI and watching
the "CLIP" record when a call comes in.  If cnam isn't in the CLIP record,
there's nothing we can do to provide one.  We'll provide a null cnam field,
so later Asterisk processes know to try other sources (e.g. cidname database,
OpenCNAM, etc.).

Reported by: Brian Martin
Tested by: Brian Martin
ASTERISK-27726

Change-Id: I89490d85fa406c36261879c50ae5e65595538ba5
2018-05-17 15:24:34 -06:00
Corey Farrell b5914d90ac Fix GCC 8 build issues.
This fixes build warnings found by GCC 8.  In some cases format
truncation is intentional so the warning is just suppressed.

ASTERISK-27824 #close

Change-Id: I724f146cbddba8b86619d4c4a9931ee877995c84
2018-05-11 09:48:58 -04:00
Tzafrir Cohen f4c360143b cdr_mysql: my_connect_db(): reduce indentation
ASTERISK-27572

Change-Id: I00bd5363ac94c764c56d8626a5945ed7f3934fcb
2018-05-06 16:46:43 +03:00
Tzafrir Cohen 2e44adf1c3 cdr_mysql: split mysql init out of my_load_module
Split out mysql connection parts to a separate my_connect_db().

ASTERISK-27572

Change-Id: If2ee676056067cc693ff08be68ee4944bf35b49f
2018-05-06 16:45:20 +03:00
Jenkins2 8c1400bb57 Merge "chan_ooh323: introduce localras config parameter" 2018-04-26 11:42:06 -05:00
Richard Mudgett 0464e773d8 Merge "chan_ooh323: fix ooManualProgress/ooManualRingback on ooh323 debuggin on" 2018-04-25 10:46:05 -05:00
Alexander Anikin c481afe873 chan_ooh323: fix ooManualProgress/ooManualRingback on ooh323 debuggin on
Call ooManualProgress/Ringback outside of ast_debug function
when ooh323 debugging is on

ASTERISK-27812 #close
ASTERISK-26893 #close
Reported by: Dimos, Marco Giordani

Change-Id: I5873762e4f05824e7b6e94a19dd4eb56adbbbb79
2018-04-20 22:17:31 +03:00
Alexander Anikin 95e8450194 chan_ooh323: introduce localras config parameter
Introduce localras parameter that specify source IP
for connecting to Gatekeeper. Useful for multihome configurations.

ASTERISK-25129 #close
Reported by: Dmitry Melekhov
Tested by: Dmitry Melekhov

Change-Id: I0b604b01793f3e02a776502659e07cd3fc7e3097
2018-04-18 13:46:30 +03:00
Alexander Anikin 446320f1d4 chan_ooh323: Fix cppcheck warnings
Fix cppcheck warnings about redundant conditions and possible
null pointer usage

ASTERISK-27793 #close
Reported by: Ilya Shipitsin
Tested by: Ilya Shipitsin

Change-Id: I0b31933b062a23331dbac9a82b8bcfe345f406f6
2018-04-18 13:38:09 +03:00
Evandro Cesar Arruda 429c758e48 cdr_mysql: Compile error because MYSQL_PORT definition is missing
If it is not defined, it will add MYSQL_PORT definition. After some
research on MySQL/MariaDB development tree, I couldn't find any reference
to MYSQL_PORT definition in include files.

ASTERISK-27782 #close

Change-Id: Ieee56c836fc2e8bd021c456145bba04c6068bb77
2018-04-11 14:26:18 -06:00
Corey Farrell 572a508ef2 loader: Convert reload_classes to built-in modules.
* acl (named_acl.c)
* cdr
* cel
* ccss
* dnsmgr
* dsp
* enum
* extconfig (config.c)
* features
* http
* indications
* logger
* manager
* plc
* sounds
* udptl

These modules are now loaded at appropriate time by the module loader.
Unlike loadable modules these use AST_MODULE_LOAD_FAILURE on error so
the module loader will abort startup on failure of these modules.

Some of these modules are still initialized or shutdown from outside the
module loader.  logger.c is initialized very early and shutdown very
late, manager.c is initialized by the module loader but is shutdown by
the Asterisk core (too much uses it without holding references).

Change-Id: I371a9a45064f20026c492623ea8062d02a1ab97f
2018-03-14 05:20:12 -04:00
Corey Farrell c8a521b6c8 Replace direct checks of option_debug with DEBUG_ATLEAST macro.
Checking option_debug directly is incorrect as it ignores file/module
specific debug settings.  This system-wide change replaces nearly all
direct checks for option_debug with the DEBUG_ATLEAST macro.

Change-Id: Ic342d4799a945dbc40ac085ac142681094a4ebf0
2018-03-07 16:03:01 -06:00
Alexander Traud 140f937c7e res_config_mysql: Avoid the header mysql_version.h.
ASTERISK-27607

Change-Id: I23d00ded955c4afd5f2c3c9dc96dcb48b3f74eec
2018-01-22 16:18:51 +01:00
Alexander Traud 797747afa7 chan_ooh323: Avoid typecasting an int to unsigned short.
clang 5.0 warned about this.

ASTERISK-27577

Change-Id: I898fe4255023138a9e8b579fe4482fcf582f2b78
2018-01-12 11:03:38 +01:00
Jenkins2 94e7a7675b Merge "General: Avoid implicit conversion to char when changes value to negative." 2018-01-08 06:51:40 -06:00
Jenkins2 26e5edd043 Merge "chan_ooh323: Limit outgoinglimit to positive values as intended." 2018-01-06 20:56:24 -06:00
Alexander Traud f84fcc1fc1 General: Avoid implicit conversion to char when changes value to negative.
clang 5.0 warned about this.

ASTERISK-27557

Change-Id: I7cceaa88e147cbdf81a3a7beec5c1c20210fa41e
2018-01-06 22:12:40 +01:00
Alexander Traud f0c8f04c73 chan_ooh323: Limit outgoinglimit to positive values as intended.
ASTERISK-27552

Change-Id: Ifbf9d51e7374ca2e8b27ec568f6770050fc1a854
2018-01-05 08:02:21 -06:00
Alexander Traud 09f339bda5 ooh323cDriver: Fix typo in header guard.
ASTERISK-27551

Change-Id: I39ff66031e3373e895e2bc47b23a5e860ea4e012
2018-01-05 13:19:36 +01:00
Sean Bright 898b3b080a 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 09:38:37 -06:00
Sean Bright fd0ca1c3f9 Remove as much trailing whitespace as possible.
Change-Id: I873c1c6d00f447269bd841494459efccdd2c19c0
2017-12-22 09:23:22 -05:00
Corey Farrell 1b80ffa495 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:40:01 -05:00
Alexander Anikin fcd9ba2b87 add cmd connection creation on creation ooh323 call data structure
ASTERISK-27353 #close

Reported by: Marco Giordani

Change-Id: I455096bd7da016b871afe09af86067c2c7c9f33f
2017-11-23 03:54:36 +03:00
Tzafrir Cohen 11cefdf621 cdr_mysql: avoid releasing a config string
Fixes a memory corruption issue after a reload of cdr_mysql.

Issue was accidentally included in 747beb1ed1 .

ASTERISK-27270 #close

Change-Id: I90b6a9d18710c0f9009466370bd5f4bac5d5d12e
2017-10-10 17:52:20 +03:00
alex 1199927fc0 cdr_mysql.c: Apply cdrzone to start and answer
Change-Id: I7de0a5adc89824a5f2b696fc22c80fc22dff36b0
2017-09-18 07:03:20 -05:00
Sean Bright ef8eb9d11b chan_ooh323: Fix confusing indentation warning
ASTERISK-27177 #close
Reported by: Tzafrir Cohen

Change-Id: I40311c404edb2302a7543ad5ca7a06b2a38f2d97
2017-09-01 13:17:15 -05:00
Corey Farrell 58d032112b Fix compiler warnings on Fedora 26 / GCC 7.
GCC 7 has added capability to produce warnings, this fixes most of those
warnings.  The specific warnings are disabled in a few places:

* app_voicemail.c: truncation of paths more than 4096 chars in many places.
* chan_mgcp.c: callid truncated to 80 chars.
* cdr.c: two userfields are combined to cdr copy, fix would break ABI.
* tcptls.c: ignore use of deprecated method SSLv3_client_method().

ASTERISK-27156 #close

Change-Id: I65f280e7d3cfad279d16f41823a4d6fddcbc4c88
2017-08-01 15:42:38 -06:00
Sean Bright 045d7b8cb7 format_mp3: Re-work menuselect/build issues
Rather than removing format_mp3 from ALL_C_MODS (which caused format_mp3
to not show up in menuselect), use .PHONY targets when the necessary
source files are not present.

ASTERISK-23951
Reported by: Tzafrir Cohen

Change-Id: I0a7512c51acc9e86043671795020b0de725bd9e8
2017-05-30 10:57:03 -04:00
Sean Bright 59348aa182 format_mp3: Don't try to build format_mp3 if we don't have sources
ASTERISK-23951 #close
Reported by: Tzafrir Cohen

Change-Id: Iebf181d44bb735787fde4b5be863c4d7e2478a30
2017-05-25 11:15:04 -05:00
Sean Bright f5b67871df cleanup: Fix fread() and fwrite() error handling
Cleaned up some of the incorrect uses of fread() and fwrite(), mostly in
the format modules. Neither of these functions will ever return a value
less than 0, which we were checking for in some cases.

I've introduced a fair amount of duplication in the format modules, but
I plan to change how format modules work internally in a subsequent
patch set, so this is simply a stop-gap.

Change-Id: I8ca1cd47c20b2c0b72088bd13b9046f6977aa872
2017-04-25 16:24:15 -05:00
George Joseph 747beb1ed1 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:57:21 -06:00
Sean Bright cf6a6226ab 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:08 -04:00
Sean Bright 6e6c96d713 realtime: Centralize some common realtime backend code
All of the realtime backends create artificial ast_categorys to pass
back into the core as query results. These categories have no filename
or line number information associated with them and the backends differ
slightly on how they create them. So create a couple helper macros to
help make things more consistent.

Also updated the call sites to remove redundant error messages about
memory allocation failure.

Note that res_config_ldap sets the category filename to the 'table name'
but that is not read by anything in the core, so I've dropped it.

Change-Id: I3a1fd91e0c807dea1ce3b643b0a6fe5be9002897
2017-02-21 10:53:17 -06:00
Sean Bright e93f2a5142 realtime: Fix LIKE escaping in SQL backends
The realtime framework allows for components to look up values using a
LIKE clause with similar syntax to SQL's. pbx_realtime uses this
functionality to search for pattern matching extensions that start with
an underscore (_).

When passing an underscore to SQL's LIKE clause, it will be interpreted
as a wildcard matching a single character and therefore needs to be
escaped. It is (for better or for worse) the responsibility of the
component that is querying realtime to escape it with a backslash before
passing it in. Some RDBMs support escape characters by default, but the
SQL92 standard explicitly says that there are no escape characters
unless they are specified with an ESCAPE clause, e.g.

	SELECT * FROM table WHERE column LIKE '\_%' ESCAPE '\'

This patch instructs 3 backends - res_config_mysql, res_config_pgsql,
and res_config_sqlite3 - to use the ESCAPE clause where appropriate.

Looking through documentation and source tarballs, I was able to
determine that the ESCAPE clause is supported in:

MySQL 5.0.15   (released 2005-10-22 - earliest version available from
                archives)
PostgreSQL 7.1 (released 2001-04-13)
SQLite 3.1.0   (released 2005-01-21)

The versions of the relevant libraries that we depend on to access MySQL
and PostgreSQL will not work on versions that old, and I've added an
explicit check in res_config_sqlite3 to only use the ESCAPE clause when
we have a sufficiently new version of SQLite3.

res_config_odbc already handles the escape characters appropriately, so
no changes were required there.

ASTERISK-15858 #close
Reported by: Humberto Figuera

ASTERISK-26057 #close
Reported by: Stepan

Change-Id: I93117fbb874189ae819f4a31222df7c82cd20efa
2017-02-16 12:59:50 -06:00
Timo Teräs 939dcf66b0 addons/chan_mobile: do not use strerror_r
The two reasons why it might be used are that some systems do not
implement strerror in thread safe manner, and that strerror_r returns
the error code in the string in case there's no error message.

However, all of asterisk elsewhere uses strerror() and assumes it
to be thread safe. And in chan_mobile the errno is also explicitly
printed so neither of the above reasons are valid.

The reasoning to remove usage is that there are actually two versions
of strerror_r: XSI and GNU. They are incompatible in their return
value, and there's no easy way to figure out which one is being
used. glibc gives you the GNU version if _GNU_SOURCE is defined,
but the same feature test macro is needed for other symbols. On
all other systems you assumedly get XSI symbol, and compilation warnings
as well as non-working error printing.

Thus the easiest solution is to just remove strerror_r and use
strerror as rest of the code. Alternative is to introduce ast_strerror
in separate translation unit so it can request the XSI symbol in
glibc case, and replace all usage of strerror.

Change-Id: I84d35225b5642d85d48bc35fdf399afbae28a91d
2016-11-11 08:33:44 +02:00
Joshua Colp dbbd1b8834 Merge "chan_ooh323: reset rrq count on gk registration" 2016-11-08 04:59:12 -06:00
Alexander Anikin 0a698cd932 chan_ooh323: Fixes to work right with Cisco devices
Changed output packets queue processing algo to one read-one write
instead of all read-all send

Remove h.245 tunneling parameter from ReleaseComplete packet

ASTERISK-24400 #close
Reported by: Dmitry Melekhov
Tested by: Dmitry Melekhov

Change-Id: I0b31933b062a21011dbac9a82b8bcfe345f406f6
2016-11-07 10:01:25 -05:00
Alexander Anikin a1cdc3891a chan_ooh323: reset rrq count on gk registration
reset registration attempts count on success registration on gatekeeper

Change-Id: I5f47351852e0ca76c9ac78421659600e0f106336
2016-11-07 09:58:50 -05:00
Alexander Anikin 1504194215 chan_ooh323: Fix infinite loop on read second part of H.225 packet
Fix logic on read second part of H.225 packet. There was infinite loop on
wrong connections due to read before poll.

Change-Id: I42b4bf75c46e4a5c5df5c5ca1f0bd74b8944e7ff
2016-11-03 13:48:45 -05:00
Corey Farrell a6e5bae3ef Remove ASTERISK_REGISTER_FILE.
ASTERISK_REGISTER_FILE no longer has any purpose so this commit removes
all traces of it.

Previously exported symbols removed:
* __ast_register_file
* __ast_unregister_file
* ast_complete_source_filename

This also removes the mtx_prof static variable that was declared when
MTX_PROFILE was enabled.  This variable was only used in lock.c so it
is now initialized in that file only.

ASTERISK-26480 #close

Change-Id: I1074af07d71f9e159c48ef36631aa432c86f9966
2016-10-27 09:53:55 -04:00
George Joseph 3b3d06884c res_config_mysql: Fix several issues related to recent table changes
Unlike any of the other database drivers, res_config_mysql checks that
the table definition matches the requirements for every insert and
update statement.  Since all requirements are forced to 'char', any
column that isn't a char, like ps_contacts' expiration_time,
qualify_timeout, etc., will throw a warning.  It's kinda harmless but
very misleading.  Since no other driver does those checks on insert
or update, they've been removed from res_config_mysql.  Also, all
the logic that actually attempted to ALTER the table to fix the issue
has been removed.  With the move to alembic, the auto-alter
functionality is not only unnecessary, it's also dangerous.

The other issue is that res_config_mysql calls the mysql_insert_id
function inside store_mysql.  Presumably the intention was to return
the number of rows inserted DESPITE A NOTE IN THE CODE THAT THE VALUE
IS NON_PORTABLE AND MAY CHANGE.  That value is then returned to
config realtime as the number of rows inserted.  Guess what?  The value
changed.  It now only returns the number of rows inserted if there's an
auto increment column on the table, which ps_contacts doesn't have.
Otherwise it returns 0.  So now, the insert worked but we tell config
realtime and sorcery that no rows were inserted.  That call to
mysql_insert_id was removed and we now always return 1 if the insert
succeeded.  We're only inserting 1 row at a time anyway.  If the insert
fails, we still return -1.

ASTERISK-26362 #close
Reported-by: Carlos Chavez

Change-Id: I83ce633efdb477b03c8399946994ee16fefceaf4
2016-10-12 16:49:01 -05:00
Tzafrir Cohen d3ddf4b0fd cdr_mysql: fix UTC support
* Make 'cdrzone=UTC' work properly.
* Fix the documentation of cdr_mysql.conf: it's cdrzone and not timezone

ASTERISK-26359 #close

Change-Id: I2a6f67b71bbbe77cac31a34d0bbfb1d67c933778
2016-09-15 13:16:04 +03:00
Corey Farrell 824a4e84d1 Refactor usage pattern of xmldoc info tag.
This updates func_channel.c and main/message.c to use a generic xpointer
include instead of including info from each channel driver.  Now the
name attribute of info is CHANNEL or CHANNEL_EXAMPLES to be included in
documentation for func_channel.  Setting the name attribute of info to
MessageToInfo or MessageFromInfo causes it to be included in the
MessageSend application and AMI action.

Change-Id: I89fd8276a3250824241a618009714267d3a8d1ea
2016-08-16 10:42:46 -05:00
Matt Jordan ddab42e296 func_channel: Reorganize documentation
* Following the example of the PJSIP channel driver, the channel
  technology specific documentation has been moved to the respective
  channel drivers that provide that functionality. This has the benefit
  of locating the documentation of items with those modules that provide
  it.

* Examples of using the CHANNEL function for both standard items as well
  as for PJSIP have been added.

* The 'max_forwards' standard item has been documented.

Change-Id: Ifaa79a232c8ac99cf8da6ef6cc7815d398b1b79b
2016-08-15 07:39:19 -05:00
Joshua Colp 7eb3a3357c Merge "BuildSystem: Avoid 'ar cru' and use 'ar cr' instead." 2016-06-09 04:40:37 -05:00
Timo Teräs 39b69ab537 Fixes to include signal.h
POSIX defines signal.h. sys/signal.h should not be used as it is
c-library internal header which may or may not exist. Notably with
musl it generates warning of being incorrect.

Change-Id: Ia56b0aa1d84b5c590114867b1b384a624f39a6fc
2016-06-08 20:37:08 +03:00
Alexander Traud da943ec5c0 BuildSystem: Avoid 'ar cru' and use 'ar cr' instead.
In several internal library projects, the files are archived with the help of
'ar cr'. Only the projects editline and the Objective Open H.323 stack
implementation in C (ooh323c) use 'ar cru' instead. Recently, some platforms
changed the default parameters of AR which creates "/usr/bin/ar: `u' modifier
ignored since `D' is the default (see `U')". For consistency and to avoid this
message all projects use 'ar cr' now.

ASTERISK-26091 #close

Change-Id: I710a9b1c01c1b5a1931a646098c044c8161ead40
2016-06-07 09:32:11 +02:00