Merge fixes

This commit is contained in:
DanB
2017-11-21 19:27:55 +01:00
153 changed files with 3691 additions and 3646 deletions

View File

@@ -111,7 +111,6 @@
// "enabled": false, // start the CDR Server service: <true|false>
// "extra_fields": [], // extra fields to store in CDRs for non-generic CDRs
// "store_cdrs": true, // store cdrs in storDb
// "cdr_account_summary": false, // add account information from dataDB
// "sm_cost_retries": 5, // number of queries to sm_costs before recalculating CDR
// "rals_conns": [
// {"address": "*internal"} // address where to reach the Rater for cost calculation, empty to disable functionality: <""|*internal|x.y.z.y:1234>

View File

@@ -4,6 +4,10 @@
// Used for cgradmin
// Starts rater, scheduler
"general": {
"log_level": 7,
},
"listen": {
"rpc_json": ":2012", // RPC JSON listening address
"rpc_gob": ":2013", // RPC GOB listening address

View File

@@ -17,7 +17,8 @@
{"tag": "Category", "field_id": "Category", "type": "*composed", "value": "^call", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*composed", "value": "^*users", "mandatory": true},
{"tag": "Subject", "field_id": "Subject", "type": "*composed", "value": "^*users", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*composed", "value": "Service-Information>IN-Information>Real-Called-Number", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "Service-Information>IN-Information>Real-Called-Number", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*handler", "handler_id": "*ccr_usage", "mandatory": true},
@@ -29,7 +30,9 @@
{"tag": "ResultCode", "field_filter":"CGRError(USER_NOT_FOUND)",
"field_id": "Result-Code", "type": "*constant", "value": "5030"},
{"tag": "GrantedUnits", "field_filter":"CGRError(^$)",
"field_id": "Granted-Service-Unit>CC-Time", "type": "*composed", "value": "CGRMaxUsage", "mandatory": true},
"field_id": "Granted-Service-Unit>CC-Time",
"type": "*handler", "handler_id": "*value_exponent",
"value": "CGRMaxUsage;^|-9", "mandatory": true},
],
},
{
@@ -54,7 +57,9 @@
],
"cca_fields":[ // fields returned in CCA
{"tag": "GrantedUnits", "field_filter":"CGRError(^$)",
"field_id": "Granted-Service-Unit>CC-Time", "type": "*composed", "value": "CGRMaxUsage", "mandatory": true},
"field_id": "Granted-Service-Unit>CC-Time",
"type": "*handler", "handler_id": "*value_exponent",
"value": "CGRMaxUsage;^|-9", "mandatory": true},
],
},
{
@@ -79,7 +84,9 @@
],
"cca_fields":[ // fields returned in CCA
{"tag": "GrantedUnits", "field_filter":"CGRError(^$)",
"field_id": "Granted-Service-Unit>CC-Time", "type": "*composed", "value": "CGRMaxUsage", "mandatory": true},
"field_id": "Granted-Service-Unit>CC-Time",
"type": "*handler", "handler_id": "*value_exponent",
"value": "CGRMaxUsage;^|-9", "mandatory": true},
],
},
],

View File

@@ -20,6 +20,12 @@
"rals": {
"enabled": true, // enable Rater service: <true|false>
"max_computed_usage": { // do not compute usage higher than this, prevents memory overload
"*any": "189h",
"*voice": "72h",
"*data": "102400",
"*sms": "10000"
},
},
"scheduler": {
@@ -33,6 +39,9 @@
"sm_generic": {
"enabled": true,
"session_ttl": "50ms",
"rals_conns": [
{"address": "127.0.0.1:2012", "transport": "*json"}
]
},
}

View File

@@ -1,3 +1,4 @@
ALTER TABLE cdrs CHANGE COLUMN `usage` `usage_old` DECIMAL(30,9);
ALTER TABLE cdrs ADD `usage` BIGINT;
UPDATE cdrs SET `usage` = `usage_old` * 1000000000 WHERE usage_old IS NOT NULL;

View File

