get cost from call cost

This commit is contained in:
Radu Ioan Fericean
2013-05-29 19:21:24 +03:00
parent dacaa14086
commit 4e7dc77db9
2 changed files with 4 additions and 10 deletions

View File

@@ -155,15 +155,10 @@ func (mys *MySQLStorage) SetCdr(cdr CDR) (err error) {
return
}
func (mys *MySQLStorage) SetRatedCdr(cdr CDR, callcost *CallCost) (err error) {
rate, err := cdr.GetRate()
if err != nil {
fmt.Println("Could not find rate in cdr")
return err
}
func (mys *MySQLStorage) SetRatedCdr(cdr CDR, cc *CallCost) (err error) {
_, err = mys.Db.Exec(fmt.Sprintf("INSERT INTO rated_cdrs VALUES ('%s', '%s', '%s', '%s')",
cdr.GetCgrId(),
rate,
cc.Cost,
"cgrcostid",
"cdrsrc",
))

View File

@@ -155,14 +155,13 @@ func (psl *PostgresStorage) SetCdr(cdr CDR) (err error) {
return
}
func (psl *PostgresStorage) SetRatedCdr(cdr CDR, callcost *CallCost) (err error) {
rate, err := cdr.GetRate()
func (psl *PostgresStorage) SetRatedCdr(cdr CDR, cc *CallCost) (err error) {
if err != nil {
return err
}
_, err = psl.Db.Exec(fmt.Sprintf("INSERT INTO cdrs_extra VALUES ('%s', '%s', '%s', '%s')",
cdr.GetCgrId(),
rate,
cc.Cost,
"cgrcostid",
"cdrsrc",
))