mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Diameter processing request flags
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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},
|
||||
|
||||
Reference in New Issue
Block a user