Commit Graph

427 Commits

Author SHA1 Message Date
Joshua C. Colp 283b09cf70 cdr_adaptive_odbc: Add support for SQL_DATETIME field type.
ASTERISK-30023

Change-Id: I0e1697f6af044e9eab7e07bbaeeffd1bb68ac34a
2022-04-25 15:44:44 -05:00
Alexander Traud 1230369b71 progdocs: Remove outdated references in doxyref.h.
ASTERISK-29773

Change-Id: Ica93160d9158cc0e80c5fda829b80d1b49a6b9b9
2021-11-29 11:12:40 -06:00
Joshua C. Colp 30d5264409 cdr_syslog: Remove deprecated module.
ASTERISK-29592

Change-Id: Ic8eb6a2100ad5bc3b48338a6d0a6cfa70ecbc50f
2021-08-17 10:35:41 -03:00
Joshua C. Colp 93870e7bb4 policy: Deprecate modules and add versions to others.
app_meetme is deprecated in 19, to be removed in 21.
app_osplookup is deprecated in 19, to be removed in 21.
chan_alsa is deprecated in 19, to be removed in 21.
chan_mgcp is deprecated in 19, to be removed in 21.
chan_skinny is deprecated in 19, to be removed in 21.
res_pktccops is deprecated in 19, to be removed in 21.
app_macro was deprecated in 16, to be removed in 21.
chan_sip was deprecated in 17, to be removed in 21.
res_monitor was deprecated in 16, to be removed in 21.

ASTERISK-29548
ASTERISK-29549
ASTERISK-29550
ASTERISK-29551
ASTERISK-29552
ASTERISK-29553
ASTERISK-29558
ASTERISK-29567
ASTERISK-29572

Change-Id: Ic3bee31a10d42c4b3bbc913d893f7b2a28a27131
2021-08-11 08:14:51 -05:00
Naveen Albert b5709e610e cdr_adaptive_odbc: Prevent filter warnings
Previously, if CDR filters were used so that
not all CDR records used all sections defined
in cdr_adaptive_odbc.conf, then warnings will
always be emitted (if each CDR record is unique
to a particular section, n-1 warnings to be
specific).

This turns the offending warning log into
a verbose message like the other one, since
this behavior is intentional and not
indicative of anything wrong.

ASTERISK-29494

Change-Id: Ifd314fa9298722bc99494d5ca2658a5caa94a5f8
2021-08-04 09:26:23 -05:00
Joshua C. Colp 149e5e5b86 xml: Embed module information into core XML documentation.
This change embeds the MODULEINFO block of modules
into the core XML documentation. This provides a shared
mechanism for use by both menuselect and Asterisk for
information and a definitive source of truth.

ASTERISK-29335

Change-Id: Ifbfd5c700049cf320a3e45351ac65dd89bc99d90
2021-03-16 10:30:43 -05:00
Alexander Traud abf4d74384 cdr_odbc: Sync load- and build-time deps.
MODULEINFO is checked while buidling/linking the module.
AST_MODULE_INFO is checked while loading/running the module.

ASTERISK-28838

Change-Id: I55dc05ce19552d0415c9045021b42bd82ef44e52
2020-04-20 12:06:05 -05:00
Christoph Moench-Tegeder 52ade18420 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:08:02 -05:00
Chris-Savinovich e61f2af89d cdr_pgsql: fix error in connection string
Fixes an error occurring in function pgsql_reconnect() caused when value of
hostname is blank. Which in turn will cause the connection string to look
like this: "host= port=xx", which creates a sintax error. This fix now checks
if the corresponding values for host, port, dbname, and user are blank. Note
that since this is a reconnect function the database library will replace any
missing value pairs with default ones.

ASTERISK-28435

Change-Id: I0a921f99bbd265768be08cd492f04b30855b8423
2019-06-04 12:38:29 -06:00
Joshua Colp 54a912b26d res_odbc: Add basic query logging.
When Asterisk is connected and used with a database the response
time of the database can cause problems in Asterisk if it is long.
Normally the only way to see this problem would be to retrieve a
backtrace from Asterisk and examine where things are blocked, or
examine the database to see if there is any indication of a
problem.

This change adds some basic query logging to make it easier to
investigate such a problem. When logging is enabled res_odbc will
now keep track of the number of queries executed, as well as the
query that has taken the longest time to execute. There is also
an option which will cause a WARNING message to be output if a
query takes longer than a configurable amount of time to execute.

This makes it easier and clearer for users that their database may
be experiencing a problem that could impact Asterisk.

ASTERISK-28277

