RadAgent sample config updated with *usage_seconds converter, tests in rsrfield

This commit is contained in:
DanB
2018-03-18 19:43:19 +01:00
parent 76f722eef9
commit 1feda9c504
3 changed files with 12 additions and 2 deletions

View File

@@ -116,7 +116,7 @@
],
"reply_fields":[
{"tag": "MaxUsage", "field_id": "SIP-AVP", "type": "*composed",
"value": "^session_max_time#;~*cgrReply>MaxUsage:s/(\\d*)\\d{9}$/$1/", "mandatory": true},
"value": "^session_max_time#;*cgrReply>MaxUsage{*usage_seconds}", "mandatory": true},
],
},
{

View File

@@ -2253,7 +2253,6 @@ func (ms *MongoStorage) SetThresholdProfileDrv(tp *ThresholdProfile) (err error)
func (ms *MongoStorage) RemThresholdProfileDrv(tenant, id string) (err error) {
session, col := ms.conn(colTps)
defer session.Close()
utils.Logger.Debug(fmt.Sprintf("dbKey %+v", session))
err = col.Remove(bson.M{"tenant": tenant, "id": id})
if err != nil {
return err

View File

@@ -503,4 +503,15 @@ func TestRSRFldParse(t *testing.T) {
} else if out != eOut {
t.Errorf("expecting: %s, received: %s", eOut, out)
}
rulesStr = `Usage{*usage_seconds}`
rsrField, err = NewRSRField(rulesStr)
if err != nil {
t.Error(err)
}
eOut = "10"
if out, err := rsrField.Parse("10000000000"); err != nil {
t.Error(err)
} else if out != eOut {
t.Errorf("expecting: %s, received: %s", eOut, out)
}
}