engine

package
Version: v0.10.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2020 License: GPL-3.0 Imports: 72 Imported by: 70

Documentation

Overview

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/>

Index

Constants

View Source
const (
	// these might be better in the confs under optimizations section
	RECURSION_MAX_DEPTH = 3
	MIN_PREFIX_MATCH    = 1
	FALLBACK_SUBJECT    = utils.ANY
	DB                  = "map"
)
View Source
const (
	// Freswitch event property names
	FS_CDR_MAP            = "variables"
	FS_UUID               = "uuid" // -Unique ID for this call leg
	FS_CALL_DEST_NR       = "dialed_extension"
	FS_PARK_TIME          = "start_epoch"
	FS_SETUP_TIME         = "start_epoch"
	FS_ANSWER_TIME        = "answer_epoch"
	FS_HANGUP_TIME        = "end_epoch"
	FS_DURATION           = "billsec"
	FS_USERNAME           = "user_name"
	FS_CDR_SOURCE         = "freeswitch_json"
	FS_SIP_REQUSER        = "sip_req_user" // Apps like FusionPBX do not set dialed_extension, alternative being destination_number but that comes in customer profile, not in vars
	FS_PROGRESS_MEDIAMSEC = "progress_mediamsec"
	FS_PROGRESSMS         = "progressmsec"
	FsUsername            = "username"
	FsIPv4                = "FreeSWITCH-IPv4"
)
View Source
const (
	MINE_PREFIX           = "*mine_"
	STRATEGY_MINE_LOWEST  = "*mine_lowest"
	STRATEGY_MINE_HIGHEST = "*mine_highest"
	STRATEGY_MINE_RANDOM  = "*mine_random"
	STRATEGY_LOWEST       = "*lowest"
	STRATEGY_HIGHEST      = "*highest"
	STRATEGY_RANDOM       = "*random"
)
View Source
const (
	ColDst  = "destinations"
	ColRds  = "reverse_destinations"
	ColAct  = "actions"
	ColApl  = "action_plans"
	ColAAp  = "account_action_plans"
	ColTsk  = "tasks"
	ColAtr  = "action_triggers"
	ColRpl  = "rating_plans"
	ColRpf  = "rating_profiles"
	ColAcc  = "accounts"
	ColShg  = "shared_groups"
	ColLht  = "load_history"
	ColVer  = "versions"
	ColRsP  = "resource_profiles"
	ColRFI  = "request_filter_indexes"
	ColTmg  = "timings"
	ColRes  = "resources"
	ColSqs  = "statqueues"
	ColSqp  = "statqueue_profiles"
	ColTps  = "threshold_profiles"
	ColThs  = "thresholds"
	ColFlt  = "filters"
	ColSpp  = "supplier_profiles"
	ColAttr = "attribute_profiles"
	ColCDRs = "cdrs"
	ColCpp  = "charger_profiles"
	ColDpp  = "dispatcher_profiles"
	ColDph  = "dispatcher_hosts"
	ColLID  = "load_ids"
)

Mongo collections names

View Source
const (
	FORMAT = "2006-1-2 15:04:05 MST"
)
View Source
const STATS_NA = -1.0

to be moved in utils

Variables

View Source
var (
	DestinationsCSVContent = `` /* 247-byte string literal not displayed */

	TimingsCSVContent = `` /* 157-byte string literal not displayed */

	RatesCSVContent = `` /* 402-byte string literal not displayed */

	DestinationRatesCSVContent = `` /* 794-byte string literal not displayed */

	RatingPlansCSVContent = `` /* 686-byte string literal not displayed */

	RatingProfilesCSVContent = `` /* 1355-byte string literal not displayed */

	SharedGroupsCSVContent = `
SG1,*any,*lowest,
SG2,*any,*lowest,one
SG3,*any,*lowest,
`
	ActionsCSVContent = `` /* 1758-byte string literal not displayed */

	ActionPlansCSVContent = `` /* 325-byte string literal not displayed */

	ActionTriggersCSVContent = `` /* 425-byte string literal not displayed */

	AccountActionsCSVContent = `` /* 645-byte string literal not displayed */

	ResourcesCSVContent = `` /* 336-byte string literal not displayed */

	StatsCSVContent = `` /* 554-byte string literal not displayed */

	ThresholdsCSVContent = `` /* 261-byte string literal not displayed */

	FiltersCSVContent = `` /* 527-byte string literal not displayed */

	SuppliersCSVContent = `` /* 641-byte string literal not displayed */

	AttributesCSVContent = `` /* 299-byte string literal not displayed */

	ChargersCSVContent = `` /* 167-byte string literal not displayed */

	DispatcherCSVContent = `` /* 261-byte string literal not displayed */

	DispatcherHostCSVContent = `` /* 136-byte string literal not displayed */

)
View Source
var (
	CGRIDLow           = strings.ToLower(utils.CGRID)
	RunIDLow           = strings.ToLower(utils.RunID)
	OrderIDLow         = strings.ToLower(utils.OrderID)
	OriginHostLow      = strings.ToLower(utils.OriginHost)
	OriginIDLow        = strings.ToLower(utils.OriginID)
	ToRLow             = strings.ToLower(utils.ToR)
	CDRHostLow         = strings.ToLower(utils.OriginHost)
	CDRSourceLow       = strings.ToLower(utils.Source)
	RequestTypeLow     = strings.ToLower(utils.RequestType)
	TenantLow          = strings.ToLower(utils.Tenant)
	CategoryLow        = strings.ToLower(utils.Category)
	AccountLow         = strings.ToLower(utils.Account)
	SubjectLow         = strings.ToLower(utils.Subject)
	SupplierLow        = strings.ToLower(utils.SUPPLIER)
	DisconnectCauseLow = strings.ToLower(utils.DISCONNECT_CAUSE)
	SetupTimeLow       = strings.ToLower(utils.SetupTime)
	AnswerTimeLow      = strings.ToLower(utils.AnswerTime)
	CreatedAtLow       = strings.ToLower(utils.CreatedAt)
	UpdatedAtLow       = strings.ToLower(utils.UpdatedAt)
	UsageLow           = strings.ToLower(utils.Usage)
	PDDLow             = strings.ToLower(utils.PDD)
	CostDetailsLow     = strings.ToLower(utils.CostDetails)
	DestinationLow     = strings.ToLower(utils.Destination)
	CostLow            = strings.ToLower(utils.COST)
	CostSourceLow      = strings.ToLower(utils.CostSource)
)

Cache is the global cache used

Functions

func CachedDestHasPrefix

func CachedDestHasPrefix(destId, prefix string) bool

Reverse search in cache to see if prefix belongs to destination id

func CallScript

func CallScript(scriptPath string, subcommand string, waitMs int) error

func CheckVersions

func CheckVersions(storage Storage) error

CheckVersions returns error if the db needs migration

func FilterToTPFilter

func FilterToTPFilter(f *Filter) (tpFltr *utils.TPFilterProfile)

func ForceKillProcName

func ForceKillProcName(procName string, waitMs int) error

func GetDefaultEmptyCacheStats

func GetDefaultEmptyCacheStats() map[string]*ltcache.CacheStats

func HttpJsonPost

