mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-20 14:48:43 +05:00
SMGenericV1.InitSession returning -1 for postpaid instead of nanoseconds, to keep OpenSIPS 2.3 happy
This commit is contained in:
@@ -1108,6 +1108,10 @@ func (smg *SMGeneric) BiRPCV1InitiateSession(clnt rpcclient.RpcClientConnection,
|
||||
if err != rpcclient.ErrSessionNotFound {
|
||||
err = utils.NewErrServerError(err)
|
||||
}
|
||||
return
|
||||
}
|
||||
if minMaxUsage == time.Duration(-1) {
|
||||
*maxUsage = -1.0
|
||||
} else {
|
||||
*maxUsage = minMaxUsage.Seconds()
|
||||
}
|
||||
@@ -1122,6 +1126,7 @@ func (smg *SMGeneric) BiRPCV2InitiateSession(clnt rpcclient.RpcClientConnection,
|
||||
if err != rpcclient.ErrSessionNotFound {
|
||||
err = utils.NewErrServerError(err)
|
||||
}
|
||||
return
|
||||
} else {
|
||||
*maxUsage = minMaxUsage
|
||||
}
|
||||
@@ -1136,6 +1141,10 @@ func (smg *SMGeneric) BiRPCV1UpdateSession(clnt rpcclient.RpcClientConnection,
|
||||
if err != rpcclient.ErrSessionNotFound {
|
||||
err = utils.NewErrServerError(err)
|
||||
}
|
||||
return
|
||||
}
|
||||
if minMaxUsage == time.Duration(-1) {
|
||||
*maxUsage = -1.0
|
||||
} else {
|
||||
*maxUsage = minMaxUsage.Seconds()
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ func TestSMGBiRPCSessionAutomaticDisconnects(t *testing.T) {
|
||||
smgEv, &maxUsage); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if maxUsage != -1e-09 {
|
||||
if maxUsage != -1 {
|
||||
t.Error("Bad max usage: ", maxUsage)
|
||||
}
|
||||
// Make sure we are receiving a disconnect event
|
||||
@@ -231,7 +231,7 @@ func TestSMGBiRPCSessionOriginatorTerminate(t *testing.T) {
|
||||
smgEv, &maxUsage); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if maxUsage != -1e-09 {
|
||||
if maxUsage != -1 {
|
||||
t.Error("Bad max usage: ", maxUsage)
|
||||
}
|
||||
time.Sleep(time.Duration(10 * time.Millisecond)) // Give time for debits to occur
|
||||
|
||||
Reference in New Issue
Block a user