Change-Id: I173cf4928b10754478a6a8c27dfa96ede0f058a6
2019-02-07 08:23:14 -06:00
Joshua Colp 134e2f0ddc module: Remove deprecated modules and update support levels.
I have removed the STATIC_BUILD option immediately as it has not
been maintained in many years and is non-functional.

ASTERISK-27965

Change-Id: I64783d017b86dba9ee3c7bcfb97e59889a3f76d7
2018-07-18 18:15:53 +00: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
Jenkins2 1485719531 Merge "Replace direct checks of option_debug with DEBUG_ATLEAST macro." 2018-03-12 10:44:46 -05: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 162fc4fba6 BuildSystem: Depend not implicitly but explicitly on external libraries.
ASTERISK-27722

Change-Id: Ie7b8c30d86cb00a54d6ac4e09e6f28f42d2bd52c
2018-03-06 14:33:14 +01:00
Sean Bright 9e2fcb82ed cdr_syslog: Deprecate unmaintained module
There has been an open issue against cdr_syslog (ASTERISK~14441) about
a race condition for 7.5 years that has never been addressed. Because
this module is effectively unmaintained and currently broken, there is
no sense in keeping it around.

If logging CDRs to syslog is a desirable feature, it would probably be
better to write the logs directly to the syslog server via socket
instead of using the facilities provided by openlog/syslog/closelog.
Doing so would address the race condition referenced in the associated
issue.

Change-Id: Ic77b94cd97f355a9cf5b1d3f3444964a6e0ba5dc
2018-01-10 09:03:57 -05:00
Sean Bright fd0ca1c3f9 Remove as much trailing whitespace as possible.
Change-Id: I873c1c6d00f447269bd841494459efccdd2c19c0
2017-12-22 09:23:22 -05:00
Jenkins2 b5ac9c8a78 Merge "This patch adds a beanstalk CDR backend." 2017-11-16 09:36:41 -06:00
Nir Simionovich 4559cd0e28 This patch adds a beanstalk CDR backend.
Beanstalkd is a simple to use job queue. It provides a means to
create multiple job queues called "tubes". Each tube can store
multiple jobs, with varying priorities with the queue. Queue
processing is available via a simple TCP socket or via well defined
libraries, avaialble at
https://github.com/kr/beanstalkd/wiki/client-libraries

This module is based upon the beanstalk-client library, available
for download at: https://github.com/deepfryed/beanstalk-client

Change-Id: I5fe4089a34ab3b39230786d9bbfddafa56715f48
2017-10-20 10:08:05 -04:00
Joshua Colp 619008f41c Merge "cdr_pgsql: Refactor magic number by definition for version" 2017-09-11 07:22:59 -05:00
Rodrigo Ramírez Norambuena c8d53a1638 cdr_pgsql: Refactor magic number by definition for version
Change-Id: I43f25976aa3069793ddbe0086833965a6fb0a518
2017-09-08 23:19:28 -03:00
Martin Tomec 44c5a144ce Sqlite3: make busy_timeout configurable.
Enables runtime configuration of busy_timeout for sqlite databases.
Default timeout remains 1000ms.

ASTERISK-27014 #close

Change-Id: I8921a3aac3c335843be4cb17d2dd0a5c157a36da
2017-05-25 10:02:42 +02: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 c537f99488 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 17:48:42 -05:00
Tzafrir Cohen 97a75e3829 Add support for building RADIUS with radcli
Radcli is yet another RADIUS client library, generally compatible with
freeradius and radiusclient-ng.

This commit adds autoconf option for detecting it as well and changes
cdr_radius and cel_radius to use its header file in that case.

ASTERISK-26540 #close

Change-Id: I271f0715406334874865ffbce0b354b3a2ca148f
2016-11-14 19:40:03 +02: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
Badalyan Vyacheslav 01d1d3763f cdr_radius,cel_radius: Fix old memleak in unload
- Call "rc_openlog" optional. If you do not call,
you will simply NULL instead of a name.

- On the one PID can be only one syslog channel.
And it can already be run in logger.c

- Calling rc_openlog we assigns a new name for
the channel syslog. This unexpected behavior for logger.c.

Most lesser evil, is to agree on a NULL name syslog
if the channel was not launched in logger.c.

It also solves the problem of memory leaks.

ASTERISK-26455 #close

Change-Id: Ic17c38de67583e971d78fe18807d1a9faf8f0afd
2016-10-25 11:45:37 +00:00
Rodrigo Ramírez Norambuena b156a291af cdr_adaptive_odbc: Fix DNSs mixed config quote quoted_identifiers
When haved more than once DNSs config and one of their dont set
quoted_identifiers and before this is with configurated with
quoted_identifiers resulting a truncate statement for a reference null
for quote character identifier.

