mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Fixed function in services
This commit is contained in:
committed by
Dan Christian Bogos
parent
7f03bafbc9
commit
25b2fdb6ec
@@ -92,7 +92,7 @@ func TestFreeSwitchAgentReload(t *testing.T) {
|
||||
}
|
||||
|
||||
srv.(*FreeswitchAgent).fS = agents.NewFSsessions(agentCfg, "", nil)
|
||||
//srv.(*FreeswitchAgent).fS = new(agents.FSsessions)
|
||||
|
||||
err := srv.Reload()
|
||||
if err != nil {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", nil, err)
|
||||
|
||||
@@ -78,12 +78,11 @@ func (kam *KamailioAgent) Start() (err error) {
|
||||
|
||||
// Reload handles the change of config
|
||||
func (kam *KamailioAgent) Reload() (err error) {
|
||||
|
||||
if err = kam.Shutdown(); err != nil {
|
||||
return
|
||||
}
|
||||
kam.Lock()
|
||||
defer kam.Unlock()
|
||||
if err = kam.kam.Shutdown(); err != nil {
|
||||
return
|
||||
}
|
||||
kam.kam.Reload()
|
||||
go func(k *agents.KamailioAgent) {
|
||||
if err = k.Connect(); err != nil {
|
||||
|
||||
@@ -26,6 +26,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/agents"
|
||||
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/cores"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
@@ -76,7 +78,17 @@ func TestKamailioAgentReload(t *testing.T) {
|
||||
} else if reply != utils.OK {
|
||||
t.Errorf("Expecting OK ,received %s", reply)
|
||||
}
|
||||
kaCfg := &config.KamAgentCfg{
|
||||
Enabled: true,
|
||||
SessionSConns: []string{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaSessionS)},
|
||||
CreateCdr: true,
|
||||
EvapiConns: []*config.KamConnCfg{{Address: "127.0.0.1:8448", Reconnects: 10, Alias: "randomAlias"}},
|
||||
Timezone: "Local",
|
||||
}
|
||||
|
||||
srv.(*KamailioAgent).kam = agents.NewKamailioAgent(kaCfg, nil, "")
|
||||
|
||||
srv.Reload()
|
||||
runtime.Gosched()
|
||||
time.Sleep(10 * time.Millisecond) //need to switch to gorutine
|
||||
// the engine should be stoped as we could not connect to kamailio
|
||||
|
||||
Reference in New Issue
Block a user