@@ -5,30 +5,25 @@
DROP TABLE IF EXISTS cdrs;
CREATE TABLE cdrs (
id int(11) NOT NULL AUTO_INCREMENT,
cgrid char(40) NOT NULL,
cgrid varchar(40) NOT NULL,
run_id varchar(64) NOT NULL,
origin_host varchar(64) NOT NULL,
source varchar(64) NOT NULL,
origin_id varchar(64) NOT NULL,
tor varchar(16) NOT NULL,
request_type varchar(24) NOT NULL,
direction varchar(8) NOT NULL,
tenant varchar(64) NOT NULL,
category varchar(32) NOT NULL,
account varchar(128) NOT NULL,
subject varchar(128) NOT NULL,
destination varchar(128) NOT NULL,
setup_time datetime NOT NULL,
pdd DECIMAL(12,9) NOT NULL,
answer_time datetime NOT NULL,
`usage` DECIMAL(30,9) NOT NULL,
supplier varchar(128) NOT NULL,
disconnect_cause varchar(64) NOT NULL,
`usage` BIGINT NOT NULL,
extra_fields text NOT NULL,
cost_source varchar(64) NOT NULL,
cost DECIMAL(20,4) NOT NULL,
cost_details text,
account_summary text,
extra_info text,
created_at TIMESTAMP NULL,
updated_at TIMESTAMP NULL,
@@ -40,12 +35,12 @@ CREATE TABLE cdrs (
DROP TABLE IF EXISTS sm_costs;
CREATE TABLE sm_costs (
id int(11) NOT NULL AUTO_INCREMENT,
cgrid char(40) NOT NULL,
cgrid varchar(40) NOT NULL,
run_id varchar(64) NOT NULL,
origin_host varchar(64) NOT NULL,
origin_id varchar(64) NOT NULL,
cost_source varchar(64) NOT NULL,
`usage` DECIMAL(30,9) NOT NULL,
`usage` BIGINT NOT NULL,
cost_details text,
created_at TIMESTAMP NULL,
deleted_at TIMESTAMP NULL,

View File

@@ -491,6 +491,7 @@ CREATE TABLE tp_filters (
-- Table structure for table `tp_lcr`
--
DROP TABLE IF EXISTS tp_lcr;
CREATE TABLE tp_lcr (
`pk` int(11) NOT NULL AUTO_INCREMENT,

View File

@@ -5,30 +5,25 @@
DROP TABLE IF EXISTS cdrs;
CREATE TABLE cdrs (
id SERIAL PRIMARY KEY,
cgrid CHAR(40) NOT NULL,
cgrid VARCHAR(40) NOT NULL,
run_id VARCHAR(64) NOT NULL,
origin_host VARCHAR(64) NOT NULL,
source VARCHAR(64) NOT NULL,
origin_id VARCHAR(64) NOT NULL,
tor VARCHAR(16) NOT NULL,
request_type VARCHAR(24) NOT NULL,
direction VARCHAR(8) NOT NULL,
tenant VARCHAR(64) NOT NULL,
category VARCHAR(32) NOT NULL,
account VARCHAR(128) NOT NULL,
subject VARCHAR(128) NOT NULL,
destination VARCHAR(128) NOT NULL,
setup_time TIMESTAMP WITH TIME ZONE NOT NULL,
pdd NUMERIC(12,9) NOT NULL,
answer_time TIMESTAMP WITH TIME ZONE NOT NULL,
usage NUMERIC(30,9) NOT NULL,
supplier VARCHAR(128) NOT NULL,
disconnect_cause VARCHAR(64) NOT NULL,
usage BIGINT NOT NULL,
extra_fields jsonb NOT NULL,
cost_source VARCHAR(64) NOT NULL,
cost NUMERIC(20,4) DEFAULT NULL,
cost_details jsonb,
account_summary jsonb,
extra_info text,
created_at TIMESTAMP WITH TIME ZONE,
updated_at TIMESTAMP WITH TIME ZONE NULL,
@@ -43,12 +38,12 @@ CREATE INDEX deleted_at_cp_idx ON cdrs (deleted_at);
DROP TABLE IF EXISTS sm_costs;
CREATE TABLE sm_costs (
id SERIAL PRIMARY KEY,
cgrid CHAR(40) NOT NULL,
cgrid VARCHAR(40) NOT NULL,
run_id VARCHAR(64) NOT NULL,
origin_host VARCHAR(64) NOT NULL,
origin_id VARCHAR(64) NOT NULL,
cost_source VARCHAR(64) NOT NULL,
usage NUMERIC(30,9) NOT NULL,
usage BIGINT NOT NULL,
cost_details jsonb,
created_at TIMESTAMP WITH TIME ZONE,
deleted_at TIMESTAMP WITH TIME ZONE NULL,
@@ -62,4 +57,3 @@ DROP INDEX IF EXISTS run_origin_smcost_idx;
CREATE INDEX run_origin_smcost_idx ON sm_costs (run_id, origin_id);
DROP INDEX IF EXISTS deleted_at_smcost_idx;
CREATE INDEX deleted_at_smcost_idx ON sm_costs (deleted_at);

View File

@@ -480,7 +480,9 @@ CREATE TABLE tp_filters (
CREATE INDEX tp_filters_idx ON tp_filters (tpid);
CREATE INDEX tp_filters_unique ON tp_filters ("tpid","tenant", "id", "filter_type", "filter_field_name");
--
-- Table structure for table `tp_lcr`
--
@@ -500,8 +502,9 @@ CREATE TABLE tp_filters (
"weight" decimal(8,2) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE
);
CREATE INDEX tp_lcr_idx ON tp_lcr (tpid);
CREATE INDEX tp_lcr_unique ON tp_lcr ("tpid", "tenant", "id", "filter_ids");
CREATE INDEX tp_lcr_idx ON tp_lcr (tpid);
CREATE INDEX tp_lcr_unique ON tp_lcr ("tpid", "tenant", "id", "filter_ids");
--
-- Table structure for table `versions`

View File

@@ -1,3 +1,4 @@
#Id,ActionsId,TimingId,Weight
PACKAGE_1,LOG,*asap,10
PACKAGE_1,LOG,FIRST_OF_YEAR_2020,10
PACKAGE_2,LOG,FIRST_OF_YEAR_2020,10
PACKAGE_2,LOG,FIRST_OF_YEAR_2020,10
1 PACKAGE_1 #Id LOG ActionsId *asap TimingId 10 Weight
1 #Id ActionsId TimingId Weight
2 PACKAGE_1 PACKAGE_1 LOG LOG *asap *asap 10 10
3 PACKAGE_1 PACKAGE_1 LOG LOG FIRST_OF_YEAR_2020 FIRST_OF_YEAR_2020 10 10
4 PACKAGE_2 PACKAGE_2 LOG LOG FIRST_OF_YEAR_2020 FIRST_OF_YEAR_2020 10 10

View File

@@ -1 +1,2 @@
LOG,*log,,,,,,,,,,,,,,false,false,10
#ActionsId[0],Action[1],ExtraParameters[2],Filter[3],BalanceId[4],BalanceType[5],Directions[6],Categories[7],DestinationIds[8],RatingSubject[9],SharedGroup[10],ExpiryTime[11],TimingIds[12],Units[13],BalanceWeight[14],BalanceBlocker[15],BalanceDisabled[16],Weight[17]
LOG,*log,,,,,,,,,,,,,,false,false,10
1 LOG #ActionsId[0] *log Action[1] ExtraParameters[2] Filter[3] BalanceId[4] BalanceType[5] Directions[6] Categories[7] DestinationIds[8] RatingSubject[9] SharedGroup[10] ExpiryTime[11] TimingIds[12] Units[13] BalanceWeight[14] false BalanceBlocker[15] false BalanceDisabled[16] 10 Weight[17]
2 LOG *log false false 10

View File

@@ -1 +1,2 @@
#Id,DestinationId,RatesTag,RoundingMethod,RoundingDecimals,MaxCost,MaxCostStrategy
DR_DATA1,*any,RT_DATA1,*up,5,,
1 DR_DATA1 #Id *any DestinationId RT_DATA1 RatesTag *up RoundingMethod 5 RoundingDecimals MaxCost MaxCostStrategy
1 #Id DestinationId RatesTag RoundingMethod RoundingDecimals MaxCost MaxCostStrategy
2 DR_DATA1 DR_DATA1 *any *any RT_DATA1 RT_DATA1 *up *up 5 5

View File

@@ -1 +1,2 @@
#Id,ConnectFee,Rate,RateUnit,RateIncrement,GroupIntervalStart
RT_DATA1,0,0.0,1048576,10240,0
1 RT_DATA1 #Id 0 ConnectFee 0.0 Rate 1048576 RateUnit 10240 RateIncrement 0 GroupIntervalStart
1 #Id ConnectFee Rate RateUnit RateIncrement GroupIntervalStart
2 RT_DATA1 RT_DATA1 0 0 0.0 0.0 1048576 1048576 10240 10240 0 0

View File

@@ -1 +1,2 @@
#Id,DestinationRatesId,TimingTag,Weight
RP_DATA1,DR_DATA1,*any,10
1 RP_DATA1 #Id DR_DATA1 DestinationRatesId *any TimingTag 10 Weight
1 #Id DestinationRatesId TimingTag Weight
2 RP_DATA1 RP_DATA1 DR_DATA1 DR_DATA1 *any *any 10 10

View File

@@ -1 +1,2 @@
#Direction,Tenant,Category,Subject,ActivationTime,RatingPlanId,RatesFallbackSubject,CdrStatQueueIds
*out,cgrates.org,data1,rpdata1,2015-01-01T00:00:00Z,RP_DATA1,,
1 *out #Direction cgrates.org Tenant data1 Category rpdata1 Subject 2015-01-01T00:00:00Z ActivationTime RP_DATA1 RatingPlanId RatesFallbackSubject CdrStatQueueIds
1 #Direction Tenant Category Subject ActivationTime RatingPlanId RatesFallbackSubject CdrStatQueueIds
2 *out *out cgrates.org cgrates.org data1 data1 rpdata1 rpdata1 2015-01-01T00:00:00Z 2015-01-01T00:00:00Z RP_DATA1 RP_DATA1

View File

@@ -1 +1,2 @@
FIRST_OF_YEAR_2020,2020,1,1,*any,00:00:00
#Tag,Years,Months,MonthDays,WeekDays,Time
FIRST_OF_YEAR_2020,2020,1,1,*any,00:00:00
1 FIRST_OF_YEAR_2020 #Tag 2020 Years 1 Months 1 MonthDays *any WeekDays 00:00:00 Time
2 FIRST_OF_YEAR_2020 2020 1 1 *any 00:00:00

View File

@@ -3,4 +3,4 @@ RT_1CENT,0,1,1s,1s,0s
RT_DATA_2c,0,0.002,10,10,0
RT_SMS_5c,0,0.005,1,1,0
RT_DATA_r,0,0.1,1048576,10240,0
RT_ZERO,0,0,1,1,0
RT_ZERO,0,0,1s,1s,0s
1 #Tag ConnectFee Rate RateUnit RateIncrement GroupIntervalStart
3 RT_DATA_2c 0 0.002 10 10 0
4 RT_SMS_5c 0 0.005 1 1 0
5 RT_DATA_r 0 0.1 1048576 10240 0
6 RT_ZERO 0 0 1 1s 1 1s 0 0s

View File

@@ -1,8 +1,8 @@
#ActionsId[0],Action[1],ExtraParameters[2],Filter[3],BalanceId[4],BalanceType[5],Directions[6],Categories[7],DestinationIds[8],RatingSubject[9],SharedGroup[10],ExpiryTime[11],TimingIds[12],Units[13],BalanceWeight[14],BalanceBlocker[15],BalanceDisabled[16],Weight[17]
TOPUP_RST_10,*topup_reset,,,,*monetary,*out,,*any,,,*unlimited,,10,10,false,false,10
TOPUP_RST_5,*topup_reset,,,,*monetary,*out,,*any,,,*unlimited,,5,20,false,false,10
TOPUP_RST_5,*topup_reset,,,,*voice,*out,,DST_1002,SPECIAL_1002,,*unlimited,,90,20,false,false,10
TOPUP_120_DST1003,*topup_reset,,,,*voice,*out,,DST_1003,,,*unlimited,,120,20,false,false,10
TOPUP_RST_5,*topup_reset,,,,*voice,*out,,DST_1002,SPECIAL_1002,,*unlimited,,90s,20,false,false,10
TOPUP_120_DST1003,*topup_reset,,,,*voice,*out,,DST_1003,,,*unlimited,,120s,20,false,false,10
TOPUP_RST_SHARED_5,*topup,,,,*monetary,*out,,*any,,SHARED_A,*unlimited,,5,10,false,false,10
SHARED_A_0,*topup_reset,,,,*monetary,*out,,*any,,SHARED_A,*unlimited,,0,10,false,false,10
TOPUP_RST_DATA_100,*topup_reset,,,,*data,*out,,*any,,,*unlimited,,102400,10,false,false,10
1 #ActionsId[0] Action[1] ExtraParameters[2] Filter[3] BalanceId[4] BalanceType[5] Directions[6] Categories[7] DestinationIds[8] RatingSubject[9] SharedGroup[10] ExpiryTime[11] TimingIds[12] Units[13] BalanceWeight[14] BalanceBlocker[15] BalanceDisabled[16] Weight[17]
2 TOPUP_RST_10 *topup_reset *monetary *out *any *unlimited 10 10 false false 10
3 TOPUP_RST_5 *topup_reset *monetary *out *any *unlimited 5 20 false false 10
4 TOPUP_RST_5 *topup_reset *voice *out DST_1002 SPECIAL_1002 *unlimited 90 90s 20 false false 10
5 TOPUP_120_DST1003 *topup_reset *voice *out DST_1003 *unlimited 120 120s 20 false false 10
6 TOPUP_RST_SHARED_5 *topup *monetary *out *any SHARED_A *unlimited 5 10 false false 10
7 SHARED_A_0 *topup_reset *monetary *out *any SHARED_A *unlimited 0 10 false false 10
8 TOPUP_RST_DATA_100 *topup_reset *data *out *any *unlimited 102400 10 false false 10

View File

@@ -2,9 +2,10 @@
*out,cgrates.org,call,*any,2014-01-14T00:00:00Z,RP_RETAIL1,,
*out,cgrates.org,call,1001,2014-01-14T00:00:00Z,RP_RETAIL2,,
*out,cgrates.org,call,SPECIAL_1002,2014-01-14T00:00:00Z,RP_SPECIAL_1002,,
*out,cgrates.org,generic,*any,2014-01-14T00:00:00Z,RP_GENERIC,,
*out,cgrates.org,data,*any,2014-01-14T00:00:00Z,RP_GENERIC,,
*out,cgrates.org,lcr_profile1,suppl1,2014-01-14T00:00:00Z,RP_RETAIL1,,STATS_SUPPL1
*out,cgrates.org,lcr_profile1,suppl2,2014-01-14T00:00:00Z,RP_RETAIL2,,STATS_SUPPL2
*out,cgrates.org,lcr_profile2,suppl1,2014-01-14T00:00:00Z,RP_RETAIL2,,STATS_SUPPL1
*out,cgrates.org,lcr_profile2,suppl2,2014-01-14T00:00:00Z,RP_RETAIL1,,STATS_SUPPL2
*out,cgrates.org,lcr_profile2,suppl3,2014-01-14T00:00:00Z,RP_SPECIAL_1002,,
*out,cgrates.org,generic,*any,2014-01-14T00:00:00Z,RP_GENERIC,,
1 #Direction Tenant Category Subject ActivationTime RatingPlanId RatesFallbackSubject CdrStatQueueIds
2 *out cgrates.org call *any 2014-01-14T00:00:00Z RP_RETAIL1
3 *out cgrates.org call 1001 2014-01-14T00:00:00Z RP_RETAIL2
4 *out cgrates.org call SPECIAL_1002 2014-01-14T00:00:00Z RP_SPECIAL_1002
5 *out cgrates.org generic *any 2014-01-14T00:00:00Z RP_GENERIC
6 *out cgrates.org data *any 2014-01-14T00:00:00Z RP_GENERIC
7 *out cgrates.org lcr_profile1 suppl1 2014-01-14T00:00:00Z RP_RETAIL1 STATS_SUPPL1
8 *out cgrates.org lcr_profile1 suppl2 2014-01-14T00:00:00Z RP_RETAIL2 STATS_SUPPL2
9 *out cgrates.org lcr_profile2 suppl1 2014-01-14T00:00:00Z RP_RETAIL2 STATS_SUPPL1
10 *out cgrates.org lcr_profile2 suppl2 2014-01-14T00:00:00Z RP_RETAIL1 STATS_SUPPL2
11 *out cgrates.org lcr_profile2 suppl3 2014-01-14T00:00:00Z RP_SPECIAL_1002
*out cgrates.org generic *any 2014-01-14T00:00:00Z RP_GENERIC