mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Adding some more debug
This commit is contained in:
@@ -113,8 +113,10 @@ type CallCostLog struct {
|
||||
|
||||
// RPC method, used to log callcosts to db
|
||||
func (self *CdrServer) LogCallCost(ccl *CallCostLog) error {
|
||||
Logger.Debug(fmt.Sprintf("<Cdrs> DEBUG: LogCallCost, callCostLog: %+v, time: %v", ccl, time.Now()))
|
||||
if ccl.CheckDuplicate {
|
||||
cc, err := self.cdrDb.GetCallCostLog(ccl.CgrId, ccl.Source, ccl.RunId)
|
||||
Logger.Debug(fmt.Sprintf("<Cdrs> DEBUG: GetCallCostLog, cgrId: %s, source: %s: runId: %s - received: cc: %v, error: %v, time: %v", ccl.CgrId, ccl.Source, ccl.RunId, cc, err, time.Now()))
|
||||
if err != nil && err != gorm.RecordNotFound {
|
||||
return err
|
||||
}
|
||||
@@ -308,7 +310,7 @@ func (self *CdrServer) rateCDR(storedCdr *StoredCdr) error {
|
||||
delay := utils.Fib()
|
||||
for i := 0; i < 4; i++ {
|
||||
qryCC, err = self.cdrDb.GetCallCostLog(storedCdr.CgrId, utils.SESSION_MANAGER_SOURCE, storedCdr.MediationRunId)
|
||||
Logger.Warning(fmt.Sprintf("<Cdrs> DEBUG: GetCallCostLog, storedCdr: %+v, callCost: %+v, error: %+v, run: %d, time: %v", storedCdr, qryCC, err, i, time.Now()))
|
||||
Logger.Debug(fmt.Sprintf("<Cdrs> DEBUG: GetCallCostLog, storedCdr: %+v, callCost: %+v, error: %+v, run: %d, time: %v", storedCdr, qryCC, err, i, time.Now()))
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
|
||||
@@ -227,6 +227,7 @@ func (s *Session) SaveOperations() {
|
||||
CallCost: firstCC,
|
||||
CheckDuplicate: true,
|
||||
}, &reply)
|
||||
engine.Logger.Debug(fmt.Sprintf("<SM> DEBUG: LogCallCost error: %v, time: %v", err, time.Now()))
|
||||
// this is a protection against the case when the close event is missed for some reason
|
||||
// when the cdr arrives to cdrserver because our callcost is not there it will be rated
|
||||
// as postpaid. When the close event finally arives we have to refund everything
|
||||
@@ -234,7 +235,7 @@ func (s *Session) SaveOperations() {
|
||||
if err == utils.ErrExists {
|
||||
s.Refund(firstCC, firstCC.Timespans[0].TimeStart)
|
||||
} else {
|
||||
engine.Logger.Err(fmt.Sprintf("failed to log call cost: %v", err))
|
||||
engine.Logger.Err(fmt.Sprintf("<SM> ERROR failed to log call cost: %v", err))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user