Changes to cgr-tester sessions

This commit is contained in:
arberkatellari
2023-08-08 04:57:33 -04:00
committed by Dan Christian Bogos
parent f2108901a1
commit bbdef8921e
2 changed files with 18 additions and 5 deletions

View File

@@ -54,7 +54,7 @@ func callSessions(digitMin, digitMax int64) (err error) {
event := &utils.CGREvent{
Tenant: *tenant,
ID: "TheEventID100000",
ID: "EventID1",
Time: utils.TimePointer(time.Now()),
Event: map[string]any{
utils.AccountField: acc,
@@ -69,8 +69,8 @@ func callSessions(digitMin, digitMax int64) (err error) {
if *updateInterval > *maxUsage {
return fmt.Errorf(`"update_interval" should be smaller than "max_usage"`)
} else if *maxUsage <= *minUsage {
return fmt.Errorf(`"min_usage" should be smaller than "max_usage"`)
} else if *maxUsage < *minUsage {
return fmt.Errorf(`"min_usage" should be equal or smaller than "max_usage"`)
}
clntHandlers := map[string]any{
@@ -170,6 +170,19 @@ func callSessions(digitMin, digitMax int64) (err error) {
log.Printf("Account: <%v>, Destination: <%v>, SessionSv1TerminateSession reply: <%v>", acc, dest, utils.ToJSON(tRply))
}
if countTerminate == *calls {
go func() {
time.Sleep(10 * time.Second)
var sSRply string
if err = brpc.Call(utils.SessionSv1SyncSessions, tArgs, &sSRply); err != nil {
return
}
if *verbose {
log.Printf("Account: <%v>, Destination: <%v>, SessionSv1TerminateSession reply: <%v>", acc, dest, utils.ToJSON(sSRply))
}
}()
}
// Delay between terminate and processCDR for a more realistic case
time.Sleep(time.Duration(utils.RandomInteger(20, 40)) * time.Millisecond)

View File

@@ -15,10 +15,10 @@
debug=2
log_stderror=no
listen=udp:enp0s8:5060
listen=udp:enp0s3:5060
listen=udp:127.0.0.1:5080
listen=udp:127.0.0.1:5060
listen=udp:enp0s8:5080
listen=udp:enp0s3:5080
memdbg=5
memlog=5