func HttpJsonPost(url string, skipTLSVerify bool, content []byte) (respBody []byte, err error)

HttpJsonPost posts without automatic failover

func InitCache

func InitCache(cfg config.CacheCfg)

InitCache will instantiate the cache with specific or default configuraiton

func InitDataDb

func InitDataDb(cfg *config.CGRConfig) error

func InitStorDb

func InitStorDb(cfg *config.CGRConfig) error

func KillEngine

func KillEngine(waitEngine int) error

func KillProcName

func KillProcName(procName string, waitMs int) error

func LoadTariffPlanFromFolder

func LoadTariffPlanFromFolder(tpPath, timezone string, dm *DataManager, disable_reverse bool,
	cacheConns, schedConns []string) error

func MapTPAccountActions

func MapTPAccountActions(s []*utils.TPAccountActions) (map[string]*utils.TPAccountActions, error)

func MapTPActionTimings

func MapTPActionTimings(s []*utils.TPActionPlan) map[string][]*utils.TPActionTiming

func MapTPActionTriggers

func MapTPActionTriggers(s []*utils.TPActionTriggers) map[string][]*utils.TPActionTrigger

func MapTPActions

func MapTPActions(s []*utils.TPActions) map[string][]*utils.TPAction

func MapTPDestinationRates

func MapTPDestinationRates(s []*utils.TPDestinationRate) (map[string]*utils.TPDestinationRate, error)

func MapTPRates

func MapTPRates(s []*utils.TPRate) (map[string]*utils.TPRate, error)

func MapTPRatingPlanBindings

func MapTPRatingPlanBindings(s []*utils.TPRatingPlan) map[string][]*utils.TPRatingPlanBinding

func MapTPRatingProfiles

func MapTPRatingProfiles(s []*utils.TPRatingProfile) (map[string]*utils.TPRatingProfile, error)

func MapTPSharedGroup

func MapTPSharedGroup(s []*utils.TPSharedGroups) map[string][]*utils.TPSharedGroup

func MapTPTimings

func MapTPTimings(tps []*utils.ApierTPTiming) (map[string]*utils.TPTiming, error)

func MatchingItemIDsForEvent

func MatchingItemIDsForEvent(ev map[string]interface{}, stringFldIDs, prefixFldIDs *[]string,
	dm *DataManager, cacheID, itemIDPrefix string, indexedSelects, nestedFields bool) (itemIDs utils.StringMap, err error)

MatchingItemIDsForEvent returns the list of item IDs matching fieldName/fieldValue for an event fieldIDs limits the fields which are checked against indexes helper on top of dataDB.MatchFilterIndex, adding utils.ANY to list of fields queried

func NewCsvFile

func NewCsvFile() csvReaderCloser

func NewCsvString

func NewCsvString() csvReaderCloser

func NewRPCPool

func NewRPCPool(dispatchStrategy string, keyPath, certPath, caPath string, connAttempts, reconnects int,
	connectTimeout, replyTimeout time.Duration, rpcConnCfgs []*config.RemoteHost,
	internalConnChan chan rpcclient.ClientConnector, lazyConnect bool) (*rpcclient.RPCPool, error)

NewRPCPool returns a new pool of connection with the given configuration

func OverwriteDBVersions

func OverwriteDBVersions(storage Storage) (err error)

OverwriteDBVersions sets the version overwriting them

func PjsuaCallUri

func PjsuaCallUri(acnt *PjsuaAccount, dstUri, outboundUri string, callDur time.Duration, localPort int) error

func SetCdrStorage

func SetCdrStorage(cStorage CdrStorage)

SetCdrStorage sets the database for CDR storing, used by *cdrlog in first place

func SetConnManager

func SetConnManager(conMgr *ConnManager)

SetConnManager is the exported method to set the connectionManager used when operate on an account.

func SetDBVersions

func SetDBVersions(storage Storage) (err error)

SetDBVersions sets the version without overwriting them

func SetDataStorage

func SetDataStorage(dm2 *DataManager)

SetDataStorage is the exported method to set the storage getter.

func SetFailedPostCacheTTL

func SetFailedPostCacheTTL(ttl time.Duration)

SetFailedPostCacheTTL recreates the failed cache

func SetRoundingDecimals

func SetRoundingDecimals(rd int)

SetRoundingDecimals sets the global rounding method and decimal precision for GetCost method

func SetRpSubjectPrefixMatching

func SetRpSubjectPrefixMatching(flag bool)

SetRpSubjectPrefixMatching sets rpSubjectPrefixMatching (is thread safe)

func StartEngine

func StartEngine(cfgPath string, waitEngine int) (*exec.Cmd, error)

Return reference towards the command started so we can stop it if necessary

func StartPjsuaListener

func StartPjsuaListener(acnts []*PjsuaAccount, localPort, waitDur time.Duration) (*os.File, error)

Returns file reference where we can write to control pjsua in terminal

func StopStartEngine

func StopStartEngine(cfgPath string, waitEngine int) (*exec.Cmd, error)

func SureTaxProcessCdr

func SureTaxProcessCdr(cdr *CDR) error

func TimeDecodeValue1

func TimeDecodeValue1(dc bsoncodec.DecodeContext, vr bsonrw.ValueReader, val reflect.Value) error

Types

type AMQPPoster

type AMQPPoster struct {
	sync.Mutex // protect connection
	// contains filtered or unexported fields
}

AMQPPoster used to post cdrs to amqp

func NewAMQPPoster

func NewAMQPPoster(dialURL string, attempts int) (*AMQPPoster, error)

NewAMQPPoster creates a new amqp poster "amqp://guest:guest@localhost:5672/?queueID=cgrates_cdrs"

func (*AMQPPoster) Close

func (pstr *AMQPPoster) Close()

Close closes the connections

func (*AMQPPoster) Post

func (pstr *AMQPPoster) Post(content []byte, _ string) (err error)

Post is the method being called when we need to post anything in the queue the optional chn will permits channel caching

type AMQPv1Poster

type AMQPv1Poster struct {
	sync.Mutex
	// contains filtered or unexported fields
}

AMQPv1Poster a poster for amqpv1

func (*AMQPv1Poster) Close

func (pstr *AMQPv1Poster) Close()

Close closes the connections

func (*AMQPv1Poster) Post

func (pstr *AMQPv1Poster) Post(content []byte, _ string) (err error)

Post is the method being called when we need to post anything in the queue

type Account

type Account struct {
	ID             string
	BalanceMap     map[string]Balances
	UnitCounters   UnitCounters
	ActionTriggers ActionTriggers
	AllowNegative  bool
	Disabled       bool
	UpdateTime     time.Time
	// contains filtered or unexported fields
}

Account structure containing information about user's credit (minutes, cents, sms...).' This can represent a user or a shared group.

func (*Account) AsAccountSummary

func (acc *Account) AsAccountSummary() *AccountSummary

AsAccountSummary converts the account into AccountSummary

func (*Account) AsOldStructure

func (acc *Account) AsOldStructure() interface{}

AsOldStructure used in some api for transition

func (*Account) CleanExpiredStuff

func (acc *Account) CleanExpiredStuff()

CleanExpiredStuff removed expired balances and actiontriggers

func (*Account) Clone