This patch initializes quoted flag before build SQL Query

Example config for this bugfix case in cdr_adaptive_odbc.conf file

	[first]
	connection=asterisk-server1
	table=cdr
	quoted_identifiers="

	[second]
	connection=asterisk-server2
	table=cdr

	[third]
	connection=asterisk-server3
	table=cdr
	quoted_identifiers=`

Change-Id: Ibd95667b468e10d4a19a2b9d88b9934ec7207e1d
2016-08-05 23:20:26 -04:00
Richard Mudgett 40d19f2e55 logging,cdr,cel: Fix stringfield memory leak.
The stringfields refactor to allow adding stringfields to the end of a
structure (f6f4cf459f) exposed some
incomplete cleanup code by some stringfield users.

The most noticeable leaker is the logging system where there is a leak for
every log message generated.

ASTERISK-26078 #close
Reported by:  Etienne Lessard
Patches:
      jira_asterisk_26078_v13.patch (license #5621) patch uploaded
      by Richard Mudgett

Change-Id: If6a08b31336b492c3de6f9dfd07c447f8d5a8782
2016-06-01 14:09:36 -05:00
Rodrigo Ramírez Norambuena 0ec9fe5421 main/cli.c: Refactor function to print seconds formatted
Refactor and created function ast_cli_print_timestr_fromseconds to print
seconds formatted:  year(s) week(s) day(s) hour(s) second(s)

This function now is used in addons/cdr_mysql.c,cdr_pgsql.c, main/cli.c,
res_config_ldap.c, res_config_pgsql.c.

Change-Id: Ibeb8634102cd11d3f8623398b279cb731bcde36c
2016-03-07 03:42:18 -03:00
Rodrigo Ramírez Norambuena 2fb45c7801 cdr_pgsql.cl: REFACTOR Macro LENGTHEN_BUF
Remove repeated code on macro of assigned buffer to SQL vars.

Add table and connection name to log error message when is not possible
allocate memory.

Change-Id: I1fbf37d286a032d38fdda72a9f736356956c9ffe
2016-01-23 14:41:38 -03:00
Rodrigo Ramírez Norambuena 99aa7cb26e dr_adaptive_odbc.c, cel_odbc.c, cel_pgsql.c: REFACTOR Macro LENGTHEN_BUF
Remove repeated code on macro of assigned buffer to SQL vars

Change-Id: Icb19ad013124498e172ea1d0b29ccd0ed17deef0
2015-09-18 12:51:59 -03:00
Elazar Broad 293c9f6894 cdr/cdr_adaptive_odbc.c: Fix quoted identifier usage when inserting CDR records
Commit a24ce38 added support for the use of quoted indentifiers when inserting
CDR records into the database. However, the if statement logic responsible for
determining whether to use those identifiers is reversed, resulting in a
reference to the quoted identifier character buffer which will be null, hence
null terminating the SQL query, resulting in a truncated statement which
fails to execute.

ASTERISK-25263 #close
Reported by: Elazar Broad
Tested by: Elazar Broad

Change-Id: I40da47309b67cc1572207b1515dcc08ec9b1f644
2015-07-20 17:46:19 -05:00
Matt Jordan 2a6282f4d8 Merge "cdr/cdr_csv.c: Set file name for csv master to the module when (re)loaded." 2015-06-02 12:02:01 -05:00
Rodrigo Ramírez Norambuena 2cd40c2bd7 cdr/cdr_csv.c: Set file name for csv master to the module when (re)loaded.
Compute the location for the csv master file when the module is
loaded or reload.  Before it was calculated every time a log
entry was written.

Change-Id: I3ed9f6a8f965308099db70b71128f43d4d3f5585
2015-06-01 15:14:58 -05:00
Rodrigo Ramírez Norambuena 9c3c7797e5 cel, cdr: Assigned separator for column name and values.
Use a separator string between column names and values for SQL sentences
instead of evaluating the separator to use each time.

This change adds a space after the comma in constructing SQL sentences.
Before the SQL was created like "INSERT INTO cdr(calldate,clid,dst"
without spaces between column name and values.

The files applied this change are cdr/cdr_adaptive_odbc.c, cdr/cdr_pgsql.c,
cel/cel_odbc.c

ASTERISK-25109 #close
Reported By: Rodrigo Ramírez Norambuena <decipher.hk@gmail.com>

Change-Id: Ia5a1a161f5e26e1643703b30f8cc9cf0860cc7ea
2015-05-20 12:08:18 -04:00
Joshua Colp 2bbfcfc647 Merge "cdr_adaptive_odbc: Add ability to set character for quoted identifiers." 2015-05-14 05:28:16 -05:00
Joshua Colp 4505f5e676 Merge "cdr_pgsql, cel_pgsql: Store maximum buffer size to prevent reallocation" 2015-05-13 15:17:48 -05:00
Joshua Colp d5acf9f1ea Merge "cdr_pgsql: Use PQescapeStringConn for escaping names." 2015-05-13 04:35:55 -05:00
Rodrigo Ramírez Norambuena e6daafb8a6 cdr_pgsql, cel_pgsql: Store maximum buffer size to prevent reallocation
The code previously used a fixed size of 512 for the SQL
queries. Depending on the size this may require it to grow.

This change makes it so if the buffer size does grow the size
is stored and next time the buffer will be large enough.

Change-Id: I55385899f1c06dee47e4274c2d21538037b2d895
2015-05-12 05:11:39 -05:00
Rodrigo Ramírez Norambuena c61b146238 cdr_pgsql: Use PQescapeStringConn for escaping names.
Use function PQescapeStringConn for escaping the name
of the table and schema instead of doing it manually.

Change-Id: I6709165e2d00463e9c813d24f17830ad4910b599
2015-05-11 07:42:22 -05:00
Matt Jordan d679f1d9b5 Merge "cdr/cdr_csv.c: Refactor, function to write content of csv file." 2015-05-07 07:05:35 -05:00
Rodrigo Ramírez Norambuena a24ce38e5e cdr_adaptive_odbc: Add ability to set character for quoted identifiers.
Added the ability to set the character to quote identifiers. This
allows adding the character at the start and end of table and column
names. This setting is configurable for cdr_adaptive_odbc via the
quoted_identifiers in configuration file cdr_adaptive_odbc.conf.

ASTERISK-25006

Change-Id: I0b9a56b79ca13a727a803d88ed3b8643e37632b8
2015-05-05 04:38:33 -04:00
Rodrigo Ramírez Norambuena 39cf642d40 cdr: standardizes tab for options of AST_MODULE_INFO
Change-Id: I3c6de30b4859717873100092a7c06e206713a301
2015-05-05 00:06:57 -04:00
Rodrigo Ramírez Norambuena 8886b724ae cdr/cdr_csv.c: Add a new option to enable columns added in Asterisk 1.8
This patch adds a new option to cdr.conf, 'newcdrcolumns', that will handle CDR
columns added in Asterisk 1.8. The columns are:
 * peeraccount
 * linkedid
 * sequence
When enabled, the columns in the database entry will be populated with the data
from the CDR.

ASTERISK-24976 #close

Change-Id: I51a57063f4ae5e194a9d933a8df45dc8a4534f0b
2015-05-03 09:50:25 -05:00
Rodrigo Ramírez Norambuena 556653d937 cdr/cdr_csv.c: Refactor, function to write content of csv file.
Create a function for write content of CDR on csv files. Before used same
code for write two distinct files (account and master cdr) instead use a
function for thats.

Reduced to one lock when files are written.

Change-Id: Idce707f4c108083252e0aeb948f421d924953e65
2015-04-30 09:45:23 -04:00
Rodrigo Ramírez Norambuena d6a2d92353 cdr/cdr_csv.c: Add missing space after comma.
Change-Id: I3866a20019b1a3a2f10fe36640053929330b0fcb
2015-04-28 05:28:37 -04:00
Joshua Colp b2153f1f49 Merge "cdr/cdr_odbc.c: Added to record new columns add on CDR 1.8 Asterisk Version" 2015-04-28 06:55:30 -05:00
Rodrigo Ramírez Norambuena 358080e86e cdr/cdr_odbc.c: Added to record new columns add on CDR 1.8 Asterisk Version
Add new column to INSERT new columns added in cdr 1.8 version. The columns are:
 * peeraccount
 * linkedid
 * sequence
This feature is configurable in cdr_odbc.conf using a new configuration
option, 'newcdrcolumns'.

ASTERISK-24976 #close

Change-Id: Ibe0c7540a88305c6012786f438a0813ad8b19127
2015-04-27 09:38:15 -05:00
Rodrigo Ramírez Norambuena bff3064578 cdr/cdr_adaptive_odbc.c: Refactor concatenate columns name.
The concatenate for columns name to INSERT INTO is always the same. It is
possible to do it on one line.

ASTERISK-24980

Change-Id: Ib8bb53c42535378581d4ef729cc5ebbb22b067ac
2015-04-20 16:49:29 -05:00