Query costs for 0 duration prepaid calls in CDRS, fixes #290

This commit is contained in:
DanB
2015-11-18 09:24:23 +01:00
parent 578954eec5
commit 2ee6802d4c
2 changed files with 7 additions and 11 deletions

View File

@@ -204,9 +204,6 @@ func (sm *FSSessionManager) onChannelHangupComplete(ev engine.Event) {
if ev.GetReqType(utils.META_DEFAULT) == utils.META_NONE { // Do not process this request
return
}
if sm.cfg.CreateCdr {
go sm.ProcessCdr(ev.AsStoredCdr(config.CgrConfig().DefaultTimezone))
}
var s *Session
for i := 0; i < 2; i++ { // Protect us against concurrency, wait a couple of seconds for the answer to be populated before we process hangup
s = sm.sessions.getSession(ev.GetUUID())
@@ -215,11 +212,13 @@ func (sm *FSSessionManager) onChannelHangupComplete(ev engine.Event) {
}
time.Sleep(time.Duration(i+1) * time.Second)
}
if s == nil { // Not handled by us
return
if s != nil { // Handled by us, cleanup here
if err := sm.sessions.removeSession(s, ev); err != nil {
utils.Logger.Err(err.Error())
}
}
if err := sm.sessions.removeSession(s, ev); err != nil {
utils.Logger.Err(err.Error())
if sm.cfg.CreateCdr {
sm.ProcessCdr(ev.AsStoredCdr(config.CgrConfig().DefaultTimezone))
}
}