Diameter processing request flags

This commit is contained in:
DanB
2018-05-30 15:26:32 +02:00
parent ccf1468e6e
commit 2bfbdc2c8e
3 changed files with 18 additions and 4 deletions

View File

@@ -96,6 +96,7 @@ func (da DiameterAgent) processCCR(ccr *CCR, reqProcessor *config.DARequestProce
}
if !reqProcessor.AppendCCA {
*cca = *NewBareCCAFromCCR(ccr, da.cgrCfg.DiameterAgentCfg().OriginHost, da.cgrCfg.DiameterAgentCfg().OriginRealm)
procVars = make(processorVars)
}
smgEv, err := ccr.AsSMGenericEvent(reqProcessor.CCRFields)
if err != nil {
@@ -110,6 +111,9 @@ func (da DiameterAgent) processCCR(ccr *CCR, reqProcessor *config.DARequestProce
}
if len(reqProcessor.Flags) != 0 {
smgEv[utils.CGRFlags] = reqProcessor.Flags.String() // Populate CGRFlags automatically
for flag, val := range reqProcessor.Flags {
procVars[flag] = val
}
}
if reqProcessor.PublishEvent && da.pubsubs != nil {
evt, err := smgEv.AsMapStringString()

View File

@@ -289,7 +289,6 @@ func TestPVAsV1AuthorizeArgs(t *testing.T) {
CGREvent: *cgrEv,
}
outVal := processorVars{MetaRadReqType: MetaRadAcctStart}.asV1AuthorizeArgs(cgrEv)
if !reflect.DeepEqual(expected, outVal) {
t.Errorf("Expecting: <%s>, received: <%s>", utils.ToJSON(expected), utils.ToJSON(outVal))
}
@@ -323,6 +322,17 @@ func TestPVAsV1InitSessionArgs(t *testing.T) {
if !reflect.DeepEqual(expected, outVal) {
t.Errorf("Expecting: <%s>, received: <%s>", utils.ToJSON(expected), utils.ToJSON(outVal))
}
eInitArgs := &sessions.V1InitSessionArgs{
InitSession: false,
AllocateResources: true,
GetAttributes: true,
CGREvent: *cgrEv,
}
initArgs := processorVars{MetaRadReqType: MetaRadAcctStart, utils.MetaResources: true,
utils.MetaAttributes: true}.asV1InitSessionArgs(cgrEv)
if !reflect.DeepEqual(eInitArgs, initArgs) {
t.Errorf("expecting: %+v, received: %+v", eInitArgs, initArgs)
}
}
func TestPVAsV1UpdateSessionArgs(t *testing.T) {

View File

@@ -7,7 +7,7 @@
"id": "VoiceInit", // formal identifier of this processor
"dry_run": false, // do not send the events to SMG, just log them
"request_filter": "Service-Context-Id(^voice);CC-Request-Type(1)", // filter requests processed by this processor
"continue_on_success": false, // continue to the next template if executed
"flags": ["*accounts"],
"ccr_fields":[ // import content_fields template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value
{"tag": "TOR", "field_id": "ToR", "type": "*composed", "value": "^*voice", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "Session-Id", "mandatory": true},
@@ -38,7 +38,7 @@
"id": "VoiceUpdate", // formal identifier of this processor
"dry_run": false, // do not send the events to SMG, just log them
"request_filter": "Service-Context-Id(^voice);CC-Request-Type(2)", // filter requests processed by this processor
"continue_on_success": false, // continue to the next template if executed
"flags": ["*accounts"],
"ccr_fields":[ // import content_fields template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value
{"tag": "TOR", "field_id": "ToR", "type": "*composed", "value": "^*voice", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "Session-Id", "mandatory": true},
@@ -64,7 +64,7 @@
"id": "VoiceTerminate", // formal identifier of this processor
"dry_run": false, // do not send the events to SMG, just log them
"request_filter": "Service-Context-Id(^voice);CC-Request-Type(3)", // filter requests processed by this processor
"continue_on_success": false, // continue to the next template if executed
"flags": ["*accounts"],
"ccr_fields":[ // import content_fields template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value
{"tag": "TOR", "field_id": "ToR", "type": "*composed", "value": "^*voice", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "Session-Id", "mandatory": true},