mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-16 05:39:54 +05:00
Diameter - SIMPA Event handling, own simpa.json sample config, tutorial files modified to add rate for generic category
This commit is contained in:
@@ -604,8 +604,8 @@ func TestDmtAgentSendCCRSimpaEvent(t *testing.T) {
|
||||
t.Error(err)
|
||||
} else if len(avps) == 0 {
|
||||
t.Error("Result-Code")
|
||||
} else if strResult := avpValAsString(avps[0]); strResult != "5030" { // Result-Code set in the template
|
||||
t.Errorf("Expecting 5030, received: %s", strResult)
|
||||
} else if strResult := avpValAsString(avps[0]); strResult != "2001" { // Result-Code set in the template
|
||||
t.Errorf("Expecting 2001, received: %s", strResult)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -216,6 +216,8 @@ func metaHandler(m *diam.Message, tag, arg string, dur time.Duration) (string, e
|
||||
return "", nil
|
||||
}
|
||||
|
||||
// metaValueExponent will multiply the float value with the exponent provided.
|
||||
// Expects 2 arguments in template separated by |
|
||||
func metaValueExponent(m *diam.Message, argsTpl utils.RSRFields, roundingDecimals int) (string, error) {
|
||||
valStr := composedFieldvalue(m, argsTpl, 0)
|
||||
handlerArgs := strings.Split(valStr, utils.HandlerArgSep)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
{
|
||||
"id": "simpa_event", // formal identifier of this processor
|
||||
"dry_run": false, // do not send the events to SMG, just log them
|
||||
"request_filter": "Service-Context-Id(^simpa);CC-RequestType(4)", // filter requests processed by this processor
|
||||
"request_filter": "Service-Context-Id(^simpa);CC-Request-Type(4)", // filter requests processed by this processor
|
||||
"continue_on_success": false, // continue to the next template if executed
|
||||
"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": "^*generic", "mandatory": true},
|
||||
@@ -14,10 +14,9 @@
|
||||
{"tag": "RequestType", "field_id": "RequestType", "type": "*composed", "value": "^*prepaid", "mandatory": true},
|
||||
{"tag": "Direction", "field_id": "Direction", "type": "*composed", "value": "^*out", "mandatory": true},
|
||||
{"tag": "Tenant", "field_id": "Tenant", "type": "*composed", "value": "^cgrates.org", "mandatory": true},
|
||||
{"tag": "Category", "field_id": "Category", "type": "*composed", "value": "^call", "mandatory": true},
|
||||
{"tag": "Category", "field_id": "Category", "type": "*composed", "value": "^generic", "mandatory": true},
|
||||
{"tag": "Account", "field_id": "Account", "type": "*composed", "value": "Subscription-Id>Subscription-Id-Data", "field_filter":"Subscription-Id>Subscription-Id-Type(0)", "mandatory": true},
|
||||
{"tag": "Subject", "field_id": "Subject", "type": "*composed", "value": "Subscription-Id>Subscription-Id-Data", "field_filter":"Subscription-Id>Subscription-Id-Type(0)", "mandatory": true},
|
||||
{"tag": "Destination", "field_id": "Destination", "type": "*composed", "value": "Service-Information>SMS-Information>Recipient-Address>Address-Data", "mandatory": true},
|
||||
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true},
|
||||
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true},
|
||||
{"tag": "Usage", "field_id": "Usage", "type": "*handler", "handler_id": "*value_exponent",
|
||||
|
||||
@@ -8,3 +8,4 @@ DR_FS_10CNT,DST_FS,RT_10CNT,*up,4,0,
|
||||
DR_SPECIAL_1002,DST_1002,RT_1CNT,*up,4,0,
|
||||
DR_1007_MAXCOST_DISC,DST_1007,RT_1CNT_PER_SEC,*up,4,0.62,*disconnect
|
||||
DR_1007_MAXCOST_FREE,DST_1007,RT_1CNT_PER_SEC,*up,4,0.62,*free
|
||||
DR_GENERIC,*any,RT_GENERIC_1,*up,4,0,
|
||||
|
||||
|
@@ -7,3 +7,4 @@ RT_40CNT,0.8,0.4,60s,30s,0s
|
||||
RT_40CNT,0,0.2,60s,10s,60s
|
||||
RT_1CNT,0,0.01,60s,60s,0s
|
||||
RT_1CNT_PER_SEC,0,0.01,1s,1s,0s
|
||||
RT_GENERIC_1,0,1,1,1,0
|
||||
|
||||
|
@@ -18,3 +18,4 @@ RP_RETAIL2,DR_FS_10CNT,OFFPEAK_EVENING,10
|
||||
RP_RETAIL2,DR_FS_10CNT,OFFPEAK_WEEKEND,10
|
||||
RP_RETAIL2,DR_1007_MAXCOST_FREE,ALWAYS,10
|
||||
RP_SPECIAL_1002,DR_SPECIAL_1002,ALWAYS,10
|
||||
RP_GENERIC,DR_GENERIC,*any,10
|
||||
|
@@ -7,3 +7,4 @@
|
||||
*out,cgrates.org,lcr_profile2,suppl1,2014-01-14T00:00:00Z,RP_RETAIL2,,STATS_SUPPL1
|
||||
*out,cgrates.org,lcr_profile2,suppl2,2014-01-14T00:00:00Z,RP_RETAIL1,,STATS_SUPPL2
|
||||
*out,cgrates.org,lcr_profile2,suppl3,2014-01-14T00:00:00Z,RP_SPECIAL_1002,,
|
||||
*out,cgrates.org,generic,*any,2014-01-14T00:00:00Z,RP_GENERIC,,
|
||||
|
||||
|
Reference in New Issue
Block a user