diff --git a/agents/diam_it_test.go b/agents/diam_it_test.go
index 06b192813..517ddbbcb 100644
--- a/agents/diam_it_test.go
+++ b/agents/diam_it_test.go
@@ -18,6 +18,7 @@ along with this program. If not, see
package agents
import (
+ "errors"
"flag"
"net/rpc"
"net/rpc/jsonrpc"
@@ -41,6 +42,7 @@ var (
dataDir = flag.String("data_dir", "/usr/share/cgrates", "CGR data dir path here")
interations = flag.Int("iterations", 1, "Number of iterations to do for dry run simulation")
replyTimeout = flag.String("reply_timeout", "1s", "Maximum duration to wait for a reply")
+ encoding = flag.String("rpc", utils.MetaJSON, "what encoding whould be uused for rpc comunication")
daCfgPath, diamConfigDIR string
daCfg *config.CGRConfig
@@ -68,6 +70,17 @@ var (
}
)
+func newRPCClient(cfg *config.ListenCfg) (c *rpc.Client, err error) {
+ switch *encoding {
+ case utils.MetaJSON:
+ return jsonrpc.Dial(utils.TCP, cfg.RPCJSONListen)
+ case utils.MetaGOB:
+ return rpc.Dial(utils.TCP, cfg.RPCGOBListen)
+ default:
+ return nil, errors.New("UNSUPPORTED_RPC")
+ }
+}
+
// Test start here
func TestDiamItTcp(t *testing.T) {
engine.KillEngine(0)
@@ -78,6 +91,10 @@ func TestDiamItTcp(t *testing.T) {
}
func TestDiamItDispatcher(t *testing.T) {
+ if *encoding == utils.MetaGOB {
+ t.SkipNow()
+ return
+ }
isDispatcherActive = true
engine.StartEngine(path.Join(*dataDir, "conf", "samples", "dispatchers", "all"), 200)
engine.StartEngine(path.Join(*dataDir, "conf", "samples", "dispatchers", "all2"), 200)
@@ -182,7 +199,7 @@ func testDiamItConnectDiameterClient(t *testing.T) {
// Connect rpc client to rater
func testDiamItApierRpcConn(t *testing.T) {
var err error
- apierRpc, err = jsonrpc.Dial("tcp", daCfg.ListenCfg().RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed
+ apierRpc, err = newRPCClient(daCfg.ListenCfg()) // We connect over JSON so we can also troubleshoot if needed
if err != nil {
t.Fatal(err)
}
@@ -760,7 +777,7 @@ func testDiamItCCRTerminate(t *testing.T) {
}
time.Sleep(time.Duration(*waitRater) * time.Millisecond)
var cdrs []*engine.CDR
- args := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaRaw}}
+ args := utils.RPCCDRsFilterWithArgDispatcher{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{utils.MetaRaw}}}
if err := apierRpc.Call(utils.CDRsV1GetCDRs, args, &cdrs); err != nil {
t.Error("Unexpected error: ", err.Error())
} else if len(cdrs) != 1 {
@@ -845,7 +862,7 @@ func testDiamItCCRSMS(t *testing.T) {
diamClnt.ReceivedMessage(rplyTimeout)
var cdrs []*engine.CDR
- args := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaRaw}, ToRs: []string{utils.SMS}}
+ args := &utils.RPCCDRsFilterWithArgDispatcher{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{utils.MetaRaw}, ToRs: []string{utils.SMS}}}
if err := apierRpc.Call(utils.CDRsV1GetCDRs, args, &cdrs); err != nil {
t.Error("Unexpected error: ", err.Error())
} else if len(cdrs) != 1 {
diff --git a/agents/dnsagent_it_test.go b/agents/dnsagent_it_test.go
index d3101d41f..ce0b40e6e 100644
--- a/agents/dnsagent_it_test.go
+++ b/agents/dnsagent_it_test.go
@@ -22,7 +22,6 @@ package agents
import (
"net/rpc"
- "net/rpc/jsonrpc"
"path"
"testing"
"time"
@@ -87,7 +86,7 @@ func testDNSitStartEngine(t *testing.T) {
// Connect rpc client to rater
func testDNSitApierRpcConn(t *testing.T) {
var err error
- dnsRPC, err = jsonrpc.Dial("tcp", dnsCfg.ListenCfg().RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed
+ dnsRPC, err = newRPCClient(dnsCfg.ListenCfg()) // We connect over JSON so we can also troubleshoot if needed
if err != nil {
t.Fatal(err)
}
diff --git a/agents/httpagent_it_test.go b/agents/httpagent_it_test.go
index eadf18cf9..f0730b937 100644
--- a/agents/httpagent_it_test.go
+++ b/agents/httpagent_it_test.go
@@ -28,7 +28,6 @@ import (
"io/ioutil"
"net/http"
"net/rpc"
- "net/rpc/jsonrpc"
"path"
"reflect"
"testing"
@@ -63,6 +62,9 @@ var sTestsHA = []func(t *testing.T){
func TestHAitSimple(t *testing.T) {
haCfgPath = path.Join(*dataDir, "conf", "samples", "httpagent")
+ if *encoding == utils.MetaGOB {
+ haCfgPath = path.Join(*dataDir, "conf", "samples", "gob", "httpagent")
+ }
// Init config first
var err error
haCfg, err = config.NewCGRConfigFromPath(haCfgPath)
@@ -79,6 +81,9 @@ func TestHAitSimple(t *testing.T) {
func TestHA2itWithTls(t *testing.T) {
haCfgPath = path.Join(*dataDir, "conf", "samples", "httpagenttls")
+ if *encoding == utils.MetaGOB {
+ haCfgPath = path.Join(*dataDir, "conf", "samples", "gob", "httpagenttls")
+ }
// Init config first
var err error
haCfg, err = config.NewCGRConfigFromPath(haCfgPath)
@@ -136,7 +141,7 @@ func testHAitStartEngine(t *testing.T) {
// Connect rpc client to rater
func testHAitApierRpcConn(t *testing.T) {
var err error
- haRPC, err = jsonrpc.Dial("tcp", haCfg.ListenCfg().RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed
+ haRPC, err = newRPCClient(haCfg.ListenCfg()) // We connect over JSON so we can also troubleshoot if needed
if err != nil {
t.Fatal(err)
}
diff --git a/agents/radagent_it_test.go b/agents/radagent_it_test.go
index 5ff50de97..94aeab1c1 100644
--- a/agents/radagent_it_test.go
+++ b/agents/radagent_it_test.go
@@ -23,7 +23,6 @@ package agents
import (
"fmt"
"net/rpc"
- "net/rpc/jsonrpc"
"os/exec"
"path"
"reflect"
@@ -68,6 +67,10 @@ func TestRAit(t *testing.T) {
}
func TestRAitDispatcher(t *testing.T) {
+ if *encoding == utils.MetaGOB {
+ t.SkipNow()
+ return
+ }
isDispatcherActive = true
engine.StartEngine(path.Join(*dataDir, "conf", "samples", "dispatchers", "all"), 200)
engine.StartEngine(path.Join(*dataDir, "conf", "samples", "dispatchers", "all2"), 200)
@@ -82,6 +85,9 @@ func TestRAitDispatcher(t *testing.T) {
func testRAitInitCfg(t *testing.T) {
raCfgPath = path.Join(*dataDir, "conf", "samples", raonfigDIR)
+ if *encoding == utils.MetaGOB {
+ raCfgPath = path.Join(*dataDir, "conf", "samples", "gob", raonfigDIR)
+ }
// Init config first
var err error
raCfg, err = config.NewCGRConfigFromPath(raCfgPath)
@@ -133,7 +139,7 @@ func testRAitStartEngine(t *testing.T) {
// Connect rpc client to rater
func testRAitApierRpcConn(t *testing.T) {
var err error
- raRPC, err = jsonrpc.Dial("tcp", raCfg.ListenCfg().RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed
+ raRPC, err = newRPCClient(raCfg.ListenCfg()) // We connect over JSON so we can also troubleshoot if needed
if err != nil {
t.Fatal(err)
}
diff --git a/data/conf/samples/gob/httpagent/cgrates.json b/data/conf/samples/gob/httpagent/cgrates.json
new file mode 100644
index 000000000..436174db2
--- /dev/null
+++ b/data/conf/samples/gob/httpagent/cgrates.json
@@ -0,0 +1,81 @@
+{
+// CGRateS Configuration file
+//
+
+
+"general": {
+ "log_level": 7,
+},
+
+
+"listen": {
+ "rpc_json": ":2012",
+ "rpc_gob": ":2013",
+ "http": ":2080",
+},
+
+
+"stor_db": {
+ "db_password": "CGRateS.org",
+},
+
+
+"rals": {
+ "enabled": true,
+ "max_increments":3000000,
+},
+
+
+"scheduler": {
+ "enabled": true,
+},
+
+
+"cdrs": {
+ "enabled": true,
+ "chargers_conns": [
+ {"address": "*internal"}
+ ],
+ "rals_conns": [
+ {"address": "*internal"}
+ ],
+},
+
+
+"attributes": {
+ "enabled": true,
+},
+
+"chargers": {
+ "enabled": true,
+ "attributes_conns": [
+ {"address": "*internal"}
+ ],
+},
+
+
+"sessions": {
+ "enabled": true,
+ "attributes_conns": [
+ {"address": "127.0.0.1:2013", "transport": "*gob"}
+ ],
+ "cdrs_conns": [
+ {"address": "127.0.0.1:2013", "transport": "*gob"}
+ ],
+ "rals_conns": [
+ {"address": "127.0.0.1:2013", "transport": "*gob"}
+ ],
+ "chargers_conns": [
+ {"address": "*internal"}
+ ],
+},
+
+
+"apier": {
+ "scheduler_conns": [ // connections to SchedulerS for reloads
+ {"address": "*internal"},
+ ],
+},
+
+
+}
diff --git a/data/conf/samples/gob/httpagent/httpagent.json b/data/conf/samples/gob/httpagent/httpagent.json
new file mode 100644
index 000000000..204664ce6
--- /dev/null
+++ b/data/conf/samples/gob/httpagent/httpagent.json
@@ -0,0 +1,174 @@
+{
+
+
+"http_agent": [
+ {
+ "id": "conecto1",
+ "url": "/conecto",
+ "sessions_conns": [
+ {"address": "127.0.0.1:2013", "transport": "*gob"}
+ ],
+ "request_payload": "*url",
+ "reply_payload": "*xml",
+ "request_processors": [
+ {
+ "id": "OutboundAUTHDryRun",
+ "filters": ["*string:~*req.request_type:OutboundAUTH","*string:~*req.Msisdn:497700056231"],
+ "tenant": "cgrates.org",
+ "flags": ["*dryrun"],
+ "request_fields":[
+ ],
+ "reply_fields":[
+ {"tag": "Allow", "field_id": "response.Allow", "type": "*constant",
+ "value": "1", "mandatory": true},
+ {"tag": "Concatenated1", "field_id": "response.Concatenated", "type": "*composed",
+ "value": "~*req.MCC;/", "mandatory": true},
+ {"tag": "Concatenated2", "field_id": "response.Concatenated", "type": "*composed",
+ "value": "Val1"},
+ {"tag": "MaxDuration", "field_id": "response.MaxDuration", "type": "*constant",
+ "value": "1200", "blocker": true},
+ {"tag": "Unused", "field_id": "response.Unused", "type": "*constant",
+ "value": "0"},
+ ],
+ },
+ {
+ "id": "OutboundAUTH",
+ "filters": ["*string:~*req.request_type:OutboundAUTH"],
+ "tenant": "cgrates.org",
+ "flags": [ "*auth", "*accounts", "*attributes"],
+ "request_fields":[
+ {"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
+ {"tag": "RequestType", "field_id": "RequestType", "type": "*constant",
+ "value": "*pseudoprepaid", "mandatory": true},
+ {"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
+ "value": "~*req.CallID", "mandatory": true},
+ {"tag": "Account", "field_id": "Account", "type": "*composed",
+ "value": "~*req.Msisdn", "mandatory": true},
+ {"tag": "Destination", "field_id": "Destination", "type": "*composed",
+ "value": "~*req.Destination", "mandatory": true},
+ {"tag": "SetupTime", "field_id": "SetupTime", "type": "*constant",
+ "value": "*now", "mandatory": true},
+ ],
+ "reply_fields":[
+ {"tag": "Allow", "field_id": "response.Allow", "type": "*constant",
+ "value": "1", "mandatory": true},
+ {"tag": "MaxDuration", "field_id": "response.MaxDuration", "type": "*composed",
+ "value": "~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true},
+ ],
+ },
+ {
+ "id": "mtcall_cdr",
+ "filters": ["*string:~*req.request_type:MTCALL_CDR"],
+ "tenant": "cgrates.org",
+ "flags": ["*cdrs"],
+ "request_fields":[
+ {"tag": "RequestType", "field_id": "RequestType", "type": "*constant",
+ "value": "*pseudoprepaid", "mandatory": true},
+ {"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
+ "value": "~*req.CDR_ID", "mandatory": true},
+ {"tag": "OriginHost", "field_id": "OriginHost", "type": "*remote_host",
+ "mandatory": true},
+ {"tag": "Account", "field_id": "Account", "type": "*composed",
+ "value": "~*req.msisdn", "mandatory": true},
+ {"tag": "Destination", "field_id": "Destination", "type": "*composed",
+ "value": "~*req.destination", "mandatory": true},
+ {"tag": "SetupTime", "field_id": "SetupTime", "type": "*variable",
+ "value": "~*req.timestamp", "mandatory": true},
+ {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*variable",
+ "value": "~*req.timestamp", "mandatory": true},
+ {"tag": "Usage", "field_id": "Usage", "type": "*composed",
+ "value": "~*req.leg_duration;s", "mandatory": true},
+ ],
+ "reply_fields":[
+ {"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
+ "field_id": "CDR_RESPONSE.RESULT_CODE", "type": "*composed", "value": "~*cgrep.Error", "blocker": true},
+ {"tag": "CDR_ID", "field_id": "CDR_RESPONSE.CDR_ID", "type": "*composed",
+ "value": "~*req.CDR_ID", "mandatory": true},
+ {"tag": "CDR_STATUS", "field_id": "CDR_RESPONSE.CDR_STATUS", "type": "*constant",
+ "value": "1", "mandatory": true},
+ ],
+ }
+ ],
+ },
+ {
+ "id": "conecto_xml",
+ "url": "/conecto_xml",
+ "sessions_conns": [
+ {"address": "127.0.0.1:2013", "transport": "*gob"}
+ ],
+ "request_payload": "*xml",
+ "reply_payload": "*xml",
+ "request_processors": [
+ {
+ "id": "cdr_from_xml",
+ "tenant": "cgrates.org",
+ "flags": ["*cdrs"],
+ "request_fields":[
+ {"tag": "TOR", "field_id": "ToR", "type": "*constant",
+ "value": "*data", "mandatory": true},
+ {"tag": "RequestType", "field_id": "RequestType", "type": "*constant",
+ "value": "*pseudoprepaid", "mandatory": true},
+ {"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
+ "value": "~*req.complete-datasession-notification.customerid", "mandatory": true},
+ {"tag": "Account", "field_id": "Account", "type": "*composed",
+ "value": "~*req.complete-datasession-notification.username", "mandatory": true},
+ {"tag": "Destination", "field_id": "Destination", "type": "*composed",
+ "value": "~*req.complete-datasession-notification.userid", "mandatory": true},
+ {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
+ "value": "~*req.complete-datasession-notification.createtime", "mandatory": true},
+ {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
+ "value": "~*req.complete-datasession-notification.createtime", "mandatory": true},
+ {"tag": "Usage", "field_id": "Usage", "type": "*composed",
+ "value": "~*req.complete-datasession-notification.callleg.bytes", "mandatory": true},
+ ],
+ "reply_fields":[],
+ }
+ ],
+ },
+ {
+ "id": "textplain",
+ "url": "/textplain",
+ "sessions_conns": [
+ {"address": "127.0.0.1:2013", "transport": "*gob"}
+ ],
+ "request_payload": "*url",
+ "reply_payload": "*text_plain",
+ "request_processors": [
+ {
+ "id": "TextPlainDryRun",
+ "filters": ["*string:~*req.request_type:TextPlainDryRun","*string:~*req.Msisdn:497700056231"],
+ "tenant": "cgrates.org",
+ "flags": ["*dryrun"],
+ "request_fields":[
+ ],
+ "reply_fields":[
+ {"tag": "Field1", "field_id": "Variable1", "type": "*variable",
+ "value": "Hola1", "mandatory": true},
+ {"tag": "Field2", "field_id": "Variable2", "type": "*variable",
+ "value": "Hola2", "mandatory": true},
+ {"tag": "Field3", "field_id": "ComposedVar", "type": "*composed",
+ "value": "Test", "mandatory": true},
+ {"tag": "Field4", "field_id": "ComposedVar", "type": "*composed",
+ "value": "Composed", "mandatory": true},
+ {"tag": "Field5", "field_id": "Item1.1", "type": "*variable",
+ "value": "Val1", "mandatory": true},
+ ],
+ "continue": true,
+ },
+ {
+ "id": "TextPlainDryRun2",
+ "filters": ["*string:~*req.request_type:TextPlainDryRun","*string:~*req.Msisdn:497700056231"],
+ "tenant": "cgrates.org",
+ "flags": ["*dryrun"],
+ "request_fields":[],
+ "reply_fields":[
+ {"tag": "Field1", "field_id": "Item1.1", "type": "*variable",
+ "value": "Val2", "mandatory": true},
+ ],
+ },
+ ],
+ },
+],
+
+
+}
\ No newline at end of file
diff --git a/data/conf/samples/gob/httpagenttls/cgrates.json b/data/conf/samples/gob/httpagenttls/cgrates.json
new file mode 100755
index 000000000..9dc89f62a
--- /dev/null
+++ b/data/conf/samples/gob/httpagenttls/cgrates.json
@@ -0,0 +1,94 @@
+{
+// CGRateS Configuration file
+//
+
+
+"general": {
+ "log_level": 7,
+},
+
+
+"listen": {
+ "rpc_json": ":2012",
+ "rpc_gob": ":2013",
+ "http": ":2080",
+ "rpc_json_tls":":2022",
+ "rpc_gob_tls":":2023",
+ "http_tls": "localhost:2280",
+},
+
+"tls": {
+ "server_certificate" : "/usr/share/cgrates/tls/server.crt", // path to server certificate(must conatin server.crt + ca.crt)
+ "server_key":"/usr/share/cgrates/tls/server.key", // path to server key
+ "client_certificate" : "/usr/share/cgrates/tls/client.crt", // path to client certificate(must conatin client.crt + ca.crt)
+ "client_key":"/usr/share/cgrates/tls/client.key", // path to client key
+ "ca_certificate":"/usr/share/cgrates/tls/ca.crt",
+},
+
+
+"stor_db": {
+ "db_password": "CGRateS.org",
+},
+
+
+"rals": {
+ "enabled": true,
+ "max_increments":3000000,
+},
+
+
+"scheduler": {
+ "enabled": true,
+},
+
+
+"cdrs": {
+ "enabled": true,
+ "chargers_conns": [
+ {"address": "*internal"}
+ ],
+ "rals_conns": [
+ {"address": "*internal"}
+ ],
+},
+
+
+"attributes": {
+ "enabled": true,
+},
+
+"chargers": {
+ "enabled": true,
+ "attributes_conns": [
+ {"address": "*internal"}
+ ],
+},
+
+"sessions": {
+ "enabled": true,
+ "attributes_conns": [
+ {"address": "127.0.0.1:2013", "transport": "*gob"}
+ ],
+ "cdrs_conns": [
+ {"address": "127.0.0.1:2013", "transport": "*gob"}
+ ],
+ "rals_conns": [
+ {"address": "127.0.0.1:2013", "transport": "*gob"}
+ ],
+ "cdrs_conns": [
+ {"address": "*internal"}
+ ],
+ "chargers_conns": [
+ {"address": "*internal"}
+ ],
+},
+
+
+"apier": {
+ "scheduler_conns": [ // connections to SchedulerS for reloads
+ {"address": "*internal"},
+ ],
+},
+
+
+}
diff --git a/data/conf/samples/gob/httpagenttls/httpagent.json b/data/conf/samples/gob/httpagenttls/httpagent.json
new file mode 100755
index 000000000..86e03d7b6
--- /dev/null
+++ b/data/conf/samples/gob/httpagenttls/httpagent.json
@@ -0,0 +1,175 @@
+{
+
+
+"http_agent": [
+ {
+ "id": "conecto1",
+ "url": "/conecto",
+ "sessions_conns": [
+ {"address": "127.0.0.1:2013", "transport": "*gob"}
+ ],
+ "request_payload": "*url",
+ "reply_payload": "*xml",
+ "request_processors": [
+ {
+ "id": "OutboundAUTHDryRun",
+ "filters": ["*string:~*req.request_type:OutboundAUTH","*string:~*req.Msisdn:497700056231"],
+ "tenant": "cgrates.org",
+ "flags": ["*dryrun"],
+ "request_fields":[
+ ],
+ "reply_fields":[
+ {"tag": "Allow", "field_id": "response.Allow", "type": "*constant",
+ "value": "1", "mandatory": true},
+ {"tag": "Concatenated1", "field_id": "response.Concatenated", "type": "*composed",
+ "value": "~*req.MCC;/", "mandatory": true},
+ {"tag": "Concatenated2", "field_id": "response.Concatenated", "type": "*composed",
+ "value": "Val1"},
+ {"tag": "MaxDuration", "field_id": "response.MaxDuration", "type": "*constant",
+ "value": "1200", "blocker": true},
+ {"tag": "Unused", "field_id": "response.Unused", "type": "*constant",
+ "value": "0"},
+ ],
+ },
+ {
+ "id": "OutboundAUTH",
+ "filters": ["*string:~*req.request_type:OutboundAUTH"],
+ "tenant": "cgrates.org",
+ "flags": [ "*auth", "*accounts", "*attributes"],
+ "request_fields":[
+ {"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
+ {"tag": "RequestType", "field_id": "RequestType", "type": "*constant",
+ "value": "*pseudoprepaid", "mandatory": true},
+ {"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
+ "value": "~*req.CallID", "mandatory": true},
+ {"tag": "Account", "field_id": "Account", "type": "*composed",
+ "value": "~*req.Msisdn", "mandatory": true},
+ {"tag": "Destination", "field_id": "Destination", "type": "*composed",
+ "value": "~*req.Destination", "mandatory": true},
+ {"tag": "SetupTime", "field_id": "SetupTime", "type": "*constant",
+ "value": "*now", "mandatory": true},
+ ],
+ "reply_fields":[
+ {"tag": "Allow", "field_id": "response.Allow", "type": "*constant",
+ "value": "1", "mandatory": true},
+ {"tag": "MaxDuration", "field_id": "response.MaxDuration", "type": "*composed",
+ "value": "~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true},
+ ],
+ },
+ {
+ "id": "mtcall_cdr",
+ "filters": ["*string:~*req.request_type:MTCALL_CDR"],
+ "tenant": "cgrates.org",
+ "flags": ["*cdrs"],
+ "request_fields":[
+ {"tag": "RequestType", "field_id": "RequestType", "type": "*constant",
+ "value": "*pseudoprepaid", "mandatory": true},
+ {"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
+ "value": "~*req.CDR_ID", "mandatory": true},
+ {"tag": "OriginHost", "field_id": "OriginHost", "type": "*remote_host",
+ "mandatory": true},
+ {"tag": "Account", "field_id": "Account", "type": "*composed",
+ "value": "~*req.msisdn", "mandatory": true},
+ {"tag": "Destination", "field_id": "Destination", "type": "*composed",
+ "value": "~*req.destination", "mandatory": true},
+ {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
+ "value": "~*req.timestamp", "mandatory": true},
+ {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
+ "value": "~*req.timestamp", "mandatory": true},
+ {"tag": "Usage", "field_id": "Usage", "type": "*composed",
+ "value": "~*req.leg_duration;s", "mandatory": true},
+ ],
+ "reply_fields":[
+ {"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
+ "field_id": "CDR_RESPONSE.RESULT_CODE", "type": "*composed", "value": "~*cgrep.Error", "blocker": true},
+ {"tag": "CDR_ID", "field_id": "CDR_RESPONSE.CDR_ID", "type": "*composed",
+ "value": "~*req.CDR_ID", "mandatory": true},
+ {"tag": "CDR_STATUS", "field_id": "CDR_RESPONSE.CDR_STATUS", "type": "*constant",
+ "value": "1", "mandatory": true},
+ ],
+ }
+ ],
+ },
+ {
+ "id": "conecto_xml",
+ "url": "/conecto_xml",
+ "sessions_conns": [
+ {"address": "127.0.0.1:2013", "transport": "*gob"}
+ ],
+ "request_payload": "*xml",
+ "reply_payload": "*xml",
+ "request_processors": [
+ {
+ "id": "cdr_from_xml",
+ "tenant": "cgrates.org",
+ "flags": ["*cdrs"],
+ "request_fields":[
+ {"tag": "TOR", "field_id": "ToR", "type": "*constant",
+ "value": "*data", "mandatory": true},
+ {"tag": "RequestType", "field_id": "RequestType", "type": "*constant",
+ "value": "*pseudoprepaid", "mandatory": true},
+ {"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
+ "value": "~*req.complete-datasession-notification.customerid", "mandatory": true},
+ {"tag": "Account", "field_id": "Account", "type": "*composed",
+ "value": "~*req.complete-datasession-notification.username", "mandatory": true},
+ {"tag": "Destination", "field_id": "Destination", "type": "*composed",
+ "value": "~*req.complete-datasession-notification.userid", "mandatory": true},
+ {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
+ "value": "~*req.complete-datasession-notification.createtime", "mandatory": true},
+ {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
+ "value": "~*req.complete-datasession-notification.createtime", "mandatory": true},
+ {"tag": "Usage", "field_id": "Usage", "type": "*composed",
+ "value": "~*req.complete-datasession-notification.callleg.bytes", "mandatory": true},
+ ],
+ "reply_fields":[],
+ }
+ ],
+ },
+ {
+ "id": "textplain",
+ "url": "/textplain",
+ "sessions_conns": [
+ {"address": "127.0.0.1:2013", "transport": "*gob"}
+ ],
+ "request_payload": "*url",
+ "reply_payload": "*text_plain",
+ "request_processors": [
+ {
+ "id": "TextPlainDryRun",
+ "filters": ["*string:~*req.request_type:TextPlainDryRun","*string:~*req.Msisdn:497700056231"],
+ "tenant": "cgrates.org",
+ "flags": ["*dryrun"],
+ "request_fields":[
+ ],
+ "reply_fields":[
+ {"tag": "Field1", "field_id": "Variable1", "type": "*variable",
+ "value": "Hola1", "mandatory": true},
+ {"tag": "Field2", "field_id": "Variable2", "type": "*variable",
+ "value": "Hola2", "mandatory": true},
+ {"tag": "Field3", "field_id": "ComposedVar", "type": "*composed",
+ "value": "Test", "mandatory": true},
+ {"tag": "Field4", "field_id": "ComposedVar", "type": "*composed",
+ "value": "Composed", "mandatory": true},
+ {"tag": "Field5", "field_id": "Item1.1", "type": "*variable",
+ "value": "Val1", "mandatory": true},
+ ],
+ "continue": true,
+ },
+ {
+ "id": "TextPlainDryRun2",
+ "filters": ["*string:~*req.request_type:TextPlainDryRun","*string:~*req.Msisdn:497700056231"],
+ "tenant": "cgrates.org",
+ "flags": ["*dryrun"],
+ "request_fields":[
+ ],
+ "reply_fields":[
+ {"tag": "Field1", "field_id": "Item1.1", "type": "*variable",
+ "value": "Val2", "mandatory": true},
+ ],
+ },
+ ],
+ },
+],
+
+
+}
\ No newline at end of file
diff --git a/data/conf/samples/gob/radagent/cgrates.json b/data/conf/samples/gob/radagent/cgrates.json
new file mode 100644
index 000000000..8e81dcbdc
--- /dev/null
+++ b/data/conf/samples/gob/radagent/cgrates.json
@@ -0,0 +1,179 @@
+{
+// CGRateS Configuration file
+//
+
+"general": {
+ "log_level": 7,
+},
+
+
+"listen": {
+ "rpc_json": ":2012", // RPC JSON listening address
+ "rpc_gob": ":2013", // RPC GOB listening address
+ "http": ":2080", // HTTP listening address
+},
+
+"data_db": { // database used to store runtime data (eg: accounts, cdr stats)
+ "db_type": "mongo", // stor database type to use:
+ "db_port": 27017, // the port to reach the stordb
+ "db_name": "datadb",
+ "db_password": "",
+},
+
+"stor_db": {
+ "db_type": "mongo", // stor database type to use:
+ "db_port": 27017, // the port to reach the stordb
+ "db_name": "stordb",
+ "db_password": "",
+},
+
+"rals": {
+ "enabled": true,
+},
+
+"scheduler": {
+ "enabled": true,
+},
+
+"cdrs": {
+ "enabled": true,
+ "rals_conns": [
+ {"address": "*internal"}
+ ],
+},
+
+"resources": {
+ "enabled": true,
+},
+
+"attributes": {
+ "enabled": true,
+},
+
+"suppliers": {
+ "enabled": true,
+},
+
+"chargers": {
+ "enabled": true,
+},
+
+"sessions": {
+ "enabled": true,
+ "attributes_conns": [
+ {"address": "127.0.0.1:2013", "transport": "*gob"}
+ ],
+ "cdrs_conns": [
+ {"address": "127.0.0.1:2013", "transport": "*gob"}
+ ],
+ "rals_conns": [
+ {"address": "127.0.0.1:2013", "transport": "*gob"}
+ ],
+ "resources_conns": [
+ {"address": "127.0.0.1:2013", "transport": "*gob"}
+ ],
+ "chargers_conns": [
+ {"address": "*internal"}
+ ],
+ "debit_interval": "10s",
+},
+
+"radius_agent": {
+ "enabled": true,
+ "sessions_conns": [
+ {"address": "127.0.0.1:2013", "transport": "*gob"} // connection towards SMG component for session management
+ ],
+ "request_processors": [
+ {
+ "id": "KamailioAuth",
+ "filters": ["*string:~*vars.*radReqType:*radAuth"],
+ "flags": ["*auth", "*accounts"],
+ "request_fields":[
+ {"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
+ {"tag": "RequestType", "field_id": "RequestType", "type": "*constant",
+ "value": "*prepaid", "mandatory": true},
+ {"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
+ "value": "~*req.Acct-Session-Id;-;~*req.Sip-From-Tag", "mandatory": true},
+ {"tag": "Account", "field_id": "Account", "type": "*composed",
+ "value": "~*req.User-Name", "mandatory": true},
+ {"tag": "Subject", "field_id": "Subject", "type": "*variable",
+ "value": "~*req.User-Name", "mandatory": true},
+ {"tag": "Destination", "field_id": "Destination", "type": "*composed",
+ "value": "~*req.Called-Station-Id", "mandatory": true},
+ {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
+ "value": "~*req.Event-Timestamp", "mandatory": true},
+ {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
+ "value": "~*req.Event-Timestamp", "mandatory": true},
+ ],
+ "reply_fields":[
+ {"tag": "MaxUsage", "field_id": "SIP-AVP", "type": "*composed",
+ "value": "session_max_time#;~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true},
+ ],
+ },
+ {
+ "id": "KamailioAccountingStart",
+ "filters": ["*string:~*req.Acct-Status-Type:Start"],
+ "flags": ["*initiate", "*attributes", "*resources", "*accounts"],
+ "request_fields":[
+ {"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
+ {"tag": "RequestType", "field_id": "RequestType", "type": "*constant",
+ "value": "*prepaid", "mandatory": true},
+ {"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
+ "value": "~*req.Acct-Session-Id;-;~*req.Sip-From-Tag;-;~*req.Sip-To-Tag", "mandatory": true},
+ {"tag": "OriginHost", "field_id": "OriginHost", "type": "*composed",
+ "value": "~*req.NAS-IP-Address", "mandatory": true},
+ {"tag": "Account", "field_id": "Account", "type": "*composed",
+ "value": "~*req.User-Name", "mandatory": true},
+ {"tag": "Subject", "field_id": "Subject", "type": "*variable",
+ "value": "~*req.User-Name", "mandatory": true},
+ {"tag": "Destination", "field_id": "Destination", "type": "*composed",
+ "value": "~*req.Called-Station-Id", "mandatory": true},
+ {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
+ "value": "~*req.Ascend-User-Acct-Time", "mandatory": true},
+ {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
+ "value": "~*req.Ascend-User-Acct-Time", "mandatory": true},
+ {"tag": "RemoteAddr" , "field_id": "RemoteAddr", "type": "*remote_host"},
+ ],
+ "reply_fields":[],
+ },
+ {
+ "id": "KamailioAccountingStop",
+ "filters": ["*string:~*req.Acct-Status-Type:Stop"],
+ "flags": ["*terminate", "*resources", "*accounts", "*cdrs"],
+ "request_fields":[
+ {"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
+ {"tag": "RequestType", "field_id": "RequestType", "type": "*constant",
+ "value": "*prepaid", "mandatory": true},
+ {"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
+ "value": "~*req.Acct-Session-Id;-;~*req.Sip-From-Tag;-;~*req.Sip-To-Tag", "mandatory": true},
+ {"tag": "OriginHost", "field_id": "OriginHost", "type": "*composed",
+ "value": "~*req.NAS-IP-Address", "mandatory": true},
+ {"tag": "Account", "field_id": "Account", "type": "*composed",
+ "value": "~*req.User-Name", "mandatory": true},
+ {"tag": "Subject", "field_id": "Subject", "type": "*variable",
+ "value": "~*req.User-Name", "mandatory": true},
+ {"tag": "Destination", "field_id": "Destination", "type": "*composed",
+ "value": "~*req.Called-Station-Id", "mandatory": true},
+ {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
+ "value": "~*req.Ascend-User-Acct-Time", "mandatory": true},
+ {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
+ "value": "~*req.Ascend-User-Acct-Time", "mandatory": true},
+ {"tag": "Usage", "field_id": "Usage", "type": "*usage_difference",
+ "value": "~*req.Event-Timestamp;~*req.Ascend-User-Acct-Time", "mandatory": true},
+ {"tag": "RemoteAddr" , "field_id": "RemoteAddr", "type": "*remote_host"},
+ ],
+ "reply_fields":[],
+ },
+ ],
+},
+
+
+
+"apier": {
+ "scheduler_conns": [ // connections to SchedulerS for reloads
+ {"address": "*internal"},
+ ],
+},
+
+
+}
diff --git a/gob_integration_test.sh b/gob_integration_test.sh
index f7a77471a..78d40ea55 100755
--- a/gob_integration_test.sh
+++ b/gob_integration_test.sh
@@ -20,9 +20,9 @@ ers=$?
echo 'go test github.com/cgrates/cgrates/general_tests -tags=integration -rpc=*gob'
go test github.com/cgrates/cgrates/general_tests -tags=integration -rpc=*gob
gnr=$?
-# echo 'go test github.com/cgrates/cgrates/agents -tags=integration'
-# go test github.com/cgrates/cgrates/agents -tags=integration
-# agts=$?
+echo 'go test github.com/cgrates/cgrates/agents -tags=integration -rpc=*gob'
+go test github.com/cgrates/cgrates/agents -tags=integration -rpc=*gob
+agts=$?
echo 'go test github.com/cgrates/cgrates/sessions -tags=integration -rpc=*gob'
go test github.com/cgrates/cgrates/sessions -tags=integration -rpc=*gob
smg=$?
@@ -33,4 +33,4 @@ echo 'go test github.com/cgrates/cgrates/loaders -tags=integration -rpc=*gob'
go test github.com/cgrates/cgrates/loaders -tags=integration -rpc=*gob
lds=$?
-exit $gen && $ap1 && $ap2 && $en && $cdrc #&& $gnr && $agts && $smg && $dis && $lds && $ers
+exit $gen && $ap1 && $ap2 && $en && $cdrc && $gnr && $agts && $smg #&& $dis && $lds && $ers