Updated call tests

This commit is contained in:
Trial97
2020-05-21 16:57:36 +03:00
committed by Dan Christian Bogos
parent 3b37712d24
commit e6834e1b78
19 changed files with 34 additions and 27 deletions

View File

@@ -321,7 +321,10 @@ func (sma *AsteriskAgent) handleChannelDestroyed(ev *SMAsteriskEvent) {
if sma.cgrCfg.AsteriskAgentCfg().CreateCDR {
if err := sma.connMgr.Call(sma.cgrCfg.AsteriskAgentCfg().SessionSConns, sma,
utils.SessionSv1ProcessCDR,
cgrEvDisp, &reply); err != nil {
&utils.CGREventWithArgDispatcher{
CGREvent: cgrEvDisp.CGREvent,
ArgDispatcher: cgrEvDisp.ArgDispatcher,
}, &reply); err != nil {
utils.Logger.Err(fmt.Sprintf("<%s> Error: %s when attempting to process CDR for channelID: %s",
utils.AsteriskAgent, err.Error(), ev.ChannelID()))
}

File diff suppressed because one or more lines are too long

View File

@@ -128,8 +128,8 @@
],
},
{
"type": "*suppliers", // data source type
"file_name": "Suppliers.csv", // file name in the tp_in_dir
"type": "*routes", // data source type
"file_name": "Routes.csv", // file name in the tp_in_dir
"fields": [
{"tag": "Tenant", "path": "Tenant", "type": "*variable", "value": "~0", "mandatory": true},
{"tag": "ID", "path": "ID", "type": "*variable", "value": "~1", "mandatory": true},

View File

@@ -2,7 +2,7 @@
exten => _1XXX,1,NoOp()
same => n,Set(CGRMaxSessionTime=0); use it to disconnect automatically the call if CGRateS is not active
same => n,DumpChan()
same => n,Stasis(cgrates_auth,cgr_reqtype=*prepaid,cgr_supplier=supplier1,"cgr_flags=*accounts,*attributes,*resources,*stats,*suppliers,*thresholds")
same => n,Stasis(cgrates_auth,cgr_reqtype=*prepaid,cgr_supplier=supplier1,"cgr_flags=*accounts,*attributes,*resources,*stats,*routes,*thresholds")
same => n,Dial(PJSIP/${EXTEN},30,L(${CGRMaxSessionTime}))
same => n,Hangup()

View File

@@ -103,6 +103,7 @@
"enabled": true,
"resources_conns": ["*internal"],
"stats_conns": ["*internal"],
"rals_conns": ["*internal"],
"string_indexed_fields": ["Account"],
},

View File

@@ -101,6 +101,7 @@
"enabled": true,
"resources_conns": ["*internal"],
"stats_conns": ["*internal"],
"rals_conns": ["*internal"],
"string_indexed_fields": ["Account"],
},

View File

@@ -113,7 +113,7 @@ route[CGRATES_SESSIONAUTH_REQUEST] {
evapi_async_relay("{\"event\":\"CGR_AUTH_REQUEST\",
\"tr_index\":\"$T(id_index)\",
\"tr_label\":\"$T(id_label)\",
\"cgr_flags\":\"*attributes,*accounts,*suppliers,*resources,*thresholds\",
\"cgr_flags\":\"*attributes,*accounts,*routes,*resources,*thresholds\",
\"reply_route\":\"CGR_SESSIONAUTH_REPLY\",
\"Account\":\"$fU\",
\"Destination\":\"$rU\",

View File

@@ -2,7 +2,7 @@
exten => _1XXX,1,NoOp()
same => n,Set(CGRMaxSessionTime=0); use it to disconnect automatically the call if CGRateS is not active
same => n,DumpChan()
same => n,Stasis(cgrates_auth,cgr_reqtype=*prepaid,cgr_supplier=supplier1,"cgr_flags=*accounts,*attributes,*resources,*stats,*suppliers,*thresholds")
same => n,Stasis(cgrates_auth,cgr_reqtype=*prepaid,cgr_supplier=supplier1,"cgr_flags=*accounts,*attributes,*resources,*stats,*routes,*thresholds")
same => n,Dial(PJSIP/${EXTEN},30,L(${CGRMaxSessionTime}))
same => n,Hangup()

View File

@@ -102,6 +102,7 @@
"enabled": true,
"resources_conns": ["*internal"],
"stats_conns": ["*internal"],
"rals_conns": ["*internal"],
"string_indexed_fields": ["Account"],
},

View File

@@ -101,6 +101,7 @@
"enabled": true,
"resources_conns": ["*internal"],
"stats_conns": ["*internal"],
"rals_conns": ["*internal"],
"string_indexed_fields": ["Account"],
},

