diff --git a/apier/v1/cdrstatsv1.go b/apier/v1/cdrstatsv1.go
index adea8e0b1..428fda287 100644
--- a/apier/v1/cdrstatsv1.go
+++ b/apier/v1/cdrstatsv1.go
@@ -45,6 +45,14 @@ func (sts *CDRStatsV1) GetQueueIds(empty string, reply *[]string) error {
return sts.CdrStats.GetQueueIds(0, reply)
}
+func (sts *CDRStatsV1) GetQueue(id string, sq *engine.StatsQueue) error {
+ return sts.CdrStats.GetQueue(id, sq)
+}
+
+func (sts *CDRStatsV1) GetQueueTriggers(id string, ats *engine.ActionTriggerPriotityList) error {
+ return sts.CdrStats.GetQueueTriggers(id, ats)
+}
+
func (sts *CDRStatsV1) ReloadQueues(attr utils.AttrCDRStatsReloadQueues, reply *string) error {
if err := sts.CdrStats.ReloadQueues(attr.StatsQueueIds, nil); err != nil {
return err
diff --git a/console/cdrstats_queue.go b/console/cdrstats_queue.go
new file mode 100644
index 000000000..261315335
--- /dev/null
+++ b/console/cdrstats_queue.go
@@ -0,0 +1,63 @@
+/*
+Rating system designed to be used in VoIP Carriers World
+Copyright (C) 2012-2015 ITsysCOM
+
+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
+*/
+
+package console
+
+import "github.com/cgrates/cgrates/engine"
+
+func init() {
+ c := &CmdCdrStatsQueue{
+ name: "cdrstats_queue",
+ rpcMethod: "CDRStatsV1.GetQueue",
+ }
+ commands[c.Name()] = c
+ c.CommandExecuter = &CommandExecuter{c}
+}
+
+type CmdCdrStatsQueue struct {
+ name string
+ rpcMethod string
+ rpcParams *StringWrapper
+ *CommandExecuter
+}
+
+func (self *CmdCdrStatsQueue) Name() string {
+ return self.name
+}
+
+func (self *CmdCdrStatsQueue) RpcMethod() string {
+ return self.rpcMethod
+}
+
+func (self *CmdCdrStatsQueue) RpcParams(ptr bool) interface{} {
+ if self.rpcParams == nil {
+ self.rpcParams = &StringWrapper{}
+ }
+ if ptr {
+ return self.rpcParams
+ }
+ return *self.rpcParams
+}
+
+func (self *CmdCdrStatsQueue) PostprocessRpcParams() error {
+ return nil
+}
+
+func (self *CmdCdrStatsQueue) RpcResult() interface{} {
+ return &engine.StatsQueue{}
+}
diff --git a/console/cdrstats_queue_triggers.go b/console/cdrstats_queue_triggers.go
new file mode 100644
index 000000000..e9f4cafd5
--- /dev/null
+++ b/console/cdrstats_queue_triggers.go
@@ -0,0 +1,63 @@
+/*
+Rating system designed to be used in VoIP Carriers World
+Copyright (C) 2012-2015 ITsysCOM
+
+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
+*/
+
+package console
+
+import "github.com/cgrates/cgrates/engine"
+
+func init() {
+ c := &CmdCdrStatsQueueTriggers{
+ name: "cdrstats_queue_triggers",
+ rpcMethod: "CDRStatsV1.GetQueueTriggers",
+ }
+ commands[c.Name()] = c
+ c.CommandExecuter = &CommandExecuter{c}
+}
+
+type CmdCdrStatsQueueTriggers struct {
+ name string
+ rpcMethod string
+ rpcParams *StringWrapper
+ *CommandExecuter
+}
+
+func (self *CmdCdrStatsQueueTriggers) Name() string {
+ return self.name
+}
+
+func (self *CmdCdrStatsQueueTriggers) RpcMethod() string {
+ return self.rpcMethod
+}
+
+func (self *CmdCdrStatsQueueTriggers) RpcParams(ptr bool) interface{} {
+ if self.rpcParams == nil {
+ self.rpcParams = &StringWrapper{}
+ }
+ if ptr {
+ return self.rpcParams
+ }
+ return *self.rpcParams
+}
+
+func (self *CmdCdrStatsQueueTriggers) PostprocessRpcParams() error {
+ return nil
+}
+
+func (self *CmdCdrStatsQueueTriggers) RpcResult() interface{} {
+ return &engine.ActionTriggerPriotityList{}
+}
diff --git a/data/conf/samples/cdrstats/cdrstats.json b/data/conf/samples/cdrstats/cdrstats.json
index 31e2ee7e9..adc9b3b4f 100644
--- a/data/conf/samples/cdrstats/cdrstats.json
+++ b/data/conf/samples/cdrstats/cdrstats.json
@@ -4,6 +4,12 @@
// Used in apier_local_tests
// Starts rater, cdrs and mediator connecting over internal channel
+"listen": {
+ "rpc_json": ":2012", // RPC JSON listening address
+ "rpc_gob": ":2013", // RPC GOB listening address
+ "http": ":2080", // HTTP listening address
+},
+
"rater": {
"enabled": true, // enable Rater service:
},
diff --git a/engine/rateinterval.go b/engine/rateinterval.go
index 378b5ff13..37d5d2f94 100644
--- a/engine/rateinterval.go
+++ b/engine/rateinterval.go
@@ -118,7 +118,6 @@ func (rit *RITiming) CronString() string {
// Returns wheter the Timing is active at the specified time
func (rit *RITiming) IsActiveAt(t time.Time, endTime bool) bool {
- t = t.In(time.UTC) // compare with UTC
// if the received time represents an endtime consider it 24 instead of 0
hour := t.Hour()
if endTime && hour == 0 {
diff --git a/engine/stats.go b/engine/stats.go
index 2e9ba38b2..97eebe32d 100644
--- a/engine/stats.go
+++ b/engine/stats.go
@@ -30,6 +30,8 @@ import (
type StatsInterface interface {
GetValues(string, *map[string]float64) error
GetQueueIds(int, *[]string) error
+ GetQueue(string, *StatsQueue) error
+ GetQueueTriggers(string, *ActionTriggerPriotityList) error
AppendCDR(*StoredCdr, *int) error
AddQueue(*CdrStats, *int) error
ReloadQueues([]string, *int) error
@@ -101,6 +103,32 @@ func (s *Stats) GetQueueIds(in int, ids *[]string) error {
return nil
}
+func (s *Stats) GetQueue(id string, sq *StatsQueue) error {
+ s.mux.Lock()
+ defer s.mux.Unlock()
+ q, found := s.queues[id]
+ if !found {
+ return utils.ErrNotFound
+ }
+ *sq = *q
+ return nil
+}
+
+func (s *Stats) GetQueueTriggers(id string, ats *ActionTriggerPriotityList) error {
+ s.mux.Lock()
+ defer s.mux.Unlock()
+ q, found := s.queues[id]
+ if !found {
+ return utils.ErrNotFound
+ }
+ if q.conf.Triggers != nil {
+ *ats = q.conf.Triggers
+ } else {
+ *ats = ActionTriggerPriotityList{}
+ }
+ return nil
+}
+
func (s *Stats) GetValues(sqID string, values *map[string]float64) error {
s.mux.RLock()
defer s.mux.RUnlock()
@@ -282,6 +310,14 @@ func (ps *ProxyStats) GetQueueIds(in int, ids *[]string) error {
return ps.Client.Call("Stats.GetQueueIds", in, ids)
}
+func (ps *ProxyStats) GetQueue(id string, sq *StatsQueue) error {
+ return ps.Client.Call("Stats.GetQueue", id, sq)
+}
+
+func (ps *ProxyStats) GetQueueTriggers(id string, ats *ActionTriggerPriotityList) error {
+ return ps.Client.Call("Stats.GetQueueTriggers", id, ats)
+}
+
func (ps *ProxyStats) AddQueue(cs *CdrStats, out *int) error {
return ps.Client.Call("Stats.AddQueue", cs, out)
}
diff --git a/general_tests/datachrg1_test.go b/general_tests/datachrg1_test.go
index 0fdf49216..b2ac3a2b0 100644
--- a/general_tests/datachrg1_test.go
+++ b/general_tests/datachrg1_test.go
@@ -135,6 +135,9 @@ func TestGetDataBetweenCostDtChrg1(t *testing.T) {
t.Error(err)
} else if cc.Cost != 0.004 {
//t.Logf("%+v", cc.Timespans[1].RateInterval.Timing)
+ for _, ts := range cc.Timespans {
+ t.Logf("TS: %+v", ts)
+ }
t.Error("Wrong cost returned: ", cc.Cost)
}
}