[svn-commits] murf: branch murf/newcdr r62539 - in
/team/murf/newcdr: cel/ main/
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Tue May 1 11:25:25 MST 2007
Author: murf
Date: Tue May 1 13:25:24 2007
New Revision: 62539
URL: http://svn.digium.com/view/asterisk?view=rev&rev=62539
Log:
OK, got the odbc and tds libs, and now those backends compile; added some event generators
Modified:
team/murf/newcdr/cel/cel_odbc.c
team/murf/newcdr/cel/cel_tds.c
team/murf/newcdr/main/channel.c
Modified: team/murf/newcdr/cel/cel_odbc.c
URL: http://svn.digium.com/view/asterisk/team/murf/newcdr/cel/cel_odbc.c?view=diff&rev=62539&r1=62538&r2=62539
==============================================================================
--- team/murf/newcdr/cel/cel_odbc.c (original)
+++ team/murf/newcdr/cel/cel_odbc.c Tue May 1 13:25:24 2007
@@ -65,7 +65,6 @@
#define DATE_FORMAT "%Y-%m-%d %T"
-static char *name = "ODBC";
static char *config = "cel_odbc.conf";
static char *dsn = NULL, *username = NULL, *password = NULL, *table = NULL;
static int loguniqueid = 0;
@@ -99,7 +98,7 @@
struct tm tm;
const struct ast_channel *chan;
enum ast_cel_eventtype eventtype;
- char *userdefname = 0;
+ const char *userdefname = 0;
time_t eventtime = 0;
chan = ast_event_get_ie_raw(event, AST_EVENT_IE_CHANPTR);
@@ -108,7 +107,7 @@
if (eventtype == CEL_USER_DEFINED)
userdefname = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_USEREVENT_NAME);
- cel_set_backend_channel_vars(chan, eventtype, userdefname, eventtime);
+ cel_set_backend_channel_vars((struct ast_channel *)chan, eventtype, userdefname, eventtime);
if (usegmtime)
gmtime_r(&eventtime,&tm);
else
@@ -134,7 +133,7 @@
if (res < 0) {
odbc_disconnect();
ast_mutex_unlock(&odbc_lock);
- return 0;
+ return;
}
}
@@ -146,7 +145,7 @@
SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt);
odbc_disconnect();
ast_mutex_unlock(&odbc_lock);
- return 0;
+ return;
}
/* We really should only have to do this once. But for some
@@ -161,22 +160,22 @@
SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt);
odbc_disconnect();
ast_mutex_unlock(&odbc_lock);
- return 0;
+ return;
}
SQLBindParameter(ODBC_stmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, sizeof(timestr), 0, ×tr, 0, NULL);
- SQLBindParameter(ODBC_stmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, sizeof(chan->cid.name), 0, cel->clid, 0, NULL);
- SQLBindParameter(ODBC_stmt, 3, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, sizeof(chan->cid.num), 0, cel->src, 0, NULL);
- SQLBindParameter(ODBC_stmt, 4, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, sizeof(chan->exten), 0, cel->dst, 0, NULL);
- SQLBindParameter(ODBC_stmt, 5, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, sizeof(chan->context), 0, cel->dcontext, 0, NULL);
- SQLBindParameter(ODBC_stmt, 6, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, sizeof(chan->name), 0, cel->channel, 0, NULL);
- SQLBindParameter(ODBC_stmt, 8, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, sizeof(chan->app), 0, cel->lastapp, 0, NULL);
- SQLBindParameter(ODBC_stmt, 9, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, sizeof(chan->data), 0, cel->lastdata, 0, NULL);
- SQLBindParameter(ODBC_stmt, 13, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &chan->amaflags, 0, NULL);
- SQLBindParameter(ODBC_stmt, 14, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, sizeof(chan->accountcode), 0, cel->accountcode, 0, NULL);
+ SQLBindParameter(ODBC_stmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, sizeof(chan->cid.cid_name), 0, chan->cid.cid_name, 0, NULL);
+ SQLBindParameter(ODBC_stmt, 3, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, sizeof(chan->cid.cid_num), 0, chan->cid.cid_num, 0, NULL);
+ SQLBindParameter(ODBC_stmt, 4, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, sizeof(chan->exten), 0, (char*)chan->exten, 0, NULL);
+ SQLBindParameter(ODBC_stmt, 5, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, sizeof(chan->context), 0, (char*)chan->context, 0, NULL);
+ SQLBindParameter(ODBC_stmt, 6, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, sizeof(chan->name), 0, (char*)chan->name, 0, NULL);
+ SQLBindParameter(ODBC_stmt, 8, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, sizeof(chan->appl), 0, (char*)chan->appl, 0, NULL);
+ SQLBindParameter(ODBC_stmt, 9, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, sizeof(chan->data), 0, (char*)chan->data, 0, NULL);
+ SQLBindParameter(ODBC_stmt, 13, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, (int*)&chan->amaflags, 0, NULL);
+ SQLBindParameter(ODBC_stmt, 14, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, sizeof(chan->accountcode), 0, (char*)chan->accountcode, 0, NULL);
if (loguniqueid) {
- SQLBindParameter(ODBC_stmt, 15, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, sizeof(cel->uniqueid), 0, cel->uniqueid, 0, NULL);
+ SQLBindParameter(ODBC_stmt, 15, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, sizeof(chan->uniqueid), 0, (char*)chan->uniqueid, 0, NULL);
}
if (connected) {
@@ -208,7 +207,7 @@
}
SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt);
ast_mutex_unlock(&odbc_lock);
- return 0;
+ return;
}
static int odbc_unload_module(void)
Modified: team/murf/newcdr/cel/cel_tds.c
URL: http://svn.digium.com/view/asterisk/team/murf/newcdr/cel/cel_tds.c?view=diff&rev=62539&r1=62538&r2=62539
==============================================================================
--- team/murf/newcdr/cel/cel_tds.c (original)
+++ team/murf/newcdr/cel/cel_tds.c Tue May 1 13:25:24 2007
@@ -82,7 +82,6 @@
#define DATE_FORMAT "%Y/%m/%d %T"
-static char *name = "mssql";
static char *config = "cel_tds.conf";
static char *hostname = NULL, *dbname = NULL, *dbuser = NULL, *password = NULL, *charset = NULL, *language = NULL;
@@ -103,11 +102,10 @@
static int mssql_connect(void);
static int mssql_disconnect(void);
-static int tds_log(const struct ast_event *event, void *userdata)
+static void tds_log(const struct ast_event *event, void *userdata)
{
char sqlcmd[2048], start[80];
char *accountcode, *clidnum, *exten, *context, *clid, *channel, *app, *appdata, *uniqueid;
- int res = 0;
int retried = 0;
#ifdef FREETDS_PRE_0_62
TDS_INT result_type;
@@ -123,7 +121,7 @@
if (eventtype == CEL_USER_DEFINED)
userdefname = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_USEREVENT_NAME);
- cel_set_backend_channel_vars(chan, eventtype, userdefname, eventtime);
+ cel_set_backend_channel_vars((struct ast_channel *)chan, eventtype, userdefname, eventtime);
ast_mutex_lock(&tds_lock);
@@ -181,7 +179,7 @@
app,
appdata,
start,
- ast_cel_flags2str(cel->amaflags),
+ ast_cel_flags2str(chan->amaflags),
uniqueid
);
@@ -219,7 +217,7 @@
ast_mutex_unlock(&tds_lock);
- return res;
+ return;
}
static char *anti_injection(const char *str, int len)
@@ -411,7 +409,6 @@
static int tds_load_module(void)
{
- int res = 0;
struct ast_config *cfg;
struct ast_variable *var;
const char *ptr = NULL;
Modified: team/murf/newcdr/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/murf/newcdr/main/channel.c?view=diff&rev=62539&r1=62538&r2=62539
==============================================================================
--- team/murf/newcdr/main/channel.c (original)
+++ team/murf/newcdr/main/channel.c Tue May 1 13:25:24 2007
@@ -52,6 +52,7 @@
#include "asterisk/cli.h"
#include "asterisk/translate.h"
#include "asterisk/manager.h"
+#include "asterisk/cel.h"
#include "asterisk/chanvars.h"
#include "asterisk/linkedlists.h"
#include "asterisk/indications.h"
@@ -740,7 +741,7 @@
S_OR(cid_name, "<unknown>"),
tmp->uniqueid);
}
-
+
/* Reminder for the future: under what conditions do we NOT want to track cdrs on channels? */
/* These 4 variables need to be set up for the cdr_init() to work right */
@@ -769,6 +770,8 @@
tmp->cdr = ast_cdr_alloc();
ast_cdr_init(tmp->cdr, tmp);
ast_cdr_start(tmp->cdr);
+
+ ast_cel_report_event(tmp, CEL_CHANNEL_START, NULL);
headp = &tmp->varshead;
AST_LIST_HEAD_INIT_NOLOCK(headp);
@@ -1073,6 +1076,8 @@
char name[AST_CHANNEL_NAME];
headp=&chan->varshead;
+
+ ast_cel_report_event(chan, CEL_CHANNEL_END, NULL);
AST_LIST_LOCK(&channels);
AST_LIST_REMOVE(&channels, chan, chan_list);
@@ -1640,6 +1645,8 @@
chan->generator->release(chan, chan->generatordata);
chan->generatordata = NULL;
chan->generator = NULL;
+ ast_cel_report_event(chan, CEL_HANGUP, NULL);
+
if (chan->cdr) { /* End the CDR if it hasn't already */
ast_cdr_end(chan->cdr);
ast_cdr_detach(chan->cdr); /* Post and Free the CDR */
@@ -1701,6 +1708,7 @@
res = chan->tech->answer(chan);
ast_setstate(chan, AST_STATE_UP);
ast_cdr_answer(chan->cdr);
+ ast_cel_report_event(chan, CEL_ANSWER, NULL);
ast_channel_unlock(chan);
if (delay)
ast_safe_sleep(chan, delay);
@@ -1708,6 +1716,7 @@
break;
case AST_STATE_UP:
ast_cdr_answer(chan->cdr);
+ ast_cel_report_event(chan, CEL_ANSWER, NULL);
break;
default:
break;
@@ -2217,6 +2226,8 @@
}
ast_cdr_answer(chan->cdr);
+ ast_cel_report_event(chan, CEL_ANSWER, NULL);
+
}
}
break;
More information about the svn-commits
mailing list