Merge branch 'master' into hapool

This commit is contained in:
Radu Ioan Fericean
2015-11-30 20:12:41 +02:00
48 changed files with 1403 additions and 706 deletions

View File

@@ -380,7 +380,7 @@ func (sm *FSSessionManager) SyncSessions() error {
}
var stillActive bool
for _, fsAChan := range aChans {
if fsAChan["call_uuid"] == session.eventStart.GetUUID() { // Channel still active
if fsAChan["call_uuid"] == session.eventStart.GetUUID() || (fsAChan["call_uuid"] == "" && fsAChan["uuid"] == session.eventStart.GetUUID()) { // Channel still active
stillActive = true
break
}

View File

@@ -161,7 +161,7 @@ func (self SMGenericEvent) GetUsage(fieldName string) (time.Duration, error) {
func (self SMGenericEvent) GetMaxUsage(fieldName string, cfgMaxUsage time.Duration) (time.Duration, error) {
if fieldName == utils.META_DEFAULT {
fieldName = utils.MAX_USAGE
fieldName = utils.USAGE
}
maxUsageStr, hasIt := self[fieldName]
if !hasIt {

View File

@@ -32,6 +32,9 @@ var ErrConnectionNotFound = errors.New("CONNECTION_NOT_FOUND")
// Attempts to get the connId previously set in the client state container
func getClientConnId(clnt *rpc2.Client) string {
if clnt == nil {
return ""
}
uuid, hasIt := clnt.State.Get(CGR_CONNUUID)
if !hasIt {
return ""

View File

@@ -162,7 +162,6 @@ func (self *SMGeneric) GetLcrSuppliers(gev SMGenericEvent, clnt *rpc2.Client) ([
// Execute debits for usage/maxUsage
func (self *SMGeneric) SessionUpdate(gev SMGenericEvent, clnt *rpc2.Client) (time.Duration, error) {
var minMaxUsage time.Duration
evMaxUsage, err := gev.GetMaxUsage(utils.META_DEFAULT, self.cgrCfg.MaxCallDuration)
if err != nil {
return nilDuration, err
@@ -172,12 +171,12 @@ func (self *SMGeneric) SessionUpdate(gev SMGenericEvent, clnt *rpc2.Client) (tim
if maxDur, err := s.debit(evMaxUsage); err != nil {
return nilDuration, err
} else {
if maxDur < minMaxUsage {
minMaxUsage = maxDur
if maxDur < evMaxUsage {
evMaxUsage = maxDur
}
}
}
return minMaxUsage, nil
return evMaxUsage, nil
}
// Called on session start