mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-15 13:19:53 +05:00
Merge branch 'master' into hapool
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 ""
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user