Update kamevapi version

This commit is contained in:
arberkatellari
2024-03-08 10:39:36 +02:00
committed by Dan Christian Bogos
parent ca815bb550
commit bd571376a7
5 changed files with 10 additions and 15 deletions

View File

@@ -21,7 +21,6 @@ package agents
import (
"errors"
"fmt"
"log"
"regexp"
"strings"
"time"
@@ -79,12 +78,10 @@ func (self *KamailioAgent) Connect() (err error) {
}
errChan := make(chan error)
for connIdx, connCfg := range self.cfg.EvapiConns {
logger := log.New(utils.Logger, "kamevapi:", 2)
if self.conns[connIdx], err = kamevapi.NewKamEvapi(connCfg.Address, connIdx, connCfg.Reconnects, connCfg.MaxReconnectInterval,
utils.FibDuration, eventHandlers, logger); err != nil {
utils.FibDuration, eventHandlers, utils.Logger); err != nil {
return
}
utils.Logger.Info(fmt.Sprintf("<%s> successfully connected to Kamailio at: <%s>", utils.KamailioAgent, connCfg.Address))
go func(conn *kamevapi.KamEvapi) { // Start reading in own goroutine, return on error
if err := conn.ReadEvents(); err != nil {
errChan <- err

View File

@@ -26,7 +26,6 @@ import (
"reflect"
"testing"
"github.com/cgrates/cgrates/agents"
"github.com/cgrates/cgrates/analyzers"
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/engine"
@@ -90,9 +89,6 @@ func TestRegisterHTTPFunc(t *testing.T) {
rcv.RpcRegisterName(utils.EmptyString, handler)
httpAgent := agents.NewHTTPAgent(nil, []string{}, nil, utils.EmptyString, utils.EmptyString, utils.EmptyString, nil)
rcv.RegisterHttpHandler("invalid_pattern", httpAgent)
if err := os.RemoveAll(cfgDflt.AnalyzerSCfg().DBPath); err != nil {
t.Fatal(err)
}
@@ -105,8 +101,6 @@ func TestRegisterProfiler(t *testing.T) {
caps := engine.NewCaps(0, utils.MetaBusy)
rcv := NewServer(caps)
registerProfiler("test_prefix", rcv.httpMux)
rcv.RegisterProfiler("/test_prefix")
rcv.StopBiRPC()

6
go.mod
View File

@@ -1,6 +1,8 @@
module github.com/cgrates/cgrates
go 1.21
go 1.22
toolchain go1.22.0
// replace github.com/cgrates/radigo => ../radigo
@@ -16,7 +18,7 @@ require (
github.com/cgrates/birpc v1.3.1-0.20211117095917-5b0ff29f3084
github.com/cgrates/cron v0.0.0-20201022095836-3522d5b72c70
github.com/cgrates/fsock v0.0.0-20230123160954-12cae14030cc
github.com/cgrates/kamevapi v0.0.0-20220525160402-5b8036487a6c
github.com/cgrates/kamevapi v0.0.0-20240307160311-26273f03eedf
github.com/cgrates/ltcache v0.0.0-20210405185848-da943e80c1ab
github.com/cgrates/radigo v0.0.0-20210902121842-ea2f9a730627
github.com/cgrates/rpcclient v0.0.0-20220922181803-b3ddc74ad65a

4
go.sum
View File

@@ -57,8 +57,8 @@ github.com/cgrates/cron v0.0.0-20201022095836-3522d5b72c70 h1:/O+Dr12jcizDiCoIG2
github.com/cgrates/cron v0.0.0-20201022095836-3522d5b72c70/go.mod h1:I9cUDn/uzkakr0hmYTjXkQqf6wagg44L2p01gSYRRz0=
github.com/cgrates/fsock v0.0.0-20230123160954-12cae14030cc h1:qKfOK61ZLktbywOLTMNWwobJsxkxszlMbuduwNgAO/c=
github.com/cgrates/fsock v0.0.0-20230123160954-12cae14030cc/go.mod h1:5A9wag324AzIlaDd7tpPDAg26ouUO1orarAq7Vxr4As=
github.com/cgrates/kamevapi v0.0.0-20220525160402-5b8036487a6c h1:ILTMiCcBw80hSe1L0LE3u2U7sFQB/vcFc2JZpvTD4/E=
github.com/cgrates/kamevapi v0.0.0-20220525160402-5b8036487a6c/go.mod h1:R1iZadqJTrjkwWxhK8gVPcYhcWoE4d0A6HZ+y6ZHzys=
github.com/cgrates/kamevapi v0.0.0-20240307160311-26273f03eedf h1:GbMJzvtwdX1OCEmsqSts/cRCIcIMvo8AYtC2dQExWlg=
github.com/cgrates/kamevapi v0.0.0-20240307160311-26273f03eedf/go.mod h1:oEq/JbubkOD2pXHvDy4r7519NkxriONisrnVpkCaNJw=
github.com/cgrates/ltcache v0.0.0-20210405185848-da943e80c1ab h1:dKdAUwrij6vYwewe1WV1+pDSagqGI5JLqjTZZyN2ANo=
github.com/cgrates/ltcache v0.0.0-20210405185848-da943e80c1ab/go.mod h1:9oSG/6gUoab/vKm/eQ3QcX6KeTR0wRw88N33iCnC/k4=
github.com/cgrates/radigo v0.0.0-20210902121842-ea2f9a730627 h1:foxHlpQxYj15khhlpbj+EiIM/W9Gk0HP800NQ/DVPpU=

View File

@@ -84,7 +84,9 @@ func (kam *KamailioAgent) Reload(_ *context.Context, shtDwn context.CancelFunc)
func (kam *KamailioAgent) connect(k *agents.KamailioAgent, shtDwn context.CancelFunc) (err error) {
if err = k.Connect(); err != nil {
if !strings.Contains(err.Error(), "use of closed network connection") { // if closed by us do not log
utils.Logger.Err(fmt.Sprintf("<%s> error: %s", utils.KamailioAgent, err))
if !strings.Contains(err.Error(), "KamEvapi") {
utils.Logger.Err(fmt.Sprintf("<%s> error: %s", utils.KamailioAgent, err))
}
shtDwn()
}
}