mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Updated SipAgent template
This commit is contained in:
committed by
Dan Christian Bogos
parent
24b2206a2a
commit
c5b472c93a
@@ -183,7 +183,7 @@ func testSAitSIPInvite(t *testing.T) {
|
||||
if expected := "SIP/2.0 302 Moved Temporarily"; recived["Request"] != expected {
|
||||
t.Errorf("Expected %q, received: %q", expected, recived["Request"])
|
||||
}
|
||||
if expected := "\"1002\" <sip:1002@cgrates.org>;q=0.7; expires=3600,\"1002\" <sip:1002@cgrates.net>;q=0.1"; recived["Contact"] != expected {
|
||||
if expected := "\"1002\" <sip:1002@cgrates.org>;q=0.7; expires=3600;cgr_cost=0.3;cgr_maxusage=60000000000,\"1002\" <sip:1002@cgrates.net>;q=0.2;cgr_cost=0.6;cgr_maxusage=60000000000,\"1002\" <sip:1002@cgrates.com>;q=0.1;cgr_cost=0.01;cgr_maxusage=60000000000"; recived["Contact"] != expected {
|
||||
t.Errorf("Expected %q, received: %q", expected, recived["Contact"])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "NAPTRRoutesQuery",
|
||||
"id": "RoutesQuery",
|
||||
"filters": ["*string:~*vars.Method:INVITE"],
|
||||
"flags": ["*event", "*routes","*continue"],
|
||||
"request_fields":[
|
||||
@@ -30,10 +30,9 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "NAPTRSuppliersOneSupplier",
|
||||
"id": "RoutesQueryOneRoute",
|
||||
"filters": ["*string:~*vars.Method:INVITE",
|
||||
"*gte:~*cgrep.Routes.Count:1",
|
||||
"*gte:~*cgrep.Routes.SortedRoutes[0].SortingData.Cost:0.1",
|
||||
],
|
||||
"flags": ["*none","*continue"], // do not send request to CGRateS
|
||||
"reply_fields":[
|
||||
@@ -52,14 +51,19 @@
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value": "~*cgrep.Routes.SortedRoutes[0].RouteParameters"},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"*constant:>;q=0.7; expires=3600"}
|
||||
"value":"*constant:>;q=0.7; expires=3600;cgr_cost="},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"~*cgrep.Routes.SortedRoutes[0].SortingData.Cost"},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"*constant:;cgr_maxusage="},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"~*cgrep.Routes.SortedRoutes[0].SortingData.MaxUsage"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "NAPTRSuppliersTwoSuppliers",
|
||||
"id": "RoutesQueryTwoRoutes",
|
||||
"filters": ["*string:~*vars.Method:INVITE",
|
||||
"*gte:~*cgrep.Routes.Count:2",
|
||||
"*gte:~*cgrep.Routes.SortedRoutes[1].SortingData.Cost:0.1",
|
||||
],
|
||||
"flags": ["*none","*continue"],
|
||||
"reply_fields":[
|
||||
@@ -76,14 +80,19 @@
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value": "~*cgrep.Routes.SortedRoutes[1].RouteParameters"},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"*constant:>;q=0.1"}
|
||||
"value":"*constant:>;q=0.2;cgr_cost="},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"~*cgrep.Routes.SortedRoutes[1].SortingData.Cost"},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"*constant:;cgr_maxusage="},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"~*cgrep.Routes.SortedRoutes[1].SortingData.MaxUsage"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "NAPTRSuppliersThreeSuppliers",
|
||||
"id": "RoutesQueryThreeRoutes",
|
||||
"filters": ["*string:~*vars.Method:INVITE",
|
||||
"*gte:~*cgrep.Routes.Count:3",
|
||||
"*gte:~*cgrep.Routes.SortedRoutes[2].SortingData.Cost:0.1",
|
||||
],
|
||||
"flags": ["*none","*continue"],
|
||||
"reply_fields":[
|
||||
@@ -98,9 +107,15 @@
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"@"},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value": "~*cgrep.Routes.SortedRoutes[2].RouteParameters"},
|
||||
"value": "~*cgrep.Routes.SortedRoutes[2].RouteParameters"},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"*constant:>;q=0.1"}
|
||||
"value":"*constant:>;q=0.1;cgr_cost="},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"~*cgrep.Routes.SortedRoutes[2].SortingData.Cost"},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"*constant:;cgr_maxusage="},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"~*cgrep.Routes.SortedRoutes[2].SortingData.MaxUsage"}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "NAPTRRoutesQuery",
|
||||
"id": "RoutesQuery",
|
||||
"filters": ["*string:~*vars.Method:INVITE"],
|
||||
"flags": ["*event", "*routes","*continue"],
|
||||
"request_fields":[
|
||||
@@ -30,10 +30,9 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "NAPTRSuppliersOneSupplier",
|
||||
"id": "RoutesQueryOneRoute",
|
||||
"filters": ["*string:~*vars.Method:INVITE",
|
||||
"*gte:~*cgrep.Routes.Count:1",
|
||||
"*gte:~*cgrep.Routes.SortedRoutes[0].SortingData.Cost:0.1",
|
||||
],
|
||||
"flags": ["*none","*continue"], // do not send request to CGRateS
|
||||
"reply_fields":[
|
||||
@@ -52,14 +51,19 @@
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value": "~*cgrep.Routes.SortedRoutes[0].RouteParameters"},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"*constant:>;q=0.7; expires=3600"}
|
||||
"value":"*constant:>;q=0.7; expires=3600;cgr_cost="},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"~*cgrep.Routes.SortedRoutes[0].SortingData.Cost"},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"*constant:;cgr_maxusage="},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"~*cgrep.Routes.SortedRoutes[0].SortingData.MaxUsage"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "NAPTRSuppliersTwoSuppliers",
|
||||
"id": "RoutesQueryTwoRoutes",
|
||||
"filters": ["*string:~*vars.Method:INVITE",
|
||||
"*gte:~*cgrep.Routes.Count:2",
|
||||
"*gte:~*cgrep.Routes.SortedRoutes[1].SortingData.Cost:0.1",
|
||||
],
|
||||
"flags": ["*none","*continue"],
|
||||
"reply_fields":[
|
||||
@@ -76,14 +80,19 @@
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value": "~*cgrep.Routes.SortedRoutes[1].RouteParameters"},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"*constant:>;q=0.1"}
|
||||
"value":"*constant:>;q=0.2;cgr_cost="},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"~*cgrep.Routes.SortedRoutes[1].SortingData.Cost"},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"*constant:;cgr_maxusage="},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"~*cgrep.Routes.SortedRoutes[1].SortingData.MaxUsage"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "NAPTRSuppliersThreeSuppliers",
|
||||
"id": "RoutesQueryThreeRoutes",
|
||||
"filters": ["*string:~*vars.Method:INVITE",
|
||||
"*gte:~*cgrep.Routes.Count:3",
|
||||
"*gte:~*cgrep.Routes.SortedRoutes[2].SortingData.Cost:0.1",
|
||||
],
|
||||
"flags": ["*none","*continue"],
|
||||
"reply_fields":[
|
||||
@@ -98,9 +107,15 @@
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"@"},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value": "~*cgrep.Routes.SortedRoutes[2].RouteParameters"},
|
||||
"value": "~*cgrep.Routes.SortedRoutes[2].RouteParameters"},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"*constant:>;q=0.1"}
|
||||
"value":"*constant:>;q=0.1;cgr_cost="},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"~*cgrep.Routes.SortedRoutes[2].SortingData.Cost"},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"*constant:;cgr_maxusage="},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"~*cgrep.Routes.SortedRoutes[2].SortingData.MaxUsage"}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "NAPTRRoutesQuery",
|
||||
"id": "RoutesQuery",
|
||||
"filters": ["*string:~*vars.Method:INVITE"],
|
||||
"flags": ["*event", "*routes","*continue"],
|
||||
"request_fields":[
|
||||
@@ -30,10 +30,9 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "NAPTRSuppliersOneSupplier",
|
||||
"id": "RoutesQueryOneRoute",
|
||||
"filters": ["*string:~*vars.Method:INVITE",
|
||||
"*gte:~*cgrep.Routes.Count:1",
|
||||
"*gte:~*cgrep.Routes.SortedRoutes[0].SortingData.Cost:0.1",
|
||||
],
|
||||
"flags": ["*none","*continue"], // do not send request to CGRateS
|
||||
"reply_fields":[
|
||||
@@ -52,14 +51,19 @@
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value": "~*cgrep.Routes.SortedRoutes[0].RouteParameters"},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"*constant:>;q=0.7; expires=3600"}
|
||||
"value":"*constant:>;q=0.7; expires=3600;cgr_cost="},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"~*cgrep.Routes.SortedRoutes[0].SortingData.Cost"},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"*constant:;cgr_maxusage="},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"~*cgrep.Routes.SortedRoutes[0].SortingData.MaxUsage"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "NAPTRSuppliersTwoSuppliers",
|
||||
"id": "RoutesQueryTwoRoutes",
|
||||
"filters": ["*string:~*vars.Method:INVITE",
|
||||
"*gte:~*cgrep.Routes.Count:2",
|
||||
"*gte:~*cgrep.Routes.SortedRoutes[1].SortingData.Cost:0.1",
|
||||
],
|
||||
"flags": ["*none","*continue"],
|
||||
"reply_fields":[
|
||||
@@ -76,14 +80,19 @@
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value": "~*cgrep.Routes.SortedRoutes[1].RouteParameters"},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"*constant:>;q=0.1"}
|
||||
"value":"*constant:>;q=0.2;cgr_cost="},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"~*cgrep.Routes.SortedRoutes[1].SortingData.Cost"},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"*constant:;cgr_maxusage="},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"~*cgrep.Routes.SortedRoutes[1].SortingData.MaxUsage"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "NAPTRSuppliersThreeSuppliers",
|
||||
"id": "RoutesQueryThreeRoutes",
|
||||
"filters": ["*string:~*vars.Method:INVITE",
|
||||
"*gte:~*cgrep.Routes.Count:3",
|
||||
"*gte:~*cgrep.Routes.SortedRoutes[2].SortingData.Cost:0.1",
|
||||
],
|
||||
"flags": ["*none","*continue"],
|
||||
"reply_fields":[
|
||||
@@ -98,9 +107,15 @@
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"@"},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value": "~*cgrep.Routes.SortedRoutes[2].RouteParameters"},
|
||||
"value": "~*cgrep.Routes.SortedRoutes[2].RouteParameters"},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"*constant:>;q=0.1"}
|
||||
"value":"*constant:>;q=0.1;cgr_cost="},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"~*cgrep.Routes.SortedRoutes[2].SortingData.Cost"},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"*constant:;cgr_maxusage="},
|
||||
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
|
||||
"value":"~*cgrep.Routes.SortedRoutes[2].SortingData.MaxUsage"}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
2
data/tariffplans/sipagent/AccountActions.csv
Normal file
2
data/tariffplans/sipagent/AccountActions.csv
Normal file
@@ -0,0 +1,2 @@
|
||||
#Tenant,Account,ActionPlanId,ActionTriggersId,AllowNegative,Disabled
|
||||
cgrates.org,1001,AP_PACKAGE_10,,,
|
||||
|
2
data/tariffplans/sipagent/ActionPlans.csv
Normal file
2
data/tariffplans/sipagent/ActionPlans.csv
Normal file
@@ -0,0 +1,2 @@
|
||||
#Id,ActionsId,TimingId,Weight
|
||||
AP_PACKAGE_10,ACT_TOPUP_RST_10,*asap,10
|
||||
|
2
data/tariffplans/sipagent/Actions.csv
Normal file
2
data/tariffplans/sipagent/Actions.csv
Normal file
@@ -0,0 +1,2 @@
|
||||
#ActionsId[0],Action[1],ExtraParameters[2],Filter[3],BalanceId[4],BalanceType[5],Categories[6],DestinationIds[7],RatingSubject[8],SharedGroup[9],ExpiryTime[10],TimingIds[11],Units[12],BalanceWeight[13],BalanceBlocker[14],BalanceDisabled[15],Weight[16]
|
||||
ACT_TOPUP_RST_10,*topup_reset,,,test,*monetary,,*any,,,*unlimited,,10,10,false,false,10
|
||||
|
4
data/tariffplans/sipagent/RatingProfiles.csv
Normal file
4
data/tariffplans/sipagent/RatingProfiles.csv
Normal file
@@ -0,0 +1,4 @@
|
||||
#Tenant,Category,Subject,ActivationTime,RatingPlanId,RatesFallbackSubject
|
||||
cgrates.org,*routes,1001,2014-01-14T00:00:00Z,RP_10CNT,
|
||||
cgrates.org,*routes,1002,2014-01-14T00:00:00Z,RP_10CNT,
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#Tenant,ID,FilterIDs,ActivationInterval,Sorting,SortingParameters,RouteID,RouteFilterIDs,RouteAccountIDs,RouteRatingPlanIDs,RouteResourceIDs,RouteStatIDs,RouteWeight,RouteBlocker,RouteParameters,Weight
|
||||
cgrates.org,SPL_ACNT_1001,*string:~*req.Account:1001,2017-11-27T00:00:00Z,*weight,,supplier1,,,RP_10CNT,,,20,,cgrates.org,20
|
||||
cgrates.org,SPL_ACNT_1001,,,,,supplier2,,,RP_20CNT,,,10,,cgrates.net,10
|
||||
cgrates.org,SPL_ACNT_1001,,,,,supplier3,,,RP_1CNT,,,5,,cgrates.com,5
|
||||
cgrates.org,SPL_ACNT_1001,*string:~*req.Account:1001,2017-11-27T00:00:00Z,*weight,,supplier1,,1001,RP_10CNT,,,20,,cgrates.org,20
|
||||
cgrates.org,SPL_ACNT_1001,,,,,supplier2,,1001,RP_20CNT,,,10,,cgrates.net,10
|
||||
cgrates.org,SPL_ACNT_1001,,,,,supplier3,,1001,RP_1CNT,,,5,,cgrates.com,5
|
||||
|
||||
|
||||
|
@@ -332,8 +332,9 @@ func (rs *Responder) GetMaxSessionTimeOnAccounts(arg *utils.GetMaxSessionTimeOnA
|
||||
utils.Responder, anctID, err.Error()))
|
||||
} else if maxDur >= arg.Usage {
|
||||
*reply = map[string]interface{}{
|
||||
utils.Cost: 0.0,
|
||||
utils.Account: anctID,
|
||||
utils.CapMaxUsage: maxDur,
|
||||
utils.Cost: 0.0,
|
||||
utils.Account: anctID,
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ func (rpS *RouteService) costForEvent(ev *utils.CGREvent,
|
||||
if acnt, err = ev.FieldAsString(utils.Account); err != nil {
|
||||
return
|
||||
}
|
||||
if subj, err = ev.FieldAsString(utils.Account); err != nil {
|
||||
if subj, err = ev.FieldAsString(utils.Subject); err != nil {
|
||||
if err != utils.ErrNotFound {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user