func (acc *Account) Clone() *Account

Clone creates a copy of the account

func (*Account) DebitConnectionFee

func (acc *Account) DebitConnectionFee(cc *CallCost, usefulMoneyBalances Balances, count bool, block bool) (bool, Balance)

DebitConnectionFee debits the connection fee

func (*Account) ExecuteActionTriggers

func (acc *Account) ExecuteActionTriggers(a *Action)

ExecuteActionTriggers scans the action triggers and execute the actions for which trigger is met

func (*Account) GetBalanceWithID

func (acc *Account) GetBalanceWithID(blcType, blcID string) (blc *Balance)

GetBalanceWithID returns a Balance given balance type and balance ID

func (*Account) GetDefaultMoneyBalance

func (acc *Account) GetDefaultMoneyBalance() *Balance

GetDefaultMoneyBalance returns the defaultmoney balance

func (*Account) GetID

func (acc *Account) GetID() string

GetID returns the account ID

func (*Account) GetSharedGroups

func (acc *Account) GetSharedGroups() (groups []string)

GetSharedGroups returns the shared groups that this user balance belnongs to

func (*Account) GetUniqueSharedGroupMembers

func (acc *Account) GetUniqueSharedGroupMembers(cd *CallDescriptor) (utils.StringMap, error)

GetUniqueSharedGroupMembers returns the acounts from the group

func (*Account) InitCounters

func (acc *Account) InitCounters()

InitCounters creates counters for all triggered actions

func (*Account) Publish

func (acc *Account) Publish()

Publish sends the account to stats and threshold

func (*Account) ResetActionTriggers

func (acc *Account) ResetActionTriggers(a *Action)

ResetActionTriggers marks all action trigers as ready for execution If the action is not nil it acts like a filter

func (*Account) SetRecurrent

func (acc *Account) SetRecurrent(a *Action, recurrent bool)

SetRecurrent sets/unsets recurrent flag for action triggers

type AccountSummary

type AccountSummary struct {
	Tenant           string
	ID               string
	BalanceSummaries BalanceSummaries
	AllowNegative    bool
	Disabled         bool
}

AccountSummary contains compressed information about an Account

func NewAccountSummaryFromJSON

func NewAccountSummaryFromJSON(jsn string) (acntSummary *AccountSummary, err error)

NewAccountSummaryFromJSON creates a new AcccountSummary from a json string

func (*AccountSummary) Clone

func (as *AccountSummary) Clone() (cln *AccountSummary)

Clone creates a copy of the structure

func (*AccountSummary) FieldAsInterface

func (as *AccountSummary) FieldAsInterface(fldPath []string) (val interface{}, err error)

FieldAsInterface func to help EventCost FieldAsInterface

type Accounting

type Accounting map[string]*BalanceCharge

Accounting the map of debited balances

func (Accounting) Clone

func (cbs Accounting) Clone() (cln Accounting)

Clone creates a copy of Accounting

func (*Accounting) FieldAsInterface

func (cbs *Accounting) FieldAsInterface(fldPath []string) (val interface{}, err error)

FieldAsInterface func to help EventCost FieldAsInterface

func (Accounting) GetIDWithSet

func (cbs Accounting) GetIDWithSet(cb *BalanceCharge) string

GetIDWithSet attempts to retrieve the UUID of a matching data or create a new one

type Action

type Action struct {
	Id               string
	ActionType       string
	ExtraParameters  string
	Filter           string
	ExpirationString string // must stay as string because it can have relative values like 1month
	Weight           float64
	Balance          *BalanceFilter
	// contains filtered or unexported fields
}

Action will be filled for each tariff plan with the bonus value for received calls minutes.

func (*Action) Clone

func (a *Action) Clone() (cln *Action)

Clone returns a clone of the action

type ActionPlan

type ActionPlan struct {
	Id            string // informative purpose only
	AccountIDs    utils.StringMap
	ActionTimings []*ActionTiming
}

func (*ActionPlan) Clone

func (apl *ActionPlan) Clone() (interface{}, error)

Clone clones *ActionPlan

func (*ActionPlan) RemoveAccountID

func (apl *ActionPlan) RemoveAccountID(accID string) (found bool)

type ActionTiming

type ActionTiming struct {
	Uuid      string
	Timing    *RateInterval
	ActionsID string
	ExtraData interface{}
	Weight    float64
	// contains filtered or unexported fields
}

func (*ActionTiming) Clone

func (at *ActionTiming) Clone() (cln *ActionTiming)

Clone clones ActionTiming

func (*ActionTiming) Execute

func (at *ActionTiming) Execute(successActions, failedActions chan *Action) (err error)

Execute will execute all actions in an action plan Reports on success/fail via channel if != nil

func (*ActionTiming) GetAccountIDs

func (at *ActionTiming) GetAccountIDs() utils.StringMap

func (*ActionTiming) GetActionPlanID

func (at *ActionTiming) GetActionPlanID() string

func (*ActionTiming) GetNextStartTime

func (at *ActionTiming) GetNextStartTime(now time.Time) (t time.Time)

func (*ActionTiming) GetNextStartTimeOld

func (at *ActionTiming) GetNextStartTimeOld(now time.Time) (t time.Time)

To be deleted after the above solution proves reliable

func (*ActionTiming) IsASAP

func (at *ActionTiming) IsASAP() bool

func (*ActionTiming) RemoveAccountID

func (at *ActionTiming) RemoveAccountID(acntID string) (found bool)

func (*ActionTiming) ResetStartTimeCache

func (at *ActionTiming) ResetStartTimeCache()

func (*ActionTiming) SetAccountIDs

func (at *ActionTiming) SetAccountIDs(accIDs utils.StringMap)

func (*ActionTiming) SetActionPlanID

func (at *ActionTiming) SetActionPlanID(id string)

func (*ActionTiming) SetActions

func (at *ActionTiming) SetActions(as Actions)

func (*ActionTiming) Tasks

func (at *ActionTiming) Tasks() (tsks []*Task)

Tasks converts an ActionTiming into multiple Tasks

type ActionTimingPriorityList

type ActionTimingPriorityList []*ActionTiming

Structure to store actions according to execution time and weight

func (ActionTimingPriorityList) Len

func (atpl ActionTimingPriorityList) Len() int

func (ActionTimingPriorityList) Less

func (atpl ActionTimingPriorityList) Less(i, j int) bool

func (ActionTimingPriorityList) Sort

func (atpl ActionTimingPriorityList) Sort()

func (ActionTimingPriorityList) Swap

func (atpl ActionTimingPriorityList) Swap(i, j int)

type ActionTimingWeightOnlyPriorityList

type ActionTimingWeightOnlyPriorityList []*ActionTiming

Structure to store actions according to weight

func (ActionTimingWeightOnlyPriorityList) Len

func (ActionTimingWeightOnlyPriorityList) Less

func (ActionTimingWeightOnlyPriorityList) Sort

func (ActionTimingWeightOnlyPriorityList) Swap

func (atpl ActionTimingWeightOnlyPriorityList) Swap(i, j int)

type ActionTrigger

