Add *log flag for diameter

This commit is contained in:
TeoV
2018-11-18 03:35:28 -05:00
committed by Dan Christian Bogos
parent 809d8e33bf
commit 9600ab9a27
4 changed files with 15 additions and 4 deletions

View File

@@ -226,6 +226,11 @@ func (da *DiameterAgent) processRequest(reqProcessor *config.DARequestProcessor,
break
}
}
if reqProcessor.Flags.HasKey(utils.MetaLog) {
utils.Logger.Info(
fmt.Sprintf("<%s> LOG, processorID: %s, diameter message: %s",
utils.DiameterAgent, reqProcessor.ID, agReq.Request.String()))
}
switch reqType {
default:
return false, fmt.Errorf("unknown request type: <%s>", reqType)
@@ -320,6 +325,11 @@ func (da *DiameterAgent) processRequest(reqProcessor *config.DARequestProcessor,
} else {
agReq.Reply.Merge(nM)
}
if reqProcessor.Flags.HasKey(utils.MetaLog) {
utils.Logger.Info(
fmt.Sprintf("<%s> LOG, Diameter reply: %s",
utils.DiameterAgent, agReq.Reply))
}
if reqType == utils.MetaDryRun {
utils.Logger.Info(
fmt.Sprintf("<%s> DRY_RUN, Diameter reply: %s",

View File

@@ -280,7 +280,7 @@ type diameterDP struct {
// String is part of engine.DataProvider interface
// when called, it will display the already parsed values out of cache
func (dP *diameterDP) String() string {
return utils.ToJSON(dP.cache)
return dP.cache.String()
}
// AsNavigableMap is part of engine.DataProvider interface

View File

@@ -7,7 +7,7 @@
"id": "VoiceInit",
"filters": ["*string:*vars.*cmd:CCR", "*string:*req.CC-Request-Type:1",
"*prefix:*req.Service-Context-Id:voice"],
"flags": ["*initiate", "*accounts", "*attributes"],
"flags": ["*initiate", "*accounts", "*attributes", "*log"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*voice"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
@@ -35,7 +35,7 @@
"id": "VoiceUpdate",
"filters": ["*string:*vars.*cmd:CCR", "*string:*req.CC-Request-Type:2",
"*prefix:*req.Service-Context-Id:voice"],
"flags": ["*update", "*accounts", "*attributes"],
"flags": ["*update", "*accounts", "*attributes", "*log"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*voice"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
@@ -65,7 +65,7 @@
"id": "VoiceTerminate",
"filters": ["*string:*vars.*cmd:CCR", "*string:*req.CC-Request-Type:3",
"*prefix:*req.Service-Context-Id:voice"],
"flags": ["*terminate", "*accounts", "*attributes", "*cdrs"],
"flags": ["*terminate", "*accounts", "*attributes", "*cdrs", "*log"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*voice"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",

View File

@@ -537,6 +537,7 @@ const (
CGRSubsystems = "cgr_subsystems"
IdxStart = "["
IdxEnd = "]"
MetaLog = "*log"
)
// Migrator Action