make mod cdr work on windows, and make it segfault less.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2279 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
eaa28d3ea9
commit
c0be28d911
|
@ -82,49 +82,55 @@ BaseCDR::BaseCDR(switch_mod_cdr_newchannel_t *newchannel)
|
||||||
callanswerdate = newchannel->timetable->answered;
|
callanswerdate = newchannel->timetable->answered;
|
||||||
callenddate = newchannel->timetable->hungup;
|
callenddate = newchannel->timetable->hungup;
|
||||||
|
|
||||||
if(newchannel->callerprofile->caller_id_name != 0)
|
if (newchannel->callerprofile) {
|
||||||
{
|
if(newchannel->callerprofile->caller_id_name != 0)
|
||||||
strncpy(clid,newchannel->callerprofile->caller_id_name,strlen(newchannel->callerprofile->caller_id_name));
|
{
|
||||||
strncat(clid," <",2);
|
strncpy(clid,newchannel->callerprofile->caller_id_name,strlen(newchannel->callerprofile->caller_id_name));
|
||||||
if(newchannel->callerprofile->caller_id_number != 0 )
|
strncat(clid," <",2);
|
||||||
strncat(clid,newchannel->callerprofile->caller_id_number,strlen(clid)+strlen(newchannel->callerprofile->caller_id_number));
|
if(newchannel->callerprofile->caller_id_number != 0 )
|
||||||
strncat(clid,">",1);
|
strncat(clid,newchannel->callerprofile->caller_id_number,strlen(clid)+strlen(newchannel->callerprofile->caller_id_number));
|
||||||
|
strncat(clid,">",1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the ANI information if it's set
|
||||||
|
if(newchannel->callerprofile->ani != 0)
|
||||||
|
strncpy(ani,newchannel->callerprofile->ani,strlen(newchannel->callerprofile->ani));
|
||||||
|
if(newchannel->callerprofile->ani2 != 0)
|
||||||
|
strncpy(ani2,newchannel->callerprofile->ani2,strlen(newchannel->callerprofile->ani2));
|
||||||
|
|
||||||
|
if(newchannel->callerprofile->dialplan != 0)
|
||||||
|
strncpy(dialplan,newchannel->callerprofile->dialplan,strlen(newchannel->callerprofile->dialplan));
|
||||||
|
|
||||||
|
if(newchannel->callerprofile->network_addr != 0)
|
||||||
|
strncpy(network_addr,newchannel->callerprofile->network_addr,strlen(newchannel->callerprofile->network_addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the ANI information if it's set
|
|
||||||
if(newchannel->callerprofile->ani != 0)
|
|
||||||
strncpy(ani,newchannel->callerprofile->ani,strlen(newchannel->callerprofile->ani));
|
|
||||||
if(newchannel->callerprofile->ani2 != 0)
|
|
||||||
strncpy(ani2,newchannel->callerprofile->ani2,strlen(newchannel->callerprofile->ani2));
|
|
||||||
|
|
||||||
if(newchannel->callerprofile->dialplan != 0)
|
|
||||||
strncpy(dialplan,newchannel->callerprofile->dialplan,strlen(newchannel->callerprofile->dialplan));
|
|
||||||
|
|
||||||
if(newchannel->callerprofile->network_addr != 0)
|
|
||||||
strncpy(network_addr,newchannel->callerprofile->network_addr,strlen(newchannel->callerprofile->network_addr));
|
|
||||||
|
|
||||||
originated = newchannel->originate;
|
originated = newchannel->originate;
|
||||||
|
|
||||||
if(newchannel->originateprofile->uuid != 0)
|
if(newchannel->originateprofile && newchannel->originateprofile->uuid != 0)
|
||||||
strncpy(destuuid,newchannel->originateprofile->uuid,strlen(newchannel->originateprofile->uuid));
|
strncpy(destuuid,newchannel->originateprofile->uuid,strlen(newchannel->originateprofile->uuid));
|
||||||
|
|
||||||
// We still need to check if this is originated or not
|
// We still need to check if this is originated or not
|
||||||
if(originated == 0)
|
if(originated == 0)
|
||||||
{
|
{
|
||||||
if(newchannel->callerprofile->destination_number != 0)
|
if (newchannel->callerprofile) {
|
||||||
strncpy(src,newchannel->callerprofile->destination_number,strlen(newchannel->callerprofile->destination_number));
|
if(newchannel->callerprofile->destination_number != 0)
|
||||||
if(newchannel->callerprofile->caller_id_number != 0)
|
strncpy(src,newchannel->callerprofile->destination_number,strlen(newchannel->callerprofile->destination_number));
|
||||||
strncpy(dst,newchannel->callerprofile->caller_id_number,strlen(newchannel->callerprofile->caller_id_number));
|
if(newchannel->callerprofile->caller_id_number != 0)
|
||||||
if(newchannel->originateprofile->chan_name != 0)
|
strncpy(dst,newchannel->callerprofile->caller_id_number,strlen(newchannel->callerprofile->caller_id_number));
|
||||||
|
}
|
||||||
|
if(newchannel->originateprofile && newchannel->originateprofile->chan_name != 0)
|
||||||
strncpy(dstchannel,newchannel->originateprofile->chan_name,strlen(newchannel->originateprofile->chan_name));
|
strncpy(dstchannel,newchannel->originateprofile->chan_name,strlen(newchannel->originateprofile->chan_name));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(newchannel->callerprofile->caller_id_number != 0)
|
if (newchannel->callerprofile) {
|
||||||
strncpy(src,newchannel->callerprofile->caller_id_number,strlen(newchannel->callerprofile->caller_id_number));
|
if(newchannel->callerprofile->caller_id_number != 0)
|
||||||
if(newchannel->callerprofile->destination_number != 0)
|
strncpy(src,newchannel->callerprofile->caller_id_number,strlen(newchannel->callerprofile->caller_id_number));
|
||||||
strncpy(dst,newchannel->callerprofile->destination_number,strlen(newchannel->callerprofile->destination_number));
|
if(newchannel->callerprofile->destination_number != 0)
|
||||||
if(newchannel->originateprofile->chan_name != 0)
|
strncpy(dst,newchannel->callerprofile->destination_number,strlen(newchannel->callerprofile->destination_number));
|
||||||
|
}
|
||||||
|
if(newchannel->originateprofile && newchannel->originateprofile->chan_name != 0)
|
||||||
strncpy(dstchannel,newchannel->originateprofile->chan_name,strlen(newchannel->originateprofile->chan_name));
|
strncpy(dstchannel,newchannel->originateprofile->chan_name,strlen(newchannel->originateprofile->chan_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ CsvCDR::CsvCDR(switch_mod_cdr_newchannel_t *newchannel) : BaseCDR(newchannel)
|
||||||
|
|
||||||
// Format the times
|
// Format the times
|
||||||
apr_size_t retsizecsd, retsizecad, retsizeced; //csd == callstartdate, cad == callanswerdate, ced == callenddate, ceff == callenddate_forfile
|
apr_size_t retsizecsd, retsizecad, retsizeced; //csd == callstartdate, cad == callanswerdate, ced == callenddate, ceff == callenddate_forfile
|
||||||
char format[] = "%F %T";
|
char format[] = "%Y-%m-%d-%H-%M-%S";
|
||||||
switch_strftime(formattedcallstartdate,&retsizecsd,sizeof(formattedcallstartdate),format,&tempcallstart);
|
switch_strftime(formattedcallstartdate,&retsizecsd,sizeof(formattedcallstartdate),format,&tempcallstart);
|
||||||
switch_strftime(formattedcallanswerdate,&retsizecad,sizeof(formattedcallanswerdate),format,&tempcallanswer);
|
switch_strftime(formattedcallanswerdate,&retsizecad,sizeof(formattedcallanswerdate),format,&tempcallanswer);
|
||||||
switch_strftime(formattedcallenddate,&retsizeced,sizeof(formattedcallenddate),format,&tempcallend);
|
switch_strftime(formattedcallenddate,&retsizeced,sizeof(formattedcallenddate),format,&tempcallend);
|
||||||
|
@ -193,7 +193,7 @@ void CsvCDR::open_file()
|
||||||
switch_time_exp_lt(&now_converted,now);
|
switch_time_exp_lt(&now_converted,now);
|
||||||
|
|
||||||
apr_size_t retsize;
|
apr_size_t retsize;
|
||||||
char format[] = "%F %T";
|
char format[] = "%Y-%m-%d-%H-%M-%S";
|
||||||
char formatteddate[100];
|
char formatteddate[100];
|
||||||
memset(formatteddate,0,100);
|
memset(formatteddate,0,100);
|
||||||
switch_strftime(formatteddate,&retsize,100,format,&now_converted);
|
switch_strftime(formatteddate,&retsize,100,format,&now_converted);
|
||||||
|
|
|
@ -60,7 +60,7 @@ PddCDR::PddCDR(switch_mod_cdr_newchannel_t *newchannel) : BaseCDR(newchannel)
|
||||||
|
|
||||||
// Format the times
|
// Format the times
|
||||||
size_t retsizecsd, retsizecad, retsizeced; //csd == callstartdate, cad == callanswerdate, ced == callenddate, ceff == callenddate_forfile
|
size_t retsizecsd, retsizecad, retsizeced; //csd == callstartdate, cad == callanswerdate, ced == callenddate, ceff == callenddate_forfile
|
||||||
char format[] = "%F %T";
|
char format[] = "%Y-%m-%d-%H-%M-%S";
|
||||||
switch_strftime(formattedcallstartdate,&retsizecsd,sizeof(formattedcallstartdate),format,&tempcallstart);
|
switch_strftime(formattedcallstartdate,&retsizecsd,sizeof(formattedcallstartdate),format,&tempcallstart);
|
||||||
switch_strftime(formattedcallanswerdate,&retsizecad,sizeof(formattedcallanswerdate),format,&tempcallanswer);
|
switch_strftime(formattedcallanswerdate,&retsizecad,sizeof(formattedcallanswerdate),format,&tempcallanswer);
|
||||||
switch_strftime(formattedcallenddate,&retsizeced,sizeof(formattedcallenddate),format,&tempcallend);
|
switch_strftime(formattedcallenddate,&retsizeced,sizeof(formattedcallenddate),format,&tempcallend);
|
||||||
|
|
Loading…
Reference in New Issue