[Freeswitch-branches] [commit] r3959 - in freeswitch/branches/mishehu/src/mod: endpoints/mod_opal event_handlers/mod_cdr
Freeswitch SVN
mishehu at freeswitch.org
Sat Jan 13 16:04:57 EST 2007
Author: mishehu
Date: Sat Jan 13 16:04:56 2007
New Revision: 3959
Modified:
freeswitch/branches/mishehu/src/mod/endpoints/mod_opal/baseopal.cpp
freeswitch/branches/mishehu/src/mod/endpoints/mod_opal/baseopal.h
freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/basecdr.cpp
freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp
freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/sqlitecdr.cpp
freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/sqlitecdr.h
Log:
Fixed a minor assumption in basecdr.cpp, few other minor issues. Also cleaning up the skeleton of mod_opal in order to make heads and tails out of it.
Modified: freeswitch/branches/mishehu/src/mod/endpoints/mod_opal/baseopal.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/endpoints/mod_opal/baseopal.cpp (original)
+++ freeswitch/branches/mishehu/src/mod/endpoints/mod_opal/baseopal.cpp Sat Jan 13 16:04:56 2007
@@ -20,9 +20,8 @@
BaseOPAL::BaseOPAL()
{
-#if OPAL_H323
h323EP = NULL;
-#endif
+ /*
#if OPAL_SIP
sipEP = NULL;
#endif
@@ -31,7 +30,7 @@
#if P_EXPAT
ivrEP = NULL;
#endif
-
+ */
autoStartReceiveVideo = autoStartTransmitVideo = FALSE;
}
@@ -48,11 +47,10 @@
// Create all the endpoints
-#if OPAL_H323
if (h323EP == NULL)
h323EP = new H323EndPoint(*this);
-#endif
+ /*
#if OPAL_SIP
if (sipEP == NULL)
sipEP = new SIPEndPoint(*this);
@@ -68,7 +66,7 @@
if (ivrEP == NULL)
ivrEP = new OpalIVREndPoint(*this);
#endif
-
+ */
// General parameters for all endpoint types
fieldArray = new PHTTPFieldArray(new PHTTPStringField(PreferredMediaKey, 25), TRUE);
PStringArray formats = fieldArray->GetStrings(cfg);
Modified: freeswitch/branches/mishehu/src/mod/endpoints/mod_opal/baseopal.h
==============================================================================
--- freeswitch/branches/mishehu/src/mod/endpoints/mod_opal/baseopal.h (original)
+++ freeswitch/branches/mishehu/src/mod/endpoints/mod_opal/baseopal.h Sat Jan 13 16:04:56 2007
@@ -17,11 +17,13 @@
typedef PHTTPServiceProcess OpalGwProcessAncestor;
#endif
-class SIPEndPoint;
+//class SIPEndPoint;
class H323EndPoint;
+/*
class OpalPOTSEndPoint;
class OpalPSTNEndPoint;
class OpalIVREndPoint;
+*/
class BaseOPAL : public OpalManager {
public:
@@ -29,12 +31,14 @@
~BaseOPAL();
protected:
H323EndPoint * h323EP;
+ /*
SIPEndPoint * sipEP;
OpalPOTSEndPoint * potsEP;
OpalPSTNEndPoint * pstnEP;
#if P_EXPAT
OpalIVREndPoint * ivrEP;
#endif
+ */
private:
switch_xml_t cfg, xml, settings, param;
static char *configfile;
Modified: freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/basecdr.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/basecdr.cpp (original)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/basecdr.cpp Sat Jan 13 16:04:56 2007
@@ -60,6 +60,7 @@
if(newchannel != 0)
{
errorstate = 0;
+ originated=1; // One-legged calls are always considered the originator
memset(clid,0,80);
memset(dialplan,0,80);
memset(myuuid,0,37);
@@ -132,7 +133,6 @@
// Or were we maybe we were the caller?
if(newchannel->callerprofile->originatee_caller_profile)
{
- originated = 1;
if (newchannel->callerprofile) {
if(newchannel->callerprofile->caller_id_number != 0)
strncpy(src,newchannel->callerprofile->caller_id_number,strlen(newchannel->callerprofile->caller_id_number));
Modified: freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp (original)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp Sat Jan 13 16:04:56 2007
@@ -335,13 +335,13 @@
set_mysql_time(tm1,my_callstartdate);
set_mysql_time(tm2,my_callanswerdate);
set_mysql_time(tm3,my_calltransferdate);
- set_mysql_time(tm4,my_calltransferdate);
+ set_mysql_time(tm4,my_callenddate);
// Why is this out of order? I don't know, it doesn't make sense.
add_parameter(my_callstartdate,MYSQL_TYPE_DATETIME);
add_parameter(my_callanswerdate,MYSQL_TYPE_DATETIME);
- add_parameter(my_callenddate,MYSQL_TYPE_DATETIME);
add_parameter(my_calltransferdate,MYSQL_TYPE_DATETIME);
+ add_parameter(my_callenddate,MYSQL_TYPE_DATETIME);
add_parameter(originated,MYSQL_TYPE_TINY);
add_string_parameter(clid,clid_length,MYSQL_TYPE_VAR_STRING,0);
Modified: freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/sqlitecdr.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/sqlitecdr.cpp (original)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/sqlitecdr.cpp Sat Jan 13 16:04:56 2007
@@ -75,6 +75,7 @@
switch_core_db_stmt_t* SqliteCDR::stmt_chanvars=0;
switch_core_db_stmt_t* SqliteCDR::stmt_begin=0;
switch_core_db_stmt_t* SqliteCDR::stmt_commit=0;
+bool SqliteCDR::use_utc_time = 0;
std::string SqliteCDR::display_name = "SqliteCDR - The sqlite3 cdr logging backend";
void SqliteCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settings, switch_xml_t& param)
@@ -132,6 +133,18 @@
repeat_fixed_in_supp = 1;
}
}
+ else if(!strcmp(var,"timezone"))
+ {
+ if(!strcmp(val,"utc"))
+ use_utc_time = 1;
+ else if(!strcmp(val,"local"))
+ use_utc_time = 0;
+ else
+ {
+ switch_console_printf(SWITCH_CHANNEL_LOG,"Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n",val);
+ use_utc_time = 0;
+ }
+ }
}
if (count_config_params==1)
@@ -409,13 +422,39 @@
bool SqliteCDR::process_record()
{
+ if(use_utc_time)
+ {
+ switch_time_exp_t tm1, tm2, tm3, tm4;
+ memset(&tm1,0,sizeof(tm1));
+ memset(&tm2,0,sizeof(tm2));
+ memset(&tm3,0,sizeof(tm3));
+ memset(&tm4,0,sizeof(tm4));
+
+ switch_time_exp_gmt(&tm1,callstartdate);
+ switch_time_exp_gmt(&tm2,callanswerdate);
+ switch_time_exp_gmt(&tm3,calltransferdate);
+ switch_time_exp_gmt(&tm4,calltransferdate);
+
+ switch_time_exp_gmt_get(&sqlite_callstartdate,&tm1);
+ switch_time_exp_gmt_get(&sqlite_callanswerdate,&tm2);
+ switch_time_exp_gmt_get(&sqlite_calltransferdate,&tm3);
+ switch_time_exp_gmt_get(&sqlite_callenddate,&tm4);
+ }
+ else
+ {
+ sqlite_callstartdate = callstartdate;
+ sqlite_callanswerdate = callanswerdate;
+ sqlite_calltransferdate = calltransferdate;
+ sqlite_callenddate = callenddate;
+ }
+
int column = 1;
switch_core_db_step(stmt_begin);
switch_core_db_reset(stmt_begin);
- switch_core_db_bind_int64(stmt, column++, (sqlite_int64) callstartdate);
- switch_core_db_bind_int64(stmt, column++, (sqlite_int64) callanswerdate);
- switch_core_db_bind_int64(stmt, column++, (sqlite_int64) calltransferdate);
- switch_core_db_bind_int64(stmt, column++, (sqlite_int64) callenddate);
+ switch_core_db_bind_int64(stmt, column++, (sqlite_int64) sqlite_callstartdate);
+ switch_core_db_bind_int64(stmt, column++, (sqlite_int64) sqlite_callanswerdate);
+ switch_core_db_bind_int64(stmt, column++, (sqlite_int64) sqlite_calltransferdate);
+ switch_core_db_bind_int64(stmt, column++, (sqlite_int64) sqlite_callenddate);
switch_core_db_bind_int(stmt, column++, (int) originated);
switch_core_db_bind_text(stmt, column++, clid,-1,SQLITE_STATIC);
switch_core_db_bind_text(stmt, column++, src,-1,SQLITE_STATIC);
Modified: freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/sqlitecdr.h
==============================================================================
--- freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/sqlitecdr.h (original)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/sqlitecdr.h Sat Jan 13 16:04:56 2007
@@ -59,6 +59,11 @@
static std::string tmp_sql_query; // Object must exist to bind the statement, this used for generating the sql
static char sql_query_chanvars[100];
static std::string db_filename;
+ static bool use_utc_time;
+ switch_time_t sqlite_callstartdate;
+ switch_time_t sqlite_callanswerdate;
+ switch_time_t sqlite_calltransferdate;
+ switch_time_t sqlite_callenddate;
static switch_core_db_t *db;
static switch_core_db_stmt_t *stmt;
static switch_core_db_stmt_t *stmt_chanvars;
More information about the Freeswitch-branches
mailing list