summaryrefslogtreecommitdiff
path: root/addons/cdr_mysql.c
AgeCommit message (Collapse)Author
2018-03-14loader: Convert reload_classes to built-in modules.Corey Farrell
* 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
2017-12-28cdr_mysql: Make sure connection charset is always setSean Bright
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-22Remove as much trailing whitespace as possible.Sean Bright
Change-Id: I873c1c6d00f447269bd841494459efccdd2c19c0
2017-10-10cdr_mysql: avoid releasing a config stringTzafrir Cohen
Fixes a memory corruption issue after a reload of cdr_mysql. Issue was accidentally included in 747beb1ed159f89a3b58742e4257740b3d6d6bba . ASTERISK-27270 #close Change-Id: I90b6a9d18710c0f9009466370bd5f4bac5d5d12e
2017-09-18cdr_mysql.c: Apply cdrzone to start and answeralex
Change-Id: I7de0a5adc89824a5f2b696fc22c80fc22dff36b0
2017-04-12modules: change module LOAD_FAILUREs to LOAD_DECLINESGeorge Joseph
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
2016-10-27Remove ASTERISK_REGISTER_FILE.Corey Farrell
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-09-15cdr_mysql: fix UTC supportTzafrir Cohen
* 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-03-07main/cli.c: Refactor function to print seconds formattedRodrigo Ramírez Norambuena
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
2015-04-13git migration: Refactor the ASTERISK_FILE_VERSION macroMatt Jordan
Git does not support the ability to replace a token with a version string during check-in. While it does have support for replacing a token on clone, this is somewhat sub-optimal: the token is replaced with the object hash, which is not particularly easy for human consumption. What's more, in practice, the source file version was often not terribly useful. Generally, when triaging bugs, the overall version of Asterisk is far more useful than an individual SVN version of a file. As a result, this patch removes Asterisk's support for showing source file versions. Specifically, it does the following: * Rename ASTERISK_FILE_VERSION macro to ASTERISK_REGISTER_FILE, and remove passing the version in with the macro. Other facilities than 'core show file version' make use of the file names, such as setting a debug level only on a specific file. As such, the act of registering source files with the Asterisk core still has use. The macro rename now reflects the new macro purpose. * main/asterisk: - Refactor the file_version structure to reflect that it no longer tracks a version field. - Remove the "core show file version" CLI command. Without the file version, it is no longer useful. - Remove the ast_file_version_find function. The file version is no longer tracked. - Rename ast_register_file_version/ast_unregister_file_version to ast_register_file/ast_unregister_file, respectively. * main/manager: Remove value from the Version key of the ModuleCheck Action. The actual key itself has not been removed, as doing so would absolutely constitute a backwards incompatible change. However, since the file version is no longer tracked, there is no need to attempt to include it in the Version key. * UPGRADE: Add notes for: - Modification to the ModuleCheck AMI Action - Removal of the "core show file version" CLI command Change-Id: I6cf0ff280e1668bf4957dc21f32a5ff43444a40e
2014-07-25Add module support level to ast_module_info structure. Print it in CLI ↵Mark Michelson
"module show" . ASTERISK-23919 #close Reported by Malcolm Davenport Review: https://reviewboard.asterisk.org/r/3802 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419592 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-27Prevent CDR backends from unregistering while billing data is in flightMatthew Jordan
This patch makes it so that CDR backends cannot be unregistered while active CDR records exist. This helps to prevent billing data from being lost during restarts and shutdowns. Review: https://reviewboard.asterisk.org/r/2880/ ........ Merged revisions 402081 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402082 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-17Make cdr_mysql compile again by not directly setting the run-time CDR objectMatthew Jordan
A stray ast_cdr_setvar was missed in cdr_mysql (silly addons). This has now been refactored to not set the property, as the property would have been set on a run-time object that was already dispatched to the backend. The module simply remembers the value it wanted to set and writes it to MySQL later in the processing. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391964 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-17Update Asterisk's CDRs for the new bridging frameworkMatthew Jordan
This patch is the initial push to update Asterisk's CDR engine for the new bridging framework. This patch guts the existing CDR engine and builds the new on top of messages coming across Stasis. As changes in channel state and bridge state are detected, CDRs are built and dispatched accordingly. This fundamentally changes CDRs in a few ways. (1) CDRs are now *very* reflective of the actual state of channels and bridges. This means CDRs track well with what an actual channel is doing - which is useful in transfer scenarios (which were previously difficult to pin down). It does, however, mean that CDRs cannot be 'fooled'. Previous behavior in Asterisk allowed for CDR applications, channels, and other properties to be spoofed in parts of the code - this no longer works. (2) CDRs have defined behavior in multi-party scenarios. This behavior will not be what everyone wants, but it is a defined behavior and as such, it is predictable. (3) The CDR manipulation functions and applications have been overhauled. Major changes have been made to ResetCDR and ForkCDR in particular. Many of the options for these two applications no longer made any sense with the new framework and the (slightly) more immutable nature of CDRs. There are a plethora of other changes. For a full description of CDR behavior, see the CDR specification on the Asterisk wiki. (closes issue ASTERISK-21196) Review: https://reviewboard.asterisk.org/r/2486/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391947 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-10Remove some dead code and additionally handle a case that wasn't handled.Tilghman Lesher
........ Merged revisions 377487 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 377504 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 377505 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@377506 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-28Fix setting CDR variables in the hangup extensionTerry Wilson
A previous CDR fix for setting CDR variables during a bridge via custom dialplan features broke setting CDR variables in the hangup extension. This patch fixes the issue. Review: https://reviewboard.asterisk.org/r/1794/ ........ Merged revisions 358978 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 358989 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360724 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-14Merged revisions 328247 via svnmerge from Leif Madsen
https://origsvn.digium.com/svn/asterisk/branches/1.10 ................ r328247 | lmadsen | 2011-07-14 16:25:31 -0400 (Thu, 14 Jul 2011) | 14 lines Merged revisions 328209 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r328209 | lmadsen | 2011-07-14 16:13:06 -0400 (Thu, 14 Jul 2011) | 6 lines Introduce <support_level> tags in MODULEINFO. This change introduces MODULEINFO into many modules in Asterisk in order to show the community support level for those modules. This is used by changes committed to menuselect by Russell Bryant recently (r917 in menuselect). More information about the support level types and what they mean is available on the wiki at https://wiki.asterisk.org/wiki/display/AST/Asterisk+Module+Support+States ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@328259 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-05-04Merged revisions 316429 via svnmerge from Tilghman Lesher
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r316429 | tilghman | 2011-05-03 19:12:25 -0500 (Tue, 03 May 2011) | 7 lines Escape column names in case they contain illegal characters ('-') or reserved words. (closes issue #19063) Reported by: festr Patches: patch uploaded by festr (license 443) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@316430 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-04-01Merged revisions 312286,312288 via svnmerge from Tilghman Lesher
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r312286 | tilghman | 2011-04-01 05:44:33 -0500 (Fri, 01 Apr 2011) | 2 lines Reload must react correctly against a possibly changed table, so dropping the conditional reload flag. ................ r312288 | tilghman | 2011-04-01 05:58:45 -0500 (Fri, 01 Apr 2011) | 21 lines Merged revisions 312287 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ................ r312287 | tilghman | 2011-04-01 05:51:24 -0500 (Fri, 01 Apr 2011) | 14 lines Merged revisions 312285 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r312285 | tilghman | 2011-04-01 05:36:42 -0500 (Fri, 01 Apr 2011) | 7 lines Found some leaking file descriptors while looking at ast_FD_SETSIZE dead code. (issue #18969) Reported by: oej Patches: 20110315__issue18969__14.diff.txt uploaded by tilghman (license 14) ........ ................ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@312289 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-08Add High Resolution Times to CDRs for AsteriskBradley Latus
People expressed an interest in having access to the exact length of calls to a finer degree than seconds. See the CHANGES and UPGRADE.txt for usage also updated the sample configs to note the change. Patch by snuffy. (closes issue #16559) Reported by: cianmaher Tested by: cianmaher, snuffy Review: https://reviewboard.asterisk.org/r/461/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@269153 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-11Permit dates and times to be stored in timezones other than the default ↵Tilghman Lesher
(typically, UTC) (closes issue #16401) Reported by: lordmortis git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@239152 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-11-13If CDR logging is disabled, it's considered a FAILUREOlle Johansson
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@229840 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-11-09Fix various problems detected with Valgrind.Tilghman Lesher
* chan_console accessed pvts after deallocation. * cdr_mysql stored a pointer that was freed by realloc() * The module loader did not check usecount on shutdown, which led to chan_iax2 reading a timer that was already unloaded. * The event subsystem sometimes creates an event with no IEs. Due to a corner condition, the code would read beyond the memory boundary. * res_pktccops did not correctly check whether its monitor thread was started. (closes issue #16062) Reported by: alexanderheinz Patches: 20091109__issue16062.diff.txt uploaded by tilghman (license 14) Tested by: tilghman git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@228798 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-10AST-2009-005Tilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@211539 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-30Rename cdr_addon_mysql to cdr_mysqlRussell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@204418 65c4cc65-6c06-0410-ace0-fbb531ad65f3