Mediator refactoring to support CDR as imput instead of csv row - adding separation of names and indexes, StartTime->AnswerTime, adding reqtype=rated

This commit is contained in:
DanB
2013-06-06 12:37:36 +02:00
parent fbbb26fab3
commit a75c2e7324
27 changed files with 523 additions and 461 deletions

View File

@@ -21,8 +21,8 @@ package sessionmanager
import (
"fmt"
"github.com/cgrates/cgrates/rater"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/fsock"
"strings"
"time"
)
@@ -38,8 +38,8 @@ type Session struct {
// Creates a new session and starts the debit loop
func NewSession(ev Event, sm SessionManager) (s *Session) {
// Ignore calls which have nothing to do with CGRateS
if strings.TrimSpace(ev.GetReqType()) == "" {
// SesionManager only handles prepaid and postpaid calls
if ev.GetReqType() != utils.PREPAID && ev.GetReqType() != utils.POSTPAID {
return
}
// Make sure cgr_type is enforced even if not set by FreeSWITCH
@@ -68,9 +68,9 @@ func NewSession(ev Event, sm SessionManager) (s *Session) {
sm.DisconnectSession(s, MISSING_PARAMETER)
} else {
switch ev.GetReqType() {
case REQTYPE_PREPAID:
case utils.PREPAID:
go s.startDebitLoop()
case REQTYPE_POSTPAID:
case utils.POSTPAID:
// do not loop, make only one debit at hangup
}
}