type ActionTrigger struct {
	ID             string // original csv tag
	UniqueID       string // individual id
	ThresholdType  string //*min_event_counter, *max_event_counter, *min_balance_counter, *max_balance_counter, *min_balance, *max_balance, *balance_expired
	ThresholdValue float64
	Recurrent      bool          // reset excuted flag each run
	MinSleep       time.Duration // Minimum duration between two executions in case of recurrent triggers
	ExpirationDate time.Time
	ActivationDate time.Time
	//BalanceType       string // *monetary/*voice etc
	Balance           *BalanceFilter
	Weight            float64
	ActionsID         string
	MinQueuedItems    int // Trigger actions only if this number is hit (stats only)
	Executed          bool
	LastExecutionTime time.Time
}

func (*ActionTrigger) Clone

func (at *ActionTrigger) Clone() *ActionTrigger

makes a shallow copy of the receiver

func (*ActionTrigger) CreateBalance

func (at *ActionTrigger) CreateBalance() *Balance

func (*ActionTrigger) Equals

func (at *ActionTrigger) Equals(oat *ActionTrigger) bool

func (*ActionTrigger) Execute

func (at *ActionTrigger) Execute(ub *Account) (err error)

func (*ActionTrigger) IsActive

func (at *ActionTrigger) IsActive(t time.Time) bool

func (*ActionTrigger) IsExpired

func (at *ActionTrigger) IsExpired(t time.Time) bool

func (*ActionTrigger) Match

func (at *ActionTrigger) Match(a *Action) bool

returns true if the field of the action timing are equeal to the non empty fields of the action

type ActionTriggers

type ActionTriggers []*ActionTrigger

Structure to store actions according to weight

func (ActionTriggers) Clone

func (atpl ActionTriggers) Clone() ActionTriggers

func (ActionTriggers) Len

func (atpl ActionTriggers) Len() int

func (ActionTriggers) Less

func (atpl ActionTriggers) Less(j, i int) bool

we need higher weights earlyer in the list

func (ActionTriggers) Sort

func (atpl ActionTriggers) Sort()

func (ActionTriggers) Swap

func (atpl ActionTriggers) Swap(i, j int)

type Actions

type Actions []*Action

Actions used to store actions according to weight

func (Actions) Clone

func (apl Actions) Clone() (interface{}, error)

Clone returns a clone from object

func (Actions) Len

func (apl Actions) Len() int

func (Actions) Less

func (apl Actions) Less(j, i int) bool

we need higher weights earlyer in the list

func (Actions) Sort

func (apl Actions) Sort()

Sort used to implement sort interface

func (Actions) Swap

func (apl Actions) Swap(i, j int)

type ArgRateCDRs

type ArgRateCDRs struct {
	Flags []string
	utils.RPCCDRsFilter
	*utils.ArgDispatcher
	*utils.TenantArg
}

ArgRateCDRs a cdr with extra flags

type ArgV1ProcessEvent

type ArgV1ProcessEvent struct {
	Flags []string
	utils.CGREvent
	*utils.ArgDispatcher
}

ArgV1ProcessEvent is the CGREvent with proccesing Flags

type ArgsGetSuppliers

type ArgsGetSuppliers struct {
	IgnoreErrors bool
	MaxCost      string // toDo: try with interface{} here
	*utils.CGREvent
	utils.Paginator
	*utils.ArgDispatcher
}

type ArgsProcessEvent

type ArgsProcessEvent struct {
	ThresholdIDs []string
	*utils.CGREvent
	*utils.ArgDispatcher
}

type ArgsV2CDRSStoreSMCost

type ArgsV2CDRSStoreSMCost struct {
	Cost           *V2SMCost
	CheckDuplicate bool
	*utils.ArgDispatcher
	*utils.TenantArg
}

type AttrArgsProcessEvent

type AttrArgsProcessEvent struct {
	AttributeIDs []string
	Context      *string // attach the event to a context
	ProcessRuns  *int    // number of loops for ProcessEvent
	*utils.CGREvent
	*utils.ArgDispatcher
}

AttrArgsProcessEvent arguments used for proccess event

type AttrCDRSStoreSMCost

type AttrCDRSStoreSMCost struct {
	Cost           *SMCost
	CheckDuplicate bool
	*utils.ArgDispatcher
	*utils.TenantArg
}

type AttrSProcessEventReply

type AttrSProcessEventReply struct {
	MatchedProfiles []string
	AlteredFields   []string
	CGREvent        *utils.CGREvent
	// contains filtered or unexported fields
}

AttrSProcessEventReply reply used for proccess event

func (*AttrSProcessEventReply) Digest

func (attrReply *AttrSProcessEventReply) Digest() (rplyDigest string)

Digest returns serialized version of alteredFields in AttrSProcessEventReply format fldName1:fldVal1,fldName2:fldVal2

type Attribute

type Attribute struct {
	FilterIDs []string
	Path      string
	Type      string
	Value     config.RSRParsers
}

Attribute used by AttributeProfile to describe a single attribute

type AttributeProfile

type AttributeProfile struct {
	Tenant             string
	ID                 string
	Contexts           []string // bind this AttributeProfile to multiple contexts
	FilterIDs          []string
	ActivationInterval *utils.ActivationInterval // Activation interval
	Attributes         []*Attribute
	Blocker            bool // blocker flag to stop processing on multiple runs
	Weight             float64
}

AttributeProfile the profile definition for the attributes

func APItoAttributeProfile

func APItoAttributeProfile(tpAttr *utils.TPAttributeProfile, timezone string) (attrPrf *AttributeProfile, err error)

func NewAttributeFromInline

func NewAttributeFromInline(tenant, inlnRule string) (attr *AttributeProfile, err error)

NewAttributeFromInline parses an inline rule into a compiled AttributeProfile

func (*AttributeProfile) Compile

func (ap *AttributeProfile) Compile() error

Compile is a wrapper for convenience setting up the AttributeProfile

func (*AttributeProfile) TenantID

func (ap *AttributeProfile) TenantID() string

TenantID returns the tenant wit the ID

type AttributeProfiles

type AttributeProfiles []*AttributeProfile

AttributeProfiles is a sortable list of Attribute profiles

func (AttributeProfiles) Sort

func (aps AttributeProfiles) Sort()

Sort is part of sort interface, sort based on Weight

type AttributeService

type AttributeService struct {
	// contains filtered or unexported fields
}

AttributeService the service for the API

func NewAttributeService

func NewAttributeService(dm *DataManager, filterS *FilterS,
	cgrcfg *config.CGRConfig) (*AttributeService, error)

NewAttributeService returns a new AttributeService

func (*AttributeService) ListenAndServe

func (alS *AttributeService) ListenAndServe(exitChan chan bool) (err error)

ListenAndServe will initialize the service

func (*AttributeService) Shutdown

func (alS *AttributeService) Shutdown() (err error)

Shutdown is called to shutdown the service

func (*AttributeService) V1GetAttributeForEvent

func (alS *AttributeService) V1GetAttributeForEvent(args *AttrArgsProcessEvent,
	attrPrfl *AttributeProfile) (err error)

V1GetAttributeForEvent returns the AttributeProfile that matches the event

func (*AttributeService) V1ProcessEvent

func (alS *AttributeService) V1ProcessEvent(args *AttrArgsProcessEvent,
	reply *AttrSProcessEventReply) (err error)

