RawCDR interface now properly returns duration

This commit is contained in:
DanB
2014-04-27 09:19:30 +02:00
parent 330fb7b894
commit f0095dbcb3
8 changed files with 23 additions and 16 deletions

View File

@@ -523,6 +523,7 @@ func (self *SQLStorage) SetCdr(cdr utils.RawCDR) (err error) {
// map[account:1001 direction:out orig_ip:172.16.1.1 tor:call accid:accid23 answer_time:2013-02-03 19:54:00 cdrsource:freeswitch_csv destination:+4986517174963 duration:62 reqtype:prepaid subject:1001 supplier:supplier1 tenant:cgrates.org]
setupTime, _ := cdr.GetSetupTime() // Ignore errors, we want to store the cdr no matter what
answerTime, _ := cdr.GetAnswerTime() // Ignore errors, we want to store the cdr no matter what
dur, _ := cdr.GetDuration()
_, err = self.Db.Exec(fmt.Sprintf("INSERT INTO %s VALUES (NULL,'%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s', %d)",
utils.TBL_CDRS_PRIMARY,
cdr.GetCgrId(),
@@ -538,7 +539,7 @@ func (self *SQLStorage) SetCdr(cdr utils.RawCDR) (err error) {
cdr.GetDestination(),
setupTime,
answerTime,
cdr.GetDuration(),
dur,
))
if err != nil {
Logger.Err(fmt.Sprintf("failed to execute cdr insert statement: %v", err))