View File

@@ -113,7 +113,7 @@ route[CGRATES_SESSIONAUTH_REQUEST] {
evapi_async_relay("{\"event\":\"CGR_AUTH_REQUEST\",
\"tr_index\":\"$T(id_index)\",
\"tr_label\":\"$T(id_label)\",
\"cgr_flags\":\"*attributes,*accounts,*suppliers,*resources,*thresholds\",
\"cgr_flags\":\"*attributes,*accounts,*routes,*resources,*thresholds\",
\"reply_route\":\"CGR_SESSIONAUTH_REPLY\",
\"Account\":\"$fU\",
\"Destination\":\"$rU\",

View File

@@ -364,7 +364,7 @@ flags
**\*auth**
Sends the request for authorization on CGRateS.
Auxiliary flags available: **\*attributes**, **\*thresholds**, **\*stats**, **\*resources**, **\*accounts**, **\*suppliers**, **\*suppliers_ignore_errors**, **\*suppliers_event_cost** which are used to influence the auth behavior on CGRateS side. More info on that can be found on the **SessionS** component's API behavior.
Auxiliary flags available: **\*attributes**, **\*thresholds**, **\*stats**, **\*resources**, **\*accounts**, **\*routes**, **\*routes_ignore_errors**, **\*routes_event_cost** which are used to influence the auth behavior on CGRateS side. More info on that can be found on the **SessionS** component's API behavior.
**\*initiate**
Initiates a session out of request on CGRateS side.
@@ -384,7 +384,7 @@ flags
**\*message**
Process the request as individual message charging on CGRateS side.
Auxiliary flags available: **\*attributes**, **\*thresholds**, **\*stats**, **\*resources**, **\*accounts**, **\*suppliers**, **\*suppliers_ignore_errors**, **\*suppliers_event_cost** which are used to influence the behavior on CGRateS side.
Auxiliary flags available: **\*attributes**, **\*thresholds**, **\*stats**, **\*resources**, **\*accounts**, **\*routes**, **\*routes_ignore_errors**, **\*routes_event_cost** which are used to influence the behavior on CGRateS side.
**\*event**

View File

@@ -214,7 +214,7 @@ flags
**\*auth**
Sends the Event for authorization on CGRateS.
Auxiliary flags available: **\*attributes**, **\*thresholds**, **\*stats**, **\*resources**, **\*accounts**, **\*suppliers**, **\*suppliers_ignore_errors**, **\*suppliers_event_cost** which are used to influence the auth behavior on CGRateS side. More info on that can be found on the **SessionS** component's API behavior.
Auxiliary flags available: **\*attributes**, **\*thresholds**, **\*stats**, **\*resources**, **\*accounts**, **\*routes**, **\*routes_ignore_errors**, **\*routes_event_cost** which are used to influence the auth behavior on CGRateS side. More info on that can be found on the **SessionS** component's API behavior.
**\*initiate**
Initiates a session out of Event on CGRateS side.
@@ -234,7 +234,7 @@ flags
**\*message**
Process the Event as individual message charging on CGRateS side.
Auxiliary flags available: **\*attributes**, **\*thresholds**, **\*stats**, **\*resources**, **\*accounts**, **\*suppliers**, **\*suppliers_ignore_errors**, **\*suppliers_event_cost** which are used to influence the behavior on CGRateS side.
Auxiliary flags available: **\*attributes**, **\*thresholds**, **\*stats**, **\*resources**, **\*accounts**, **\*routes**, **\*routes_ignore_errors**, **\*routes_event_cost** which are used to influence the behavior on CGRateS side.
**\*event**
Process the Event as generic event on CGRateS side.

View File

@@ -341,14 +341,14 @@ Instead of arguments, the options for enabling various functionaity will come in
**\*terminate**
Terminate a session (or initialize + terminate) out of event.
\*suppliers
\*routes
Process the event with :ref:`Suppliers`. Auxiliary flags available:
**\*ignore_errors**
Ignore the suppliers with errors instead of failing the request completely.
Ignore the routes with errors instead of failing the request completely.
**\*event_cost**
Ignore suppliers with cost higher than the event cost.
Ignore routes with cost higher than the event cost.
\*thresholds
Process the event with :ref:`ThresholdS` for monitoring.

View File

@@ -52,7 +52,7 @@ SupplierS
**SupplierS** is the **CGRateS** component responsible for handling the *SupplierProfiles*.
It is configured within **suppliers** section from :ref:`JSON configuration <configuration>` via the following parameters:
It is configured within **routes** section from :ref:`JSON configuration <configuration>` via the following parameters:
enabled
Will enable starting of the service. Possible values: <true|false>.

View File

@@ -610,7 +610,7 @@ func testCallStatMetrics(t *testing.T) {
if err := tutorialCallsRpc.Call(utils.StatSv1GetQueueStringMetrics,
&utils.TenantID{Tenant: "cgrates.org", ID: "Stats2"}, &metrics); err != nil {
t.Error(err)
t.Fatal(err)
}
if optConf == utils.Asterisk {
metrics[utils.MetaTCD] = strings.Split(metrics[utils.MetaTCD], ".")[0] + "s"

View File

@@ -361,16 +361,16 @@ func TestCGREventconsumeRoutePaginator(t *testing.T) {
if err != nil {
t.Error(err)
}
//check if *suppliers_limit and *suppliers_offset was deleted
//check if *routes_limit and *routes_offset was deleted
if _, has := opts[RoutesLimit]; has {
t.Errorf("*suppliers_limit wasn't deleted")
t.Errorf("*routes_limit wasn't deleted")
} else if _, has := opts[RoutesOffset]; has {
t.Errorf("*suppliers_offset wasn't deleted")
t.Errorf("*routes_offset wasn't deleted")
}
if !reflect.DeepEqual(eOut, rcv) {
t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
}
//check without *suppliers_limit, but with *suppliers_offset
//check without *routes_limit, but with *routes_offset
opts = map[string]interface{}{
RoutesOffset: 20,
}
@@ -382,16 +382,16 @@ func TestCGREventconsumeRoutePaginator(t *testing.T) {
if err != nil {
t.Error(err)
}
//check if *suppliers_limit and *suppliers_offset was deleted
//check if *routes_limit and *routes_offset was deleted
if _, has := opts[RoutesLimit]; has {
t.Errorf("*suppliers_limit wasn't deleted")
t.Errorf("*routes_limit wasn't deleted")
} else if _, has := opts[RoutesOffset]; has {
t.Errorf("*suppliers_offset wasn't deleted")
t.Errorf("*routes_offset wasn't deleted")
}
if !reflect.DeepEqual(eOut, rcv) {
t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
}
//check with notAnInt at *suppliers_limit
//check with notAnInt at *routes_limit
opts = map[string]interface{}{
RoutesLimit: "Not an int",
}
@@ -403,7 +403,7 @@ func TestCGREventconsumeRoutePaginator(t *testing.T) {
if !reflect.DeepEqual(eOut, rcv) {
t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
}
//check with notAnInt at and *suppliers_offset
//check with notAnInt at and *routes_offset
opts = map[string]interface{}{
RoutesOffset: "Not an int",
}