V1ProcessEvent proccess the event and returns the result

type BSONMarshaler

type BSONMarshaler struct{}

func (*BSONMarshaler) Marshal

func (jm *BSONMarshaler) Marshal(v interface{}) ([]byte, error)

func (*BSONMarshaler) Unmarshal

func (jm *BSONMarshaler) Unmarshal(data []byte, v interface{}) error

type Balance

type Balance struct {
	Uuid           string //system wide unique
	ID             string // account wide unique
	Value          float64
	ExpirationDate time.Time
	Weight         float64
	DestinationIDs utils.StringMap
	RatingSubject  string
	Categories     utils.StringMap
	SharedGroups   utils.StringMap
	Timings        []*RITiming
	TimingIDs      utils.StringMap
	Disabled       bool
	Factor         ValueFactor
	Blocker        bool
	// contains filtered or unexported fields
}

Can hold different units as seconds or monetary

func (*Balance) AddValue

func (b *Balance) AddValue(amount float64)

func (*Balance) AsBalanceSummary

func (b *Balance) AsBalanceSummary(typ string) *BalanceSummary

Converts the balance towards compressed information to be displayed

func (*Balance) Clone

func (b *Balance) Clone() *Balance

func (*Balance) Equal

func (b *Balance) Equal(o *Balance) bool

func (*Balance) GetCost

func (b *Balance) GetCost(cd *CallDescriptor, getStandardIfEmpty bool) (*CallCost, error)

Gets the cost using balance RatingSubject if present otherwize retuns a callcost obtained using standard rating

func (*Balance) GetMinutesForCredit

func (b *Balance) GetMinutesForCredit(origCD *CallDescriptor, initialCredit float64) (duration time.Duration, credit float64)

Returns the available number of seconds for a specified credit

func (*Balance) GetValue

func (b *Balance) GetValue() float64

func (*Balance) HardMatchFilter

func (b *Balance) HardMatchFilter(o *BalanceFilter, skipIds bool) bool

func (*Balance) HasDestination

func (b *Balance) HasDestination() bool

func (*Balance) IsActive

func (b *Balance) IsActive() bool

func (*Balance) IsActiveAt

func (b *Balance) IsActiveAt(t time.Time) bool

func (*Balance) IsDefault

func (b *Balance) IsDefault() bool

the default balance has standard Id

func (*Balance) IsExpiredAt

func (b *Balance) IsExpiredAt(t time.Time) bool

IsExpiredAt check if ExpirationDate is before time t

func (*Balance) MatchActionTrigger

func (b *Balance) MatchActionTrigger(at *ActionTrigger) bool

func (*Balance) MatchCategory

func (b *Balance) MatchCategory(category string) bool

func (*Balance) MatchDestination

func (b *Balance) MatchDestination(destinationID string) bool

func (*Balance) MatchFilter

func (b *Balance) MatchFilter(o *BalanceFilter, skipIds, skipExpiry bool) bool

func (*Balance) Publish

func (b *Balance) Publish()

func (*Balance) SetDirty

func (b *Balance) SetDirty()

func (*Balance) SetValue

func (b *Balance) SetValue(amount float64)

func (*Balance) SubstractValue

func (b *Balance) SubstractValue(amount float64)

type BalanceCharge

type BalanceCharge struct {
	AccountID     string  // keep reference for shared balances
	BalanceUUID   string  // balance charged
	RatingID      string  // special price applied on this balance
	Units         float64 // number of units charged
	ExtraChargeID string  // used in cases when paying *voice with *monetary
}

BalanceCharge represents one unit charged to a balance

func (*BalanceCharge) Clone

func (bc *BalanceCharge) Clone() *BalanceCharge

Clone creates a copy of BalanceCharge

func (*BalanceCharge) Equals

func (bc *BalanceCharge) Equals(oBC *BalanceCharge) bool

Equals returns if the structure have the same fields

func (*BalanceCharge) FieldAsInterface

func (bc *BalanceCharge) FieldAsInterface(fldPath []string) (val interface{}, err error)

FieldAsInterface func to help EventCost FieldAsInterface

type BalanceFilter

type BalanceFilter struct {
	Uuid           *string
	ID             *string
	Type           *string
	Value          *utils.ValueFormula
	ExpirationDate *time.Time
	Weight         *float64
	DestinationIDs *utils.StringMap
	RatingSubject  *string
	Categories     *utils.StringMap
	SharedGroups   *utils.StringMap
	TimingIDs      *utils.StringMap
	Timings        []*RITiming
	Disabled       *bool
	Factor         *ValueFactor
	Blocker        *bool
}

func NewBalanceFilter

func NewBalanceFilter(filter map[string]interface{}, defaultTimezone string) (bf *BalanceFilter, err error)

NewBalanceFilter creates a new BalanceFilter based on given filter

func (*BalanceFilter) Clone

func (bf *BalanceFilter) Clone() *BalanceFilter

func (*BalanceFilter) CreateBalance

func (bp *BalanceFilter) CreateBalance() *Balance

func (*BalanceFilter) EmptyExpirationDate

func (bp *BalanceFilter) EmptyExpirationDate() bool

func (*BalanceFilter) Equal

func (bp *BalanceFilter) Equal(o *BalanceFilter) bool

func (*BalanceFilter) GetBlocker

func (bp *BalanceFilter) GetBlocker() bool

func (*BalanceFilter) GetCategories

func (bp *BalanceFilter) GetCategories() utils.StringMap

func (*BalanceFilter) GetDestinationIDs

func (bp *BalanceFilter) GetDestinationIDs() utils.StringMap

func (*BalanceFilter) GetDisabled

func (bp *BalanceFilter) GetDisabled() bool

func (*BalanceFilter) GetExpirationDate

func (bp *BalanceFilter) GetExpirationDate() time.Time

func (*BalanceFilter) GetFactor

func (bp *BalanceFilter) GetFactor() ValueFactor

func (*BalanceFilter) GetID

func (bp *BalanceFilter) GetID() string

func (*BalanceFilter) GetRatingSubject

func (bp *BalanceFilter) GetRatingSubject() string

func (*BalanceFilter) GetSharedGroups

func (bp *BalanceFilter) GetSharedGroups() utils.StringMap

func (*BalanceFilter) GetTimingIDs

func (bp *BalanceFilter) GetTimingIDs() utils.StringMap

func (*BalanceFilter) GetType

func (bp *BalanceFilter) GetType() string

func (*BalanceFilter) GetUuid

func (bp *BalanceFilter) GetUuid() string

func (*BalanceFilter) GetValue

func (bp *BalanceFilter) GetValue() float64

func (*BalanceFilter) GetWeight

func (bp *BalanceFilter) GetWeight() float64

func (*BalanceFilter) LoadFromBalance

func (bf *BalanceFilter) LoadFromBalance(b *Balance) *BalanceFilter

func (*BalanceFilter) ModifyBalance

func (bf *BalanceFilter) ModifyBalance(b *Balance)

func (*BalanceFilter) SetValue

func (bp *BalanceFilter) SetValue(v float64)

type BalanceSummaries

type BalanceSummaries []*BalanceSummary

BalanceSummaries is a list of BalanceSummaries

