mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-20 06:38:45 +05:00
Methods from service with utils (utils.StatSv1ProcessEvent,utils.ResourceSv1.ProcessEvent,...)
This commit is contained in:
committed by
Dan Christian Bogos
parent
59eae814c6
commit
411d453ded
@@ -24,37 +24,37 @@ import (
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
func NewResourceSV1(rls *engine.ResourceService) *ResourceSV1 {
|
||||
return &ResourceSV1{rls: rls}
|
||||
func NewResourceSv1(rls *engine.ResourceService) *ResourceSv1 {
|
||||
return &ResourceSv1{rls: rls}
|
||||
}
|
||||
|
||||
// Exports RPC from RLs
|
||||
type ResourceSV1 struct {
|
||||
type ResourceSv1 struct {
|
||||
rls *engine.ResourceService
|
||||
}
|
||||
|
||||
// Call implements rpcclient.RpcClientConnection interface for internal RPC
|
||||
func (rsv1 *ResourceSV1) Call(serviceMethod string, args interface{}, reply interface{}) error {
|
||||
func (rsv1 *ResourceSv1) Call(serviceMethod string, args interface{}, reply interface{}) error {
|
||||
return utils.APIerRPCCall(rsv1, serviceMethod, args, reply)
|
||||
}
|
||||
|
||||
// GetResourcesForEvent returns Resources matching a specific event
|
||||
func (rsv1 *ResourceSV1) GetResourcesForEvent(args utils.ArgRSv1ResourceUsage, reply *engine.Resources) error {
|
||||
func (rsv1 *ResourceSv1) GetResourcesForEvent(args utils.ArgRSv1ResourceUsage, reply *engine.Resources) error {
|
||||
return rsv1.rls.V1ResourcesForEvent(args, reply)
|
||||
}
|
||||
|
||||
// AllowUsage checks if there are limits imposed for event
|
||||
func (rsv1 *ResourceSV1) AllowUsage(args utils.ArgRSv1ResourceUsage, allowed *bool) error {
|
||||
func (rsv1 *ResourceSv1) AllowUsage(args utils.ArgRSv1ResourceUsage, allowed *bool) error {
|
||||
return rsv1.rls.V1AllowUsage(args, allowed)
|
||||
}
|
||||
|
||||
// V1InitiateResourceUsage records usage for an event
|
||||
func (rsv1 *ResourceSV1) AllocateResource(args utils.ArgRSv1ResourceUsage, reply *string) error {
|
||||
func (rsv1 *ResourceSv1) AllocateResource(args utils.ArgRSv1ResourceUsage, reply *string) error {
|
||||
return rsv1.rls.V1AllocateResource(args, reply)
|
||||
}
|
||||
|
||||
// V1TerminateResourceUsage releases usage for an event
|
||||
func (rsv1 *ResourceSV1) ReleaseResource(args utils.ArgRSv1ResourceUsage, reply *string) error {
|
||||
func (rsv1 *ResourceSv1) ReleaseResource(args utils.ArgRSv1ResourceUsage, reply *string) error {
|
||||
return rsv1.rls.V1ReleaseResource(args, reply)
|
||||
}
|
||||
|
||||
|
||||
@@ -135,12 +135,12 @@ func testV1RsGetResourcesForEvent(t *testing.T) {
|
||||
args := &utils.ArgRSv1ResourceUsage{
|
||||
Tenant: "cgrates.org",
|
||||
Event: map[string]interface{}{"Unknown": "unknown"}}
|
||||
if err := rlsV1Rpc.Call("ResourceSV1.GetResourcesForEvent", args, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
if err := rlsV1Rpc.Call(utils.ResourceSv1GetResourcesForEvent, args, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Error(err)
|
||||
}
|
||||
time.Sleep(time.Duration(500) * time.Millisecond)
|
||||
args.Event = map[string]interface{}{"Destination": "10"}
|
||||
if err := rlsV1Rpc.Call("ResourceSV1.GetResourcesForEvent", args, &reply); err != nil {
|
||||
if err := rlsV1Rpc.Call(utils.ResourceSv1GetResourcesForEvent, args, &reply); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
time.Sleep(time.Duration(500) * time.Millisecond)
|
||||
@@ -152,12 +152,12 @@ func testV1RsGetResourcesForEvent(t *testing.T) {
|
||||
}
|
||||
|
||||
args.Event = map[string]interface{}{"Destination": "20"}
|
||||
if err := rlsV1Rpc.Call("ResourceSV1.GetResourcesForEvent", args, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
if err := rlsV1Rpc.Call(utils.ResourceSv1GetResourcesForEvent, args, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
args.Event = map[string]interface{}{"Account": "1002", "Subject": "test", "Destination": "1002"}
|
||||
if err := rlsV1Rpc.Call("ResourceSV1.GetResourcesForEvent", args, &reply); err != nil {
|
||||
if err := rlsV1Rpc.Call(utils.ResourceSv1GetResourcesForEvent, args, &reply); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if len(*reply) != 2 {
|
||||
@@ -165,7 +165,7 @@ func testV1RsGetResourcesForEvent(t *testing.T) {
|
||||
}
|
||||
|
||||
args.Event = map[string]interface{}{"Account": "1002", "Subject": "test", "Destination": "1001"}
|
||||
if err := rlsV1Rpc.Call("ResourceSV1.GetResourcesForEvent", args, &reply); err != nil {
|
||||
if err := rlsV1Rpc.Call(utils.ResourceSv1GetResourcesForEvent, args, &reply); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if len(*reply) != 1 {
|
||||
@@ -187,7 +187,7 @@ func testV1RsTTL0(t *testing.T) {
|
||||
Units: 1,
|
||||
}
|
||||
var reply string
|
||||
if err := rlsV1Rpc.Call("ResourceSV1.AllocateResource", argsRU, &reply); err != nil {
|
||||
if err := rlsV1Rpc.Call(utils.ResourceSv1AllocateResource, argsRU, &reply); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
// second allocation should be also allowed
|
||||
@@ -199,7 +199,7 @@ func testV1RsTTL0(t *testing.T) {
|
||||
"Destination": "3002"},
|
||||
Units: 1,
|
||||
}
|
||||
if err := rlsV1Rpc.Call("ResourceSV1.AllocateResource", argsRU, &reply); err != nil {
|
||||
if err := rlsV1Rpc.Call(utils.ResourceSv1AllocateResource, argsRU, &reply); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
// too many units should be rejected
|
||||
@@ -211,7 +211,7 @@ func testV1RsTTL0(t *testing.T) {
|
||||
"Destination": "3002"},
|
||||
Units: 2,
|
||||
}
|
||||
if err := rlsV1Rpc.Call("ResourceSV1.AllocateResource", argsRU, &reply); err == nil ||
|
||||
if err := rlsV1Rpc.Call(utils.ResourceSv1AllocateResource, argsRU, &reply); err == nil ||
|
||||
err.Error() != utils.ErrResourceUnavailable.Error() {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -222,7 +222,7 @@ func testV1RsTTL0(t *testing.T) {
|
||||
Event: map[string]interface{}{
|
||||
"Account": "3001",
|
||||
"Destination": "3002"}}
|
||||
if err := rlsV1Rpc.Call("ResourceSV1.GetResourcesForEvent", args, &rs); err != nil {
|
||||
if err := rlsV1Rpc.Call(utils.ResourceSv1GetResourcesForEvent, args, &rs); err != nil {
|
||||
t.Error(err)
|
||||
} else if len(*rs) != 1 {
|
||||
t.Errorf("Resources: %+v", rs)
|
||||
@@ -241,7 +241,7 @@ func testV1RsTTL0(t *testing.T) {
|
||||
"Account": "3001",
|
||||
"Destination": "3002"},
|
||||
}
|
||||
if err := rlsV1Rpc.Call("ResourceSV1.ReleaseResource", argsRU, &releaseReply); err != nil {
|
||||
if err := rlsV1Rpc.Call(utils.ResourceSv1ReleaseResource, argsRU, &releaseReply); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
@@ -258,7 +258,7 @@ func testV1RsAllocateResource(t *testing.T) {
|
||||
"Destination": "1002"},
|
||||
Units: 3,
|
||||
}
|
||||
if err := rlsV1Rpc.Call("ResourceSV1.AllocateResource", argsRU, &reply); err != nil {
|
||||
if err := rlsV1Rpc.Call(utils.ResourceSv1AllocateResource, argsRU, &reply); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
eAllocationMsg := "ResGroup1"
|
||||
@@ -275,7 +275,7 @@ func testV1RsAllocateResource(t *testing.T) {
|
||||
"Destination": "1002"},
|
||||
Units: 4,
|
||||
}
|
||||
if err := rlsV1Rpc.Call("ResourceSV1.AllocateResource", argsRU, &reply); err != nil {
|
||||
if err := rlsV1Rpc.Call(utils.ResourceSv1AllocateResource, argsRU, &reply); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
eAllocationMsg = "ResGroup1"
|
||||
@@ -292,7 +292,7 @@ func testV1RsAllocateResource(t *testing.T) {
|
||||
"Destination": "1002"},
|
||||
Units: 1,
|
||||
}
|
||||
if err := rlsV1Rpc.Call("ResourceSV1.AllocateResource", argsRU, &reply); err != nil {
|
||||
if err := rlsV1Rpc.Call(utils.ResourceSv1AllocateResource, argsRU, &reply); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
eAllocationMsg = "SPECIAL_1002"
|
||||
@@ -309,7 +309,7 @@ func testV1RsAllocateResource(t *testing.T) {
|
||||
"Destination": "1002"},
|
||||
Units: 1,
|
||||
}
|
||||
if err := rlsV1Rpc.Call("ResourceSV1.AllocateResource", argsRU, &reply); err == nil || err.Error() != utils.ErrResourceUnavailable.Error() {
|
||||
if err := rlsV1Rpc.Call(utils.ResourceSv1AllocateResource, argsRU, &reply); err == nil || err.Error() != utils.ErrResourceUnavailable.Error() {
|
||||
t.Error(err)
|
||||
}
|
||||
eAllocationMsg = "ResGroup1"
|
||||
@@ -324,7 +324,7 @@ func testV1RsAllocateResource(t *testing.T) {
|
||||
"Destination": "1002"},
|
||||
Units: 1,
|
||||
}
|
||||
if err := rlsV1Rpc.Call("ResourceSV1.AllocateResource", argsRU, &reply); err != nil {
|
||||
if err := rlsV1Rpc.Call(utils.ResourceSv1AllocateResource, argsRU, &reply); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
eAllocationMsg = "ResGroup1"
|
||||
@@ -344,7 +344,7 @@ func testV1RsAllowUsage(t *testing.T) {
|
||||
"Destination": "1002"},
|
||||
Units: 6,
|
||||
}
|
||||
if err := rlsV1Rpc.Call("ResourceSV1.AllowUsage", argsRU, &allowed); err != nil {
|
||||
if err := rlsV1Rpc.Call(utils.ResourceSv1AllowUsage, argsRU, &allowed); err != nil {
|
||||
t.Error(err)
|
||||
} else if !allowed { // already 3 usages active before allow call, we should have now more than allowed
|
||||
t.Error("resource is not allowed")
|
||||
@@ -358,7 +358,7 @@ func testV1RsAllowUsage(t *testing.T) {
|
||||
"Destination": "1002"},
|
||||
Units: 7,
|
||||
}
|
||||
if err := rlsV1Rpc.Call("ResourceSV1.AllowUsage", argsRU, &allowed); err != nil {
|
||||
if err := rlsV1Rpc.Call(utils.ResourceSv1AllowUsage, argsRU, &allowed); err != nil {
|
||||
t.Error(err)
|
||||
} else if allowed { // already 3 usages active before allow call, we should have now more than allowed
|
||||
t.Error("resource should not be allowed")
|
||||
@@ -376,7 +376,7 @@ func testV1RsReleaseResource(t *testing.T) {
|
||||
"Subject": "1001",
|
||||
"Destination": "1002"},
|
||||
}
|
||||
if err := rlsV1Rpc.Call("ResourceSV1.ReleaseResource", argsRU, &reply); err != nil {
|
||||
if err := rlsV1Rpc.Call(utils.ResourceSv1ReleaseResource, argsRU, &reply); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
// try reserving with full units for Resource1, case which did not work in previous test
|
||||
@@ -391,7 +391,7 @@ func testV1RsReleaseResource(t *testing.T) {
|
||||
Units: 7,
|
||||
}
|
||||
var allowed bool
|
||||
if err := rlsV1Rpc.Call("ResourceSV1.AllowUsage", argsRU, &allowed); err != nil {
|
||||
if err := rlsV1Rpc.Call(utils.ResourceSv1AllowUsage, argsRU, &allowed); err != nil {
|
||||
t.Error(err)
|
||||
} else if !allowed {
|
||||
t.Error("resource should be allowed")
|
||||
@@ -403,7 +403,7 @@ func testV1RsReleaseResource(t *testing.T) {
|
||||
"Account": "1002",
|
||||
"Subject": "1001",
|
||||
"Destination": "1002"}}
|
||||
if err := rlsV1Rpc.Call("ResourceSV1.GetResourcesForEvent", args, &rs); err != nil {
|
||||
if err := rlsV1Rpc.Call(utils.ResourceSv1GetResourcesForEvent, args, &rs); err != nil {
|
||||
t.Error(err)
|
||||
} else if len(*rs) != 2 {
|
||||
t.Errorf("Resources: %+v", rs)
|
||||
@@ -429,7 +429,7 @@ func testV1RsDBStore(t *testing.T) {
|
||||
}
|
||||
var reply string
|
||||
eAllocationMsg := "ResGroup1"
|
||||
if err := rlsV1Rpc.Call("ResourceSV1.AllocateResource", argsRU, &reply); err != nil {
|
||||
if err := rlsV1Rpc.Call(utils.ResourceSv1AllocateResource, argsRU, &reply); err != nil {
|
||||
t.Error(err)
|
||||
} else if reply != eAllocationMsg {
|
||||
t.Errorf("Expecting: %+v, received: %+v", eAllocationMsg, reply)
|
||||
@@ -441,7 +441,7 @@ func testV1RsDBStore(t *testing.T) {
|
||||
"Account": "1002",
|
||||
"Subject": "1001",
|
||||
"Destination": "1002"}}
|
||||
if err := rlsV1Rpc.Call("ResourceSV1.GetResourcesForEvent", args, &rs); err != nil {
|
||||
if err := rlsV1Rpc.Call(utils.ResourceSv1GetResourcesForEvent, args, &rs); err != nil {
|
||||
t.Error(err)
|
||||
} else if len(*rs) != 2 {
|
||||
t.Errorf("Resources: %+v", rs)
|
||||
@@ -474,7 +474,7 @@ func testV1RsDBStore(t *testing.T) {
|
||||
"Account": "1002",
|
||||
"Subject": "1001",
|
||||
"Destination": "1002"}}
|
||||
if err := rlsV1Rpc.Call("ResourceSV1.GetResourcesForEvent", args, &rs); err != nil {
|
||||
if err := rlsV1Rpc.Call(utils.ResourceSv1GetResourcesForEvent, args, &rs); err != nil {
|
||||
t.Error(err)
|
||||
} else if len(*rs) != 2 {
|
||||
t.Errorf("Resources: %+v", rs)
|
||||
|
||||
@@ -65,41 +65,41 @@ func (apierV1 *ApierV1) RemStatQueueProfile(args *utils.TenantID, reply *string)
|
||||
}
|
||||
|
||||
// NewStatSV1 initializes StatSV1
|
||||
func NewStatSV1(sS *engine.StatService) *StatSV1 {
|
||||
return &StatSV1{sS: sS}
|
||||
func NewStatSv1(sS *engine.StatService) *StatSv1 {
|
||||
return &StatSv1{sS: sS}
|
||||
}
|
||||
|
||||
// Exports RPC from RLs
|
||||
type StatSV1 struct {
|
||||
type StatSv1 struct {
|
||||
sS *engine.StatService
|
||||
}
|
||||
|
||||
// Call implements rpcclient.RpcClientConnection interface for internal RPC
|
||||
func (stsv1 *StatSV1) Call(serviceMethod string, args interface{}, reply interface{}) error {
|
||||
func (stsv1 *StatSv1) Call(serviceMethod string, args interface{}, reply interface{}) error {
|
||||
return utils.APIerRPCCall(stsv1, serviceMethod, args, reply)
|
||||
}
|
||||
|
||||
// GetQueueIDs returns list of queueIDs registered for a tenant
|
||||
func (stsv1 *StatSV1) GetQueueIDs(tenant string, qIDs *[]string) error {
|
||||
func (stsv1 *StatSv1) GetQueueIDs(tenant string, qIDs *[]string) error {
|
||||
return stsv1.sS.V1GetQueueIDs(tenant, qIDs)
|
||||
}
|
||||
|
||||
// ProcessEvent returns processes a new Event
|
||||
func (stsv1 *StatSV1) ProcessEvent(ev *engine.StatEvent, reply *string) error {
|
||||
func (stsv1 *StatSv1) ProcessEvent(ev *engine.StatEvent, reply *string) error {
|
||||
return stsv1.sS.V1ProcessEvent(ev, reply)
|
||||
}
|
||||
|
||||
// GetQueueIDs returns the list of queues IDs in the system
|
||||
func (stsv1 *StatSV1) GetStatQueuesForEvent(ev *engine.StatEvent, reply *engine.StatQueues) (err error) {
|
||||
func (stsv1 *StatSv1) GetStatQueuesForEvent(ev *engine.StatEvent, reply *engine.StatQueues) (err error) {
|
||||
return stsv1.sS.V1GetStatQueuesForEvent(ev, reply)
|
||||
}
|
||||
|
||||
// GetStringMetrics returns the string metrics for a Queue
|
||||
func (stsv1 *StatSV1) GetQueueStringMetrics(args *utils.TenantID, reply *map[string]string) (err error) {
|
||||
func (stsv1 *StatSv1) GetQueueStringMetrics(args *utils.TenantID, reply *map[string]string) (err error) {
|
||||
return stsv1.sS.V1GetQueueStringMetrics(args, reply)
|
||||
}
|
||||
|
||||
// GetQueueFloatMetrics returns the float metrics for a Queue
|
||||
func (stsv1 *StatSV1) GetQueueFloatMetrics(args *utils.TenantID, reply *map[string]float64) (err error) {
|
||||
func (stsv1 *StatSv1) GetQueueFloatMetrics(args *utils.TenantID, reply *map[string]float64) (err error) {
|
||||
return stsv1.sS.V1GetQueueFloatMetrics(args, reply)
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ func testV1STSFromFolder(t *testing.T) {
|
||||
func testV1STSGetStats(t *testing.T) {
|
||||
var reply []string
|
||||
expectedIDs := []string{"Stats1"}
|
||||
if err := stsV1Rpc.Call("StatSV1.GetQueueIDs", "cgrates.org", &reply); err != nil {
|
||||
if err := stsV1Rpc.Call(utils.StatSv1GetQueueIDs, "cgrates.org", &reply); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(expectedIDs, reply) {
|
||||
t.Errorf("expecting: %+v, received reply: %s", expectedIDs, reply)
|
||||
@@ -160,7 +160,7 @@ func testV1STSGetStats(t *testing.T) {
|
||||
utils.MetaACC: utils.NOT_AVAILABLE,
|
||||
utils.MetaPDD: utils.NOT_AVAILABLE,
|
||||
}
|
||||
if err := stsV1Rpc.Call("StatSV1.GetQueueStringMetrics",
|
||||
if err := stsV1Rpc.Call(utils.StatSv1GetGetQueueStringMetrics,
|
||||
&utils.TenantID{Tenant: "cgrates.org", ID: expectedIDs[0]}, &metrics); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(expectedMetrics, metrics) {
|
||||
@@ -179,7 +179,7 @@ func testV1STSProcessEvent(t *testing.T) {
|
||||
utils.USAGE: time.Duration(135 * time.Second),
|
||||
utils.COST: 123.0,
|
||||
utils.PDD: time.Duration(12 * time.Second)}}
|
||||
if err := stsV1Rpc.Call("StatSV1.ProcessEvent", &ev1, &reply); err != nil {
|
||||
if err := stsV1Rpc.Call(utils.StatSv1ProcessEvent, &ev1, &reply); err != nil {
|
||||
t.Error(err)
|
||||
} else if reply != utils.OK {
|
||||
t.Errorf("received reply: %s", reply)
|
||||
@@ -194,7 +194,7 @@ func testV1STSProcessEvent(t *testing.T) {
|
||||
utils.MetaPDD: utils.NOT_AVAILABLE,
|
||||
}
|
||||
var metrics map[string]string
|
||||
if err := stsV1Rpc.Call("StatSV1.GetQueueStringMetrics", &utils.TenantID{Tenant: "cgrates.org", ID: "Stats1"}, &metrics); err != nil {
|
||||
if err := stsV1Rpc.Call(utils.StatSv1GetGetQueueStringMetrics, &utils.TenantID{Tenant: "cgrates.org", ID: "Stats1"}, &metrics); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(expectedMetrics, metrics) {
|
||||
t.Errorf("expecting: %+v, received reply: %s", expectedMetrics, metrics)
|
||||
@@ -206,7 +206,7 @@ func testV1STSProcessEvent(t *testing.T) {
|
||||
utils.ACCOUNT: "1002",
|
||||
utils.ANSWER_TIME: time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
|
||||
utils.USAGE: time.Duration(45 * time.Second)}}
|
||||
if err := stsV1Rpc.Call("StatSV1.ProcessEvent", &ev2, &reply); err != nil {
|
||||
if err := stsV1Rpc.Call(utils.StatSv1ProcessEvent, &ev2, &reply); err != nil {
|
||||
t.Error(err)
|
||||
} else if reply != utils.OK {
|
||||
t.Errorf("received reply: %s", reply)
|
||||
@@ -218,7 +218,7 @@ func testV1STSProcessEvent(t *testing.T) {
|
||||
utils.ACCOUNT: "1002",
|
||||
utils.SETUP_TIME: time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
|
||||
utils.USAGE: 0}}
|
||||
if err := stsV1Rpc.Call("StatSV1.ProcessEvent", &ev3, &reply); err != nil {
|
||||
if err := stsV1Rpc.Call(utils.StatSv1ProcessEvent, &ev3, &reply); err != nil {
|
||||
t.Error(err)
|
||||
} else if reply != utils.OK {
|
||||
t.Errorf("received reply: %s", reply)
|
||||
@@ -232,7 +232,7 @@ func testV1STSProcessEvent(t *testing.T) {
|
||||
utils.MetaPDD: "4s",
|
||||
}
|
||||
var metrics2 map[string]string
|
||||
if err := stsV1Rpc.Call("StatSV1.GetQueueStringMetrics", &utils.TenantID{Tenant: "cgrates.org", ID: "Stats1"}, &metrics2); err != nil {
|
||||
if err := stsV1Rpc.Call(utils.StatSv1GetGetQueueStringMetrics, &utils.TenantID{Tenant: "cgrates.org", ID: "Stats1"}, &metrics2); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(expectedMetrics2, metrics2) {
|
||||
t.Errorf("expecting: %+v, received reply: %s", expectedMetrics2, metrics2)
|
||||
@@ -259,7 +259,7 @@ func testV1STSGetStatsAfterRestart(t *testing.T) {
|
||||
utils.MetaPDD: "4s",
|
||||
}
|
||||
var metrics2 map[string]string
|
||||
if err := stsV1Rpc.Call("StatSV1.GetQueueStringMetrics", &utils.TenantID{Tenant: "cgrates.org", ID: "Stats1"}, &metrics2); err != nil {
|
||||
if err := stsV1Rpc.Call(utils.StatSv1GetGetQueueStringMetrics, &utils.TenantID{Tenant: "cgrates.org", ID: "Stats1"}, &metrics2); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(expectedMetrics2, metrics2) {
|
||||
t.Errorf("After restat expecting: %+v, received reply: %s", expectedMetrics2, metrics2)
|
||||
@@ -359,7 +359,7 @@ func BenchmarkSTSV1SetEvent(b *testing.B) {
|
||||
var reply string
|
||||
b.StartTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
if err := stsV1Rpc.Call("StatSV1.ProcessEvent", evs[rand.Intn(len(evs))],
|
||||
if err := stsV1Rpc.Call(utils.StatSv1ProcessEvent, evs[rand.Intn(len(evs))],
|
||||
&reply); err != nil {
|
||||
b.Error(err)
|
||||
} else if reply != utils.OK {
|
||||
@@ -372,7 +372,7 @@ func BenchmarkSTSV1SetEvent(b *testing.B) {
|
||||
func BenchmarkSTSV1GetQueueStringMetrics(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
var metrics map[string]string
|
||||
if err := stsV1Rpc.Call("StatSV1.GetQueueStringMetrics",
|
||||
if err := stsV1Rpc.Call(utils.StatSv1GetGetQueueStringMetrics,
|
||||
&utils.TenantID{Tenant: "cgrates.org", ID: "STATS_1"},
|
||||
&metrics); err != nil {
|
||||
b.Error(err)
|
||||
|
||||
@@ -25,37 +25,37 @@ import (
|
||||
)
|
||||
|
||||
// NewThresholdSV1 initializes ThresholdSV1
|
||||
func NewThresholdSV1(tS *engine.ThresholdService) *ThresholdSV1 {
|
||||
return &ThresholdSV1{tS: tS}
|
||||
func NewThresholdSv1(tS *engine.ThresholdService) *ThresholdSv1 {
|
||||
return &ThresholdSv1{tS: tS}
|
||||
}
|
||||
|
||||
// Exports RPC from RLs
|
||||
type ThresholdSV1 struct {
|
||||
type ThresholdSv1 struct {
|
||||
tS *engine.ThresholdService
|
||||
}
|
||||
|
||||
// Call implements rpcclient.RpcClientConnection interface for internal RPC
|
||||
func (tSv1 *ThresholdSV1) Call(serviceMethod string, args interface{}, reply interface{}) error {
|
||||
func (tSv1 *ThresholdSv1) Call(serviceMethod string, args interface{}, reply interface{}) error {
|
||||
return utils.APIerRPCCall(tSv1, serviceMethod, args, reply)
|
||||
}
|
||||
|
||||
// GetThresholdIDs returns list of threshold IDs registered for a tenant
|
||||
func (tSv1 *ThresholdSV1) GetThresholdIDs(tenant string, tIDs *[]string) error {
|
||||
func (tSv1 *ThresholdSv1) GetThresholdIDs(tenant string, tIDs *[]string) error {
|
||||
return tSv1.tS.V1GetThresholdIDs(tenant, tIDs)
|
||||
}
|
||||
|
||||
// GetThresholdsForEvent returns a list of thresholds matching an event
|
||||
func (tSv1 *ThresholdSV1) GetThresholdsForEvent(ev *engine.ThresholdEvent, reply *engine.Thresholds) error {
|
||||
func (tSv1 *ThresholdSv1) GetThresholdsForEvent(ev *engine.ThresholdEvent, reply *engine.Thresholds) error {
|
||||
return tSv1.tS.V1GetThresholdsForEvent(ev, reply)
|
||||
}
|
||||
|
||||
// GetThreshold queries a Threshold
|
||||
func (tSv1 *ThresholdSV1) GetThreshold(tntID *utils.TenantID, t *engine.Threshold) error {
|
||||
func (tSv1 *ThresholdSv1) GetThreshold(tntID *utils.TenantID, t *engine.Threshold) error {
|
||||
return tSv1.tS.V1GetThreshold(tntID, t)
|
||||
}
|
||||
|
||||
// ProcessEvent will process an Event
|
||||
func (tSv1 *ThresholdSV1) ProcessEvent(ev *engine.ThresholdEvent, hits *int) error {
|
||||
func (tSv1 *ThresholdSv1) ProcessEvent(ev *engine.ThresholdEvent, hits *int) error {
|
||||
return tSv1.tS.V1ProcessEvent(ev, hits)
|
||||
}
|
||||
|
||||
|
||||
@@ -234,14 +234,14 @@ func testV1TSFromFolder(t *testing.T) {
|
||||
func testV1TSGetThresholds(t *testing.T) {
|
||||
var tIDs []string
|
||||
expectedIDs := []string{"THD_RES_1", "THD_STATS_2", "THD_STATS_1", "THD_ACNT_BALANCE_1", "THD_ACNT_EXPIRED", "THD_STATS_3", "THD_CDRS_1"}
|
||||
if err := tSv1Rpc.Call("ThresholdSV1.GetThresholdIDs", "cgrates.org", &tIDs); err != nil {
|
||||
if err := tSv1Rpc.Call(utils.ThresholdSv1GetThresholdIDs, "cgrates.org", &tIDs); err != nil {
|
||||
t.Error(err)
|
||||
} else if len(expectedIDs) != len(tIDs) {
|
||||
t.Errorf("expecting: %+v, received reply: %s", expectedIDs, tIDs)
|
||||
}
|
||||
var td engine.Threshold
|
||||
eTd := engine.Threshold{Tenant: "cgrates.org", ID: expectedIDs[0]}
|
||||
if err := tSv1Rpc.Call("ThresholdSV1.GetThreshold",
|
||||
if err := tSv1Rpc.Call(utils.ThresholdSv1GetThreshold,
|
||||
&utils.TenantID{Tenant: "cgrates.org", ID: expectedIDs[0]}, &td); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(eTd, td) {
|
||||
@@ -252,55 +252,55 @@ func testV1TSGetThresholds(t *testing.T) {
|
||||
func testV1TSProcessEvent(t *testing.T) {
|
||||
var hits int
|
||||
eHits := 0
|
||||
if err := tSv1Rpc.Call("ThresholdSV1.ProcessEvent", tEvs[0], &hits); err != nil {
|
||||
if err := tSv1Rpc.Call(utils.ThresholdSv1ProcessEvent, tEvs[0], &hits); err != nil {
|
||||
t.Error(err)
|
||||
} else if hits != eHits {
|
||||
t.Errorf("Expecting hits: %d, received: %d", eHits, hits)
|
||||
}
|
||||
eHits = 1
|
||||
if err := tSv1Rpc.Call("ThresholdSV1.ProcessEvent", tEvs[1], &hits); err != nil {
|
||||
if err := tSv1Rpc.Call(utils.ThresholdSv1ProcessEvent, tEvs[1], &hits); err != nil {
|
||||
t.Error(err)
|
||||
} else if hits != eHits {
|
||||
t.Errorf("Expecting hits: %d, received: %d", eHits, hits)
|
||||
}
|
||||
eHits = 1
|
||||
if err := tSv1Rpc.Call("ThresholdSV1.ProcessEvent", tEvs[2], &hits); err != nil {
|
||||
if err := tSv1Rpc.Call(utils.ThresholdSv1ProcessEvent, tEvs[2], &hits); err != nil {
|
||||
t.Error(err)
|
||||
} else if hits != eHits {
|
||||
t.Errorf("Expecting hits: %d, received: %d", eHits, hits)
|
||||
}
|
||||
eHits = 2
|
||||
if err := tSv1Rpc.Call("ThresholdSV1.ProcessEvent", tEvs[3], &hits); err != nil {
|
||||
if err := tSv1Rpc.Call(utils.ThresholdSv1ProcessEvent, tEvs[3], &hits); err != nil {
|
||||
t.Error(err)
|
||||
} else if hits != eHits {
|
||||
t.Errorf("Expecting hits: %d, received: %d", eHits, hits)
|
||||
}
|
||||
eHits = 1
|
||||
if err := tSv1Rpc.Call("ThresholdSV1.ProcessEvent", tEvs[4], &hits); err != nil {
|
||||
if err := tSv1Rpc.Call(utils.ThresholdSv1ProcessEvent, tEvs[4], &hits); err != nil {
|
||||
t.Error(err)
|
||||
} else if hits != eHits {
|
||||
t.Errorf("Expecting hits: %d, received: %d", eHits, hits)
|
||||
}
|
||||
eHits = 1
|
||||
if err := tSv1Rpc.Call("ThresholdSV1.ProcessEvent", tEvs[5], &hits); err != nil {
|
||||
if err := tSv1Rpc.Call(utils.ThresholdSv1ProcessEvent, tEvs[5], &hits); err != nil {
|
||||
t.Error(err)
|
||||
} else if hits != eHits {
|
||||
t.Errorf("Expecting hits: %d, received: %d", eHits, hits)
|
||||
}
|
||||
eHits = 1
|
||||
if err := tSv1Rpc.Call("ThresholdSV1.ProcessEvent", tEvs[6], &hits); err != nil {
|
||||
if err := tSv1Rpc.Call(utils.ThresholdSv1ProcessEvent, tEvs[6], &hits); err != nil {
|
||||
t.Error(err)
|
||||
} else if hits != eHits {
|
||||
t.Errorf("Expecting hits: %d, received: %d", eHits, hits)
|
||||
}
|
||||
eHits = 1
|
||||
if err := tSv1Rpc.Call("ThresholdSV1.ProcessEvent", tEvs[7], &hits); err != nil {
|
||||
if err := tSv1Rpc.Call(utils.ThresholdSv1ProcessEvent, tEvs[7], &hits); err != nil {
|
||||
t.Error(err)
|
||||
} else if hits != eHits {
|
||||
t.Errorf("Expecting hits: %d, received: %d", eHits, hits)
|
||||
}
|
||||
eHits = 1
|
||||
if err := tSv1Rpc.Call("ThresholdSV1.ProcessEvent", tEvs[8], &hits); err != nil {
|
||||
if err := tSv1Rpc.Call(utils.ThresholdSv1ProcessEvent, tEvs[8], &hits); err != nil {
|
||||
t.Error(err)
|
||||
} else if hits != eHits {
|
||||
t.Errorf("Expecting hits: %d, received: %d", eHits, hits)
|
||||
@@ -310,13 +310,13 @@ func testV1TSProcessEvent(t *testing.T) {
|
||||
func testV1TSGetThresholdsAfterProcess(t *testing.T) {
|
||||
var tIDs []string
|
||||
expectedIDs := []string{"THD_RES_1", "THD_STATS_2", "THD_STATS_1", "THD_ACNT_BALANCE_1", "THD_ACNT_EXPIRED"}
|
||||
if err := tSv1Rpc.Call("ThresholdSV1.GetThresholdIDs", "cgrates.org", &tIDs); err != nil {
|
||||
if err := tSv1Rpc.Call(utils.ThresholdSv1GetThresholdIDs, "cgrates.org", &tIDs); err != nil {
|
||||
t.Error(err)
|
||||
} else if len(expectedIDs) != len(tIDs) { // THD_STATS_3 is not reccurent, so it was removed
|
||||
t.Errorf("expecting: %+v, received reply: %s", expectedIDs, tIDs)
|
||||
}
|
||||
var td engine.Threshold
|
||||
if err := tSv1Rpc.Call("ThresholdSV1.GetThreshold",
|
||||
if err := tSv1Rpc.Call(utils.ThresholdSv1GetThreshold,
|
||||
&utils.TenantID{Tenant: "cgrates.org", ID: "THD_ACNT_BALANCE_1"}, &td); err != nil {
|
||||
t.Error(err)
|
||||
} else if td.Snooze.IsZero() { // make sure Snooze time was reset during execution
|
||||
@@ -335,7 +335,7 @@ func testV1TSGetThresholdsAfterRestart(t *testing.T) {
|
||||
t.Fatal("Could not connect to rater: ", err.Error())
|
||||
}
|
||||
var td engine.Threshold
|
||||
if err := tSv1Rpc.Call("ThresholdSV1.GetThreshold",
|
||||
if err := tSv1Rpc.Call(utils.ThresholdSv1GetThreshold,
|
||||
&utils.TenantID{Tenant: "cgrates.org", ID: "THD_ACNT_BALANCE_1"}, &td); err != nil {
|
||||
t.Error(err)
|
||||
} else if td.Snooze.IsZero() { // make sure Snooze time was reset during execution
|
||||
|
||||
@@ -568,7 +568,7 @@ func startResourceService(internalRsChan, internalThresholdSChan chan rpcclient.
|
||||
exitChan <- true
|
||||
return
|
||||
}()
|
||||
rsV1 := v1.NewResourceSV1(rS)
|
||||
rsV1 := v1.NewResourceSv1(rS)
|
||||
server.RpcRegister(rsV1)
|
||||
internalRsChan <- rsV1
|
||||
}
|
||||
@@ -603,7 +603,7 @@ func startStatService(internalStatSChan, internalThresholdSChan chan rpcclient.R
|
||||
exitChan <- true
|
||||
return
|
||||
}()
|
||||
stsV1 := v1.NewStatSV1(sS)
|
||||
stsV1 := v1.NewStatSv1(sS)
|
||||
server.RpcRegister(stsV1)
|
||||
internalStatSChan <- stsV1
|
||||
}
|
||||
@@ -629,7 +629,7 @@ func startThresholdService(internalThresholdSChan chan rpcclient.RpcClientConnec
|
||||
exitChan <- true
|
||||
return
|
||||
}()
|
||||
tSv1 := v1.NewThresholdSV1(tS)
|
||||
tSv1 := v1.NewThresholdSv1(tS)
|
||||
server.RpcRegister(tSv1)
|
||||
internalThresholdSChan <- tSv1
|
||||
}
|
||||
|
||||
@@ -837,7 +837,7 @@ func (bc Balances) SaveDirtyBalances(acc *Account) {
|
||||
utils.AllowNegative: acnt.AllowNegative,
|
||||
utils.Disabled: acnt.Disabled}}
|
||||
var hits int
|
||||
if err := thresholdS.Call("ThresholdSV1.ProcessEvent", ev, &hits); err != nil {
|
||||
if err := thresholdS.Call(utils.ThresholdSv1ProcessEvent, ev, &hits); err != nil {
|
||||
utils.Logger.Warning(
|
||||
fmt.Sprintf("<AccountS> error: %s processing account event %+v with ThresholdS.", err.Error(), ev))
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ func (self *CdrServer) processCdr(cdr *CDR) (err error) {
|
||||
cdrIf[utils.ID] = cdr.OriginID
|
||||
}
|
||||
var reply string
|
||||
go self.stats.Call("StatSV1.ProcessEvent", cdrIf, &reply)
|
||||
go self.stats.Call(utils.StatSv1ProcessEvent, cdrIf, &reply)
|
||||
}
|
||||
if len(self.cgrCfg.CDRSOnlineCDRExports) != 0 { // Replicate raw CDR
|
||||
self.replicateCDRs([]*CDR{cdr})
|
||||
@@ -300,7 +300,7 @@ func (self *CdrServer) deriveRateStoreStatsReplicate(cdr *CDR, store, cdrstats,
|
||||
cdrIf[utils.ID] = ratedCDR.OriginID
|
||||
}
|
||||
var reply string
|
||||
go self.stats.Call("StatSV1.ProcessEvent", cdrIf, &reply)
|
||||
go self.stats.Call(utils.StatSv1ProcessEvent, cdrIf, &reply)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ func (sm *FSSessionManager) onChannelPark(ev engine.Event, connId string) {
|
||||
Event: ev.(FSEvent).AsMapStringInterface(sm.timezone),
|
||||
Units: 1,
|
||||
}
|
||||
if err := sm.rls.Call("ResourceSV1.AllocateResource", attrRU, &reply); err != nil {
|
||||
if err := sm.rls.Call(utils.ResourceSv1AllocateResource, attrRU, &reply); err != nil {
|
||||
if err.Error() == utils.ErrResourceUnavailable.Error() {
|
||||
sm.unparkCall(ev.GetUUID(), connId, ev.GetCallDestNr(utils.META_DEFAULT), "-"+utils.ErrResourceUnavailable.Error())
|
||||
} else {
|
||||
@@ -286,7 +286,7 @@ func (sm *FSSessionManager) onChannelHangupComplete(ev engine.Event) {
|
||||
Units: 1,
|
||||
}
|
||||
if sm.rls != nil {
|
||||
if err := sm.rls.Call("ResourceSV1.ReleaseResource", attrRU, &reply); err != nil {
|
||||
if err := sm.rls.Call(utils.ResourceSv1ReleaseResource, attrRU, &reply); err != nil {
|
||||
utils.Logger.Err(fmt.Sprintf("<SM-FreeSWITCH> RLs API error: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ func (self *KamailioSessionManager) allocateResources(kev KamEvent) (err error)
|
||||
Units: 1, // One channel reserved
|
||||
}
|
||||
var reply string
|
||||
return self.rlS.Call("ResourceSV1.AllocateResource", attrRU, &reply)
|
||||
return self.rlS.Call(utils.ResourceSv1AllocateResource, attrRU, &reply)
|
||||
}
|
||||
|
||||
func (self *KamailioSessionManager) onCgrAuth(evData []byte, connId string) {
|
||||
@@ -220,7 +220,7 @@ func (self *KamailioSessionManager) onCallEnd(evData []byte, connId string) {
|
||||
Event: ev,
|
||||
Units: 1,
|
||||
}
|
||||
if err := self.rlS.Call("ResourceSV1.ReleaseResource", attrRU, &reply); err != nil {
|
||||
if err := self.rlS.Call(utils.ResourceSv1ReleaseResource, attrRU, &reply); err != nil {
|
||||
utils.Logger.Err(fmt.Sprintf("<SM-Kamailio> RLs API error: %s", err.Error()))
|
||||
}
|
||||
}()
|
||||
|
||||
481
utils/consts.go
481
utils/consts.go
@@ -338,242 +338,251 @@ const (
|
||||
CGR_SESSION_END = "CgrSessionEnd"
|
||||
CGR_LCR_REQUEST = "CgrLcrRequest"
|
||||
// action trigger threshold types
|
||||
TRIGGER_MIN_EVENT_COUNTER = "*min_event_counter"
|
||||
TRIGGER_MIN_BALANCE_COUNTER = "*min_balance_counter"
|
||||
TRIGGER_MAX_EVENT_COUNTER = "*max_event_counter"
|
||||
TRIGGER_MAX_BALANCE_COUNTER = "*max_balance_counter"
|
||||
TRIGGER_MIN_BALANCE = "*min_balance"
|
||||
TRIGGER_MAX_BALANCE = "*max_balance"
|
||||
TRIGGER_BALANCE_EXPIRED = "*balance_expired"
|
||||
HIERARCHY_SEP = ">"
|
||||
META_COMPOSED = "*composed"
|
||||
NegativePrefix = "!"
|
||||
MatchStartPrefix = "^"
|
||||
MatchEndPrefix = "$"
|
||||
SMG = "SMG"
|
||||
MetaGrouped = "*grouped"
|
||||
MetaRaw = "*raw"
|
||||
CreatedAt = "CreatedAt"
|
||||
UpdatedAt = "UpdatedAt"
|
||||
HandlerArgSep = "|"
|
||||
FlagForceDuration = "fd"
|
||||
InstanceID = "InstanceID"
|
||||
ActiveGoroutines = "ActiveGoroutines"
|
||||
SessionTTL = "SessionTTL"
|
||||
SessionTTLMaxDelay = "SessionTTLMaxDelay"
|
||||
SessionTTLLastUsed = "SessionTTLLastUsed"
|
||||
SessionTTLUsage = "SessionTTLUsage"
|
||||
HandlerSubstractUsage = "*substract_usage"
|
||||
XML = "xml"
|
||||
MetaGOBrpc = "*gob"
|
||||
MetaJSONrpc = "*json"
|
||||
MetaDateTime = "*datetime"
|
||||
MetaMaskedDestination = "*masked_destination"
|
||||
MetaUnixTimestamp = "*unix_timestamp"
|
||||
MetaPostCDR = "*post_cdr"
|
||||
MetaDumpToFile = "*dump_to_file"
|
||||
NonTransactional = "" // used in transactional cache mechanism
|
||||
EVT_ACCOUNT_BALANCE_MODIFIED = "ACCOUNT_BALANCE_MODIFIED"
|
||||
EVT_ACTION_TRIGGER_FIRED = "ACTION_TRIGGER_FIRED"
|
||||
EVT_ACTION_TIMING_FIRED = "ACTION_TRIGGER_FIRED"
|
||||
SMAsterisk = "sm_asterisk"
|
||||
DataDB = "data_db"
|
||||
StorDB = "stor_db"
|
||||
Cache = "cache"
|
||||
NotFoundCaps = "NOT_FOUND"
|
||||
ItemNotFound = "item not found"
|
||||
ItemNotCloneable = "item not cloneable"
|
||||
NotCloneableCaps = "NOT_CLONEABLE"
|
||||
ServerErrorCaps = "SERVER_ERROR"
|
||||
MandatoryIEMissingCaps = "MANDATORY_IE_MISSING"
|
||||
UnsupportedCachePrefix = "unsupported cache prefix"
|
||||
CDRSCtx = "cdrs"
|
||||
MandatoryInfoMissing = "mandatory information missing"
|
||||
UnsupportedServiceIDCaps = "UNSUPPORTED_SERVICE_ID"
|
||||
ServiceManager = "service_manager"
|
||||
ServiceAlreadyRunning = "service already running"
|
||||
ServiceNotRunning = "service not running"
|
||||
RunningCaps = "RUNNING"
|
||||
StoppedCaps = "STOPPED"
|
||||
SchedulerNotRunningCaps = "SCHEDULLER_NOT_RUNNING"
|
||||
MetaScheduler = "*scheduler"
|
||||
MetaCostDetails = "*cost_details"
|
||||
MetaAccounts = "*accounts"
|
||||
MetaActionPlans = "*action_plans"
|
||||
MetaActionTriggers = "*action_triggers"
|
||||
MetaActions = "*actions"
|
||||
MetaSharedGroups = "*shared_groups"
|
||||
MetaStats = "*stats"
|
||||
MetaThresholds = "*thresholds"
|
||||
Migrator = "migrator"
|
||||
UnsupportedMigrationTask = "unsupported migration task"
|
||||
NoStorDBConnection = "not connected to StorDB"
|
||||
UndefinedVersion = "undefined version"
|
||||
UnsupportedDB = "unsupported database"
|
||||
ACCOUNT_SUMMARY = "AccountSummary"
|
||||
TxtSuffix = ".txt"
|
||||
JSNSuffix = ".json"
|
||||
FormSuffix = ".form"
|
||||
CSVSuffix = ".csv"
|
||||
FWVSuffix = ".fwv"
|
||||
CONTENT_JSON = "json"
|
||||
CONTENT_FORM = "form"
|
||||
CONTENT_TEXT = "text"
|
||||
FileLockPrefix = "file_"
|
||||
ActionsPoster = "act"
|
||||
CDRPoster = "cdr"
|
||||
MetaFileCSV = "*file_csv"
|
||||
MetaFileFWV = "*file_fwv"
|
||||
Accounts = "Accounts"
|
||||
AccountService = "AccountS"
|
||||
Actions = "Actions"
|
||||
ActionPlans = "ActionPlans"
|
||||
ActionTriggers = "ActionTriggers"
|
||||
SharedGroups = "SharedGroups"
|
||||
MetaEveryMinute = "*every_minute"
|
||||
MetaHourly = "*hourly"
|
||||
ID = "ID"
|
||||
CacheDestinations = "destinations"
|
||||
CacheReverseDestinations = "reverse_destinations"
|
||||
CacheRatingPlans = "rating_plans"
|
||||
CacheRatingProfiles = "rating_profiles"
|
||||
CacheLCRRules = "lcr_rules"
|
||||
CacheCDRStatS = "cdr_stats"
|
||||
CacheActions = "actions"
|
||||
CacheActionPlans = "action_plans"
|
||||
CacheAccountActionPlans = "account_action_plans"
|
||||
CacheActionTriggers = "action_triggers"
|
||||
CacheSharedGroups = "shared_groups"
|
||||
CacheAliases = "aliases"
|
||||
CacheReverseAliases = "reverse_aliases"
|
||||
CacheDerivedChargers = "derived_chargers"
|
||||
CacheResources = "resources"
|
||||
CacheResourceProfiles = "resource_profiles"
|
||||
CacheTimings = "timings"
|
||||
Thresholds = "Thresholds"
|
||||
StatS = "stats"
|
||||
StatService = "StatS"
|
||||
RALService = "RALs"
|
||||
CostSource = "CostSource"
|
||||
ExtraInfo = "ExtraInfo"
|
||||
MetaPrefix = "*"
|
||||
CacheEventResources = "event_resources"
|
||||
CacheStatQueueProfiles = "statqueue_profiles"
|
||||
CacheStatQueues = "statqueues"
|
||||
EventResourcesPrefix = "ers_"
|
||||
MetaSysLog = "*syslog"
|
||||
MetaStdLog = "*stdout"
|
||||
MetaNever = "*never"
|
||||
EventType = "EventType"
|
||||
EventSource = "EventSource"
|
||||
AccountID = "AccountID"
|
||||
ResourceID = "ResourceID"
|
||||
TotalUsage = "TotalUsage"
|
||||
StatID = "StatID"
|
||||
BalanceType = "BalanceType"
|
||||
BalanceID = "BalanceID"
|
||||
Units = "Units"
|
||||
ResourceS = "ResourceS"
|
||||
CacheThresholdProfiles = "threshold_profiles"
|
||||
CacheThresholds = "thresholds"
|
||||
CacheFilters = "filters"
|
||||
CacheLCRProfiles = "lcr_profiles"
|
||||
AccountUpdate = "AccountUpdate"
|
||||
BalanceUpdate = "BalanceUpdate"
|
||||
StatUpdate = "StatUpdate"
|
||||
ResourceUpdate = "ResourceUpdate"
|
||||
CDR = "CDR"
|
||||
CDRs = "CDRs"
|
||||
ExpiryTime = "ExpiryTime"
|
||||
AllowNegative = "AllowNegative"
|
||||
Disabled = "Disabled"
|
||||
Action = "Action"
|
||||
ThresholdSv1ProcessEvent = "ThresholdSv1.ProcessEvent"
|
||||
MetaNow = "*now"
|
||||
TpRatingPlans = "TpRatingPlans"
|
||||
TpLcrs = "TpLcrs"
|
||||
TpFilters = "TpFilters"
|
||||
TpDestinationRates = "TpDestinationRates"
|
||||
TpActionTriggers = "TpActionTriggers"
|
||||
TpAccountActions = "TpAccountActions"
|
||||
TpActionPlans = "TpActionPlans"
|
||||
TpActions = "TpActions"
|
||||
TpDerivedCharges = "TpDerivedCharges"
|
||||
TpThresholds = "TpThresholds"
|
||||
TpStats = "TpStats"
|
||||
TpSharedGroups = "TpSharedGroups"
|
||||
TpRatingProfiles = "TpRatingProfiles"
|
||||
TpResources = "TpResources"
|
||||
TpRates = "TpRates"
|
||||
TpTiming = "TpTiming"
|
||||
TpResource = "TpResource"
|
||||
TpAliases = "TpAliases"
|
||||
TpUsers = "TpUsers"
|
||||
TpDerivedChargersV = "TpDerivedChargers"
|
||||
TpCdrStats = "TpCdrStats"
|
||||
TpDestinations = "TpDestinations"
|
||||
TpLCR = "TpLCR"
|
||||
TpRatingPlan = "TpRatingPlan"
|
||||
TpRatingProfile = "TpRatingProfile"
|
||||
Timing = "Timing"
|
||||
RQF = "RQF"
|
||||
Resource = "Resource"
|
||||
ReverseAlias = "ReverseAlias"
|
||||
Alias = "Alias"
|
||||
User = "User"
|
||||
Subscribers = "Subscribers"
|
||||
DerivedChargersV = "DerivedChargers"
|
||||
CdrStats = "CdrStats"
|
||||
Destinations = "Destinations"
|
||||
ReverseDestinations = "ReverseDestinations"
|
||||
LCR = "LCR"
|
||||
RatingPlan = "RatingPlan"
|
||||
RatingProfile = "RatingProfile"
|
||||
MetaRatingPlans = "*ratingplans"
|
||||
MetaRatingProfile = "*ratingprofile"
|
||||
MetaDestinations = "*destinations"
|
||||
MetaReverseDestinations = "*reversedestinations"
|
||||
MetaLCR = "*lcr"
|
||||
MetaCdrStats = "*cdrstats"
|
||||
MetaTiming = "*Timing"
|
||||
MetaRQF = "*RQF"
|
||||
MetaResource = "*Resource"
|
||||
MetaReverseAlias = "*ReverseAlias"
|
||||
MetaAlias = "*Alias"
|
||||
MetaUser = "*User"
|
||||
MetaSubscribers = "*Subscribers"
|
||||
MetaDerivedChargersV = "*DerivedChargers"
|
||||
MetaTpRatingPlans = "*TpRatingPlans"
|
||||
MetaTpLcrs = "*TpLcrs"
|
||||
MetaTpFilters = "*TpFilters"
|
||||
MetaTpDestinationRates = "*TpDestinationRates"
|
||||
MetaTpActionTriggers = "*TpActionTriggers"
|
||||
MetaTpAccountActions = "*TpAccountActions"
|
||||
MetaTpActionPlans = "*TpActionPlans"
|
||||
MetaTpActions = "*TpActions"
|
||||
MetaTpDerivedCharges = "*TpDerivedCharges"
|
||||
MetaTpThresholds = "*TpThresholds"
|
||||
MetaTpStats = "*TpStats"
|
||||
MetaTpSharedGroups = "*TpSharedGroups"
|
||||
MetaTpRatingProfiles = "*TpRatingProfiles"
|
||||
MetaTpResources = "*TpResources"
|
||||
MetaTpRates = "*TpRates"
|
||||
MetaTpTiming = "*TpTiming"
|
||||
MetaTpResource = "*TpResource"
|
||||
MetaTpAliases = "*TpAliases"
|
||||
MetaTpUsers = "*TpUsers"
|
||||
MetaTpDerivedChargersV = "*TpDerivedChargers"
|
||||
MetaTpCdrStats = "*TpCdrStats"
|
||||
MetaTpDestinations = "*TpDestinations"
|
||||
MetaTpLCR = "*TpLCR"
|
||||
MetaTpRatingPlan = "*TpRatingPlan"
|
||||
MetaTpRatingProfile = "*TpRatingProfile"
|
||||
MetaStorDB = "*StorDB"
|
||||
MetaDataDB = "*DataDB"
|
||||
SMGenericV2UpdateSession = "SMGenericV2.UpdateSession"
|
||||
SMGenericV2InitiateSession = "SMGenericV2.InitiateSession"
|
||||
SMGenericV1UpdateSession = "SMGenericV1.UpdateSession"
|
||||
SMGenericV1InitiateSession = "SMGenericV1.InitiateSession"
|
||||
TRIGGER_MIN_EVENT_COUNTER = "*min_event_counter"
|
||||
TRIGGER_MIN_BALANCE_COUNTER = "*min_balance_counter"
|
||||
TRIGGER_MAX_EVENT_COUNTER = "*max_event_counter"
|
||||
TRIGGER_MAX_BALANCE_COUNTER = "*max_balance_counter"
|
||||
TRIGGER_MIN_BALANCE = "*min_balance"
|
||||
TRIGGER_MAX_BALANCE = "*max_balance"
|
||||
TRIGGER_BALANCE_EXPIRED = "*balance_expired"
|
||||
HIERARCHY_SEP = ">"
|
||||
META_COMPOSED = "*composed"
|
||||
NegativePrefix = "!"
|
||||
MatchStartPrefix = "^"
|
||||
MatchEndPrefix = "$"
|
||||
SMG = "SMG"
|
||||
MetaGrouped = "*grouped"
|
||||
MetaRaw = "*raw"
|
||||
CreatedAt = "CreatedAt"
|
||||
UpdatedAt = "UpdatedAt"
|
||||
HandlerArgSep = "|"
|
||||
FlagForceDuration = "fd"
|
||||
InstanceID = "InstanceID"
|
||||
ActiveGoroutines = "ActiveGoroutines"
|
||||
SessionTTL = "SessionTTL"
|
||||
SessionTTLMaxDelay = "SessionTTLMaxDelay"
|
||||
SessionTTLLastUsed = "SessionTTLLastUsed"
|
||||
SessionTTLUsage = "SessionTTLUsage"
|
||||
HandlerSubstractUsage = "*substract_usage"
|
||||
XML = "xml"
|
||||
MetaGOBrpc = "*gob"
|
||||
MetaJSONrpc = "*json"
|
||||
MetaDateTime = "*datetime"
|
||||
MetaMaskedDestination = "*masked_destination"
|
||||
MetaUnixTimestamp = "*unix_timestamp"
|
||||
MetaPostCDR = "*post_cdr"
|
||||
MetaDumpToFile = "*dump_to_file"
|
||||
NonTransactional = "" // used in transactional cache mechanism
|
||||
EVT_ACCOUNT_BALANCE_MODIFIED = "ACCOUNT_BALANCE_MODIFIED"
|
||||
EVT_ACTION_TRIGGER_FIRED = "ACTION_TRIGGER_FIRED"
|
||||
EVT_ACTION_TIMING_FIRED = "ACTION_TRIGGER_FIRED"
|
||||
SMAsterisk = "sm_asterisk"
|
||||
DataDB = "data_db"
|
||||
StorDB = "stor_db"
|
||||
Cache = "cache"
|
||||
NotFoundCaps = "NOT_FOUND"
|
||||
ItemNotFound = "item not found"
|
||||
ItemNotCloneable = "item not cloneable"
|
||||
NotCloneableCaps = "NOT_CLONEABLE"
|
||||
ServerErrorCaps = "SERVER_ERROR"
|
||||
MandatoryIEMissingCaps = "MANDATORY_IE_MISSING"
|
||||
UnsupportedCachePrefix = "unsupported cache prefix"
|
||||
CDRSCtx = "cdrs"
|
||||
MandatoryInfoMissing = "mandatory information missing"
|
||||
UnsupportedServiceIDCaps = "UNSUPPORTED_SERVICE_ID"
|
||||
ServiceManager = "service_manager"
|
||||
ServiceAlreadyRunning = "service already running"
|
||||
ServiceNotRunning = "service not running"
|
||||
RunningCaps = "RUNNING"
|
||||
StoppedCaps = "STOPPED"
|
||||
SchedulerNotRunningCaps = "SCHEDULLER_NOT_RUNNING"
|
||||
MetaScheduler = "*scheduler"
|
||||
MetaCostDetails = "*cost_details"
|
||||
MetaAccounts = "*accounts"
|
||||
MetaActionPlans = "*action_plans"
|
||||
MetaActionTriggers = "*action_triggers"
|
||||
MetaActions = "*actions"
|
||||
MetaSharedGroups = "*shared_groups"
|
||||
MetaStats = "*stats"
|
||||
MetaThresholds = "*thresholds"
|
||||
Migrator = "migrator"
|
||||
UnsupportedMigrationTask = "unsupported migration task"
|
||||
NoStorDBConnection = "not connected to StorDB"
|
||||
UndefinedVersion = "undefined version"
|
||||
UnsupportedDB = "unsupported database"
|
||||
ACCOUNT_SUMMARY = "AccountSummary"
|
||||
TxtSuffix = ".txt"
|
||||
JSNSuffix = ".json"
|
||||
FormSuffix = ".form"
|
||||
CSVSuffix = ".csv"
|
||||
FWVSuffix = ".fwv"
|
||||
CONTENT_JSON = "json"
|
||||
CONTENT_FORM = "form"
|
||||
CONTENT_TEXT = "text"
|
||||
FileLockPrefix = "file_"
|
||||
ActionsPoster = "act"
|
||||
CDRPoster = "cdr"
|
||||
MetaFileCSV = "*file_csv"
|
||||
MetaFileFWV = "*file_fwv"
|
||||
Accounts = "Accounts"
|
||||
AccountService = "AccountS"
|
||||
Actions = "Actions"
|
||||
ActionPlans = "ActionPlans"
|
||||
ActionTriggers = "ActionTriggers"
|
||||
SharedGroups = "SharedGroups"
|
||||
MetaEveryMinute = "*every_minute"
|
||||
MetaHourly = "*hourly"
|
||||
ID = "ID"
|
||||
CacheDestinations = "destinations"
|
||||
CacheReverseDestinations = "reverse_destinations"
|
||||
CacheRatingPlans = "rating_plans"
|
||||
CacheRatingProfiles = "rating_profiles"
|
||||
CacheLCRRules = "lcr_rules"
|
||||
CacheCDRStatS = "cdr_stats"
|
||||
CacheActions = "actions"
|
||||
CacheActionPlans = "action_plans"
|
||||
CacheAccountActionPlans = "account_action_plans"
|
||||
CacheActionTriggers = "action_triggers"
|
||||
CacheSharedGroups = "shared_groups"
|
||||
CacheAliases = "aliases"
|
||||
CacheReverseAliases = "reverse_aliases"
|
||||
CacheDerivedChargers = "derived_chargers"
|
||||
CacheResources = "resources"
|
||||
CacheResourceProfiles = "resource_profiles"
|
||||
CacheTimings = "timings"
|
||||
Thresholds = "Thresholds"
|
||||
StatS = "stats"
|
||||
StatService = "StatS"
|
||||
RALService = "RALs"
|
||||
CostSource = "CostSource"
|
||||
ExtraInfo = "ExtraInfo"
|
||||
MetaPrefix = "*"
|
||||
CacheEventResources = "event_resources"
|
||||
CacheStatQueueProfiles = "statqueue_profiles"
|
||||
CacheStatQueues = "statqueues"
|
||||
EventResourcesPrefix = "ers_"
|
||||
MetaSysLog = "*syslog"
|
||||
MetaStdLog = "*stdout"
|
||||
MetaNever = "*never"
|
||||
EventType = "EventType"
|
||||
EventSource = "EventSource"
|
||||
AccountID = "AccountID"
|
||||
ResourceID = "ResourceID"
|
||||
TotalUsage = "TotalUsage"
|
||||
StatID = "StatID"
|
||||
BalanceType = "BalanceType"
|
||||
BalanceID = "BalanceID"
|
||||
Units = "Units"
|
||||
ResourceS = "ResourceS"
|
||||
CacheThresholdProfiles = "threshold_profiles"
|
||||
CacheThresholds = "thresholds"
|
||||
CacheFilters = "filters"
|
||||
CacheLCRProfiles = "lcr_profiles"
|
||||
AccountUpdate = "AccountUpdate"
|
||||
BalanceUpdate = "BalanceUpdate"
|
||||
StatUpdate = "StatUpdate"
|
||||
ResourceUpdate = "ResourceUpdate"
|
||||
CDR = "CDR"
|
||||
CDRs = "CDRs"
|
||||
ExpiryTime = "ExpiryTime"
|
||||
AllowNegative = "AllowNegative"
|
||||
Disabled = "Disabled"
|
||||
Action = "Action"
|
||||
ThresholdSv1ProcessEvent = "ThresholdSv1.ProcessEvent"
|
||||
ThresholdSv1GetThreshold = "ThresholdSv1.GetThreshold"
|
||||
ThresholdSv1GetThresholdIDs = "ThresholdSv1.GetThresholdIDs"
|
||||
StatSv1ProcessEvent = "StatSv1.ProcessEvent"
|
||||
StatSv1GetQueueIDs = "StatSv1.GetQueueIDs"
|
||||
StatSv1GetGetQueueStringMetrics = "StatSv1.GetQueueStringMetrics"
|
||||
ResourceSv1GetResourcesForEvent = "ResourceSv1.GetResourcesForEvent"
|
||||
ResourceSv1AllocateResource = "ResourceSv1.AllocateResource"
|
||||
ResourceSv1ReleaseResource = "ResourceSv1.ReleaseResource"
|
||||
ResourceSv1AllowUsage = "ResourceSv1.AllowUsage"
|
||||
MetaNow = "*now"
|
||||
TpRatingPlans = "TpRatingPlans"
|
||||
TpLcrs = "TpLcrs"
|
||||
TpFilters = "TpFilters"
|
||||
TpDestinationRates = "TpDestinationRates"
|
||||
TpActionTriggers = "TpActionTriggers"
|
||||
TpAccountActions = "TpAccountActions"
|
||||
TpActionPlans = "TpActionPlans"
|
||||
TpActions = "TpActions"
|
||||
TpDerivedCharges = "TpDerivedCharges"
|
||||
TpThresholds = "TpThresholds"
|
||||
TpStats = "TpStats"
|
||||
TpSharedGroups = "TpSharedGroups"
|
||||
TpRatingProfiles = "TpRatingProfiles"
|
||||
TpResources = "TpResources"
|
||||
TpRates = "TpRates"
|
||||
TpTiming = "TpTiming"
|
||||
TpResource = "TpResource"
|
||||
TpAliases = "TpAliases"
|
||||
TpUsers = "TpUsers"
|
||||
TpDerivedChargersV = "TpDerivedChargers"
|
||||
TpCdrStats = "TpCdrStats"
|
||||
TpDestinations = "TpDestinations"
|
||||
TpLCR = "TpLCR"
|
||||
TpRatingPlan = "TpRatingPlan"
|
||||
TpRatingProfile = "TpRatingProfile"
|
||||
Timing = "Timing"
|
||||
RQF = "RQF"
|
||||
Resource = "Resource"
|
||||
ReverseAlias = "ReverseAlias"
|
||||
Alias = "Alias"
|
||||
User = "User"
|
||||
Subscribers = "Subscribers"
|
||||
DerivedChargersV = "DerivedChargers"
|
||||
CdrStats = "CdrStats"
|
||||
Destinations = "Destinations"
|
||||
ReverseDestinations = "ReverseDestinations"
|
||||
LCR = "LCR"
|
||||
RatingPlan = "RatingPlan"
|
||||
RatingProfile = "RatingProfile"
|
||||
MetaRatingPlans = "*ratingplans"
|
||||
MetaRatingProfile = "*ratingprofile"
|
||||
MetaDestinations = "*destinations"
|
||||
MetaReverseDestinations = "*reversedestinations"
|
||||
MetaLCR = "*lcr"
|
||||
MetaCdrStats = "*cdrstats"
|
||||
MetaTiming = "*Timing"
|
||||
MetaRQF = "*RQF"
|
||||
MetaResource = "*Resource"
|
||||
MetaReverseAlias = "*ReverseAlias"
|
||||
MetaAlias = "*Alias"
|
||||
MetaUser = "*User"
|
||||
MetaSubscribers = "*Subscribers"
|
||||
MetaDerivedChargersV = "*DerivedChargers"
|
||||
MetaTpRatingPlans = "*TpRatingPlans"
|
||||
MetaTpLcrs = "*TpLcrs"
|
||||
MetaTpFilters = "*TpFilters"
|
||||
MetaTpDestinationRates = "*TpDestinationRates"
|
||||
MetaTpActionTriggers = "*TpActionTriggers"
|
||||
MetaTpAccountActions = "*TpAccountActions"
|
||||
MetaTpActionPlans = "*TpActionPlans"
|
||||
MetaTpActions = "*TpActions"
|
||||
MetaTpDerivedCharges = "*TpDerivedCharges"
|
||||
MetaTpThresholds = "*TpThresholds"
|
||||
MetaTpStats = "*TpStats"
|
||||
MetaTpSharedGroups = "*TpSharedGroups"
|
||||
MetaTpRatingProfiles = "*TpRatingProfiles"
|
||||
MetaTpResources = "*TpResources"
|
||||
MetaTpRates = "*TpRates"
|
||||
MetaTpTiming = "*TpTiming"
|
||||
MetaTpResource = "*TpResource"
|
||||
MetaTpAliases = "*TpAliases"
|
||||
MetaTpUsers = "*TpUsers"
|
||||
MetaTpDerivedChargersV = "*TpDerivedChargers"
|
||||
MetaTpCdrStats = "*TpCdrStats"
|
||||
MetaTpDestinations = "*TpDestinations"
|
||||
MetaTpLCR = "*TpLCR"
|
||||
MetaTpRatingPlan = "*TpRatingPlan"
|
||||
MetaTpRatingProfile = "*TpRatingProfile"
|
||||
MetaStorDB = "*StorDB"
|
||||
MetaDataDB = "*DataDB"
|
||||
SMGenericV2UpdateSession = "SMGenericV2.UpdateSession"
|
||||
SMGenericV2InitiateSession = "SMGenericV2.InitiateSession"
|
||||
SMGenericV1UpdateSession = "SMGenericV1.UpdateSession"
|
||||
SMGenericV1InitiateSession = "SMGenericV1.InitiateSession"
|
||||
)
|
||||
|
||||
//Meta
|
||||
|
||||
Reference in New Issue
Block a user