From 2974f32e4f200726ffdcf7f2a5d9f22a47f6014e Mon Sep 17 00:00:00 2001 From: markster Date: Sun, 25 Jul 2004 14:56:34 +0000 Subject: Add Manager CDR (off by default) (bug #2127) courtesy cybershield git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3509 f38db490-d61c-443f-a65b-d21fe96a405b --- cdr/cdr_manager.c | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100755 cdr/cdr_manager.c (limited to 'cdr/cdr_manager.c') diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c new file mode 100755 index 000000000..1ebc58e73 --- /dev/null +++ b/cdr/cdr_manager.c @@ -0,0 +1,158 @@ +/* + * Asterisk -- A telephony toolkit for Linux. + * + * Asterisk Call Manager CDR records. + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "../asterisk.h" +#include "../astconf.h" +#include +#include +#include + +#define DATE_FORMAT "%Y-%m-%d %T" +#define CONF_FILE "cdr_manager.conf" + +static char *desc = "Asterisk Call Manager CDR Backend"; +static char *name = "cdr_as"; + +static int enablecdr = 0; + +static void loadconfigurationfile(void) +{ + char *cat; + struct ast_config *cfg; + struct ast_variable *v; + + cfg = ast_load(CONF_FILE); + if (!cfg) { + /* Standard configuration */ + enablecdr = 0; + return; + } + + cat = ast_category_browse(cfg, NULL); + while (cat) { + if (!strcasecmp(cat, "general")) { + v = ast_variable_browse(cfg, cat); + while (v) { + if (!strcasecmp(v->name, "enabled")) { + enablecdr = ast_true(v->value); + } + + v = v->next; + } + } + + /* Next category */ + cat = ast_category_browse(cfg, cat); + } + + ast_destroy(cfg); +} + +static int manager_log(struct ast_cdr *cdr) +{ + time_t t; + struct tm timeresult; + char strStartTime[80] = ""; + char strAnswerTime[80] = ""; + char strEndTime[80] = ""; + + if (!enablecdr) + return 0; + + t = cdr->start.tv_sec; + localtime_r(&t, &timeresult); + strftime(strStartTime, sizeof(strStartTime), DATE_FORMAT, &timeresult); + + if (cdr->answer.tv_sec) { + t = cdr->answer.tv_sec; + localtime_r(&t, &timeresult); + strftime(strAnswerTime, sizeof(strAnswerTime), DATE_FORMAT, &timeresult); + } + + t = cdr->end.tv_sec; + localtime_r(&t, &timeresult); + strftime(strEndTime, sizeof(strEndTime), DATE_FORMAT, &timeresult); + + manager_event(EVENT_FLAG_CALL, "Cdr", + "AccountCode: %s\r\n" + "Source: %s\r\n" + "Destination: %s\r\n" + "DestinationContext: %s\r\n" + "CallerID: %s\r\n" + "Channel: %s\r\n" + "DestinationChannel: %s\r\n" + "LastApplication: %s\r\n" + "LastData: %s\r\n" + "StartTime: %s\r\n" + "AnswerTime: %s\r\n" + "EndTime: %s\r\n" + "Duration: %d\r\n" + "BillableSeconds: %d\r\n" + "Disposition: %s\r\n" + "AMAFlags: %s\r\n" + "UniqueID: %s\r\n" + "UserField: %s\r\n", + cdr->accountcode, cdr->src, cdr->dst, cdr->dcontext, cdr->clid, cdr->channel, + cdr->dstchannel, cdr->lastapp, cdr->lastdata, strStartTime, strAnswerTime, strEndTime, + cdr->duration, cdr->billsec, ast_cdr_disp2str(cdr->disposition), + ast_cdr_flags2str(cdr->amaflags), cdr->uniqueid, cdr->userfield); + + return 0; +} + +char *description(void) +{ + return desc; +} + +int unload_module(void) +{ + ast_cdr_unregister(name); + return 0; +} + +int load_module(void) +{ + int res; + + /* Configuration file */ + loadconfigurationfile(); + + res = ast_cdr_register(name, desc, manager_log); + if (res) { + ast_log(LOG_ERROR, "Unable to register Asterisk Call Manager CDR handling\n"); + } + + return res; +} + +int reload(void) +{ + loadconfigurationfile(); + return 0; +} + +int usecount(void) +{ + return 0; +} + +char *key() +{ + return ASTERISK_GPL_KEY; +} -- cgit v1.2.3 From 2207b9a515214bf72785eabf75bd587bd7df23e8 Mon Sep 17 00:00:00 2001 From: markster Date: Tue, 25 Jan 2005 06:10:20 +0000 Subject: Merge config updates (bug #3406) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4889 f38db490-d61c-443f-a65b-d21fe96a405b --- cdr/cdr_manager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cdr/cdr_manager.c') diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c index 1ebc58e73..110aebadc 100755 --- a/cdr/cdr_manager.c +++ b/cdr/cdr_manager.c @@ -36,7 +36,7 @@ static void loadconfigurationfile(void) struct ast_config *cfg; struct ast_variable *v; - cfg = ast_load(CONF_FILE); + cfg = ast_config_load(CONF_FILE); if (!cfg) { /* Standard configuration */ enablecdr = 0; @@ -60,7 +60,7 @@ static void loadconfigurationfile(void) cat = ast_category_browse(cfg, cat); } - ast_destroy(cfg); + ast_config_destroy(cfg); } static int manager_log(struct ast_cdr *cdr) -- cgit v1.2.3 From 31e8dcf4fe91466bf35a3f6d4de2bd714c43b288 Mon Sep 17 00:00:00 2001 From: kpfleming Date: Thu, 21 Apr 2005 06:02:45 +0000 Subject: use double-quotes instead of angle-brackets for non-system include files (bug #4058) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5490 f38db490-d61c-443f-a65b-d21fe96a405b --- cdr/cdr_manager.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'cdr/cdr_manager.c') diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c index 110aebadc..6ba46fd5f 100755 --- a/cdr/cdr_manager.c +++ b/cdr/cdr_manager.c @@ -9,15 +9,15 @@ */ #include -#include -#include -#include -#include -#include -#include -#include -#include "../asterisk.h" -#include "../astconf.h" +#include "asterisk/channel.h" +#include "asterisk/cdr.h" +#include "asterisk/module.h" +#include "asterisk/logger.h" +#include "asterisk/utils.h" +#include "asterisk/manager.h" +#include "asterisk/config.h" +#include "asterisk.h" +#include "astconf.h" #include #include #include -- cgit v1.2.3 From 46d0533b99ab53d15a5c3b68c3004d765ba3bf1f Mon Sep 17 00:00:00 2001 From: kpfleming Date: Fri, 3 Jun 2005 01:42:31 +0000 Subject: support configurable batch posting of CDRs (off by default) (bug #3883) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5823 f38db490-d61c-443f-a65b-d21fe96a405b --- cdr/cdr_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cdr/cdr_manager.c') diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c index 6ba46fd5f..d8421783c 100755 --- a/cdr/cdr_manager.c +++ b/cdr/cdr_manager.c @@ -26,7 +26,7 @@ #define CONF_FILE "cdr_manager.conf" static char *desc = "Asterisk Call Manager CDR Backend"; -static char *name = "cdr_as"; +static char *name = "cdr_manager"; static int enablecdr = 0; -- cgit v1.2.3 From e5006737913cf0182a428bea5fe509001aa4e98f Mon Sep 17 00:00:00 2001 From: kpfleming Date: Mon, 6 Jun 2005 03:04:58 +0000 Subject: major Makefile and build process improvements, including removal of all hardcoded paths (modules must now use run-time paths as they should) (bug #4116) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5855 f38db490-d61c-443f-a65b-d21fe96a405b --- cdr/cdr_manager.c | 1 - 1 file changed, 1 deletion(-) (limited to 'cdr/cdr_manager.c') diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c index d8421783c..556358287 100755 --- a/cdr/cdr_manager.c +++ b/cdr/cdr_manager.c @@ -17,7 +17,6 @@ #include "asterisk/manager.h" #include "asterisk/config.h" #include "asterisk.h" -#include "astconf.h" #include #include #include -- cgit v1.2.3 From 09f3094700013cd98ad62e36384942be94348225 Mon Sep 17 00:00:00 2001 From: kpfleming Date: Mon, 6 Jun 2005 21:09:59 +0000 Subject: another round of version tag updates, along with 'show version files' pattern filtering git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5865 f38db490-d61c-443f-a65b-d21fe96a405b --- cdr/cdr_manager.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'cdr/cdr_manager.c') diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c index 556358287..c529d05e1 100755 --- a/cdr/cdr_manager.c +++ b/cdr/cdr_manager.c @@ -9,6 +9,14 @@ */ #include +#include +#include +#include + +#include "asterisk.h" + +ASTERISK_FILE_VERSION("$Revision$") + #include "asterisk/channel.h" #include "asterisk/cdr.h" #include "asterisk/module.h" @@ -16,10 +24,6 @@ #include "asterisk/utils.h" #include "asterisk/manager.h" #include "asterisk/config.h" -#include "asterisk.h" -#include -#include -#include #define DATE_FORMAT "%Y-%m-%d %T" #define CONF_FILE "cdr_manager.conf" -- cgit v1.2.3 From 6f0f46299c012f00eada2e4f504a52eb0cbd3040 Mon Sep 17 00:00:00 2001 From: kpfleming Date: Mon, 6 Jun 2005 22:12:19 +0000 Subject: more file version tags git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5866 f38db490-d61c-443f-a65b-d21fe96a405b --- cdr/cdr_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cdr/cdr_manager.c') diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c index c529d05e1..3aa9afdc0 100755 --- a/cdr/cdr_manager.c +++ b/cdr/cdr_manager.c @@ -15,7 +15,7 @@ #include "asterisk.h" -ASTERISK_FILE_VERSION("$Revision$") +ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/channel.h" #include "asterisk/cdr.h" -- cgit v1.2.3 From f89c44df03e93ece4abe3b54451c3a203f03f53a Mon Sep 17 00:00:00 2001 From: kpfleming Date: Thu, 15 Sep 2005 15:44:26 +0000 Subject: more license/copyright header updates (thanks Ian!) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6618 f38db490-d61c-443f-a65b-d21fe96a405b --- cdr/cdr_manager.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'cdr/cdr_manager.c') diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c index 3aa9afdc0..7acc07de1 100755 --- a/cdr/cdr_manager.c +++ b/cdr/cdr_manager.c @@ -1,11 +1,23 @@ /* - * Asterisk -- A telephony toolkit for Linux. + * Asterisk -- An open source telephony toolkit. + * + * Copyright (C) 2004 - 2005 + * + * See http://www.asterisk.org for more information about + * the Asterisk project. Please do not directly contact + * any of the maintainers of this project for assistance; + * the project provides a web site, mailing lists and IRC + * channels for your use. * - * Asterisk Call Manager CDR records. - * * This program is free software, distributed under the terms of - * the GNU General Public License. + * the GNU General Public License Version 2. See the LICENSE file + * at the top of the source tree. + */ + +/* * + * Asterisk Call Manager CDR records. + * */ #include -- cgit v1.2.3 From bb65d2e30ad3f60c41392e62f6967cd56da24807 Mon Sep 17 00:00:00 2001 From: russell Date: Wed, 26 Oct 2005 13:03:17 +0000 Subject: more doxygenification (issue #5513) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6852 f38db490-d61c-443f-a65b-d21fe96a405b --- cdr/cdr_manager.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'cdr/cdr_manager.c') diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c index 7acc07de1..71546b120 100755 --- a/cdr/cdr_manager.c +++ b/cdr/cdr_manager.c @@ -14,10 +14,14 @@ * at the top of the source tree. */ -/* +/*! \file * - * Asterisk Call Manager CDR records. + * \brief Asterisk Call Manager CDR records. * + * See also + * \arg \ref AstCDR + * \arg \ref AstAMI + * \arg \ref Config_ami */ #include -- cgit v1.2.3 From d3ddc001a22ebbbea8ff3601fe8698edff8e7f05 Mon Sep 17 00:00:00 2001 From: russell Date: Sun, 6 Nov 2005 15:09:47 +0000 Subject: issue #5605 git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6979 f38db490-d61c-443f-a65b-d21fe96a405b --- cdr/cdr_manager.c | 1 + 1 file changed, 1 insertion(+) (limited to 'cdr/cdr_manager.c') diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c index 71546b120..e914772a2 100755 --- a/cdr/cdr_manager.c +++ b/cdr/cdr_manager.c @@ -22,6 +22,7 @@ * \arg \ref AstCDR * \arg \ref AstAMI * \arg \ref Config_ami + * \ingroup cdr_drivers */ #include -- cgit v1.2.3 From 24c1e3c22259fee9f8a08911d5e5c6e2604ead18 Mon Sep 17 00:00:00 2001 From: kpfleming Date: Tue, 29 Nov 2005 18:24:39 +0000 Subject: git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7221 f38db490-d61c-443f-a65b-d21fe96a405b --- cdr/cdr_manager.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 cdr/cdr_manager.c (limited to 'cdr/cdr_manager.c') diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c old mode 100755 new mode 100644 -- cgit v1.2.3 From d723568b932abb813d34582169a03b6e45dc800a Mon Sep 17 00:00:00 2001 From: tilghman Date: Wed, 1 Mar 2006 17:53:05 +0000 Subject: Merged revisions 11503 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r11503 | tilghman | 2006-03-01 11:41:52 -0600 (Wed, 01 Mar 2006) | 2 lines Bug 6615 - Fix 64bit conversion errors by using a long int ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@11504 f38db490-d61c-443f-a65b-d21fe96a405b --- cdr/cdr_manager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cdr/cdr_manager.c') diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c index e914772a2..cd43c12be 100644 --- a/cdr/cdr_manager.c +++ b/cdr/cdr_manager.c @@ -121,8 +121,8 @@ static int manager_log(struct ast_cdr *cdr) "StartTime: %s\r\n" "AnswerTime: %s\r\n" "EndTime: %s\r\n" - "Duration: %d\r\n" - "BillableSeconds: %d\r\n" + "Duration: %ld\r\n" + "BillableSeconds: %ld\r\n" "Disposition: %s\r\n" "AMAFlags: %s\r\n" "UniqueID: %s\r\n" -- cgit v1.2.3 From e4880150b1746ede7bd3c9e0f8fb88901a8c562b Mon Sep 17 00:00:00 2001 From: kpfleming Date: Sat, 8 Apr 2006 22:01:19 +0000 Subject: since the module API is changing, it's a good time to const-ify the description() and key() return values git-svn-id: http://svn.digium.com/svn/asterisk/trunk@18552 f38db490-d61c-443f-a65b-d21fe96a405b --- cdr/cdr_manager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cdr/cdr_manager.c') diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c index cd43c12be..ed99a5690 100644 --- a/cdr/cdr_manager.c +++ b/cdr/cdr_manager.c @@ -135,7 +135,7 @@ static int manager_log(struct ast_cdr *cdr) return 0; } -char *description(void) +const char *description(void) { return desc; } @@ -172,7 +172,7 @@ int usecount(void) return 0; } -char *key() +const char *key() { return ASTERISK_GPL_KEY; } -- cgit v1.2.3 From 3664249356aa4768fcb0b3b8e6cf9365fcbd0c8d Mon Sep 17 00:00:00 2001 From: rizzo Date: Fri, 14 Apr 2006 14:08:19 +0000 Subject: This rather large commit changes the way modules are loaded. As partly documented in loader.c and include/asterisk/module.h, modules are now expected to return all of their methods and flags into a structure 'mod_data', and are normally loaded with RTLD_NOW | RTLD_LOCAL, so symbols are resolved immediately and conflicts should be less likely. Only in a small number of cases (res_*, typically) modules are loaded RTLD_GLOBAL, so they can export symbols. The core of the change is only the two files loader.c and include/asterisk/module.h, all the rest is simply adaptation of the existing modules to the new API, a rather mechanical (but believe me, time and finger-consuming!) process whose detail you can figure out by svn diff'ing any single module. Expect some minor compilation issue after this change, please report it on mantis http://bugs.digium.com/view.php?id=6968 so we collect all the feedback in one place. I am just sorry that this change missed SVN version number 20000! git-svn-id: http://svn.digium.com/svn/asterisk/trunk@20003 f38db490-d61c-443f-a65b-d21fe96a405b --- cdr/cdr_manager.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'cdr/cdr_manager.c') diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c index ed99a5690..c24130df7 100644 --- a/cdr/cdr_manager.c +++ b/cdr/cdr_manager.c @@ -135,18 +135,18 @@ static int manager_log(struct ast_cdr *cdr) return 0; } -const char *description(void) +static const char *description(void) { return desc; } -int unload_module(void) +static int unload_module(void *mod) { ast_cdr_unregister(name); return 0; } -int load_module(void) +static int load_module(void *mod) { int res; @@ -161,18 +161,15 @@ int load_module(void) return res; } -int reload(void) +static int reload(void *mod) { loadconfigurationfile(); return 0; } -int usecount(void) -{ - return 0; -} - -const char *key() +static const char *key(void) { return ASTERISK_GPL_KEY; } + +STD_MOD(MOD_1 | NO_USECOUNT, reload, NULL, NULL); -- cgit v1.2.3 From 73c525e6e2dbcf452c2e78e44a63678f2b2068ea Mon Sep 17 00:00:00 2001 From: kpfleming Date: Wed, 7 Jun 2006 18:54:56 +0000 Subject: simplify autoconfig include mechanism (make tholo happy he can use lint again :-) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@32846 f38db490-d61c-443f-a65b-d21fe96a405b --- cdr/cdr_manager.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cdr/cdr_manager.c') diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c index c24130df7..1e1db4890 100644 --- a/cdr/cdr_manager.c +++ b/cdr/cdr_manager.c @@ -25,15 +25,15 @@ * \ingroup cdr_drivers */ +#include "asterisk.h" + +ASTERISK_FILE_VERSION(__FILE__, "$Revision$") + #include #include #include #include -#include "asterisk.h" - -ASTERISK_FILE_VERSION(__FILE__, "$Revision$") - #include "asterisk/channel.h" #include "asterisk/cdr.h" #include "asterisk/module.h" -- cgit v1.2.3 From 8b0c007ad990aa27d9868da49215fd1076ac77cc Mon Sep 17 00:00:00 2001 From: kpfleming Date: Mon, 21 Aug 2006 02:11:39 +0000 Subject: merge new_loader_completion branch, including (at least): - restructured build tree and makefiles to eliminate recursion problems - support for embedded modules - support for static builds - simpler cross-compilation support - simpler module/loader interface (no exported symbols) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@40722 f38db490-d61c-443f-a65b-d21fe96a405b --- cdr/cdr_manager.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'cdr/cdr_manager.c') diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c index 1e1db4890..07406734d 100644 --- a/cdr/cdr_manager.c +++ b/cdr/cdr_manager.c @@ -45,7 +45,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #define DATE_FORMAT "%Y-%m-%d %T" #define CONF_FILE "cdr_manager.conf" -static char *desc = "Asterisk Call Manager CDR Backend"; static char *name = "cdr_manager"; static int enablecdr = 0; @@ -135,25 +134,20 @@ static int manager_log(struct ast_cdr *cdr) return 0; } -static const char *description(void) -{ - return desc; -} - -static int unload_module(void *mod) +static int unload_module(void) { ast_cdr_unregister(name); return 0; } -static int load_module(void *mod) +static int load_module(void) { int res; /* Configuration file */ loadconfigurationfile(); - res = ast_cdr_register(name, desc, manager_log); + res = ast_cdr_register(name, "Asterisk Manager Interface CDR Backend", manager_log); if (res) { ast_log(LOG_ERROR, "Unable to register Asterisk Call Manager CDR handling\n"); } @@ -161,15 +155,14 @@ static int load_module(void *mod) return res; } -static int reload(void *mod) +static int reload(void) { loadconfigurationfile(); return 0; } -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD(MOD_1 | NO_USECOUNT, reload, NULL, NULL); +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Asterisk Manager Interface CDR Backend", + .load = load_module, + .unload = unload_module, + .reload = reload, + ); -- cgit v1.2.3 From 73925ee14a02afb50f6c0aea3cc4e54f99493440 Mon Sep 17 00:00:00 2001 From: mogorman Date: Thu, 31 Aug 2006 21:00:20 +0000 Subject: everything that loads a config that needs a config file to run now reports AST_MODULE_LOAD_DECLINE when loading if config file is not there, also fixed an error in res_config_pgsql where it had a non static function when it should. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@41633 f38db490-d61c-443f-a65b-d21fe96a405b --- cdr/cdr_manager.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'cdr/cdr_manager.c') diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c index 07406734d..4e43a30ff 100644 --- a/cdr/cdr_manager.c +++ b/cdr/cdr_manager.c @@ -49,7 +49,7 @@ static char *name = "cdr_manager"; static int enablecdr = 0; -static void loadconfigurationfile(void) +static int loadconfigurationfile(void) { char *cat; struct ast_config *cfg; @@ -59,7 +59,7 @@ static void loadconfigurationfile(void) if (!cfg) { /* Standard configuration */ enablecdr = 0; - return; + return 0; } cat = ast_category_browse(cfg, NULL); @@ -80,6 +80,7 @@ static void loadconfigurationfile(void) } ast_config_destroy(cfg); + return 1; } static int manager_log(struct ast_cdr *cdr) @@ -145,7 +146,8 @@ static int load_module(void) int res; /* Configuration file */ - loadconfigurationfile(); + if(loadconfigurationfile()) + return AST_MODULE_LOAD_DECLINE; res = ast_cdr_register(name, "Asterisk Manager Interface CDR Backend", manager_log); if (res) { -- cgit v1.2.3 From 5e6f8b1258fc42cbc7d8ad8a47ec42356ea302f8 Mon Sep 17 00:00:00 2001 From: qwell Date: Wed, 10 Jan 2007 16:45:36 +0000 Subject: Reverse some logic in cdr_manager, which made it fail to load if the config file existed. Issue 8777 git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@50346 f38db490-d61c-443f-a65b-d21fe96a405b --- cdr/cdr_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cdr/cdr_manager.c') diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c index 4e43a30ff..bd6ef6709 100644 --- a/cdr/cdr_manager.c +++ b/cdr/cdr_manager.c @@ -146,7 +146,7 @@ static int load_module(void) int res; /* Configuration file */ - if(loadconfigurationfile()) + if (!loadconfigurationfile()) return AST_MODULE_LOAD_DECLINE; res = ast_cdr_register(name, "Asterisk Manager Interface CDR Backend", manager_log); -- cgit v1.2.3 From a45f0ce8a0fded7acff845122856b8b92e8a1e00 Mon Sep 17 00:00:00 2001 From: kpfleming Date: Thu, 14 Jun 2007 21:50:40 +0000 Subject: use ast_localtime() in every place localtime_r() was being used git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@69392 f38db490-d61c-443f-a65b-d21fe96a405b --- cdr/cdr_manager.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cdr/cdr_manager.c') diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c index bd6ef6709..352d7d400 100644 --- a/cdr/cdr_manager.c +++ b/cdr/cdr_manager.c @@ -95,17 +95,17 @@ static int manager_log(struct ast_cdr *cdr) return 0; t = cdr->start.tv_sec; - localtime_r(&t, &timeresult); + ast_localtime(&t, &timeresult, NULL); strftime(strStartTime, sizeof(strStartTime), DATE_FORMAT, &timeresult); if (cdr->answer.tv_sec) { t = cdr->answer.tv_sec; - localtime_r(&t, &timeresult); + ast_localtime(&t, &timeresult, NULL); strftime(strAnswerTime, sizeof(strAnswerTime), DATE_FORMAT, &timeresult); } t = cdr->end.tv_sec; - localtime_r(&t, &timeresult); + ast_localtime(&t, &timeresult, NULL); strftime(strEndTime, sizeof(strEndTime), DATE_FORMAT, &timeresult); manager_event(EVENT_FLAG_CALL, "Cdr", -- cgit v1.2.3