func (BalanceSummaries) BalanceSummaryWithUUD

func (bs BalanceSummaries) BalanceSummaryWithUUD(bsUUID string) (b *BalanceSummary)

BalanceSummaryWithUUD returns a BalanceSummary based on an UUID

type BalanceSummary

type BalanceSummary struct {
	UUID     string // Balance UUID
	ID       string // Balance ID  if not defined
	Type     string // *voice, *data, etc
	Value    float64
	Disabled bool
}

BalanceSummary represents compressed information about a balance

func (*BalanceSummary) FieldAsInterface

func (bl *BalanceSummary) FieldAsInterface(fldPath []string) (val interface{}, err error)

FieldAsInterface func to help EventCost FieldAsInterface

type Balances

type Balances []*Balance

Structure to store minute buckets according to weight, precision or price.

func (Balances) Clone

func (bc Balances) Clone() Balances

func (Balances) Equal

func (bc Balances) Equal(o Balances) bool

func (Balances) GetBalance

func (bc Balances) GetBalance(uuid string) *Balance

func (Balances) GetTotalValue

func (bc Balances) GetTotalValue() (total float64)

func (Balances) HasBalance

func (bc Balances) HasBalance(balance *Balance) bool

func (Balances) Len

func (bc Balances) Len() int

func (Balances) Less

func (bc Balances) Less(j, i int) bool

we need the better ones at the beginning

func (Balances) SaveDirtyBalances

func (bc Balances) SaveDirtyBalances(acc *Account)

func (Balances) Sort

func (bc Balances) Sort()

func (Balances) Swap

func (bc Balances) Swap(i, j int)

type BincMarshaler

type BincMarshaler struct {
	// contains filtered or unexported fields
}

func NewBincMarshaler

func NewBincMarshaler() *BincMarshaler

func (*BincMarshaler) Marshal

func (bm *BincMarshaler) Marshal(v interface{}) (b []byte, err error)

func (*BincMarshaler) Unmarshal

func (bm *BincMarshaler) Unmarshal(data []byte, v interface{}) error

type CDR

type CDR struct {
	CGRID       string
	RunID       string
	OrderID     int64             // Stor order id used as export order id
	OriginHost  string            // represents the IP address of the host generating the CDR (automatically populated by the server)
	Source      string            // formally identifies the source of the CDR (free form field)
	OriginID    string            // represents the unique accounting id given by the telecom switch generating the CDR
	ToR         string            // type of record, meta-field, should map to one of the TORs hardcoded inside the server <*voice|*data|*sms|*generic>
	RequestType string            // matching the supported request types by the **CGRateS**, accepted values are hardcoded in the server <prepaid|postpaid|pseudoprepaid|rated>.
	Tenant      string            // tenant whom this record belongs
	Category    string            // free-form filter for this record, matching the category defined in rating profiles.
	Account     string            // account id (accounting subsystem) the record should be attached to
	Subject     string            // rating subject (rating subsystem) this record should be attached to
	Destination string            // destination to be charged
	SetupTime   time.Time         // set-up time of the event. Supported formats: datetime RFC3339 compatible, SQL datetime (eg: MySQL), unix timestamp.
	AnswerTime  time.Time         // answer time of the event. Supported formats: datetime RFC3339 compatible, SQL datetime (eg: MySQL), unix timestamp.
	Usage       time.Duration     // event usage information (eg: in case of tor=*voice this will represent the total duration of a call)
	ExtraFields map[string]string // Extra fields to be stored in CDR
	ExtraInfo   string            // Container for extra information related to this CDR, eg: populated with error reason in case of error on calculation
	Partial     bool              // Used for partial record processing by ERs
	PreRated    bool              // Mark the CDR as rated so we do not process it during rating
	CostSource  string            // The source of this cost
	Cost        float64           //
	CostDetails *EventCost        // Attach the cost details to CDR when possible
}

func NewCDRFromExternalCDR

func NewCDRFromExternalCDR(extCdr *ExternalCDR, timezone string) (*CDR, error)

func NewCDRFromSQL

func NewCDRFromSQL(cdrSQL *CDRsql) (cdr *CDR, err error)

NewCDRFromSQL converts the CDRsql into CDR

func NewCDRWithDefaults

func NewCDRWithDefaults(cfg *config.CGRConfig) *CDR

func (*CDR) AddDefaults

func (cdr *CDR) AddDefaults(cfg *config.CGRConfig)

AddDefaults will add missing information based on other fields

func (*CDR) AsCDRsql

func (cdr *CDR) AsCDRsql() (cdrSQL *CDRsql)

AsCDRsql converts the CDR into the format used for SQL storage

func (*CDR) AsCGREvent

func (cdr *CDR) AsCGREvent() *utils.CGREvent

func (*CDR) AsExportMap

func (cdr *CDR) AsExportMap(exportFields []*config.FCTemplate, httpSkipTLSCheck bool,
	groupedCDRs []*CDR, filterS *FilterS) (expMap map[string]string, err error)

AsExportMap converts the CDR into a map[string]string based on export template Used in real-time replication as well as remote exports

func (*CDR) AsExportRecord

func (cdr *CDR) AsExportRecord(exportFields []*config.FCTemplate,
	httpSkipTLSCheck bool, groupedCDRs []*CDR, filterS *FilterS) (expRecord []string, err error)

AsExportRecord is used in place where we need to export the CDR based on an export template ExportRecord is a []string to keep it compatible with encoding/csv Writer

func (*CDR) AsExternalCDR

func (cdr *CDR) AsExternalCDR() *ExternalCDR

func (*CDR) AsMapStringIface

func (cdr *CDR) AsMapStringIface() (mp map[string]interface{})

func (*CDR) Clone

func (cdr *CDR) Clone() *CDR

func (*CDR) ComputeCGRID

func (cdr *CDR) ComputeCGRID()

func (*CDR) CostDetailsJson

func (cdr *CDR) CostDetailsJson() string

func (*CDR) FieldAsString

func (cdr *CDR) FieldAsString(rsrPrs *config.RSRParser) (parsed string, err error)

FieldAsString is used to retrieve fields as string, primary fields are const labeled

func (*CDR) FieldsAsString

func (cdr *CDR) FieldsAsString(rsrFlds config.RSRParsers) string

FieldsAsString concatenates values of multiple fields defined in template, used eg in CDR templates

func (*CDR) FormatCost

func (cdr *CDR) FormatCost(shiftDecimals, roundDecimals int) string

FormatCost formats the cost as string on export

func (*CDR) String

func (cdr *CDR) String() string

func (*CDR) UpdateFromCGREvent

func (cdr *CDR) UpdateFromCGREvent(cgrEv *utils.CGREvent, fields []string) (err error)

UpdateFromCGREvent will update CDR with event fields from CGREvent

type CDRExporter

type CDRExporter struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

CDRExporter used to export the CDRs

func NewCDRExporter

func NewCDRExporter(cdrs []*CDR, exportTemplate *config.CdreCfg, exportFormat, exportPath, fallbackPath, exportID string,
	synchronous bool, attempts int, fieldSeparator rune,
	httpSkipTLSCheck bool, attrsConns []string, filterS *FilterS) (*CDRExporter, error)

