SessionS.BiRPCV1InitiateSession force return of maxCallDuration

This commit is contained in:
DanB
2018-12-20 19:26:58 +01:00
parent 03549c6bec
commit fd08a595a5
2 changed files with 14 additions and 0 deletions

View File

@@ -1335,6 +1335,8 @@ func (smg *SMGeneric) BiRPCV1InitiateSession(clnt rpcclient.RpcClientConnection,
}
if authUsage != time.Duration(-1) {
*maxUsage = authUsage.Seconds()
} else {
*maxUsage = smg.cgrCfg.SessionSCfg().MaxCallDuration.Seconds() // Force max since -1 is not supported by OpenSIPS 2.1
}
} else {
*maxUsage = minMaxUsage.Seconds()

View File

@@ -32,6 +32,18 @@ func IsSliceMember(ss []string, s string) bool {
return false
}
// SliceHasMember is a simpler mode to match inside a slice
// useful to search in shared vars (no slice sort)
func SliceHasMember(ss []string, s string) (has bool) {
for _, mbr := range ss {
if mbr == s {
has = true
break
}
}
return
}
func SliceWithoutMember(ss []string, s string) []string {
sort.Strings(ss)
if i := sort.SearchStrings(ss, s); i < len(ss) && ss[i] == s {