mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Add ce_applications to diameter_agent config
This commit is contained in:
committed by
Dan Christian Bogos
parent
cd0c7245f7
commit
7678bf181f
@@ -31,10 +31,10 @@ import (
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
"github.com/fiorix/go-diameter/v4/diam"
|
||||
"github.com/fiorix/go-diameter/v4/diam/avp"
|
||||
"github.com/fiorix/go-diameter/v4/diam/datatype"
|
||||
"github.com/fiorix/go-diameter/v4/diam/dict"
|
||||
"github.com/cgrates/go-diameter/diam"
|
||||
"github.com/cgrates/go-diameter/diam/avp"
|
||||
"github.com/cgrates/go-diameter/diam/datatype"
|
||||
"github.com/cgrates/go-diameter/diam/dict"
|
||||
)
|
||||
|
||||
func TestDiameterAgentCapsIT(t *testing.T) {
|
||||
|
||||
@@ -32,10 +32,10 @@ import (
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
"github.com/cgrates/go-diameter/diam"
|
||||
"github.com/cgrates/go-diameter/diam/avp"
|
||||
"github.com/cgrates/go-diameter/diam/datatype"
|
||||
"github.com/cgrates/radigo"
|
||||
"github.com/fiorix/go-diameter/v4/diam"
|
||||
"github.com/fiorix/go-diameter/v4/diam/avp"
|
||||
"github.com/fiorix/go-diameter/v4/diam/datatype"
|
||||
)
|
||||
|
||||
func TestAgReqSetFields(t *testing.T) {
|
||||
|
||||
111
agents/diam_empty_ce_it_test.go
Normal file
111
agents/diam_empty_ce_it_test.go
Normal file
@@ -0,0 +1,111 @@
|
||||
//go:build integration
|
||||
|
||||
/*
|
||||
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
|
||||
Copyright (C) ITsysCOM GmbH
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package agents
|
||||
|
||||
import (
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/cgrates/birpc/context"
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
var (
|
||||
daCfgPathND, diamConfigDIRND string
|
||||
daCfgND *config.CGRConfig
|
||||
diamClntND *DiameterClient
|
||||
|
||||
sTestsDiamND = []func(t *testing.T){
|
||||
testDiamEmptyCEItInitCfg,
|
||||
testDiamEmptyCEItDataDb,
|
||||
testDiamEmptyCEItResetStorDb,
|
||||
testDiamEmptyCEItStartEngine,
|
||||
testDiamEmptyCEItConnectDiameterClient,
|
||||
testDiamEmptyCEItKillEngine,
|
||||
}
|
||||
)
|
||||
|
||||
// Test start here
|
||||
func TestDiamEmptyCEItTcp(t *testing.T) {
|
||||
switch *utils.DBType {
|
||||
case utils.MetaInternal:
|
||||
diamConfigDIRND = "diamagent_internal_empty_apps"
|
||||
case utils.MetaMySQL, utils.MetaMongo, utils.MetaPostgres:
|
||||
t.SkipNow()
|
||||
default:
|
||||
t.Fatal("Unknown Database type")
|
||||
}
|
||||
for _, stest := range sTestsDiamND {
|
||||
t.Run(diamConfigDIRND, stest)
|
||||
}
|
||||
}
|
||||
|
||||
func testDiamEmptyCEItInitCfg(t *testing.T) {
|
||||
daCfgPathND = path.Join(*utils.DataDir, "conf", "samples", diamConfigDIRND)
|
||||
// Init config first
|
||||
var err error
|
||||
daCfgND, err = config.NewCGRConfigFromPath(context.Background(), daCfgPathND)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
daCfgND.DataFolderPath = *utils.DataDir // Share DataFolderPath through config towards StoreDb for Flush()
|
||||
}
|
||||
|
||||
// Remove data in both rating and accounting db
|
||||
func testDiamEmptyCEItDataDb(t *testing.T) {
|
||||
if err := engine.InitDataDB(daCfgND); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
// Wipe out the cdr database
|
||||
func testDiamEmptyCEItResetStorDb(t *testing.T) {
|
||||
if err := engine.InitStorDB(daCfgND); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
// Start CGR Engine
|
||||
func testDiamEmptyCEItStartEngine(t *testing.T) {
|
||||
if _, err := engine.StartEngine(daCfgPathND, 500); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func testDiamEmptyCEItConnectDiameterClient(t *testing.T) {
|
||||
var err error
|
||||
diamClntND, err = NewDiameterClient(daCfgND.DiameterAgentCfg().Listen,
|
||||
"INTEGRATION_TESTS",
|
||||
daCfgND.DiameterAgentCfg().OriginRealm, daCfgND.DiameterAgentCfg().VendorID,
|
||||
daCfgND.DiameterAgentCfg().ProductName, utils.DiameterFirmwareRevision,
|
||||
daCfgND.DiameterAgentCfg().DictionariesPath, daCfgND.DiameterAgentCfg().ListenNet)
|
||||
if err.Error() != "missing application" {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func testDiamEmptyCEItKillEngine(t *testing.T) {
|
||||
if err := engine.KillEngine(1000); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
@@ -81,6 +81,20 @@ package agents
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// func TestDiamItTcpNoDefaults(t *testing.T) {
|
||||
// switch *utils.DBType {
|
||||
// case utils.MetaInternal:
|
||||
// diamConfigDIR = "diamagent_internal_supp_apps"
|
||||
// case utils.MetaMySQL, utils.MetaMongo, utils.MetaPostgres:
|
||||
// t.SkipNow()
|
||||
// default:
|
||||
// t.Fatal("Unknown Database type")
|
||||
// }
|
||||
// for _, stest := range sTestsDiam {
|
||||
// t.Run(diamConfigDIR, stest)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// func TestDiamItDispatcher(t *testing.T) {
|
||||
// if *utils.Encoding == utils.MetaGOB {
|
||||
// t.SkipNow()
|
||||
|
||||
@@ -31,10 +31,10 @@ import (
|
||||
"github.com/cgrates/birpc/context"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
"github.com/fiorix/go-diameter/v4/diam"
|
||||
"github.com/fiorix/go-diameter/v4/diam/avp"
|
||||
"github.com/fiorix/go-diameter/v4/diam/datatype"
|
||||
"github.com/fiorix/go-diameter/v4/diam/dict"
|
||||
"github.com/cgrates/go-diameter/diam"
|
||||
"github.com/cgrates/go-diameter/diam/avp"
|
||||
"github.com/cgrates/go-diameter/diam/datatype"
|
||||
"github.com/cgrates/go-diameter/diam/dict"
|
||||
)
|
||||
|
||||
func TestDiamPrometheus(t *testing.T) {
|
||||
|
||||
@@ -32,12 +32,12 @@ import (
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/sessions"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
"github.com/fiorix/go-diameter/v4/diam"
|
||||
"github.com/fiorix/go-diameter/v4/diam/avp"
|
||||
"github.com/fiorix/go-diameter/v4/diam/datatype"
|
||||
"github.com/fiorix/go-diameter/v4/diam/dict"
|
||||
"github.com/fiorix/go-diameter/v4/diam/sm"
|
||||
"github.com/fiorix/go-diameter/v4/diam/sm/smpeer"
|
||||
"github.com/cgrates/go-diameter/diam"
|
||||
"github.com/cgrates/go-diameter/diam/avp"
|
||||
"github.com/cgrates/go-diameter/diam/datatype"
|
||||
"github.com/cgrates/go-diameter/diam/dict"
|
||||
"github.com/cgrates/go-diameter/diam/sm"
|
||||
"github.com/cgrates/go-diameter/diam/sm/smpeer"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -130,6 +130,7 @@ func (da *DiameterAgent) ListenAndServe(stopChan <-chan struct{}) (err error) {
|
||||
// Creates the message handlers
|
||||
func (da *DiameterAgent) handlers() diam.Handler {
|
||||
settings := &sm.Settings{
|
||||
SupportedApps: da.cgrCfg.DiameterAgentCfg().CEApplications,
|
||||
OriginHost: datatype.DiameterIdentity(da.cgrCfg.DiameterAgentCfg().OriginHost),
|
||||
OriginRealm: datatype.DiameterIdentity(da.cgrCfg.DiameterAgentCfg().OriginRealm),
|
||||
VendorID: datatype.Unsigned32(da.cgrCfg.DiameterAgentCfg().VendorID),
|
||||
|
||||
@@ -28,10 +28,10 @@ import (
|
||||
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
"github.com/fiorix/go-diameter/v4/diam"
|
||||
"github.com/fiorix/go-diameter/v4/diam/avp"
|
||||
"github.com/fiorix/go-diameter/v4/diam/datatype"
|
||||
"github.com/fiorix/go-diameter/v4/diam/dict"
|
||||
"github.com/cgrates/go-diameter/diam"
|
||||
"github.com/cgrates/go-diameter/diam/avp"
|
||||
"github.com/cgrates/go-diameter/diam/datatype"
|
||||
"github.com/cgrates/go-diameter/diam/dict"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -26,10 +26,10 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
"github.com/fiorix/go-diameter/v4/diam"
|
||||
"github.com/fiorix/go-diameter/v4/diam/avp"
|
||||
"github.com/fiorix/go-diameter/v4/diam/datatype"
|
||||
"github.com/fiorix/go-diameter/v4/diam/sm"
|
||||
"github.com/cgrates/go-diameter/diam"
|
||||
"github.com/cgrates/go-diameter/diam/avp"
|
||||
"github.com/cgrates/go-diameter/diam/datatype"
|
||||
"github.com/cgrates/go-diameter/diam/sm"
|
||||
)
|
||||
|
||||
var dictOnce sync.Once
|
||||
|
||||
@@ -31,10 +31,10 @@ import (
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
"github.com/fiorix/go-diameter/v4/diam"
|
||||
"github.com/fiorix/go-diameter/v4/diam/avp"
|
||||
"github.com/fiorix/go-diameter/v4/diam/datatype"
|
||||
"github.com/fiorix/go-diameter/v4/diam/dict"
|
||||
"github.com/cgrates/go-diameter/diam"
|
||||
"github.com/cgrates/go-diameter/diam/avp"
|
||||
"github.com/cgrates/go-diameter/diam/datatype"
|
||||
"github.com/cgrates/go-diameter/diam/dict"
|
||||
)
|
||||
|
||||
func loadDictionaries(dictsDir, componentID string) error {
|
||||
|
||||
@@ -29,9 +29,9 @@ import (
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
"github.com/fiorix/go-diameter/v4/diam"
|
||||
"github.com/fiorix/go-diameter/v4/diam/avp"
|
||||
"github.com/fiorix/go-diameter/v4/diam/datatype"
|
||||
"github.com/cgrates/go-diameter/diam"
|
||||
"github.com/cgrates/go-diameter/diam/avp"
|
||||
"github.com/cgrates/go-diameter/diam/datatype"
|
||||
)
|
||||
|
||||
func TestDPFieldAsInterface(t *testing.T) {
|
||||
|
||||
@@ -1024,6 +1024,7 @@ const CGRATES_CFG_JSON = `
|
||||
"listen": "127.0.0.1:3868", // address where to listen for diameter requests <x.y.z.y/x1.y1.z1.y1:1234>
|
||||
"listen_net": "tcp", // transport type for diameter <tcp|sctp>
|
||||
"dictionaries_path": "/usr/share/cgrates/diameter/dict/", // path towards directory holding additional dictionaries to load
|
||||
// "ce_applications": [], // list of applications in dictionaries wanted to be included in Capability-Exchange. Needed either "app name", "app ID", or "vendor name.app name/ID"
|
||||
"sessions_conns": ["*birpc_internal"],
|
||||
"stats_conns": [], // connections to StatS, empty to disable: <""|*internal|$rpc_conns_id>
|
||||
"thresholds_conns": [], // connections to ThresholdS, empty to disable: <""|*internal|$rpc_conns_id>
|
||||
|
||||
@@ -737,6 +737,7 @@ func TestDiameterAgentJsonCfg(t *testing.T) {
|
||||
Listen: utils.StringPointer("127.0.0.1:3868"),
|
||||
ListenNet: utils.StringPointer(utils.TCP),
|
||||
DictionariesPath: utils.StringPointer("/usr/share/cgrates/diameter/dict/"),
|
||||
CEApplications: nil,
|
||||
SessionSConns: &[]string{rpcclient.BiRPCInternal},
|
||||
StatSConns: &[]string{},
|
||||
ThresholdSConns: &[]string{},
|
||||
|
||||
@@ -31,6 +31,7 @@ type DiameterAgentCfg struct {
|
||||
ListenNet string // sctp or tcp
|
||||
Listen string // address where to listen for diameter requests <x.y.z.y:1234>
|
||||
DictionariesPath string
|
||||
CEApplications []string
|
||||
SessionSConns []string
|
||||
StatSConns []string
|
||||
ThresholdSConns []string
|
||||
@@ -70,6 +71,10 @@ func (da *DiameterAgentCfg) loadFromJSONCfg(jsnCfg *DiameterAgentJsonCfg) (err e
|
||||
if jsnCfg.DictionariesPath != nil {
|
||||
da.DictionariesPath = *jsnCfg.DictionariesPath
|
||||
}
|
||||
if jsnCfg.CEApplications != nil {
|
||||
da.CEApplications = make([]string, len(*jsnCfg.CEApplications))
|
||||
copy(da.CEApplications, *jsnCfg.CEApplications)
|
||||
}
|
||||
if jsnCfg.SessionSConns != nil {
|
||||
da.SessionSConns = tagInternalConns(*jsnCfg.SessionSConns, utils.MetaSessionS)
|
||||
}
|
||||
@@ -131,6 +136,11 @@ func (da DiameterAgentCfg) AsMapInterface() any {
|
||||
utils.ForcedDisconnectCfg: da.ForcedDisconnect,
|
||||
utils.RequestProcessorsCfg: requestProcessors,
|
||||
}
|
||||
if da.CEApplications != nil {
|
||||
apps := make([]string, len(da.CEApplications))
|
||||
copy(apps, da.CEApplications)
|
||||
mp[utils.CEApplicationsCfg] = apps
|
||||
}
|
||||
return mp
|
||||
}
|
||||
|
||||
@@ -144,6 +154,7 @@ func (da DiameterAgentCfg) Clone() *DiameterAgentCfg {
|
||||
ListenNet: da.ListenNet,
|
||||
Listen: da.Listen,
|
||||
DictionariesPath: da.DictionariesPath,
|
||||
CEApplications: slices.Clone(da.CEApplications),
|
||||
SessionSConns: slices.Clone(da.SessionSConns),
|
||||
StatSConns: slices.Clone(da.StatSConns),
|
||||
ThresholdSConns: slices.Clone(da.ThresholdSConns),
|
||||
@@ -156,6 +167,10 @@ func (da DiameterAgentCfg) Clone() *DiameterAgentCfg {
|
||||
RARTemplate: da.RARTemplate,
|
||||
ForcedDisconnect: da.ForcedDisconnect,
|
||||
}
|
||||
if da.CEApplications != nil {
|
||||
clone.CEApplications = make([]string, len(da.CEApplications))
|
||||
copy(clone.CEApplications, da.CEApplications)
|
||||
}
|
||||
if da.RequestProcessors != nil {
|
||||
clone.RequestProcessors = make([]*RequestProcessor, len(da.RequestProcessors))
|
||||
for i, req := range da.RequestProcessors {
|
||||
@@ -171,6 +186,7 @@ type DiameterAgentJsonCfg struct {
|
||||
Listen *string `json:"listen"`
|
||||
ListenNet *string `json:"listen_net"`
|
||||
DictionariesPath *string `json:"dictionaries_path"`
|
||||
CEApplications *[]string `json:"ce_applications"`
|
||||
SessionSConns *[]string `json:"sessions_conns"`
|
||||
StatSConns *[]string `json:"stats_conns"`
|
||||
ThresholdSConns *[]string `json:"thresholds_conns"`
|
||||
@@ -201,6 +217,9 @@ func diffDiameterAgentJsonCfg(d *DiameterAgentJsonCfg, v1, v2 *DiameterAgentCfg)
|
||||
if v1.DictionariesPath != v2.DictionariesPath {
|
||||
d.DictionariesPath = utils.StringPointer(v2.DictionariesPath)
|
||||
}
|
||||
if !slices.Equal(v1.CEApplications, v2.CEApplications) {
|
||||
d.CEApplications = utils.SliceStringPointer(v2.CEApplications)
|
||||
}
|
||||
if !slices.Equal(v1.SessionSConns, v2.SessionSConns) {
|
||||
d.SessionSConns = utils.SliceStringPointer(stripInternalConns(v2.SessionSConns))
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ func TestDiameterAgentCfgloadFromJsonCfg(t *testing.T) {
|
||||
ListenNet: utils.StringPointer("tcp"),
|
||||
Listen: utils.StringPointer("127.0.0.1:3868"),
|
||||
DictionariesPath: utils.StringPointer("/usr/share/cgrates/diameter/dict/"),
|
||||
CEApplications: &[]string{"Base"},
|
||||
SessionSConns: &[]string{utils.MetaInternal, "*conn1"},
|
||||
StatSConns: &[]string{utils.MetaInternal, "*conn1"},
|
||||
ThresholdSConns: &[]string{utils.MetaInternal, "*conn1"},
|
||||
@@ -54,6 +55,7 @@ func TestDiameterAgentCfgloadFromJsonCfg(t *testing.T) {
|
||||
ListenNet: "tcp",
|
||||
Listen: "127.0.0.1:3868",
|
||||
DictionariesPath: "/usr/share/cgrates/diameter/dict/",
|
||||
CEApplications: []string{"Base"},
|
||||
SessionSConns: []string{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaSessionS), "*conn1"},
|
||||
StatSConns: []string{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaStats), "*conn1"},
|
||||
ThresholdSConns: []string{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaThresholds), "*conn1"},
|
||||
@@ -130,6 +132,7 @@ func TestDiameterAgentCfgAsMapInterface(t *testing.T) {
|
||||
"enabled": false,
|
||||
"listen": "127.0.0.1:3868",
|
||||
"dictionaries_path": "/usr/share/cgrates/diameter/dict/",
|
||||
"ce_applications": ["Base"],
|
||||
"sessions_conns": ["*birpc_internal","*internal", "*conn1"],
|
||||
"stats_conns": ["*birpc_internal","*internal", "*conn1"],
|
||||
"thresholds_conns": ["*birpc_internal","*internal", "*conn1"],
|
||||
@@ -157,6 +160,7 @@ func TestDiameterAgentCfgAsMapInterface(t *testing.T) {
|
||||
eMap := map[string]any{
|
||||
utils.ASRTemplateCfg: "",
|
||||
utils.DictionariesPathCfg: "/usr/share/cgrates/diameter/dict/",
|
||||
utils.CEApplicationsCfg: []string{"Base"},
|
||||
utils.EnabledCfg: false,
|
||||
utils.ForcedDisconnectCfg: "*none",
|
||||
utils.ListenCfg: "127.0.0.1:3868",
|
||||
@@ -304,6 +308,7 @@ func TestDiffDiameterAgentJsonCfg(t *testing.T) {
|
||||
ListenNet: "udp",
|
||||
Listen: "localhost:8037",
|
||||
DictionariesPath: "/path/different",
|
||||
CEApplications: []string{"Base"},
|
||||
SessionSConns: []string{"*birpc_internal"},
|
||||
StatSConns: []string{"*internal"},
|
||||
ThresholdSConns: []string{"*internal"},
|
||||
@@ -327,6 +332,7 @@ func TestDiffDiameterAgentJsonCfg(t *testing.T) {
|
||||
ListenNet: utils.StringPointer("udp"),
|
||||
Listen: utils.StringPointer("localhost:8037"),
|
||||
DictionariesPath: utils.StringPointer("/path/different"),
|
||||
CEApplications: utils.SliceStringPointer([]string{"Base"}),
|
||||
SessionSConns: &[]string{"*birpc_internal"},
|
||||
StatSConns: &[]string{"*internal"},
|
||||
ThresholdSConns: &[]string{"*internal"},
|
||||
|
||||
67
data/conf/samples/diamagent_internal_empty_apps/cgrates.json
Normal file
67
data/conf/samples/diamagent_internal_empty_apps/cgrates.json
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
// CGRateS Configuration file
|
||||
//
|
||||
// Used for cgradmin
|
||||
// Starts rater, scheduler
|
||||
|
||||
"general": {
|
||||
"default_tenant": "cgrates.com",
|
||||
},
|
||||
|
||||
"logger": {
|
||||
"level": 7
|
||||
},
|
||||
|
||||
"listen": {
|
||||
"rpc_json": ":2012", // RPC JSON listening address
|
||||
"rpc_gob": ":2013", // RPC GOB listening address
|
||||
"http": ":2080", // HTTP listening address
|
||||
},
|
||||
|
||||
"data_db": {
|
||||
"db_type": "*internal"
|
||||
},
|
||||
|
||||
"stor_db": {
|
||||
"db_type": "*internal"
|
||||
},
|
||||
|
||||
"cdrs": {
|
||||
"enabled": true,
|
||||
},
|
||||
|
||||
"attributes": {
|
||||
"enabled": true,
|
||||
},
|
||||
|
||||
"chargers": {
|
||||
"enabled": true,
|
||||
"attributes_conns": ["*internal"],
|
||||
},
|
||||
|
||||
"rates": {
|
||||
"enabled": true,
|
||||
},
|
||||
|
||||
"sessions": {
|
||||
"enabled": true,
|
||||
"attributes_conns": ["*localhost"],
|
||||
"chargers_conns": ["*localhost"],
|
||||
"rates_conns": ["*localhost"],
|
||||
"cdrs_conns": ["*localhost"],
|
||||
},
|
||||
|
||||
"diameter_agent": {
|
||||
"enabled": true,
|
||||
"ce_applications": [],
|
||||
"sessions_conns": ["*bijson_localhost"],
|
||||
"asr_template": "*asr",
|
||||
"rar_template": "*rar",
|
||||
"forced_disconnect": "*asr", // the request to send to diameter on DisconnectSession <*none|*asr|*rar>
|
||||
},
|
||||
|
||||
"admins": {
|
||||
"enabled": true,
|
||||
},
|
||||
|
||||
}
|
||||
71
data/conf/samples/diamagent_internal_supp_apps/cgrates.json
Normal file
71
data/conf/samples/diamagent_internal_supp_apps/cgrates.json
Normal file
@@ -0,0 +1,71 @@
|
||||
{
|
||||
// CGRateS Configuration file
|
||||
//
|
||||
// Used for cgradmin
|
||||
// Starts rater, scheduler
|
||||
|
||||
"general": {
|
||||
"default_tenant": "cgrates.com",
|
||||
},
|
||||
|
||||
"logger": {
|
||||
"level": 7
|
||||
},
|
||||
|
||||
"listen": {
|
||||
"rpc_json": ":2012", // RPC JSON listening address
|
||||
"rpc_gob": ":2013", // RPC GOB listening address
|
||||
"http": ":2080", // HTTP listening address
|
||||
},
|
||||
|
||||
"data_db": {
|
||||
"db_type": "*internal"
|
||||
},
|
||||
|
||||
"stor_db": {
|
||||
"db_type": "*internal"
|
||||
},
|
||||
|
||||
"cdrs": {
|
||||
"enabled": true,
|
||||
},
|
||||
|
||||
"attributes": {
|
||||
"enabled": true,
|
||||
},
|
||||
|
||||
"chargers": {
|
||||
"enabled": true,
|
||||
"attributes_conns": ["*internal"],
|
||||
},
|
||||
|
||||
"rates": {
|
||||
"enabled": true,
|
||||
},
|
||||
|
||||
"sessions": {
|
||||
"enabled": true,
|
||||
"attributes_conns": ["*localhost"],
|
||||
"chargers_conns": ["*localhost"],
|
||||
"rates_conns": ["*localhost"],
|
||||
"cdrs_conns": ["*localhost"],
|
||||
},
|
||||
|
||||
"diameter_agent": {
|
||||
"enabled": true,
|
||||
"ce_applications": [
|
||||
"Charging Control",
|
||||
"1",
|
||||
"Metaswitch Networks Ltd.4",
|
||||
],
|
||||
"sessions_conns": ["*bijson_localhost"],
|
||||
"asr_template": "*asr",
|
||||
"rar_template": "*rar",
|
||||
"forced_disconnect": "*asr", // the request to send to diameter on DisconnectSession <*none|*asr|*rar>
|
||||
},
|
||||
|
||||
"admins": {
|
||||
"enabled": true,
|
||||
},
|
||||
|
||||
}
|
||||
377
data/conf/samples/diamagent_internal_supp_apps/data.json
Normal file
377
data/conf/samples/diamagent_internal_supp_apps/data.json
Normal file
@@ -0,0 +1,377 @@
|
||||
|
||||
{
|
||||
|
||||
"diameter_agent": {
|
||||
"request_processors": [
|
||||
|
||||
{
|
||||
"id": "data_init",
|
||||
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:1", "*prefix:~*req.Service-Context-Id:gprs"],
|
||||
"flags": ["*initiate", "*accounts"],
|
||||
"request_fields":[
|
||||
{
|
||||
"tag": "ToR",
|
||||
"path": "*cgreq.ToR",
|
||||
"type": "*constant",
|
||||
"value": "*data"
|
||||
},
|
||||
{
|
||||
"tag": "OriginID",
|
||||
"path": "*cgreq.OriginID",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Session-Id",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "RequestType",
|
||||
"path": "*cgreq.RequestType",
|
||||
"type": "*constant",
|
||||
"value": "*prepaid"
|
||||
},
|
||||
{
|
||||
"tag": "Category",
|
||||
"path": "Category",
|
||||
"type": "*constant",
|
||||
"value": "generic"
|
||||
},
|
||||
{
|
||||
"tag": "Account",
|
||||
"path": "*cgreq.Account",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(1)]",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "Destination",
|
||||
"path": "*cgreq.Destination",
|
||||
"type": "*constant",
|
||||
"value": "data"
|
||||
},
|
||||
{
|
||||
"tag": "SetupTime",
|
||||
"path": "*cgreq.SetupTime",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Event-Timestamp",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "AnswerTime",
|
||||
"path": "*cgreq.AnswerTime",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Event-Timestamp",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "Usage",
|
||||
"path": "*cgreq.Usage",
|
||||
"type": "*constant",
|
||||
"value": "2048"
|
||||
},
|
||||
],
|
||||
"reply_fields": [
|
||||
{
|
||||
"tag": "CCATemplate",
|
||||
"type": "*template",
|
||||
"value": "*cca"
|
||||
},
|
||||
{
|
||||
"tag": "ResultCode",
|
||||
"filters": ["*notempty:~*cgrep.Error:"],
|
||||
"path": "*rep.Result-Code",
|
||||
"type": "*constant",
|
||||
"value": "5030",
|
||||
"blocker": true
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
"id": "data_update_grp1",
|
||||
"filters": [
|
||||
"*string:~*vars.*cmd:CCR",
|
||||
"*string:~*req.CC-Request-Type:2",
|
||||
"*string:~*req.Multiple-Services-Credit-Control.Rating-Group:1",
|
||||
"*prefix:~*req.Service-Context-Id:gprs"
|
||||
],
|
||||
"flags": ["*update", "*accounts","*continue"],
|
||||
"request_fields":[
|
||||
{
|
||||
"tag": "ToR",
|
||||
"path": "*cgreq.ToR",
|
||||
"type": "*constant",
|
||||
"value": "*data"
|
||||
},
|
||||
{
|
||||
"tag": "InitialOriginID",
|
||||
"path": "*cgreq.InitialOriginID",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Session-Id",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "OriginID",
|
||||
"path": "*cgreq.OriginID",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Session-Id",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "OriginID",
|
||||
"path": "*cgreq.OriginID",
|
||||
"type": "*variable",
|
||||
"value": "_grp1"
|
||||
},
|
||||
{
|
||||
"tag": "RequestType",
|
||||
"path": "*cgreq.RequestType",
|
||||
"type": "*constant",
|
||||
"value": "*prepaid"
|
||||
},
|
||||
{
|
||||
"tag": "Category",
|
||||
"path": "*cgreq.Category",
|
||||
"type": "*contant",
|
||||
"value": "generic"
|
||||
},
|
||||
{
|
||||
"tag": "Account",
|
||||
"path": "*cgreq.Account",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"
|
||||
},
|
||||
{
|
||||
"tag": "Destination",
|
||||
"path": "*cgreq.Destination",
|
||||
"type": "*constant",
|
||||
"value": "data"
|
||||
},
|
||||
{
|
||||
"tag": "SetupTime",
|
||||
"path": "*cgreq.SetupTime",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Event-Timestamp",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "AnswerTime",
|
||||
"path": "*cgreq.AnswerTime",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Event-Timestamp",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "Usage",
|
||||
"path": "*cgreq.Usage",
|
||||
"type": "*constant",
|
||||
"value": "2048"
|
||||
},
|
||||
{
|
||||
"tag": "LastUsed",
|
||||
"path": "*cgreq.LastUsed",
|
||||
"type": "*sum",
|
||||
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(1)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(1)]"
|
||||
},
|
||||
],
|
||||
"reply_fields": [
|
||||
{
|
||||
"tag": "CCATemplate",
|
||||
"type": "*template",
|
||||
"value": "*cca"
|
||||
},
|
||||
{
|
||||
"tag": "ResultCode",
|
||||
"filters": ["*notempty:~*cgrep.Error:"],
|
||||
"path": "*rep.Result-Code",
|
||||
"type": "*constant",
|
||||
"value": "5030",
|
||||
"blocker": true
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
"id": "data_update_grp2",
|
||||
"filters": [
|
||||
"*string:~*vars.*cmd:CCR",
|
||||
"*string:~*req.CC-Request-Type:2",
|
||||
"*string:~*req.Multiple-Services-Credit-Control.Rating-Group[1]:2",
|
||||
"*prefix:~*req.Service-Context-Id:gprs"
|
||||
],
|
||||
"flags": ["*update", "*accounts"],
|
||||
"request_fields":[
|
||||
{
|
||||
"tag": "ToR",
|
||||
"path": "*cgreq.ToR",
|
||||
"type": "*constant",
|
||||
"value": "*data"
|
||||
},
|
||||
{
|
||||
"tag": "InitialOriginID",
|
||||
"path": "*cgreq.InitialOriginID",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Session-Id",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "OriginID",
|
||||
"path": "OriginID",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Session-Id",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "OriginID",
|
||||
"path": "*cgreq.OriginID",
|
||||
"type": "*constant",
|
||||
"value": "_grp2"
|
||||
},
|
||||
{
|
||||
"tag": "RequestType",
|
||||
"path": "*cgreq.RequestType",
|
||||
"type": "*constant",
|
||||
"value": "*prepaid"
|
||||
},
|
||||
{
|
||||
"tag": "Category",
|
||||
"path": "*cgreq.Category",
|
||||
"type": "*constant",
|
||||
"value": "generic"
|
||||
},
|
||||
{
|
||||
"tag": "Account",
|
||||
"path": "*cgreq.Account",
|
||||
"type": "*variable",
|
||||
"mandatory": true,
|
||||
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"
|
||||
},
|
||||
{
|
||||
"tag": "Destination",
|
||||
"path": "*cgreq.Destination",
|
||||
"type": "*constant",
|
||||
"value": "data"
|
||||
},
|
||||
{
|
||||
"tag": "SetupTime",
|
||||
"path": "*cgreq.SetupTime",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Event-Timestamp",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "AnswerTime",
|
||||
"path": "*cgreq.AnswerTime",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Event-Timestamp",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "Usage",
|
||||
"path": "*cgreq.Usage",
|
||||
"type": "*constant",
|
||||
"value": "2048"
|
||||
},
|
||||
{
|
||||
"tag": "LastUsed",
|
||||
"path": "*cgreq.LastUsed",
|
||||
"type": "*sum",
|
||||
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(2)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(2)]"
|
||||
},
|
||||
],
|
||||
"reply_fields": [
|
||||
{
|
||||
"tag": "CCATemplate",
|
||||
"type": "*template",
|
||||
"value": "*cca"
|
||||
},
|
||||
{
|
||||
"tag": "ResultCode",
|
||||
"filters": ["*notempty:~*cgrep.Error:"],
|
||||
"path": "*rep.Result-Code",
|
||||
"type": "*constant",
|
||||
"value": "5030",
|
||||
"blocker": true
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
"id": "data_terminate",
|
||||
"filters": [
|
||||
"*string:~*vars.*cmd:CCR",
|
||||
"*string:~*req.CC-Request-Type:3",
|
||||
"*prefix:~*req.Service-Context-Id:gprs"
|
||||
],
|
||||
"flags": ["*terminate", "*accounts"],
|
||||
"request_fields":[
|
||||
{
|
||||
"tag": "ToR",
|
||||
"path": "*cgreq.ToR",
|
||||
"type": "*constant",
|
||||
"value": "*data"
|
||||
},
|
||||
{
|
||||
"tag": "OriginID",
|
||||
"path": "*cgreq.OriginID",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Session-Id",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "OriginIDPrefix",
|
||||
"path": "*cgreq.OriginIDPrefix",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Session-Id",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "RequestType",
|
||||
"path": "*cgreq.RequestType",
|
||||
"type": "*constant",
|
||||
"value": "*prepaid"
|
||||
},
|
||||
{
|
||||
"tag": "Category",
|
||||
"path": "*cgreq.Category",
|
||||
"type": "*constant",
|
||||
"value": "generic"
|
||||
},
|
||||
{
|
||||
"tag": "Account",
|
||||
"path": "*cgreq.Account",
|
||||
"type": "*variable",
|
||||
"mandatory": true,
|
||||
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"
|
||||
},
|
||||
{
|
||||
"tag": "Destination",
|
||||
"path": "*cgreq.Destination",
|
||||
"type": "*constant",
|
||||
"value": "data"
|
||||
},
|
||||
{
|
||||
"tag": "SetupTime",
|
||||
"path": "*cgreq.SetupTime",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Event-Timestamp",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "AnswerTime",
|
||||
"path": "*cgreq.AnswerTime",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Event-Timestamp",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "LastUsed",
|
||||
"path": "*cgreq.LastUsed",
|
||||
"type": "*handler",
|
||||
"handler_id": "*sum",
|
||||
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets"
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
200
data/conf/samples/diamagent_internal_supp_apps/dryrun.json
Normal file
200
data/conf/samples/diamagent_internal_supp_apps/dryrun.json
Normal file
@@ -0,0 +1,200 @@
|
||||
{
|
||||
|
||||
"diameter_agent": {
|
||||
"request_processors": [
|
||||
{
|
||||
"id": "dryrun1",
|
||||
"filters": [
|
||||
"*string:~*vars.*cmd:CCR",
|
||||
"*string:~*req.Service-Context-Id:TestDiamItDryRun"
|
||||
],
|
||||
"flags": ["*dryrun","*continue"],
|
||||
"request_fields":[
|
||||
{
|
||||
"tag": "ToR",
|
||||
"path": "*cgreq.ToR",
|
||||
"type": "*constant",
|
||||
"value": "*sms"
|
||||
},
|
||||
{
|
||||
"tag": "Val1",
|
||||
"path": "*cgreq.Val1",
|
||||
"type": "*constant",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"tag": "Val2",
|
||||
"path": "*cgreq.Val2",
|
||||
"type": "*constant",
|
||||
"value": "2"
|
||||
},
|
||||
{
|
||||
"tag": "Val3",
|
||||
"path": "*cgreq.Val3",
|
||||
"type": "*constant",
|
||||
"value": "3"
|
||||
},
|
||||
{
|
||||
"tag": "OptionalField",
|
||||
"path":"*cgreq.OptionalField",
|
||||
"type":"*variable",
|
||||
"value":"~*req.Inexistent",
|
||||
},
|
||||
{
|
||||
"tag": "OriginID",
|
||||
"path": "*cgreq.OriginID",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Session-Id",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "RequestType",
|
||||
"path": "*cgreq.RequestType",
|
||||
"type": "*constant",
|
||||
"value": "*prepaid"
|
||||
},
|
||||
{
|
||||
"tag": "SetupTime",
|
||||
"path": "*cgreq.SetupTime",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Event-Timestamp",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "UsedUnits1",
|
||||
"path": "*cgreq.UsedUnits1",
|
||||
"type": "*variable",
|
||||
"mandatory": true,
|
||||
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(1)]"
|
||||
},
|
||||
{
|
||||
"tag": "UsedUnits2",
|
||||
"path": "*cgreq.UsedUnits2",
|
||||
"type": "*variable",
|
||||
"mandatory": true,
|
||||
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(2)]"
|
||||
},
|
||||
|
||||
],
|
||||
"reply_fields":[
|
||||
{
|
||||
"tag": "CCATemplate",
|
||||
"type": "*template",
|
||||
"value": "*cca"
|
||||
},
|
||||
{
|
||||
"tag": "ResultCode",
|
||||
"path": "*rep.Result-Code",
|
||||
"type": "*constant",
|
||||
"value": "2002"
|
||||
},
|
||||
{
|
||||
"tag": "RatingGroup",
|
||||
"path": "*rep.Multiple-Services-Credit-Control.Rating-Group",
|
||||
"type": "*constant",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"tag": "CCTotalOctets1",
|
||||
"path": "*rep.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets",
|
||||
"type": "*variable",
|
||||
"value": "~*cgreq.UsedUnits1"
|
||||
},
|
||||
{
|
||||
"tag": "GrantedUsage",
|
||||
"path": "*rep.Granted-Service-Unit.CC-Time",
|
||||
"type": "*sum",
|
||||
"value": "~*cgreq.Val1;~*cgreq.Val2;~*cgreq.Val3"},
|
||||
],
|
||||
},
|
||||
{
|
||||
"id": "dryrun2",
|
||||
"filters": ["*notempty:~*rep.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[0]:"], // make sure the CC-Total-Octets was populated in the previous processor
|
||||
"flags": ["*dryrun"],
|
||||
"request_fields":[
|
||||
{
|
||||
"tag": "ToR",
|
||||
"path": "*cgreq.ToR",
|
||||
"type": "*constant",
|
||||
"value": "*sms"
|
||||
},
|
||||
{
|
||||
"tag": "Val1",
|
||||
"path": "*cgreq.Val1",
|
||||
"type": "*constant",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"tag": "Val2",
|
||||
"path": "*cgreq.Val2",
|
||||
"type": "*constant",
|
||||
"value": "2"
|
||||
},
|
||||
{
|
||||
"tag": "Val3",
|
||||
"path": "*cgreq.Val3",
|
||||
"type": "*constant",
|
||||
"value": "3"
|
||||
},
|
||||
{
|
||||
"tag": "OptionalField",
|
||||
"path":"*cgreq.OptionalField",
|
||||
"type":"*variable",
|
||||
"value":"~*req.Inexistent"
|
||||
},
|
||||
{
|
||||
"tag": "OriginID",
|
||||
"path": "*cgreq.OriginID",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Session-Id",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "RequestType",
|
||||
"path": "*cgreq.RequestType",
|
||||
"type": "*constant",
|
||||
"value": "*prepaid"
|
||||
},
|
||||
{
|
||||
"tag": "SetupTime",
|
||||
"path": "*cgreq.SetupTime",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Event-Timestamp",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "UsedUnits1",
|
||||
"path": "*cgreq.UsedUnits1",
|
||||
"type": "*variable",
|
||||
"mandatory": true,
|
||||
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(1)]"
|
||||
},
|
||||
{
|
||||
"tag": "UsedUnits2",
|
||||
"path": "*cgreq.UsedUnits2",
|
||||
"type": "*variable",
|
||||
"mandatory": true,
|
||||
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(2)]"
|
||||
},
|
||||
],
|
||||
"reply_fields":[
|
||||
{
|
||||
"tag": "RatingGroup",
|
||||
"path": "*rep.Multiple-Services-Credit-Control.Rating-Group",
|
||||
"type": "*group",
|
||||
"value": "2",
|
||||
"new_branch": true
|
||||
},
|
||||
{
|
||||
"tag": "CCTotalOctets2",
|
||||
"path": "*rep.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets",
|
||||
"type": "*group",
|
||||
"value": "~*cgreq.UsedUnits2"
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
],
|
||||
},
|
||||
|
||||
}
|
||||
91
data/conf/samples/diamagent_internal_supp_apps/message.json
Normal file
91
data/conf/samples/diamagent_internal_supp_apps/message.json
Normal file
@@ -0,0 +1,91 @@
|
||||
{
|
||||
|
||||
"diameter_agent": {
|
||||
"request_processors": [
|
||||
|
||||
{
|
||||
"id": "message",
|
||||
"filters": [
|
||||
"*string:~*vars.*cmd:CCR",
|
||||
"*prefix:~*req.Service-Context-Id:message",
|
||||
"*string:~*req.CC-Request-Type:4"
|
||||
],
|
||||
"flags": ["*message", "*accounts", "*cdrs","*attributes"],
|
||||
"request_fields":[
|
||||
{
|
||||
"tag": "ToR",
|
||||
"path": "*cgreq.ToR",
|
||||
"type": "*constant",
|
||||
"value": "*sms"
|
||||
},
|
||||
{
|
||||
"tag": "OriginID",
|
||||
"path": "*cgreq.OriginID",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Session-Id",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "Category",
|
||||
"path": "*cgreq.Category",
|
||||
"type": "*constant",
|
||||
"value": "sms"
|
||||
},
|
||||
{
|
||||
"tag": "RequestType",
|
||||
"path": "*cgreq.RequestType",
|
||||
"type": "*constant",
|
||||
"value": "*prepaid"
|
||||
},
|
||||
{
|
||||
"tag": "Account",
|
||||
"path": "*cgreq.Account",
|
||||
"type": "*variable",
|
||||
"mandatory": true,
|
||||
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"
|
||||
},
|
||||
{
|
||||
"tag": "Destination",
|
||||
"path": "*cgreq.Destination",
|
||||
"type": "*variable",
|
||||
"mandatory": true,
|
||||
"value": "~*req.Service-Information.SMS-Information.Recipient-Address.Address-Data"
|
||||
},
|
||||
{
|
||||
"tag": "SetupTime",
|
||||
"path": "*cgreq.SetupTime",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Event-Timestamp",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "AnswerTime",
|
||||
"path": "*cgreq.AnswerTime",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Event-Timestamp",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "Usage",
|
||||
"path": "*cgreq.Usage",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Requested-Service-Unit.CC-Time",
|
||||
"mandatory": true
|
||||
},
|
||||
],
|
||||
"reply_fields":[
|
||||
{
|
||||
"tag": "ResultCode",
|
||||
"filters": ["*notempty:~*cgrep.Error:"],
|
||||
"path": "*rep.Result-Code",
|
||||
"type": "*constant",
|
||||
"value": "5030",
|
||||
"blocker": true
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
],
|
||||
},
|
||||
|
||||
}
|
||||
91
data/conf/samples/diamagent_internal_supp_apps/mms.json
Normal file
91
data/conf/samples/diamagent_internal_supp_apps/mms.json
Normal file
@@ -0,0 +1,91 @@
|
||||
{
|
||||
|
||||
"diameter_agent": {
|
||||
"request_processors": [
|
||||
|
||||
{
|
||||
"id": "mms",
|
||||
"filters": [
|
||||
"*string:~*vars.*cmd:CCR",
|
||||
"*prefix:~*req.Service-Context-Id:mms",
|
||||
"*string:~*req.CC-Request-Type:4"
|
||||
],
|
||||
"flags": ["*message", "*accounts", "*cdrs","*attributes"],
|
||||
"request_fields":[
|
||||
{
|
||||
"tag": "ToR",
|
||||
"path": "*cgreq.ToR",
|
||||
"type": "*constant",
|
||||
"value": "*mms"
|
||||
},
|
||||
{
|
||||
"tag": "OriginID",
|
||||
"path": "*cgreq.OriginID",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Session-Id",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "Category",
|
||||
"path": "*cgreq.Category",
|
||||
"type": "*constant",
|
||||
"value": "mms"
|
||||
},
|
||||
{
|
||||
"tag": "RequestType",
|
||||
"path": "*cgreq.RequestType",
|
||||
"type": "*constant",
|
||||
"value": "*prepaid"
|
||||
},
|
||||
{
|
||||
"tag": "Account",
|
||||
"path": "*cgreq.Account",
|
||||
"type": "*variable",
|
||||
"mandatory": true,
|
||||
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"
|
||||
},
|
||||
{
|
||||
"tag": "Destination",
|
||||
"path": "*cgreq.Destination",
|
||||
"type": "*variable",
|
||||
"mandatory": true,
|
||||
"value": "~*req.Service-Information.SMS-Information.Recipient-Address.Address-Data"
|
||||
},
|
||||
{
|
||||
"tag": "SetupTime",
|
||||
"path": "*cgreq.SetupTime",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Event-Timestamp",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "AnswerTime",
|
||||
"path": "*cgreq.AnswerTime",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Event-Timestamp",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "Usage",
|
||||
"path": "*cgreq.Usage",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Requested-Service-Unit.CC-Time",
|
||||
"mandatory": true
|
||||
},
|
||||
],
|
||||
"reply_fields":[
|
||||
{
|
||||
"tag": "ResultCode",
|
||||
"filters": ["*notempty:~*cgrep.Error:"],
|
||||
"path": "*rep.Result-Code",
|
||||
"type": "*constant",
|
||||
"value": "5030",
|
||||
"blocker": true
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
],
|
||||
},
|
||||
|
||||
}
|
||||
66
data/conf/samples/diamagent_internal_supp_apps/simpa.json
Normal file
66
data/conf/samples/diamagent_internal_supp_apps/simpa.json
Normal file
@@ -0,0 +1,66 @@
|
||||
|
||||
{
|
||||
|
||||
"diameter_agent": {
|
||||
"request_processors": [
|
||||
{
|
||||
"id": "simpa_event",
|
||||
"filters": [
|
||||
"*string:~*vars.*cmd:CCR",
|
||||
"*string:~*req.CC-Request-Type:4",
|
||||
"*prefix:~*req.Service-Context-Id:simpa"
|
||||
],
|
||||
"flags": ["*message", "*accounts", "*log"],
|
||||
"request_fields":[
|
||||
{
|
||||
"tag": "ToR",
|
||||
"path": "*cgreq.ToR",
|
||||
"type": "*constant",
|
||||
"value": "*generic"
|
||||
},
|
||||
{
|
||||
"tag": "OriginID",
|
||||
"path": "*cgreq.OriginID",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Session-Id",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "RequestType",
|
||||
"path": "*cgreq.RequestType",
|
||||
"type": "*constant",
|
||||
"value": "*prepaid"
|
||||
},
|
||||
{
|
||||
"tag": "Category",
|
||||
"path": "*cgreq.Category",
|
||||
"type": "*constant",
|
||||
"value": "generic"
|
||||
},
|
||||
{
|
||||
"tag": "Account",
|
||||
"path": "*cgreq.Account",
|
||||
"type": "*variable",
|
||||
"mandatory": true,
|
||||
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"
|
||||
},
|
||||
{
|
||||
"tag": "AnswerTime",
|
||||
"path": "*cgreq.AnswerTime",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Event-Timestamp",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "Usage",
|
||||
"path": "*cgreq.Usage",
|
||||
"type": "*value_exponent",
|
||||
"mandatory": true,
|
||||
"value": "~*req.Requested-Service-Unit.CC-Money.Unit-Value.Value-Digits;~*req.Requested-Service-Unit.CC-Money.Unit-Value.Exponent"
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
}
|
||||
116
data/conf/samples/diamagent_internal_supp_apps/tests.json
Normal file
116
data/conf/samples/diamagent_internal_supp_apps/tests.json
Normal file
@@ -0,0 +1,116 @@
|
||||
|
||||
{
|
||||
|
||||
"diameter_agent": {
|
||||
"request_processors": [
|
||||
{
|
||||
"id": "TestSessionDisconnect",
|
||||
"filters": [
|
||||
"*string:~*vars.*cmd:CCR",
|
||||
"*string:~*req.CC-Request-Type:1",
|
||||
"*prefix:~*req.Service-Context-Id:testSessionDisconnect"
|
||||
],
|
||||
"flags": ["*initiate", "*accounts","*attributes"],
|
||||
"request_fields":[
|
||||
{
|
||||
"tag": "ToR",
|
||||
"path": "*cgreq.ToR",
|
||||
"type": "*constant",
|
||||
"value": "*voice"
|
||||
},
|
||||
{
|
||||
"tag": "OriginID",
|
||||
"path": "*cgreq.OriginID",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Session-Id",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "OriginHost",
|
||||
"path": "*cgreq.OriginHost",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Origin-Host",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "RequestType",
|
||||
"path": "*cgreq.RequestType",
|
||||
"type": "*constant",
|
||||
"value": "*prepaid"
|
||||
},
|
||||
{
|
||||
"tag": "Category",
|
||||
"path": "*cgreq.Category",
|
||||
"type": "*constant",
|
||||
"value": "call"
|
||||
},
|
||||
{
|
||||
"tag": "Account",
|
||||
"path": "*cgreq.Account",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Subscription-Id.Subscription-Id-Data",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "Subject",
|
||||
"path": "*cgreq.Subject",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Service-Information.IN-Information.Calling-Party-Address",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "Destination",
|
||||
"path": "*cgreq.Destination",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Service-Information.IN-Information.Real-Called-Number",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "AnswerTime",
|
||||
"path": "*cgreq.AnswerTime",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Event-Timestamp",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "Usage",
|
||||
"path": "*cgreq.Usage",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Requested-Service-Unit.CC-Time:s/(.*)/${1}s/",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "DebitInterval",
|
||||
"path": "*opts.*sessionsDebitInterval",
|
||||
"type": "*constant",
|
||||
"value": "1s"
|
||||
},
|
||||
],
|
||||
"reply_fields":[
|
||||
{
|
||||
"tag": "CCATemplate",
|
||||
"type": "*template",
|
||||
"value": "*cca"
|
||||
},
|
||||
{
|
||||
"tag": "ResultCode",
|
||||
"filters": ["*notempty:~*cgrep.Error:"],
|
||||
"path": "*rep.Result-Code",
|
||||
"type": "*constant",
|
||||
"value": "5030",
|
||||
"blocker": true
|
||||
},
|
||||
{
|
||||
"tag": "GrantedUnits",
|
||||
"path": "*rep.Granted-Service-Unit.CC-Time",
|
||||
"filters": ["*gte:~*cgrep.MaxUsage:0s"],
|
||||
"type": "*variable",
|
||||
"value": "~*cgrep.MaxUsage{*duration_seconds&*round:0}",
|
||||
"mandatory": true
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
}
|
||||
438
data/conf/samples/diamagent_internal_supp_apps/voice.json
Normal file
438
data/conf/samples/diamagent_internal_supp_apps/voice.json
Normal file
@@ -0,0 +1,438 @@
|
||||
|
||||
{
|
||||
|
||||
"diameter_agent": {
|
||||
"request_processors": [
|
||||
{
|
||||
"id": "VoiceInitForceDuration",
|
||||
"filters": [
|
||||
"*string:~*vars.*cmd:CCR",
|
||||
"*string:~*req.CC-Request-Type:1",
|
||||
"*prefix:~*req.Service-Context-Id:forceDurationVoice"
|
||||
],
|
||||
"flags": ["*initiate", "*fd", "*accounts", "*attributes"],
|
||||
"request_fields":[
|
||||
{
|
||||
"tag": "ToR",
|
||||
"path": "*cgreq.ToR",
|
||||
"type": "*constant",
|
||||
"value": "*voice"
|
||||
},
|
||||
{
|
||||
"tag": "OriginID",
|
||||
"path": "*cgreq.OriginID",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Session-Id",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "OriginHost",
|
||||
"path": "*cgreq.OriginHost",
|
||||
"type": "*variable",
|
||||
"value": "~*vars.RemoteHost",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "RequestType",
|
||||
"path": "*cgreq.RequestType",
|
||||
"type": "*constant",
|
||||
"value": "*attributes"
|
||||
},
|
||||
{
|
||||
"tag": "Category",
|
||||
"path": "*cgreq.Category",
|
||||
"type": "*constant",
|
||||
"value": "call"
|
||||
},
|
||||
{
|
||||
"tag": "Account",
|
||||
"path": "*cgreq.Account",
|
||||
"type": "*constant",
|
||||
"value": "*attributes"
|
||||
},
|
||||
{
|
||||
"tag": "Destination",
|
||||
"path": "*cgreq.Destination",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Service-Information.IN-Information.Real-Called-Number",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "AnswerTime",
|
||||
"path": "*cgreq.AnswerTime",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Event-Timestamp",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "Usage",
|
||||
"path": "*cgreq.Usage",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Requested-Service-Unit.CC-Time:s/(.*)/${1}s/",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "SubscriberID",
|
||||
"path": "*cgreq.SubscriberId",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Subscription-Id.Subscription-Id-Data",
|
||||
"mandatory": true
|
||||
},
|
||||
],
|
||||
"reply_fields":[
|
||||
{
|
||||
"tag": "ResultCode",
|
||||
"filters": ["*notempty:~*cgrep.Error:"],
|
||||
"path": "*rep.Result-Code",
|
||||
"type": "*constant",
|
||||
"value": "5030",
|
||||
"blocker": true
|
||||
},
|
||||
{
|
||||
"tag": "ResultCode",
|
||||
"path": "*rep.Result-Code",
|
||||
"type": "*constant",
|
||||
"value": "2001"
|
||||
},
|
||||
{
|
||||
"tag": "GrantedUnits",
|
||||
"path": "*rep.Granted-Service-Unit.CC-Time",
|
||||
"type": "*variable",
|
||||
"value": "~*cgrep.MaxUsage{*duration_seconds}",
|
||||
"mandatory": true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"id": "VoiceInit",
|
||||
"filters": [
|
||||
"*string:~*vars.*cmd:CCR",
|
||||
"*string:~*req.CC-Request-Type:1",
|
||||
"*prefix:~*req.Service-Context-Id:voice"
|
||||
],
|
||||
"flags": ["*initiate", "*accounts", "*attributes", "*continue"],
|
||||
"request_fields":[
|
||||
{
|
||||
"tag": "ToR",
|
||||
"path": "*cgreq.ToR",
|
||||
"type": "*constant",
|
||||
"value": "*voice"
|
||||
},
|
||||
{
|
||||
"tag": "OriginID",
|
||||
"path": "*cgreq.OriginID",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Session-Id",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "OriginHost",
|
||||
"path": "*cgreq.OriginHost",
|
||||
"type": "*variable",
|
||||
"value": "~*vars.RemoteHost",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "RequestType",
|
||||
"path": "*cgreq.RequestType",
|
||||
"type": "*constant",
|
||||
"value": "*attributes"
|
||||
},
|
||||
{
|
||||
"tag": "Category",
|
||||
"path": "*cgreq.Category",
|
||||
"type": "*constant",
|
||||
"value": "call"
|
||||
},
|
||||
{
|
||||
"tag": "Account",
|
||||
"path": "*cgreq.Account",
|
||||
"type": "*constant",
|
||||
"value": "*attributes"
|
||||
},
|
||||
{
|
||||
"tag": "Destination",
|
||||
"path": "*cgreq.Destination",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Service-Information.IN-Information.Real-Called-Number",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "AnswerTime",
|
||||
"path": "*cgreq.AnswerTime",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Event-Timestamp",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "Usage",
|
||||
"path": "*cgreq.Usage",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Requested-Service-Unit.CC-Time:s/(.*)/${1}s/",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "SubscriberID",
|
||||
"path": "*cgreq.SubscriberId",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Subscription-Id.Subscription-Id-Data",
|
||||
"mandatory": true
|
||||
},
|
||||
],
|
||||
"reply_fields":[
|
||||
{
|
||||
"tag": "ResultCode",
|
||||
"filters": ["*notempty:~*cgrep.Error:"],
|
||||
"path": "*rep.Result-Code",
|
||||
"type": "*constant",
|
||||
"value": "5030",
|
||||
"blocker": true
|
||||
},
|
||||
{
|
||||
"tag": "ResultCode",
|
||||
"path": "*rep.Result-Code",
|
||||
"type": "*constant",
|
||||
"value": "2001"
|
||||
},
|
||||
{
|
||||
"tag": "GrantedUnits",
|
||||
"path": "*rep.Granted-Service-Unit.CC-Time",
|
||||
"type": "*variable",
|
||||
"value": "~*cgrep.MaxUsage{*duration_seconds}",
|
||||
"mandatory": true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"id": "VoiceTerminateEmulate",
|
||||
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:1",
|
||||
"*prefix:~*req.Service-Context-Id:voice","*eq:~*cgrep.MaxUsage:0"],
|
||||
"flags": ["*terminate", "*accounts", "*attributes"],
|
||||
"request_fields":[
|
||||
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*voice"},
|
||||
{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable",
|
||||
"value": "~*req.Session-Id", "mandatory": true},
|
||||
{"tag": "OriginHost", "path": "*cgreq.OriginHost", "type": "*variable",
|
||||
"value": "~*vars.RemoteHost", "mandatory": true},
|
||||
{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*attributes"},
|
||||
{"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "call"},
|
||||
{"tag": "Account", "path": "*cgreq.Account", "type": "*constant", "value": "*attributes"},
|
||||
{"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable",
|
||||
"value": "~*req.Service-Information.IN-Information.Real-Called-Number", "mandatory": true},
|
||||
{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable",
|
||||
"value": "~*req.Event-Timestamp", "mandatory": true},
|
||||
{"tag": "Usage", "path": "*cgreq.Usage", "type": "*variable",
|
||||
"value": "0s", "mandatory": true},
|
||||
{"tag": "SubscriberID", "path": "*cgreq.SubscriberId", "type": "*variable",
|
||||
"value": "~*req.Subscription-Id.Subscription-Id-Data", "mandatory": true}
|
||||
],
|
||||
"reply_fields":[
|
||||
{"tag": "ResultCode", "filters": ["*notempty:~*cgrep.Error:"],
|
||||
"path": "*rep.Result-Code", "type": "*constant", "value": "5030", "blocker": true},
|
||||
{"tag": "ResultCode", "path": "*rep.Result-Code", "type": "*constant", "value": "2001"},
|
||||
],
|
||||
},
|
||||
{
|
||||
"id": "VoiceUpdate",
|
||||
"filters": [
|
||||
"*string:~*vars.*cmd:CCR",
|
||||
"*string:~*req.CC-Request-Type:2",
|
||||
"*prefix:~*req.Service-Context-Id:voice"
|
||||
],
|
||||
"flags": ["*update", "*accounts", "*attributes"],
|
||||
"request_fields":[
|
||||
{
|
||||
"tag": "ToR",
|
||||
"path": "*cgreq.ToR",
|
||||
"type": "*constant",
|
||||
"value": "*voice"
|
||||
},
|
||||
{
|
||||
"tag": "OriginID",
|
||||
"path": "*cgreq.OriginID",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Session-Id",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "OriginHost",
|
||||
"path": "*cgreq.OriginHost",
|
||||
"type": "*variable",
|
||||
"value": "~*vars.RemoteHost",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "RequestType",
|
||||
"path": "*cgreq.RequestType",
|
||||
"type": "*constant",
|
||||
"value": "*attributes"
|
||||
},
|
||||
{
|
||||
"tag": "Category",
|
||||
"path": "*cgreq.Category",
|
||||
"type": "*constant",
|
||||
"value": "call"
|
||||
},
|
||||
{
|
||||
"tag": "Account",
|
||||
"path": "*cgreq.Account",
|
||||
"type": "*constant",
|
||||
"value": "*attributes"
|
||||
},
|
||||
{
|
||||
"tag": "Destination",
|
||||
"path": "*cgreq.Destination",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Service-Information.IN-Information.Real-Called-Number",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "AnswerTime",
|
||||
"path": "*cgreq.AnswerTime",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Event-Timestamp",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "Usage",
|
||||
"path": "*cgreq.Usage", "type": "*variable",
|
||||
"value": "~*req.Requested-Service-Unit.CC-Time:s/(.*)/${1}s/",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "LastUsed",
|
||||
"path": "*cgreq.LastUsed",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Used-Service-Unit.CC-Time:s/(.*)/${1}s/",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "SubscriberID",
|
||||
"path": "*cgreq.SubscriberId",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Subscription-Id.Subscription-Id-Data",
|
||||
"mandatory": true
|
||||
},
|
||||
],
|
||||
"reply_fields":[
|
||||
{
|
||||
"tag": "ResultCode",
|
||||
"filters": ["*notempty:~*cgrep.Error:"],
|
||||
"path": "*rep.Result-Code",
|
||||
"type": "*constant",
|
||||
"value": "5030",
|
||||
"blocker": true
|
||||
},
|
||||
{
|
||||
"tag": "ResultCode",
|
||||
"path": "*rep.Result-Code",
|
||||
"type": "*constant",
|
||||
"value": "2001"
|
||||
},
|
||||
{
|
||||
"tag": "GrantedUnits",
|
||||
"path": "*rep.Granted-Service-Unit.CC-Time",
|
||||
"type": "*variable",
|
||||
"value": "~*cgrep.MaxUsage{*duration_seconds}",
|
||||
"mandatory": true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"id": "VoiceTerminate",
|
||||
"filters": [
|
||||
"*string:~*vars.*cmd:CCR",
|
||||
"*string:~*req.CC-Request-Type:3",
|
||||
"*prefix:~*req.Service-Context-Id:voice"
|
||||
],
|
||||
"flags": ["*terminate", "*accounts", "*attributes", "*cdrs"],
|
||||
"request_fields":[
|
||||
{
|
||||
"tag": "ToR",
|
||||
"path": "*cgreq.ToR",
|
||||
"type": "*constant",
|
||||
"value": "*voice"
|
||||
},
|
||||
{
|
||||
"tag": "OriginID",
|
||||
"path": "*cgreq.OriginID",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Session-Id",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "OriginHost",
|
||||
"path": "*cgreq.OriginHost",
|
||||
"type": "*variable",
|
||||
"value": "~*vars.RemoteHost",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "RequestType",
|
||||
"path": "*cgreq.RequestType",
|
||||
"type": "*constant",
|
||||
"value": "*attributes"
|
||||
},
|
||||
{
|
||||
"tag": "Account",
|
||||
"path": "*cgreq.Account",
|
||||
"type": "*constant",
|
||||
"value": "*attributes"
|
||||
},
|
||||
{
|
||||
"tag": "Destination",
|
||||
"path": "*cgreq.Destination",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Service-Information.IN-Information.Real-Called-Number",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "AnswerTime",
|
||||
"path": "*cgreq.AnswerTime",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Event-Timestamp",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "Usage",
|
||||
"path": "*cgreq.Usage",
|
||||
"type": "*cc_usage",
|
||||
"mandatory": true,
|
||||
"value": "~*req.CC-Request-Number;~*req.Used-Service-Unit.CC-Time:s/(.*)/${1}s/;5m"
|
||||
},
|
||||
{
|
||||
"tag": "LastUsed",
|
||||
"path": "*cgreq.LastUsed",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Used-Service-Unit.CC-Time:s/(.*)/${1}s/",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "SubscriberID",
|
||||
"path": "*cgreq.SubscriberId",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Subscription-Id.Subscription-Id-Data",
|
||||
"mandatory": true
|
||||
},
|
||||
],
|
||||
"reply_fields":[
|
||||
{
|
||||
"tag": "ResultCode",
|
||||
"filters": ["*notempty:~*cgrep.Error:"],
|
||||
"path": "*rep.Result-Code",
|
||||
"type": "*constant",
|
||||
"value": "5030",
|
||||
"blocker": true
|
||||
},
|
||||
{
|
||||
"tag": "ResultCode",
|
||||
"path": "*rep.Result-Code",
|
||||
"type": "*constant",
|
||||
"value": "2001"
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
{
|
||||
|
||||
|
||||
"diameter_agent": {
|
||||
"request_processors": [
|
||||
{ // this request proccessor is only used to test that an error message
|
||||
// is sent if one is raised when proccesing the request
|
||||
"id": "ErrorProcessing",
|
||||
"filters": [
|
||||
"*string:~*vars.*cmd:CCR",
|
||||
"*string:~*req.CC-Request-Type:4",
|
||||
"*prefix:~*req.Service-Context-Id:error"
|
||||
],
|
||||
"flags": ["*event", "*accounts"],
|
||||
"request_fields":[
|
||||
{
|
||||
"tag": "ToR",
|
||||
"path": "*cgreq.ToR",
|
||||
"type": "*constant",
|
||||
"value": "*sms"
|
||||
},
|
||||
{
|
||||
"tag": "OriginID",
|
||||
"path": "*cgreq.OriginID",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Session-Id",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "Category",
|
||||
"path": "*cgreq.Category",
|
||||
"type": "*constant",
|
||||
"value": "sms"
|
||||
},
|
||||
{
|
||||
"tag": "RequestType",
|
||||
"path": "*cgreq.RequestType",
|
||||
"type": "*constant",
|
||||
"value": "*prepaid"
|
||||
},
|
||||
{
|
||||
"tag": "Account",
|
||||
"path": "*cgreq.Account",
|
||||
"type": "*variable",
|
||||
"mandatory": true,
|
||||
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"
|
||||
},
|
||||
{
|
||||
"tag": "Destination",
|
||||
"path": "*cgreq.Destination",
|
||||
"type": "*variable",
|
||||
"mandatory": true,
|
||||
"value": "~*req.Service-Information.SMS-Information.Recipient-Address.Address-Data"
|
||||
},
|
||||
{
|
||||
"tag": "SetupTime",
|
||||
"path": "*cgreq.SetupTime",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Event-Timestamp",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "AnswerTime",
|
||||
"path": "*cgreq.AnswerTime",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Event-Timestamp",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "Usage",
|
||||
"path": "*cgreq.Usage",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Requested-Service-Unit.CC-Time",
|
||||
"mandatory": true
|
||||
},
|
||||
],
|
||||
"reply_fields":[
|
||||
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
|
||||
{
|
||||
"tag": "GrantedUnitsError",
|
||||
"path": "*rep.Granted-Service-Unit.CC-Total", // this should return a error because it expect an unsigned integer
|
||||
"type": "*constant", "blocker": true,
|
||||
"value": "-10"
|
||||
},
|
||||
{
|
||||
"tag": "ResultCode","path": "*rep.Result-Code",
|
||||
"filters": ["*eq:~*cgrep.MaxUsage[*raw]:0"],
|
||||
"type": "*constant", "value": "4012",
|
||||
"blocker": true
|
||||
},
|
||||
{
|
||||
"tag": "ResultCode", "path": "*rep.Result-Code",
|
||||
"filters": ["*notempty:~*cgrep.Error:"],
|
||||
"type": "*constant", "value": "5030",
|
||||
"blocker": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
2
go.mod
2
go.mod
@@ -16,6 +16,7 @@ require (
|
||||
github.com/cgrates/birpc v1.3.1-0.20211117095917-5b0ff29f3084
|
||||
github.com/cgrates/cron v0.0.0-20201022095836-3522d5b72c70
|
||||
github.com/cgrates/fsock v0.0.0-20240522220429-b6cc1d96fd2b
|
||||
github.com/cgrates/go-diameter v0.0.0-20250228104837-c21fdf924ab5
|
||||
github.com/cgrates/guardian v0.0.0-20250331150912-885bd700e96b
|
||||
github.com/cgrates/janusgo v0.0.0-20240503152118-188a408d7e73
|
||||
github.com/cgrates/kamevapi v0.0.0-20240307160311-26273f03eedf
|
||||
@@ -28,7 +29,6 @@ require (
|
||||
github.com/elastic/elastic-transport-go/v8 v8.6.0
|
||||
github.com/elastic/go-elasticsearch/v8 v8.15.0
|
||||
github.com/ericlagergren/decimal v0.0.0-20240411145413-00de7ca16731
|
||||
github.com/fiorix/go-diameter/v4 v4.0.4
|
||||
github.com/fsnotify/fsnotify v1.7.0
|
||||
github.com/go-sql-driver/mysql v1.8.1
|
||||
github.com/google/go-cmp v0.7.0
|
||||
|
||||
7
go.sum
7
go.sum
@@ -79,6 +79,8 @@ github.com/cgrates/cron v0.0.0-20201022095836-3522d5b72c70 h1:/O+Dr12jcizDiCoIG2
|
||||
github.com/cgrates/cron v0.0.0-20201022095836-3522d5b72c70/go.mod h1:I9cUDn/uzkakr0hmYTjXkQqf6wagg44L2p01gSYRRz0=
|
||||
github.com/cgrates/fsock v0.0.0-20240522220429-b6cc1d96fd2b h1:PQzDye+0GcgJ3cKG5NcAOjdRyX0v76ZFkolu3X70fbs=
|
||||
github.com/cgrates/fsock v0.0.0-20240522220429-b6cc1d96fd2b/go.mod h1:bKByLko2HF33K+PbiiToAgevrrbr96C+7Pp3HGS6oag=
|
||||
github.com/cgrates/go-diameter v0.0.0-20250228104837-c21fdf924ab5 h1:gqD+fcj7eIywXTVG0twRCYjPK+bVCC7kEx9xNBLq/4Y=
|
||||
github.com/cgrates/go-diameter v0.0.0-20250228104837-c21fdf924ab5/go.mod h1:Vfjo2o1DEmpI+csUo3cYRpCzfM9DajXZ8CR73MNeNh4=
|
||||
github.com/cgrates/guardian v0.0.0-20250331150912-885bd700e96b h1:SqTeoUV65ki0ls7zvCAn2LmKRL1jPUZO70JOspplu84=
|
||||
github.com/cgrates/guardian v0.0.0-20250331150912-885bd700e96b/go.mod h1:te9B6PUvoE0jWCM7Zj4Ftrsco3mREKZ0Y29ODxAYDpY=
|
||||
github.com/cgrates/janusgo v0.0.0-20240503152118-188a408d7e73 h1:7AYhvpegrSkY9tLGCQsZgNl8yTjL5CaQOTr3/kYlPek=
|
||||
@@ -118,8 +120,6 @@ github.com/ericlagergren/decimal v0.0.0-20240411145413-00de7ca16731 h1:R/ZjJpjQK
|
||||
github.com/ericlagergren/decimal v0.0.0-20240411145413-00de7ca16731/go.mod h1:M9R1FoZ3y//hwwnJtO51ypFGwm8ZfpxPT/ZLtO1mcgQ=
|
||||
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
|
||||
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||
github.com/fiorix/go-diameter/v4 v4.0.4 h1:/nw5zEmEW7pmP9YUYjOfU1GomR0LupKdYy52yd1j3NM=
|
||||
github.com/fiorix/go-diameter/v4 v4.0.4/go.mod h1:Qx/+pf+c9sBUHWq1d7EH3bkdwN8U0mUpdy9BieDw6UQ=
|
||||
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
|
||||
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
@@ -174,7 +174,6 @@ github.com/googleapis/gax-go/v2 v2.13.0 h1:yitjD5f7jQHhyDsnhKEBU52NdvvdSeGzlAnDP
|
||||
github.com/googleapis/gax-go/v2 v2.13.0/go.mod h1:Z/fvTZXF8/uw7Xu5GuslPw+bplx6SS338j1Is2S+B7A=
|
||||
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/ishidawataru/sctp v0.0.0-20190922091402-408ec287e38c/go.mod h1:co9pwDoBCm1kGxawmb4sPq0cSIOOWNPT4KnHotMP1Zg=
|
||||
github.com/ishidawataru/sctp v0.0.0-20230406120618-7ff4192f6ff2 h1:i2fYnDurfLlJH8AyyMOnkLHnHeP8Ff/DDpuZA/D3bPo=
|
||||
github.com/ishidawataru/sctp v0.0.0-20230406120618-7ff4192f6ff2/go.mod h1:co9pwDoBCm1kGxawmb4sPq0cSIOOWNPT4KnHotMP1Zg=
|
||||
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
|
||||
@@ -323,7 +322,6 @@ golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73r
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20191007182048-72f939374954/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
@@ -405,7 +403,6 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA=
|
||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
||||
|
||||
@@ -2274,6 +2274,7 @@ const (
|
||||
ListenersCfg = "listeners"
|
||||
ListenCfg = "listen"
|
||||
DictionariesPathCfg = "dictionaries_path"
|
||||
CEApplicationsCfg = "ce_applications"
|
||||
OriginHostCfg = "origin_host"
|
||||
OriginRealmCfg = "origin_realm"
|
||||
VendorIDCfg = "vendor_id"
|
||||
|
||||
Reference in New Issue
Block a user