NewCDRExporter returns a new CDRExporter

func (*CDRExporter) ExportCDRs

func (cdre *CDRExporter) ExportCDRs() (err error)

ExportCDRs exports the given CDRs

func (*CDRExporter) FirstOrderID

func (cdre *CDRExporter) FirstOrderID() int64

FirstOrderID returns the first exported Cdr OrderId

func (*CDRExporter) LastOrderID

func (cdre *CDRExporter) LastOrderID() int64

LastOrderID return the last exported Cdr OrderId

func (*CDRExporter) NegativeExports

func (cdre *CDRExporter) NegativeExports() map[string]string

NegativeExports returns the failed exported CGRIDs together with the reason

func (*CDRExporter) PositiveExports

func (cdre *CDRExporter) PositiveExports() []string

PositiveExports returns the successfully exported CGRIDs

func (*CDRExporter) TotalCost

func (cdre *CDRExporter) TotalCost() float64

TotalCost returns the total cost in the exported cdrs

func (*CDRExporter) TotalExportedCdrs

func (cdre *CDRExporter) TotalExportedCdrs() int

TotalExportedCdrs returns the number of exported CDRs

type CDRServer

type CDRServer struct {
	// contains filtered or unexported fields
}

CDRServer stores and rates CDRs

func NewCDRServer

func NewCDRServer(cgrCfg *config.CGRConfig, storDBChan chan StorDB, dm *DataManager, filterS *FilterS,
	connMgr *ConnManager) *CDRServer

NewCDRServer is a constructor for CDRServer

func (*CDRServer) Call

func (cdrS *CDRServer) Call(serviceMethod string, args interface{}, reply interface{}) error

Call implements the rpcclient.ClientConnector interface

func (*CDRServer) ListenAndServe

func (cdrS *CDRServer) ListenAndServe(stopChan chan struct{}) (err error)

ListenAndServe listen for storbd reload

func (*CDRServer) RegisterHandlersToServer

func (cdrS *CDRServer) RegisterHandlersToServer(server *utils.Server)

RegisterHandlersToServer is called by cgr-engine to register HTTP URL handlers

func (*CDRServer) V1CountCDRs

func (cdrS *CDRServer) V1CountCDRs(args *utils.RPCCDRsFilterWithArgDispatcher, cnt *int64) error

V1CountCDRs counts CDRs from DB

func (*CDRServer) V1GetCDRs

func (cdrS *CDRServer) V1GetCDRs(args utils.RPCCDRsFilterWithArgDispatcher, cdrs *[]*CDR) error

V1GetCDRs returns CDRs from DB

func (*CDRServer) V1ProcessCDR

func (cdrS *CDRServer) V1ProcessCDR(cdr *CDRWithArgDispatcher, reply *string) (err error)

V1ProcessCDR processes a CDR

func (*CDRServer) V1ProcessEvent

func (cdrS *CDRServer) V1ProcessEvent(arg *ArgV1ProcessEvent, reply *string) (err error)

V1ProcessEvent will process the CGREvent

func (*CDRServer) V1ProcessExternalCDR

func (cdrS *CDRServer) V1ProcessExternalCDR(eCDR *ExternalCDRWithArgDispatcher, reply *string) error

V1ProcessExternalCDR is used to process external CDRs

func (*CDRServer) V1RateCDRs

func (cdrS *CDRServer) V1RateCDRs(arg *ArgRateCDRs, reply *string) (err error)

V1RateCDRs is used for re-/rate CDRs which are already stored within StorDB FixMe: add RPC caching

func (*CDRServer) V1StoreSessionCost

func (cdrS *CDRServer) V1StoreSessionCost(attr *AttrCDRSStoreSMCost, reply *string) (err error)

V1StoreSessionCost handles storing of the cost into session_costs table

func (*CDRServer) V2StoreSessionCost

func (cdrS *CDRServer) V2StoreSessionCost(args *ArgsV2CDRSStoreSMCost, reply *string) (err error)

V2StoreSessionCost will store the SessionCost into session_costs table

type CDRWithArgDispatcher

type CDRWithArgDispatcher struct {
	*CDR
	*utils.ArgDispatcher
}

type CDRsql

type CDRsql struct {
	ID          int64
	Cgrid       string
	RunID       string
	OriginHost  string
	Source      string
	OriginID    string
	TOR         string
	RequestType string
	Tenant      string
	Category    string
	Account     string
	Subject     string
	Destination string
	SetupTime   time.Time
	AnswerTime  time.Time
	Usage       int64
	ExtraFields string
	CostSource  string
	Cost        float64
	CostDetails string
	ExtraInfo   string
	CreatedAt   time.Time
	UpdatedAt   time.Time
	DeletedAt   *time.Time
}

func (CDRsql) AsMapStringInterface

func (t CDRsql) AsMapStringInterface() (out map[string]interface{})

func (CDRsql) TableName

func (t CDRsql) TableName() string

type CGRSafEvent

type CGRSafEvent struct {
	Tenant string
	ID     string
	Time   *time.Time // event time
	Event  *SafEvent
}

CGRSafEvent is a safe CGREvent

func NewCGRSafEventFromCGREvent

func NewCGRSafEventFromCGREvent(cgrEv *utils.CGREvent) *CGRSafEvent

func (*CGRSafEvent) AsCGREvent

func (cgrSafEv *CGRSafEvent) AsCGREvent() *utils.CGREvent

type CSVStorage

type CSVStorage struct {
	// contains filtered or unexported fields
}

func NewCSVStorage

func NewCSVStorage(sep rune,
	destinationsFn, timingsFn, ratesFn, destinationratesFn,
	destinationratetimingsFn, ratingprofilesFn, sharedgroupsFn,
	actionsFn, actiontimingsFn, actiontriggersFn, accountactionsFn,
	resProfilesFn, statsFn, thresholdsFn,
	filterFn, suppProfilesFn, attributeProfilesFn,
	chargerProfilesFn, dispatcherProfilesFn, dispatcherHostsFn []string) *CSVStorage

func NewFileCSVStorage

func NewFileCSVStorage(sep rune, dataPath string, recursive bool) *CSVStorage

func NewGoogleCSVStorage

func NewGoogleCSVStorage(sep rune, spreadsheetId, cfgPath string) (*CSVStorage, error)

func NewStringCSVStorage

func NewStringCSVStorage(sep rune,
	destinationsFn, timingsFn, ratesFn, destinationratesFn,
	destinationratetimingsFn, ratingprofilesFn, sharedgroupsFn,
	actionsFn, actiontimingsFn, actiontriggersFn,
	accountactionsFn, resProfilesFn, statsFn,
	thresholdsFn, filterFn, suppProfilesFn,
	attributeProfilesFn, chargerProfilesFn,
	dispatcherProfilesFn, dispatcherHostsFn string) *CSVStorage

func (*CSVStorage) GetTPAccountActions

func (csvs *CSVStorage) GetTPAccountActions(filter *utils.TPAccountActions) ([]*utils.TPAccountActions, error)

func (*CSVStorage) GetTPActionPlans

func (csvs *CSVStorage) GetTPActionPlans(tpid, id string) ([]*utils.TPActionPlan, error)

func (*CSVStorage) GetTPActionTriggers

