DiameterAgent config - message_templates option added

This commit is contained in:
DanB
2018-09-19 14:23:44 +02:00
parent 36665f2cb4
commit 4ad9212541
3 changed files with 11 additions and 0 deletions

View File

@@ -78,6 +78,7 @@ func (self *DiameterAgent) handlers() diam.Handler {
return dSM
}
// handleALL is the handler of all messages coming in via Diameter
func (self *DiameterAgent) handleALL(c diam.Conn, m *diam.Message) {
utils.Logger.Warning(fmt.Sprintf("<%s> received unexpected message from %s:\n%s", utils.DiameterAgent, c.RemoteAddr(), m))
}

View File

@@ -31,6 +31,7 @@ type DiameterAgentCfg struct {
OriginRealm string
VendorId int
ProductName string
MessageTemplates map[string][]*FCTemplate
RequestProcessors []*DARequestProcessor
}
@@ -66,6 +67,14 @@ func (da *DiameterAgentCfg) loadFromJsonCfg(jsnCfg *DiameterAgentJsonCfg) error
if jsnCfg.Product_name != nil {
da.ProductName = *jsnCfg.Product_name
}
if jsnCfg.Message_templates != nil {
if da.MessageTemplates == nil {
da.MessageTemplates = make(map[string][]*FCTemplate)
}
for k, jsnTpls := range jsnCfg.Message_templates {
da.MessageTemplates[k] = FCTemplatesFromFCTemapltesJsonCfg(jsnTpls)
}
}
if jsnCfg.Request_processors != nil {
for _, reqProcJsn := range *jsnCfg.Request_processors {
rp := new(DARequestProcessor)

View File

@@ -335,6 +335,7 @@ type DiameterAgentJsonCfg struct {
Origin_realm *string
Vendor_id *int
Product_name *string
Message_templates map[string][]*FcTemplateJsonCfg
Request_processors *[]*DARequestProcessorJsnCfg
}