mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Skel configuration for EventReaderService
This commit is contained in:
@@ -294,6 +294,47 @@ const CGRATES_CFG_JSON = `
|
||||
],
|
||||
|
||||
|
||||
"ers": { // EventReaderService
|
||||
"enabled": false, // starts the EventReader service: <true|false>
|
||||
"sessions_conns": [ // connections to SessionS: <*internal|127.0.0.1:2012>
|
||||
{"address": "*internal"}
|
||||
],
|
||||
"readers": [
|
||||
{
|
||||
"id": "*default", // identifier of the EventReader profile
|
||||
"type": "*file_csv", // reader type <*file_csv>
|
||||
"field_separator": ",", // separator used in case of csv files
|
||||
"run_delay": 0, // sleep interval in seconds between consecutive runs, 0 to use automation via inotify
|
||||
"concurrent_requests": 1024, // maximum simultaneous requests/files to process, 0 for unlimited
|
||||
"source_path": "/var/spool/cgrates/cdrc/in", // read data from this path
|
||||
"processed_path": "/var/spool/cgrates/cdrc/out", // move processed data here
|
||||
"Xml_root_path": "", // path towards one event in case of XML CDRs
|
||||
"Source_id": "ers_csv", // free form field, tag identifying the source of the CDRs within CDRS database
|
||||
"tenant": "", // tenant used by import
|
||||
"timezone": "", // timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB>
|
||||
"filters": [], // limit parsing based on the filters
|
||||
"flags": [], // flags to influence the event processing
|
||||
"header_fields": [], // template of the import header fields
|
||||
"content_fields":[ // import content_fields template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value
|
||||
{"tag": "TOR", "field_id": "ToR", "type": "*composed", "value": "~2", "mandatory": true},
|
||||
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "~3", "mandatory": true},
|
||||
{"tag": "RequestType", "field_id": "RequestType", "type": "*composed", "value": "~4", "mandatory": true},
|
||||
{"tag": "Tenant", "field_id": "Tenant", "type": "*composed", "value": "~6", "mandatory": true},
|
||||
{"tag": "Category", "field_id": "Category", "type": "*composed", "value": "~7", "mandatory": true},
|
||||
{"tag": "Account", "field_id": "Account", "type": "*composed", "value": "~8", "mandatory": true},
|
||||
{"tag": "Subject", "field_id": "Subject", "type": "*composed", "value": "~9", "mandatory": true},
|
||||
{"tag": "Destination", "field_id": "Destination", "type": "*composed", "value": "~10", "mandatory": true},
|
||||
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", "value": "~11", "mandatory": true},
|
||||
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", "value": "~12", "mandatory": true},
|
||||
{"tag": "Usage", "field_id": "Usage", "type": "*composed", "value": "~13", "mandatory": true},
|
||||
],
|
||||
"trailer_fields": [], // template of the import trailer fields
|
||||
"continue": false, // continue to the next template if executed
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
|
||||
"sessions": {
|
||||
"enabled": false, // starts the session service: <true|false>
|
||||
"listen_bijson": "127.0.0.1:2014", // address where to listen for bidirectional JSON-RPC requests
|
||||
|
||||
@@ -67,6 +67,7 @@ const (
|
||||
AnalyzerCfgJson = "analyzers"
|
||||
Apier = "apier"
|
||||
DNSAgentJson = "dns_agent"
|
||||
ERsJson = "ers"
|
||||
)
|
||||
|
||||
// Loads the json config out of io.Reader, eg other sources than file, maybe over http
|
||||
@@ -237,6 +238,16 @@ func (self CgrJsonCfg) CdrcJsonCfg() ([]*CdrcJsonCfg, error) {
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
func (self CgrJsonCfg) ERsJsonCfg() (erSCfg *ERsJsonCfg, err error) {
|
||||
rawCfg, hasKey := self[ERsJson]
|
||||
if !hasKey {
|
||||
return
|
||||
}
|
||||
erSCfg = new(ERsJsonCfg)
|
||||
err = json.Unmarshal(*rawCfg, &erSCfg)
|
||||
return
|
||||
}
|
||||
|
||||
func (self CgrJsonCfg) SessionSJsonCfg() (*SessionSJsonCfg, error) {
|
||||
rawCfg, hasKey := self[SessionSJson]
|
||||
if !hasKey {
|
||||
|
||||
70
config/erscfg.go
Normal file
70
config/erscfg.go
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
|
||||
Copyright (C) ITsysCOM GmbH
|
||||
|
||||
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 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package config
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
type ERsCfg struct {
|
||||
Enabled bool
|
||||
SessionSConns []*RemoteHost
|
||||
Readers []*EventReaderCfg
|
||||
}
|
||||
|
||||
func (erS *ERsJsonCfg) loadFromJsonCfg(jsnCfg *ERsJsonCfg, sep string) (err error) {
|
||||
if jsnCfg == nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Clone itself into a new ERsCfg
|
||||
func (erS *ERsCfg) Clone() (cln *ERsCfg) {
|
||||
return
|
||||
}
|
||||
|
||||
type EventReaderCfg struct {
|
||||
ID string
|
||||
Type string
|
||||
FieldSep string
|
||||
RunDelay time.Duration
|
||||
ConcurrentReqs int
|
||||
SourcePath string
|
||||
ProcessedPath string
|
||||
XmlRootPath string
|
||||
Tenant RSRParsers
|
||||
Timezone string
|
||||
SourceID string
|
||||
Filters []string
|
||||
Flags utils.FlagsWithParams
|
||||
Header_fields []*FCTemplate
|
||||
Content_fields []*FCTemplate
|
||||
Trailer_fields []*FCTemplate
|
||||
Continue bool
|
||||
}
|
||||
|
||||
func (er *EventReaderCfg) loadFromJsonCfg(jsnCfg *EventReaderJsonCfg, sep string) (err error) {
|
||||
if jsnCfg == nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -170,6 +170,34 @@ type CdrcJsonCfg struct {
|
||||
Cache_dump_fields *[]*FcTemplateJsonCfg
|
||||
}
|
||||
|
||||
// EventReaderSJsonCfg contains the configuration of EventReaderService
|
||||
type ERsJsonCfg struct {
|
||||
Enabled *bool
|
||||
Sessions_conns *[]*RemoteHostJson
|
||||
Readers *[]*EventReaderJsonCfg
|
||||
}
|
||||
|
||||
// EventReaderSJsonCfg is the configuration of a single EventReader
|
||||
type EventReaderJsonCfg struct {
|
||||
Id *string
|
||||
Type *string
|
||||
Field_separator *string
|
||||
Run_delay *int
|
||||
Concurrent_requests *int
|
||||
Source_path *string
|
||||
Processed_path *string
|
||||
Xml_root_path *string
|
||||
Source_id *string
|
||||
Tenant *string
|
||||
Timezone *string
|
||||
Filters *[]string
|
||||
Flags *[]string
|
||||
Header_fields *[]*FcTemplateJsonCfg
|
||||
Content_fields *[]*FcTemplateJsonCfg
|
||||
Trailer_fields *[]*FcTemplateJsonCfg
|
||||
Continue *bool
|
||||
}
|
||||
|
||||
// SM-Generic config section
|
||||
type SessionSJsonCfg struct {
|
||||
Enabled *bool
|
||||
@@ -199,13 +227,11 @@ type SessionSJsonCfg struct {
|
||||
|
||||
// FreeSWITCHAgent config section
|
||||
type FreeswitchAgentJsonCfg struct {
|
||||
Enabled *bool
|
||||
Sessions_conns *[]*RemoteHostJson
|
||||
Subscribe_park *bool
|
||||
Create_cdr *bool
|
||||
Extra_fields *[]string
|
||||
//Min_dur_low_balance *string
|
||||
//Low_balance_ann_file *string
|
||||
Enabled *bool
|
||||
Sessions_conns *[]*RemoteHostJson
|
||||
Subscribe_park *bool
|
||||
Create_cdr *bool
|
||||
Extra_fields *[]string
|
||||
Empty_balance_context *string
|
||||
Empty_balance_ann_file *string
|
||||
Max_wait_connection *string
|
||||
|
||||
Reference in New Issue
Block a user