mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
DiameterAgent SMGeneric connection configuration
This commit is contained in:
@@ -378,6 +378,12 @@ func (self *CGRConfig) checkConfigSanity() error {
|
||||
return errors.New("CDRS not enabled but referenced by SM-OpenSIPS component")
|
||||
}
|
||||
}
|
||||
// DAgent checks
|
||||
if self.DiameterAgentCfg.Enabled {
|
||||
if self.DiameterAgentCfg.SMGeneric == utils.INTERNAL && !self.SmGenericConfig.Enabled {
|
||||
return errors.New("SMGeneric not enabled but referenced by DiameterAgent component")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -262,7 +262,8 @@ const CGRATES_CFG_JSON = `
|
||||
"diameter_agent": {
|
||||
"enabled": false, // enables the diameter agent: <true|false>
|
||||
"listen": "127.0.0.1:3868", // address where to listen for diameter requests <x.y.z.y:1234>
|
||||
"timezone": "", // timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB>
|
||||
"sm_generic": "internal", // Connection towards SMG component for session management
|
||||
"timezone": "", // timezone for timestamps where not specified, empty for general defaults <""|UTC|Local|$IANA_TZ_DB>
|
||||
"request_processors": [
|
||||
{
|
||||
"id": "*default", // Identifier of this processor
|
||||
|
||||
@@ -416,9 +416,10 @@ func TestSmOsipsJsonCfg(t *testing.T) {
|
||||
|
||||
func TestDiameterAgentJsonCfg(t *testing.T) {
|
||||
eCfg := &DiameterAgentJsonCfg{
|
||||
Enabled: utils.BoolPointer(false),
|
||||
Listen: utils.StringPointer("127.0.0.1:3868"),
|
||||
Timezone: utils.StringPointer(""),
|
||||
Enabled: utils.BoolPointer(false),
|
||||
Listen: utils.StringPointer("127.0.0.1:3868"),
|
||||
Sm_generic: utils.StringPointer("internal"),
|
||||
Timezone: utils.StringPointer(""),
|
||||
Request_processors: &[]*DARequestProcessorJsnCfg{
|
||||
&DARequestProcessorJsnCfg{
|
||||
Id: utils.StringPointer("*default"),
|
||||
|
||||
@@ -27,6 +27,7 @@ import (
|
||||
type DiameterAgentCfg struct {
|
||||
Enabled bool // enables the diameter agent: <true|false>
|
||||
Listen string // address where to listen for diameter requests <x.y.z.y:1234>
|
||||
SMGeneric string // connection towards SMG component
|
||||
Timezone string // timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB>
|
||||
RequestProcessors []*DARequestProcessor
|
||||
}
|
||||
@@ -41,6 +42,9 @@ func (self *DiameterAgentCfg) loadFromJsonCfg(jsnCfg *DiameterAgentJsonCfg) erro
|
||||
if jsnCfg.Listen != nil {
|
||||
self.Listen = *jsnCfg.Listen
|
||||
}
|
||||
if jsnCfg.Sm_generic != nil {
|
||||
self.SMGeneric = *jsnCfg.Sm_generic
|
||||
}
|
||||
if jsnCfg.Timezone != nil {
|
||||
self.Timezone = *jsnCfg.Timezone
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user