func (csvs *CSVStorage) GetTPActionTriggers(tpid, id string) ([]*utils.TPActionTriggers, error)

func (*CSVStorage) GetTPActions

func (csvs *CSVStorage) GetTPActions(tpid, id string) ([]*utils.TPActions, error)

func (*CSVStorage) GetTPAttributes

func (csvs *CSVStorage) GetTPAttributes(tpid, tenant, id string) ([]*utils.TPAttributeProfile, error)

func (*CSVStorage) GetTPChargers

func (csvs *CSVStorage) GetTPChargers(tpid, tenant, id string) ([]*utils.TPChargerProfile, error)

func (*CSVStorage) GetTPDestinationRates

func (csvs *CSVStorage) GetTPDestinationRates(tpid, id string, p *utils.Paginator) ([]*utils.TPDestinationRate, error)

func (*CSVStorage) GetTPDestinations

func (csvs *CSVStorage) GetTPDestinations(tpid, id string) ([]*utils.TPDestination, error)

func (*CSVStorage) GetTPDispatcherHosts

func (csvs *CSVStorage) GetTPDispatcherHosts(tpid, tenant, id string) ([]*utils.TPDispatcherHost, error)

func (*CSVStorage) GetTPDispatcherProfiles

func (csvs *CSVStorage) GetTPDispatcherProfiles(tpid, tenant, id string) ([]*utils.TPDispatcherProfile, error)

func (*CSVStorage) GetTPFilters

func (csvs *CSVStorage) GetTPFilters(tpid, tenant, id string) ([]*utils.TPFilterProfile, error)

func (*CSVStorage) GetTPRates

func (csvs *CSVStorage) GetTPRates(tpid, id string) ([]*utils.TPRate, error)

func (*CSVStorage) GetTPRatingPlans

func (csvs *CSVStorage) GetTPRatingPlans(tpid, id string, p *utils.Paginator) ([]*utils.TPRatingPlan, error)

func (*CSVStorage) GetTPRatingProfiles

func (csvs *CSVStorage) GetTPRatingProfiles(filter *utils.TPRatingProfile) ([]*utils.TPRatingProfile, error)

func (*CSVStorage) GetTPResources

func (csvs *CSVStorage) GetTPResources(tpid, tenant, id string) ([]*utils.TPResourceProfile, error)

func (*CSVStorage) GetTPSharedGroups

func (csvs *CSVStorage) GetTPSharedGroups(tpid, id string) ([]*utils.TPSharedGroups, error)

func (*CSVStorage) GetTPStats

func (csvs *CSVStorage) GetTPStats(tpid, tenant, id string) ([]*utils.TPStatProfile, error)

func (*CSVStorage) GetTPSuppliers

func (csvs *CSVStorage) GetTPSuppliers(tpid, tenant, id string) ([]*utils.TPSupplierProfile, error)

func (*CSVStorage) GetTPThresholds

func (csvs *CSVStorage) GetTPThresholds(tpid, tenant, id string) ([]*utils.TPThresholdProfile, error)

func (*CSVStorage) GetTPTimings

func (csvs *CSVStorage) GetTPTimings(tpid, id string) ([]*utils.ApierTPTiming, error)

func (*CSVStorage) GetTpIds

func (csvs *CSVStorage) GetTpIds(colName string) ([]string, error)

func (*CSVStorage) GetTpTableIds

func (csvs *CSVStorage) GetTpTableIds(tpid, table string,
	distinct utils.TPDistinctIds, filters map[string]string, p *utils.PaginatorWithSearch) ([]string, error)

type CacheS

type CacheS struct {
	// contains filtered or unexported fields
}

CacheS deals with cache preload and other cache related tasks/APIs

func NewCacheS

func NewCacheS(cfg *config.CGRConfig, dm *DataManager) (c *CacheS)

NewCacheS initializes the Cache service and executes the precaching

func (*CacheS) Call

func (chS *CacheS) Call(serviceMethod string, args interface{}, reply interface{}) error

Call gives the ability of CacheS to be passed as internal RPC

func (*CacheS) GetPrecacheChannel

func (chS *CacheS) GetPrecacheChannel(chID string) chan struct{}

GetPrecacheChannel returns the channel used to signal precaching

func (*CacheS) Precache

func (chS *CacheS) Precache() (err error)

Precache loads data from DataDB into cache at engine start

func (*CacheS) V1Clear

func (chS *CacheS) V1Clear(args *utils.AttrCacheIDsWithArgDispatcher,
	reply *string) (err error)

func (*CacheS) V1FlushCache

func (chS *CacheS) V1FlushCache(args utils.AttrReloadCacheWithArgDispatcher, reply *string) (err error)

V1FlushCache wipes out cache for a prefix or completely

func (*CacheS) V1GetCacheStats

func (chS *CacheS) V1GetCacheStats(args *utils.AttrCacheIDsWithArgDispatcher,
	rply *map[string]*ltcache.CacheStats) (err error)

func (*CacheS) V1GetGroupItemIDs

func (chS *CacheS) V1GetGroupItemIDs(args *utils.ArgsGetGroupWithArgDispatcher,
	rply *[]string) (err error)

func (*CacheS) V1GetItemExpiryTime

func (chS *CacheS) V1GetItemExpiryTime(args *utils.ArgsGetCacheItemWithArgDispatcher,
	reply *time.Time) (err error)

func (*CacheS) V1GetItemIDs

func (chS *CacheS) V1GetItemIDs(args *utils.ArgsGetCacheItemIDsWithArgDispatcher,
	reply *[]string) (err error)

func (*CacheS) V1HasGroup

func (chS *CacheS) V1HasGroup(args *utils.ArgsGetGroupWithArgDispatcher,
	rply *bool) (err error)

func (*CacheS) V1HasItem

func (chS *CacheS) V1HasItem(args *utils.ArgsGetCacheItemWithArgDispatcher,
	reply *bool) (err error)

func (*CacheS) V1LoadCache

func (chS *CacheS) V1LoadCache(args utils.AttrReloadCacheWithArgDispatcher, reply *string) (err error)

func (*CacheS) V1PrecacheStatus

func (chS *CacheS) V1PrecacheStatus(args *utils.AttrCacheIDsWithArgDispatcher, rply *map[string]string) (err error)

func (*CacheS) V1ReloadCache

func (chS *CacheS) V1ReloadCache(attrs utils.AttrReloadCacheWithArgDispatcher, reply *string) (err error)

func (*CacheS) V1RemoveGroup

func (chS *CacheS) V1RemoveGroup(args *utils.ArgsGetGroupWithArgDispatcher,
	rply *string) (err error)

func (*CacheS) V1RemoveItem

func (chS *CacheS) V1RemoveItem(args *utils.ArgsGetCacheItemWithArgDispatcher,
	reply *string) (err error)

type CallCost

type CallCost struct {
	Category, Tenant, Subject, Account, Destination, ToR string
	Cost                                                 float64
	Timespans                                            TimeSpans
	RatedUsage                                           float64
	AccountSummary                                       *AccountSummary
	// contains filtered or unexported fields
}

The output structure that will be returned with the call cost information.

func (*CallCost) AsJSON

func (cc *CallCost) AsJSON() string