engine

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: GPL-3.0 Imports: 70 Imported by: 80

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

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"
)

Collection names in MongoDB.

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 configuration

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]any, 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 NewBiRPCService added in v0.10.3

func NewBiRPCService(val any) (srv *birpc.Service, err error)

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 birpc.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 UpdateFilterIndexes added in v0.10.3

func UpdateFilterIndexes(dm *DataManager, tnt string, oldFltr *Filter, newFltr *Filter) (err error)

UpdateFilterIndexes will update the indexes for every reference of a filter that exists in a profile. Every profile that contains the filters from oldFltr will be updated with the new values for newFltr. oldFltr and newFltr has the same tenant and ID.

func UpdateReplicationFilters added in v0.10.3

func UpdateReplicationFilters(objType, objID, connID string)

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() any

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 AccountActionPlanIHReply added in v0.10.3

type AccountActionPlanIHReply struct {
	MissingAccountActionPlans map[string][]string // list of missing indexes for each object (the map has the key as the indexKey and a list of objects)
	BrokenReferences          map[string][]string // list of broken references (the map has the key as the objectID and a list of indexes)
}

func GetAccountActionPlansIndexHealth added in v0.10.3

func GetAccountActionPlansIndexHealth(dm *DataManager, objLimit, indexLimit int, objTTL, indexTTL time.Duration, objStaticTTL, indexStaticTTL bool) (rply *AccountActionPlanIHReply, err error)

add cache in args API

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 any, err error)

FieldAsInterface func to help EventCost FieldAsInterface

func (*AccountSummary) UpdateBalances added in v0.10.3

func (as *AccountSummary) UpdateBalances(old *AccountSummary)

UpdateBalances will add the expired balances back

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 any, 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() (any, 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 any
	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() (any, 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 any 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 process 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 process 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 processes the event and returns the result

type BSONMarshaler

type BSONMarshaler struct{}

func (*BSONMarshaler) Marshal

func (jm *BSONMarshaler) Marshal(v any) ([]byte, error)

func (*BSONMarshaler) Unmarshal

func (jm *BSONMarshaler) Unmarshal(data []byte, v any) 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 returns 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 any, 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]any, 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 any, 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 any) (b []byte, err error)

func (*BincMarshaler) Unmarshal

func (bm *BincMarshaler) Unmarshal(data []byte, v any) 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) ([]string, 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) AsMapStorage added in v0.10.3

func (cdr *CDR) AsMapStorage() (mp utils.MapStorage)

func (*CDR) AsMapStringIface

func (cdr *CDR) AsMapStringIface() (mp map[string]any)

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) FieldAsFloat64 added in v0.10.3

func (cdr *CDR) FieldAsFloat64(rsrPrs *config.RSRParser) (parsed float64, err error)

FieldAsFloat64 retrieves a field from the CDR and attempts to parse it as a float64. It uses the provided parser to identify and parse the field.

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(value *config.RSRParser, shiftDecimals, roundDecimals int) (string, error)

FormatCost retrieves a cost related field from the CDR, shifts its decimal place, rounds it to the specified number of decimal places, and formats it as a string. The decimal place of the cost field is shifted by `shiftDecimals` places to the right. The cost field is then rounded to `roundDecimals` decimal places before it is formatted as a string.

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(ctx *context.Context, serviceMethod string, args any, reply any) error

Call implements the birpc.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]any)

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(ctx *context.Context, serviceMethod string, args any, reply any) 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) CreateCallDescriptor

func (cc *CallCost) CreateCallDescriptor() *CallDescriptor

Creates a CallDescriptor structure copying related data from CallCost

func (*CallCost) GetConnectFee

func (cc *CallCost) GetConnectFee() float64

func (*CallCost) GetDuration

func (cc *CallCost) GetDuration() (td time.Duration)

func (*CallCost) GetEndTime

func (cc *CallCost) GetEndTime() time.Time

func (*CallCost) GetLongestRounding

func (cc *CallCost) GetLongestRounding() (roundingDecimals int, roundingMethod string)

func (*CallCost) GetRoundIncrements

func (cc *CallCost) GetRoundIncrements() (roundIncrements Increments)

func (*CallCost) GetStartTime

func (cc *CallCost) GetStartTime() time.Time

func (*CallCost) IsPaid

func (cc *CallCost) IsPaid() bool

func (*CallCost) MatchCCFilter

func (cc *CallCost) MatchCCFilter(bf *BalanceFilter) bool

func (*CallCost) Merge

func (cc *CallCost) Merge(other *CallCost)

Merges the received timespan if they are similar (same activation period, same interval, same minute info.

func (*CallCost) Round

func (cc *CallCost) Round()

Round creates the RoundIncrements in timespans

func (*CallCost) ToDataCost

func (cc *CallCost) ToDataCost() (*DataCost, error)

func (*CallCost) UpdateCost

func (cc *CallCost) UpdateCost()

public function to update final (merged) callcost

func (*CallCost) UpdateRatedUsage

func (cc *CallCost) UpdateRatedUsage() time.Duration

type CallDescriptor

type CallDescriptor struct {
	Category        string
	Tenant          string
	Subject         string
	Account         string
	Destination     string
	TimeStart       time.Time
	TimeEnd         time.Time
	LoopIndex       float64       // indicates the position of this segment in a cost request loop
	DurationIndex   time.Duration // the call duration so far (till TimeEnd)
	FallbackSubject string        // the subject to check for destination if not found on primary subject
	RatingInfos     RatingInfos
	Increments      Increments
	ToR             string            // used unit balances selector
	ExtraFields     map[string]string // Extra fields, mostly used for user profile matching
	// session limits
	MaxRate             float64
	MaxRateUnit         time.Duration
	MaxCostSoFar        float64
	CgrID               string
	RunID               string
	ForceDuration       bool // for Max debit if less than duration return err
	PerformRounding     bool // flag for rating info rounding
	DryRun              bool
	DenyNegativeAccount bool // prevent account going on negative during debit
	// contains filtered or unexported fields
}

The input structure that contains call information.

func NewCallDescriptorFromCGREvent

func NewCallDescriptorFromCGREvent(cgrEv *utils.CGREvent,
	timezone string) (cd *CallDescriptor, err error)

NewCallDescriptorFromCGREvent converts a CGREvent into CallDescriptor

func (*CallDescriptor) AccountSummary

func (cd *CallDescriptor) AccountSummary(initialAcnt *AccountSummary) *AccountSummary

AccountSummary returns the AccountSummary for cached account

func (*CallDescriptor) AddRatingInfo

func (cd *CallDescriptor) AddRatingInfo(ris ...*RatingInfo)

Adds a rating plan that applyes to current call descriptor.

func (*CallDescriptor) AsCGREvent

func (cd *CallDescriptor) AsCGREvent() *utils.CGREvent

AsCGREvent converts the CallDescriptor into CGREvent

func (*CallDescriptor) Clone

func (cd *CallDescriptor) Clone() *CallDescriptor

func (*CallDescriptor) CreateCallCost

func (cd *CallDescriptor) CreateCallCost() *CallCost

Creates a CallCost structure copying related data from CallDescriptor

func (*CallDescriptor) Debit

func (cd *CallDescriptor) Debit() (cc *CallCost, err error)

func (*CallDescriptor) FieldAsInterface

func (cd *CallDescriptor) FieldAsInterface(fldPath []string) (fldVal any, err error)

FieldAsInterface is part of utils.DataProvider

func (*CallDescriptor) FieldAsString

func (cd *CallDescriptor) FieldAsString(fldPath []string) (fldVal string, err error)

FieldAsString is part of utils.DataProvider

func (*CallDescriptor) GetAccountKey

func (cd *CallDescriptor) GetAccountKey() string

GetAccountKey returns the key used to retrieve the user balance involved in this call

func (*CallDescriptor) GetCost

func (cd *CallDescriptor) GetCost() (*CallCost, error)

Creates a CallCost structure with the cost information calculated for the received CallDescriptor.

func (*CallDescriptor) GetDuration

func (cd *CallDescriptor) GetDuration() time.Duration

Returns call descripor's total duration

func (*CallDescriptor) GetKey

func (cd *CallDescriptor) GetKey(subject string) string

GetKey constructs the key for the storage lookup. The prefixLen is limiting the length of the destination prefix.

func (*CallDescriptor) GetMaxSessionDuration

func (cd *CallDescriptor) GetMaxSessionDuration() (duration time.Duration, err error)

func (*CallDescriptor) LoadRatingPlans

func (cd *CallDescriptor) LoadRatingPlans() (err error)

Restores the activation periods for the specified prefix from storage.

func (*CallDescriptor) MaxDebit

func (cd *CallDescriptor) MaxDebit() (cc *CallCost, err error)

Interface method used to add/subtract an amount of cents or bonus seconds (as returned by GetCost method) from user's money balance. This methods combines the Debit and GetMaxSessionDuration and will debit the max available time as returned by the GetMaxSessionDuration method. The amount filed has to be filled in call descriptor.

func (*CallDescriptor) RefundIncrements

func (cd *CallDescriptor) RefundIncrements() (acnt *Account, err error)

func (*CallDescriptor) RefundRounding

func (cd *CallDescriptor) RefundRounding() (acc *Account, err error)

func (*CallDescriptor) RemoteHost

func (cd *CallDescriptor) RemoteHost() net.Addr

RemoteHost is part of utils.DataProvider

func (*CallDescriptor) String

func (cd *CallDescriptor) String() string

String is part of utils.DataProvider

func (*CallDescriptor) UpdateFromCGREvent

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

UpdateFromCGREvent will update CallDescriptor with fields from CGREvent cgrEv contains both fields and their values fields represent fields needing update

func (*CallDescriptor) ValidateCallData

func (cd *CallDescriptor) ValidateCallData() error

type CallDescriptorWithArgDispatcher

type CallDescriptorWithArgDispatcher struct {
	*CallDescriptor
	*utils.ArgDispatcher
}

type CdrStorage

type CdrStorage interface {
	Storage
	SetCDR(*CDR, bool) error
	SetSMCost(smc *SMCost) error
	GetSMCosts(cgrid, runid, originHost, originIDPrfx string) ([]*SMCost, error)
	RemoveSMCost(*SMCost) error
	RemoveSMCosts(qryFltr *utils.SMCostFilter) error
	GetCDRs(*utils.CDRsFilter, bool) ([]*CDR, int64, error)
}

type CgrCdr

type CgrCdr map[string]string

func NewCgrCdrFromHttpReq

func NewCgrCdrFromHttpReq(req *http.Request, timezone string) (CgrCdr, error)

func (CgrCdr) AsCDR

func (cgrCdr CgrCdr) AsCDR(timezone string) *CDR

type ChargedRates

type ChargedRates map[string]RateGroups

ChargedRates the map with rateGroups

func (ChargedRates) Clone

func (crs ChargedRates) Clone() (cln ChargedRates)

Clone creates a copy of ChargedRates

func (ChargedRates) FieldAsInterface

func (crs ChargedRates) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface func to help EventCost FieldAsInterface

func (ChargedRates) GetIDWithSet

func (crs ChargedRates) GetIDWithSet(rg RateGroups) string

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

type ChargedTiming

type ChargedTiming struct {
	Years     utils.Years
	Months    utils.Months
	MonthDays utils.MonthDays
	WeekDays  utils.WeekDays
	StartTime string
}

ChargedTiming represents one timing attached to a charge

func (*ChargedTiming) Clone

func (ct *ChargedTiming) Clone() (cln *ChargedTiming)

Clone creates a copy of ChargedTiming

func (*ChargedTiming) Equals

func (ct *ChargedTiming) Equals(oCT *ChargedTiming) bool

Equals returns if the timings are equal

func (ChargedTiming) FieldAsInterface

func (ct ChargedTiming) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface func to help EventCost FieldAsInterface

type ChargedTimings

type ChargedTimings map[string]*ChargedTiming

ChargedTimings the map of ChargedTiming

func (ChargedTimings) Clone

func (cts ChargedTimings) Clone() (cln ChargedTimings)

Clone creates a copy of ChargedTimings

func (ChargedTimings) FieldAsInterface

func (cts ChargedTimings) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface func to help EventCost FieldAsInterface

func (ChargedTimings) GetIDWithSet

func (cts ChargedTimings) GetIDWithSet(ct *ChargedTiming) string

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

type ChargerProfile

type ChargerProfile struct {
	Tenant             string
	ID                 string
	FilterIDs          []string
	ActivationInterval *utils.ActivationInterval // Activation interval
	RunID              string
	AttributeIDs       []string // perform data aliasing based on these Attributes
	Weight             float64
}

ChargerProfile is the config for one Charger

func APItoChargerProfile

func APItoChargerProfile(tpCPP *utils.TPChargerProfile, timezone string) (cpp *ChargerProfile, err error)

func (*ChargerProfile) TenantID

func (cP *ChargerProfile) TenantID() string

type ChargerProfiles

type ChargerProfiles []*ChargerProfile

ChargerProfiles is a sortable list of Charger profiles

func (ChargerProfiles) Sort

func (cps ChargerProfiles) Sort()

Sort is part of sort interface, sort based on Weight

type ChargerService

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

ChargerService is performing charging

func NewChargerService

func NewChargerService(dm *DataManager, filterS *FilterS,
	cfg *config.CGRConfig, connMgr *ConnManager) (*ChargerService, error)

func (*ChargerService) ListenAndServe

func (cS *ChargerService) ListenAndServe(exitChan chan bool) (err error)

ListenAndServe will initialize the service

func (*ChargerService) Shutdown

func (cS *ChargerService) Shutdown() (err error)

Shutdown is called to shutdown the service

func (*ChargerService) V1GetChargersForEvent

func (cS *ChargerService) V1GetChargersForEvent(args *utils.CGREventWithArgDispatcher,
	rply *ChargerProfiles) (err error)

V1GetChargersForEvent exposes the list of ordered matching ChargingProfiles for an event

func (*ChargerService) V1ProcessEvent

func (cS *ChargerService) V1ProcessEvent(args *utils.CGREventWithArgDispatcher,
	reply *[]*ChrgSProcessEventReply) (err error)

V1ProcessEvent will process the event received via API and return list of events forked

type ChargingIncrement

type ChargingIncrement struct {
	Usage          time.Duration
	Cost           float64
	AccountingID   string
	CompressFactor int
}

ChargingIncrement represents one unit charged inside an interval

func (*ChargingIncrement) Clone

func (cIt *ChargingIncrement) Clone() (cln *ChargingIncrement)

Clone creates a copy of ChargingIncrement

func (*ChargingIncrement) Equals

func (cIt *ChargingIncrement) Equals(oCIt *ChargingIncrement) bool

Equals returns if the structure has the same value

func (*ChargingIncrement) FieldAsInterface

func (cIt *ChargingIncrement) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface func to help EventCost FieldAsInterface

func (*ChargingIncrement) PartiallyEquals

func (cIt *ChargingIncrement) PartiallyEquals(oCIt *ChargingIncrement) bool

PartiallyEquals ignores the CompressFactor when comparing

func (*ChargingIncrement) TotalCost

func (cIt *ChargingIncrement) TotalCost() float64

TotalCost returns the cost of the increment

func (*ChargingIncrement) TotalUsage

func (cIt *ChargingIncrement) TotalUsage() time.Duration

TotalUsage returns the total usage of the increment, considering compress factor

type ChargingInterval

type ChargingInterval struct {
	RatingID       string               // reference to RatingUnit
	Increments     []*ChargingIncrement // specific increments applied to this interval
	CompressFactor int
	// contains filtered or unexported fields
}

ChargingInterval represents one interval out of Usage providing charging info eg: PEAK vs OFFPEAK

func (*ChargingInterval) Clone

func (cIl *ChargingInterval) Clone() (cln *ChargingInterval)

Clone returns a new instance of ChargingInterval with independent data

func (*ChargingInterval) Cost

func (cIl *ChargingInterval) Cost() float64

Cost computes the total cost on this ChargingInterval

func (*ChargingInterval) EndTime

func (cIl *ChargingInterval) EndTime(cIlST time.Time) (et time.Time)

EndTime computes an EndTime based on ChargingInterval StartTime value and usage

func (*ChargingInterval) EventCostUsageIndex

func (cIl *ChargingInterval) EventCostUsageIndex() *time.Duration

EventCostUsageIndex publishes the value of ecUsageIdx

func (*ChargingInterval) PartiallyEquals

func (cIl *ChargingInterval) PartiallyEquals(oCIl *ChargingInterval) bool

PartiallyEquals does not compare CompressFactor, useful for Merge

func (*ChargingInterval) StartTime

func (cIl *ChargingInterval) StartTime(ecST time.Time) (st time.Time)

StartTime computes a StartTime based on EventCost.Start time and ecUsageIdx

func (*ChargingInterval) TotalCost

func (cIl *ChargingInterval) TotalCost() float64

TotalCost returns the cost of charges

func (*ChargingInterval) TotalUsage

func (cIl *ChargingInterval) TotalUsage() (tu *time.Duration)

TotalUsage returns the total usage of this interval, considering compress factor

func (*ChargingInterval) Usage

func (cIl *ChargingInterval) Usage() *time.Duration

Usage computes the total usage of this ChargingInterval, ignoring CompressFactor

type ChrgSProcessEventReply

type ChrgSProcessEventReply struct {
	ChargerSProfile    string
	AttributeSProfiles []string
	AlteredFields      []string
	CGREvent           *utils.CGREvent
}

ChrgSProcessEventReply is the reply to processEvent

type CodecMsgpackMarshaler

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

func NewCodecMsgpackMarshaler

func NewCodecMsgpackMarshaler() *CodecMsgpackMarshaler

func (*CodecMsgpackMarshaler) Marshal

func (cmm *CodecMsgpackMarshaler) Marshal(v any) (b []byte, err error)

func (*CodecMsgpackMarshaler) Unmarshal

func (cmm *CodecMsgpackMarshaler) Unmarshal(data []byte, v any) error

type ConnManager

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

ConnManager handle the RPC connections

func NewConnManager

func NewConnManager(cfg *config.CGRConfig, rpcInternal map[string]chan birpc.ClientConnector) (cM *ConnManager)

NewConnManager returns the Connection Manager

func (*ConnManager) Call

func (cM *ConnManager) Call(connIDs []string, biRPCClient birpc.ClientConnector,
	method string, arg, reply any) (err error)

Call gets the connection calls the method on it

func (*ConnManager) CallWithConnIDs added in v0.10.3

func (cM *ConnManager) CallWithConnIDs(connIDs []string, subsHostIDs utils.StringSet, method string, arg, reply any) (err error)

func (*ConnManager) Reload added in v0.10.3

func (cM *ConnManager) Reload()

type CoreService

type CoreService struct {
}

func NewCoreService

func NewCoreService() *CoreService

func (*CoreService) ListenAndServe

func (cS *CoreService) ListenAndServe(exitChan chan bool) (err error)

ListenAndServe will initialize the service

func (*CoreService) Shutdown

func (cS *CoreService) Shutdown() (err error)

Shutdown is called to shutdown the service

func (*CoreService) Status

func (cS *CoreService) Status(arg *utils.TenantWithArgDispatcher, reply *map[string]any) (err error)

type CounterFilter

type CounterFilter struct {
	Value  float64
	Filter *BalanceFilter
}

func (*CounterFilter) Clone

func (cfs *CounterFilter) Clone() *CounterFilter

Clone clones *CounterFilter

type CounterFilters

type CounterFilters []*CounterFilter

func (CounterFilters) HasCounter

func (cfs CounterFilters) HasCounter(cf *CounterFilter) bool

type DataCost

type DataCost struct {
	Category, Tenant, Subject, Account,
	Destination, ToR string
	Cost      float64
	DataSpans []*DataSpan
	// contains filtered or unexported fields
}

type used for showing sane data cost

type DataDB

type DataDB interface {
	Storage
	HasDataDrv(string, string, string) (bool, error)
	GetRatingPlanDrv(string) (*RatingPlan, error)
	SetRatingPlanDrv(*RatingPlan) error
	RemoveRatingPlanDrv(key string) (err error)
	GetRatingProfileDrv(string) (*RatingProfile, error)
	SetRatingProfileDrv(*RatingProfile) error
	RemoveRatingProfileDrv(string) error
	GetDestinationDrv(string, bool, string) (*Destination, error)
	SetDestinationDrv(*Destination, string) error
	RemoveDestinationDrv(string, string) error
	SetReverseDestinationDrv(*Destination, string) error
	GetReverseDestinationDrv(string, bool, string) ([]string, error)
	UpdateReverseDestinationDrv(*Destination, *Destination, string) error
	GetActionsDrv(string) (Actions, error)
	SetActionsDrv(string, Actions) error
	RemoveActionsDrv(string) error
	GetSharedGroupDrv(string) (*SharedGroup, error)
	SetSharedGroupDrv(*SharedGroup) error
	RemoveSharedGroupDrv(id string) (err error)
	GetActionTriggersDrv(string) (ActionTriggers, error)
	SetActionTriggersDrv(string, ActionTriggers) error
	RemoveActionTriggersDrv(string) error
	GetActionPlanDrv(string) (*ActionPlan, error)
	SetActionPlanDrv(string, *ActionPlan) error
	RemoveActionPlanDrv(key string) error
	GetAllActionPlansDrv() (map[string]*ActionPlan, error)
	GetAccountActionPlansDrv(acntID string) (apIDs []string, err error)
	SetAccountActionPlansDrv(acntID string, apIDs []string) (err error)
	RemAccountActionPlansDrv(acntID string) (err error)
	PushTask(*Task) error
	PopTask() (*Task, error)
	GetAccountDrv(string) (*Account, error)
	SetAccountDrv(*Account) error
	RemoveAccountDrv(string) error
	GetResourceProfileDrv(string, string) (*ResourceProfile, error)
	SetResourceProfileDrv(*ResourceProfile) error
	RemoveResourceProfileDrv(string, string) error
	GetResourceDrv(string, string) (*Resource, error)
	SetResourceDrv(*Resource) error
	RemoveResourceDrv(string, string) error
	GetTimingDrv(string) (*utils.TPTiming, error)
	SetTimingDrv(*utils.TPTiming) error
	RemoveTimingDrv(string) error
	GetLoadHistory(int, bool, string) ([]*utils.LoadInstance, error)
	AddLoadHistory(*utils.LoadInstance, int, string) error
	GetFilterIndexesDrv(cacheID, itemIDPrefix, filterType string,
		fldNameVal map[string]string) (indexes map[string]utils.StringMap, err error)
	SetFilterIndexesDrv(cacheID, itemIDPrefix string,
		indexes map[string]utils.StringMap, commit bool, transactionID string) (err error)
	RemoveFilterIndexesDrv(cacheID, itemIDPrefix string) (err error)
	MatchFilterIndexDrv(cacheID, itemIDPrefix,
		filterType, fieldName, fieldVal string) (itemIDs utils.StringMap, err error)
	GetStatQueueProfileDrv(tenant string, ID string) (sq *StatQueueProfile, err error)
	SetStatQueueProfileDrv(sq *StatQueueProfile) (err error)
	RemStatQueueProfileDrv(tenant, id string) (err error)
	GetStatQueueDrv(tenant, id string) (sq *StatQueue, err error)
	SetStatQueueDrv(ssq *StoredStatQueue, sq *StatQueue) (err error)
	RemStatQueueDrv(tenant, id string) (err error)
	GetThresholdProfileDrv(tenant string, ID string) (tp *ThresholdProfile, err error)
	SetThresholdProfileDrv(tp *ThresholdProfile) (err error)
	RemThresholdProfileDrv(tenant, id string) (err error)
	GetThresholdDrv(string, string) (*Threshold, error)
	SetThresholdDrv(*Threshold) error
	RemoveThresholdDrv(string, string) error
	GetFilterDrv(string, string) (*Filter, error)
	SetFilterDrv(*Filter) error
	RemoveFilterDrv(string, string) error
	GetSupplierProfileDrv(string, string) (*SupplierProfile, error)
	SetSupplierProfileDrv(*SupplierProfile) error
	RemoveSupplierProfileDrv(string, string) error
	GetAttributeProfileDrv(string, string) (*AttributeProfile, error)
	SetAttributeProfileDrv(*AttributeProfile) error
	RemoveAttributeProfileDrv(string, string) error
	GetChargerProfileDrv(string, string) (*ChargerProfile, error)
	SetChargerProfileDrv(*ChargerProfile) error
	RemoveChargerProfileDrv(string, string) error
	GetDispatcherProfileDrv(string, string) (*DispatcherProfile, error)
	SetDispatcherProfileDrv(*DispatcherProfile) error
	RemoveDispatcherProfileDrv(string, string) error
	GetItemLoadIDsDrv(itemIDPrefix string) (loadIDs map[string]int64, err error)
	SetLoadIDsDrv(loadIDs map[string]int64) error
	RemoveLoadIDsDrv() error
	GetDispatcherHostDrv(string, string) (*DispatcherHost, error)
	SetDispatcherHostDrv(*DispatcherHost) error
	RemoveDispatcherHostDrv(string, string) error
}

OnlineStorage contains methods to use for administering online data

func NewDataDBConn

func NewDataDBConn(dbType, host, port, name, user,
	pass, marshaler, sentinelName string,
	itemsCacheCfg map[string]*config.ItemOpt) (d DataDB, err error)

NewDataDBConn creates a DataDB connection

type DataIncrement

type DataIncrement struct {
	Amount         float64
	Cost           float64
	BalanceInfo    *DebitInfo // need more than one for units with cost
	CompressFactor int
	// contains filtered or unexported fields
}

type DataManager

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

DataManager is the data storage manager for CGRateS transparently manages data retrieval, further serialization and caching

func NewDataManager

func NewDataManager(dataDB DataDB, cacheCfg config.CacheCfg, connMgr *ConnManager) *DataManager

NewDataManager returns a new DataManager

func (*DataManager) CacheDataFromDB

func (dm *DataManager) CacheDataFromDB(prfx string, ids []string, mustBeCached bool) (err error)

func (*DataManager) DataDB

func (dm *DataManager) DataDB() DataDB

DataDB exports access to dataDB

func (*DataManager) GetAccount

func (dm *DataManager) GetAccount(id string) (acc *Account, err error)

func (*DataManager) GetAccountActionPlans

func (dm *DataManager) GetAccountActionPlans(acntID string, cacheRead, cacheWrite bool, transactionID string) (apIDs []string, err error)

func (*DataManager) GetActionPlan

func (dm *DataManager) GetActionPlan(key string, cacheRead, cacheWrite bool, transactionID string) (ats *ActionPlan, err error)

func (*DataManager) GetActionTriggers

func (dm *DataManager) GetActionTriggers(id string, skipCache bool,
	transactionID string) (attrs ActionTriggers, err error)

func (*DataManager) GetActions

func (dm *DataManager) GetActions(key string, skipCache bool, transactionID string) (as Actions, err error)

func (*DataManager) GetAllActionPlans

func (dm *DataManager) GetAllActionPlans() (ats map[string]*ActionPlan, err error)

func (*DataManager) GetAttributeProfile

func (dm *DataManager) GetAttributeProfile(tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (attrPrfl *AttributeProfile, err error)

GetAttributeProfile returns the AttributeProfile with the given id

func (*DataManager) GetChargerProfile

func (dm *DataManager) GetChargerProfile(tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (cpp *ChargerProfile, err error)

func (*DataManager) GetDestination

func (dm *DataManager) GetDestination(key string, skipCache bool, transactionID string) (dest *Destination, err error)

func (*DataManager) GetDispatcherHost

func (dm *DataManager) GetDispatcherHost(tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (dH *DispatcherHost, err error)

func (*DataManager) GetDispatcherProfile

func (dm *DataManager) GetDispatcherProfile(tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (dpp *DispatcherProfile, err error)

func (*DataManager) GetFilterIndexes

func (dm *DataManager) GetFilterIndexes(cacheID, itemIDPrefix, filterType string,
	fldNameVal map[string]string) (indexes map[string]utils.StringMap, err error)

func (*DataManager) GetItemLoadIDs

func (dm *DataManager) GetItemLoadIDs(itemIDPrefix string, cacheWrite bool) (loadIDs map[string]int64, err error)

func (*DataManager) GetRatingPlan

func (dm *DataManager) GetRatingPlan(key string, skipCache bool,
	transactionID string) (rp *RatingPlan, err error)

func (*DataManager) GetRatingProfile

func (dm *DataManager) GetRatingProfile(key string, skipCache bool,
	transactionID string) (rpf *RatingProfile, err error)

GetRatingProfile returns the RatingProfile for the key

func (*DataManager) GetResource

func (dm *DataManager) GetResource(tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (rs *Resource, err error)

func (*DataManager) GetResourceProfile

func (dm *DataManager) GetResourceProfile(tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (rp *ResourceProfile, err error)

func (*DataManager) GetReverseDestination

func (dm *DataManager) GetReverseDestination(prefix string,
	skipCache bool, transactionID string) (ids []string, err error)

func (*DataManager) GetSharedGroup

func (dm *DataManager) GetSharedGroup(key string, skipCache bool,
	transactionID string) (sg *SharedGroup, err error)

func (*DataManager) GetStatQueue

func (dm *DataManager) GetStatQueue(tenant, id string,
	cacheRead, cacheWrite bool, transactionID string) (sq *StatQueue, err error)

GetStatQueue retrieves a StatQueue from dataDB handles caching and deserialization of metrics

func (*DataManager) GetStatQueueProfile

func (dm *DataManager) GetStatQueueProfile(tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (sqp *StatQueueProfile, err error)

func (*DataManager) GetSupplierProfile

func (dm *DataManager) GetSupplierProfile(tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (supp *SupplierProfile, err error)

func (*DataManager) GetThreshold

func (dm *DataManager) GetThreshold(tenant, id string,
	cacheRead, cacheWrite bool, transactionID string) (th *Threshold, err error)

func (*DataManager) GetThresholdProfile

func (dm *DataManager) GetThresholdProfile(tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (th *ThresholdProfile, err error)

func (*DataManager) GetTiming

func (dm *DataManager) GetTiming(id string, skipCache bool,
	transactionID string) (t *utils.TPTiming, err error)

func (*DataManager) HasData

func (dm *DataManager) HasData(category, subject, tenant string) (has bool, err error)

func (*DataManager) LoadDataDBCache

func (dm *DataManager) LoadDataDBCache(dstIDs, rvDstIDs, rplIDs, rpfIDs, actIDs, aplIDs,
	aaPlIDs, atrgIDs, sgIDs, rpIDs, resIDs, stqIDs, stqpIDs, thIDs, thpIDs, fltrIDs,
	splPrflIDs, alsPrfIDs, cppIDs, dppIDs, dphIDs []string) (err error)

func (*DataManager) MatchFilterIndex

func (dm *DataManager) MatchFilterIndex(cacheID, itemIDPrefix,
	filterType, fieldName, fieldVal string) (itemIDs utils.StringMap, err error)

func (*DataManager) MatchFilterIndexFromKey

func (dm *DataManager) MatchFilterIndexFromKey(cacheID, key string) (err error)

func (*DataManager) PreloadCacheForPrefix

func (dm *DataManager) PreloadCacheForPrefix(prefix string) error

Used for InternalDB

func (*DataManager) RebuildReverseForPrefix added in v0.10.3

func (dm *DataManager) RebuildReverseForPrefix(prefix string) (err error)

func (*DataManager) Reconnect

func (dm *DataManager) Reconnect(marshaller string, newcfg *config.DataDbCfg) (err error)

Reconnect reconnects to the DB when the config was changed

func (*DataManager) RemAccountActionPlans

func (dm *DataManager) RemAccountActionPlans(acntID string, apIDs []string) (err error)

func (*DataManager) RemoveAccount

func (dm *DataManager) RemoveAccount(id string) (err error)

func (*DataManager) RemoveActionPlan

func (dm *DataManager) RemoveActionPlan(key string, transactionID string) (err error)

func (*DataManager) RemoveActionTriggers

func (dm *DataManager) RemoveActionTriggers(id, transactionID string) (err error)

func (*DataManager) RemoveActions

func (dm *DataManager) RemoveActions(key, transactionID string) (err error)

func (*DataManager) RemoveAttributeProfile

func (dm *DataManager) RemoveAttributeProfile(tenant, id string, transactionID string, withIndex bool) (err error)

func (*DataManager) RemoveChargerProfile

func (dm *DataManager) RemoveChargerProfile(tenant, id string,
	transactionID string, withIndex bool) (err error)

func (*DataManager) RemoveDestination

func (dm *DataManager) RemoveDestination(destID string, transactionID string) (err error)

func (*DataManager) RemoveDispatcherHost

func (dm *DataManager) RemoveDispatcherHost(tenant, id string,
	transactionID string) (err error)

func (*DataManager) RemoveDispatcherProfile

func (dm *DataManager) RemoveDispatcherProfile(tenant, id string,
	transactionID string, withIndex bool) (err error)

func (*DataManager) RemoveFilter

func (dm *DataManager) RemoveFilter(tenant, id, transactionID string) (err error)

func (*DataManager) RemoveFilterIndexes

func (dm *DataManager) RemoveFilterIndexes(cacheID, itemIDPrefix string) (err error)

func (*DataManager) RemoveRatingPlan

func (dm *DataManager) RemoveRatingPlan(key string, transactionID string) (err error)

func (*DataManager) RemoveRatingProfile

func (dm *DataManager) RemoveRatingProfile(key string,
	transactionID string) (err error)

func (*DataManager) RemoveResource

func (dm *DataManager) RemoveResource(tenant, id, transactionID string) (err error)

func (*DataManager) RemoveResourceProfile

func (dm *DataManager) RemoveResourceProfile(tenant, id, transactionID string, withIndex bool) (err error)

func (*DataManager) RemoveSharedGroup

func (dm *DataManager) RemoveSharedGroup(id, transactionID string) (err error)

func (*DataManager) RemoveStatQueue

func (dm *DataManager) RemoveStatQueue(tenant, id string, transactionID string) (err error)

RemoveStatQueue removes the StoredStatQueue

func (*DataManager) RemoveStatQueueProfile

func (dm *DataManager) RemoveStatQueueProfile(tenant, id,
	transactionID string, withIndex bool) (err error)

func (*DataManager) RemoveSupplierProfile

func (dm *DataManager) RemoveSupplierProfile(tenant, id, transactionID string, withIndex bool) (err error)

func (*DataManager) RemoveThreshold

func (dm *DataManager) RemoveThreshold(tenant, id, transactionID string) (err error)

func (*DataManager) RemoveThresholdProfile

func (dm *DataManager) RemoveThresholdProfile(tenant, id,
	transactionID string, withIndex bool) (err error)

func (*DataManager) RemoveTiming

func (dm *DataManager) RemoveTiming(id, transactionID string) (err error)

func (*DataManager) SetAccount

func (dm *DataManager) SetAccount(acc *Account) (err error)

func (*DataManager) SetAccountActionPlans

func (dm *DataManager) SetAccountActionPlans(acntID string, aPlIDs []string, overwrite bool) (err error)

func (*DataManager) SetActionPlan

func (dm *DataManager) SetActionPlan(key string, ats *ActionPlan,
	overwrite bool, transactionID string) (err error)

func (*DataManager) SetActionTriggers

func (dm *DataManager) SetActionTriggers(key string, attr ActionTriggers,
	transactionID string) (err error)

func (*DataManager) SetActions

func (dm *DataManager) SetActions(key string, as Actions, transactionID string) (err error)

func (*DataManager) SetAttributeProfile

func (dm *DataManager) SetAttributeProfile(ap *AttributeProfile, withIndex bool) (err error)

func (*DataManager) SetChargerProfile

func (dm *DataManager) SetChargerProfile(cpp *ChargerProfile, withIndex bool) (err error)

func (*DataManager) SetDestination

func (dm *DataManager) SetDestination(dest *Destination, transactionID string) (err error)

func (*DataManager) SetDispatcherHost

func (dm *DataManager) SetDispatcherHost(dpp *DispatcherHost) (err error)

func (*DataManager) SetDispatcherProfile

func (dm *DataManager) SetDispatcherProfile(dpp *DispatcherProfile, withIndex bool) (err error)

func (*DataManager) SetFilter

func (dm *DataManager) SetFilter(fltr *Filter) (err error)

func (*DataManager) SetFilterIndexes

func (dm *DataManager) SetFilterIndexes(cacheID, itemIDPrefix string,
	indexes map[string]utils.StringMap, commit bool, transactionID string) (err error)

func (*DataManager) SetLoadIDs

func (dm *DataManager) SetLoadIDs(loadIDs map[string]int64) (err error)

func (*DataManager) SetRatingPlan

func (dm *DataManager) SetRatingPlan(rp *RatingPlan, transactionID string) (err error)

func (*DataManager) SetRatingProfile

func (dm *DataManager) SetRatingProfile(rpf *RatingProfile,
	transactionID string) (err error)

func (*DataManager) SetResource

func (dm *DataManager) SetResource(rs *Resource) (err error)

func (*DataManager) SetResourceProfile

func (dm *DataManager) SetResourceProfile(rp *ResourceProfile, withIndex bool) (err error)

func (*DataManager) SetReverseDestination

func (dm *DataManager) SetReverseDestination(dest *Destination, transactionID string) (err error)

func (*DataManager) SetSharedGroup

func (dm *DataManager) SetSharedGroup(sg *SharedGroup,
	transactionID string) (err error)

func (*DataManager) SetStatQueue

func (dm *DataManager) SetStatQueue(sq *StatQueue) (err error)

SetStatQueue converts to StoredStatQueue and stores the result in dataDB

func (*DataManager) SetStatQueueProfile

func (dm *DataManager) SetStatQueueProfile(sqp *StatQueueProfile, withIndex bool) (err error)

func (*DataManager) SetSupplierProfile

func (dm *DataManager) SetSupplierProfile(supp *SupplierProfile, withIndex bool) (err error)

func (*DataManager) SetThreshold

func (dm *DataManager) SetThreshold(th *Threshold) (err error)

func (*DataManager) SetThresholdProfile

func (dm *DataManager) SetThresholdProfile(th *ThresholdProfile, withIndex bool) (err error)

func (*DataManager) SetTiming

func (dm *DataManager) SetTiming(t *utils.TPTiming) (err error)

func (*DataManager) UpdateReverseDestination

func (dm *DataManager) UpdateReverseDestination(oldDest, newDest *Destination,
	transactionID string) error

type DataSpan

type DataSpan struct {
	DataStart, DataEnd float64
	Cost               float64

	RateInterval *RateInterval
	DataIndex    float64 // the data transfer so far till DataEnd
	Increments   []*DataIncrement
	MatchedSubject, MatchedPrefix,
	MatchedDestId, RatingPlanId string
	// contains filtered or unexported fields
}

type DebitInfo

type DebitInfo struct {
	Unit      *UnitInfo
	Monetary  *MonetaryInfo
	AccountID string // used when debited from shared balance
}

Holds information about the balance that made a specific payment

func (*DebitInfo) Clone

func (di *DebitInfo) Clone() *DebitInfo

func (*DebitInfo) Equal

func (di *DebitInfo) Equal(other *DebitInfo) bool

type Destination

type Destination struct {
	Id       string
	Prefixes []string
}

Structure that gathers multiple destination prefixes under a common id.

func NewDestinationFromTPDestination

func NewDestinationFromTPDestination(tpDst *utils.TPDestination) *Destination

func (*Destination) AddPrefix

func (d *Destination) AddPrefix(pfx string)

func (*Destination) String

func (d *Destination) String() (result string)

type DispatcherHost

type DispatcherHost struct {
	Tenant string
	ID     string
	Conns  []*config.RemoteHost
	// contains filtered or unexported fields
}

DispatcherHost represents one virtual host used by dispatcher

func APItoDispatcherHost

func APItoDispatcherHost(tpDPH *utils.TPDispatcherHost) (dpp *DispatcherHost)

func (*DispatcherHost) Call

func (dH *DispatcherHost) Call(serviceMethod string, args any, reply any) (err error)

GetRPCConnection builds or returns the cached connection

func (*DispatcherHost) TenantID

func (dH *DispatcherHost) TenantID() string

type DispatcherHostProfile

type DispatcherHostProfile struct {
	ID        string
	FilterIDs []string
	Weight    float64        // applied in case of multiple connections need to be ordered
	Params    map[string]any // additional parameters stored for a session
	Blocker   bool           // no connection after this one
}

func (*DispatcherHostProfile) Clone

func (dC *DispatcherHostProfile) Clone() (cln *DispatcherHostProfile)

type DispatcherHostProfiles

type DispatcherHostProfiles []*DispatcherHostProfile

func (DispatcherHostProfiles) Clone

func (dHPrfls DispatcherHostProfiles) Clone() (cln DispatcherHostProfiles)

func (DispatcherHostProfiles) HostIDs

func (dHPrfls DispatcherHostProfiles) HostIDs() (hostIDs []string)

func (DispatcherHostProfiles) ReorderFromIndex

func (dHPrfls DispatcherHostProfiles) ReorderFromIndex(idx int)

ReorderFromIndex will consider idx as starting point for the reordered slice

func (DispatcherHostProfiles) Shuffle

func (dHPrfls DispatcherHostProfiles) Shuffle()

Shuffle will mix the connections in place

func (DispatcherHostProfiles) Sort

func (dHPrfls DispatcherHostProfiles) Sort()

Sort is part of sort interface, sort based on Weight

type DispatcherProfile

type DispatcherProfile struct {
	Tenant             string
	ID                 string
	Subsystems         []string
	FilterIDs          []string
	ActivationInterval *utils.ActivationInterval // activation interval
	Strategy           string
	StrategyParams     map[string]any         // ie for distribution, set here the pool weights
	Weight             float64                // used for profile sorting on match
	Hosts              DispatcherHostProfiles // dispatch to these connections
}

DispatcherProfile is the config for one Dispatcher

func APItoDispatcherProfile

func APItoDispatcherProfile(tpDPP *utils.TPDispatcherProfile, timezone string) (dpp *DispatcherProfile, err error)

func (*DispatcherProfile) TenantID

func (dP *DispatcherProfile) TenantID() string

type DispatcherProfiles

type DispatcherProfiles []*DispatcherProfile

DispatcherProfiles is a sortable list of Dispatcher profiles

func (DispatcherProfiles) Sort

func (dps DispatcherProfiles) Sort()

Sort is part of sort interface, sort based on Weight

type DurationWithCompress

type DurationWithCompress struct {
	Duration       time.Duration
	CompressFactor int
}

ACDHelper structure

type EventCost

type EventCost struct {
	CGRID          string
	RunID          string
	StartTime      time.Time
	Usage          *time.Duration
	Cost           *float64 // pointer so we can nil it when dirty
	Charges        []*ChargingInterval
	AccountSummary *AccountSummary // Account summary at the end of the event calculation
	Rating         Rating
	Accounting     Accounting
	RatingFilters  RatingFilters
	Rates          ChargedRates
	Timings        ChargedTimings
	// contains filtered or unexported fields
}

EventCost stores cost for an Event

func IfaceAsEventCost

func IfaceAsEventCost(itm any) (ec *EventCost, err error)

IfaceAsEventCost converts an interface to EventCost

func NewBareEventCost

func NewBareEventCost() *EventCost

NewBareEventCost will initialize the EventCost with minimum information

func NewEventCostFromCallCost

func NewEventCostFromCallCost(cc *CallCost, cgrID, runID string) (ec *EventCost)

NewEventCostFromCallCost will initilaize the EventCost from a CallCost

func (*EventCost) AsCallCost

func (ec *EventCost) AsCallCost(tor string) *CallCost

AsCallCost converts an EventCost into a CallCost

func (*EventCost) AsRefundIncrements

func (ec *EventCost) AsRefundIncrements(tor string) (cd *CallDescriptor)

AsRefundIncrements converts an EventCost into a CallDescriptor

func (*EventCost) Clone

func (ec *EventCost) Clone() (cln *EventCost)

Clone will create a clone of the object

func (*EventCost) Compute

func (ec *EventCost) Compute()

Compute aggregates all the compute methods on EventCost

func (*EventCost) ComputeEventCostUsageIndexes

func (ec *EventCost) ComputeEventCostUsageIndexes()

ComputeEventCostUsageIndexes will iterate through Chargers and populate their ecUsageIdx

func (*EventCost) FieldAsInterface

func (ec *EventCost) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface func to implement DataProvider

func (*EventCost) FieldAsString

func (ec *EventCost) FieldAsString(fldPath []string) (string, error)

FieldAsString to implement Dataprovider

func (*EventCost) GetCost

func (ec *EventCost) GetCost() float64

GetCost iterates through Charges, computing EventCost.Cost

func (*EventCost) GetUsage

func (ec *EventCost) GetUsage() time.Duration

GetUsage iterates through Charges, computing EventCost.Usage

func (*EventCost) Merge

func (ec *EventCost) Merge(ecs ...*EventCost)

Merge will merge a list of EventCosts into this one

func (*EventCost) RemoteHost

func (ec *EventCost) RemoteHost() net.Addr

RemoteHost to implement Dataprovider

func (*EventCost) RemoveStaleReferences

func (ec *EventCost) RemoveStaleReferences()

RemoveStaleReferences iterates through cached data and makes sure it is still referenced from Charging

func (*EventCost) ResetCounters

func (ec *EventCost) ResetCounters()

ResetCounters will reset all the computed cached values

func (*EventCost) String

func (ec *EventCost) String() string

String to implement Dataprovider

func (*EventCost) SyncKeys

func (ec *EventCost) SyncKeys(refEC *EventCost)

SyncKeys will sync the keys present into ec with the ones in refEC

func (*EventCost) Trim

func (ec *EventCost) Trim(atUsage time.Duration) (srplusEC *EventCost, err error)

Trim will cut the EventCost at specific duration returns the srplusEC as separate EventCost

type ExportEvents

type ExportEvents struct {
	Path   string
	Format string
	Events []any
	// contains filtered or unexported fields
}

ExportEvents used to save the failed post to file

func NewExportEventsFromFile

func NewExportEventsFromFile(filePath string) (expEv *ExportEvents, err error)

NewExportEventsFromFile returns ExportEvents from the file used only on replay failed post

func (*ExportEvents) AddEvent

func (expEv *ExportEvents) AddEvent(ev any)

AddEvent adds one event

func (*ExportEvents) FileName

func (expEv *ExportEvents) FileName() string

FileName returns the file name it should use for saving the failed events

func (*ExportEvents) ReplayFailedPosts

func (expEv *ExportEvents) ReplayFailedPosts(attempts int) (failedEvents *ExportEvents, err error)

ReplayFailedPosts tryies to post cdrs again

func (*ExportEvents) SetModule

func (expEv *ExportEvents) SetModule(mod string)

SetModule sets the module for this event

func (*ExportEvents) WriteToFile

func (expEv *ExportEvents) WriteToFile(filePath string) (err error)

WriteToFile writes the events to file

type ExternalAttribute

type ExternalAttribute struct {
	FilterIDs []string
	Path      string
	Type      string
	Value     string
}

ExternalAttribute the attribute for external profile

type ExternalAttributeProfile

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

ExternalAttributeProfile used by APIs

func (*ExternalAttributeProfile) AsAttributeProfile

func (ext *ExternalAttributeProfile) AsAttributeProfile() (attr *AttributeProfile, err error)

AsAttributeProfile converts the external attribute format to the actual AttributeProfile

type ExternalCDR

type ExternalCDR struct {
	CGRID       string
	RunID       string
	OrderID     int64
	OriginHost  string
	Source      string
	OriginID    string
	ToR         string
	RequestType string
	Tenant      string
	Category    string
	Account     string
	Subject     string
	Destination string
	SetupTime   string
	AnswerTime  string
	Usage       string
	ExtraFields map[string]string
	CostSource  string
	Cost        float64
	CostDetails string
	ExtraInfo   string
	PreRated    bool // Mark the CDR as rated so we do not process it during mediation
}

type ExternalCDRWithArgDispatcher

type ExternalCDRWithArgDispatcher struct {
	*ExternalCDR
	*utils.ArgDispatcher
}

type FSCdr

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

func NewFSCdr

func NewFSCdr(body []byte, cgrCfg *config.CGRConfig) (*FSCdr, error)

func (FSCdr) AsCDR

func (fsCdr FSCdr) AsCDR(timezone string) *CDR

type Filter

type Filter struct {
	Tenant             string
	ID                 string
	Rules              []*FilterRule
	ActivationInterval *utils.ActivationInterval
}

Filter structure to define a basic filter

func APItoFilter

func APItoFilter(tpTH *utils.TPFilterProfile, timezone string) (th *Filter, err error)

func GetFilter

func GetFilter(dm *DataManager, tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (fltr *Filter, err error)

GetFilter returns a filter based on the given ID

func NewFilterFromInline

func NewFilterFromInline(tenant, inlnRule string) (f *Filter, err error)

NewFilterFromInline parses an inline rule into a compiled Filter

func (*Filter) Compile

func (fltr *Filter) Compile() (err error)

Compile will compile the underlaying request filters where necessary (ie. regexp rules)

func (*Filter) TenantID

func (fltr *Filter) TenantID() string

TenantID returns the tenant wit the ID

type FilterIHReply added in v0.10.3

type FilterIHReply struct {
	MissingObjects []string            // list of object that are referenced in indexes but are not found in the dataDB
	MissingIndexes map[string][]string // list of missing indexes for each object (the map has the key as the objectID and a list of indexes)
	BrokenIndexes  map[string][]string // list of broken indexes for each object (the map has the key as the index and a list of objects)
	MissingFilters map[string][]string // list of broken references (the map has the key as the filterID and a list of  objectIDs)
}

func GetFltrIdxHealth added in v0.10.3

func GetFltrIdxHealth(dm *DataManager, fltrCache, fltrIdxCache, objCache *ltcache.Cache, indxType string) (rply *FilterIHReply, err error)

GetFltrIdxHealth returns the missing indexes for all objects

type FilterIndexer

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

FilterIndexer is a centralized indexer for all data sources using RequestFilter retrieves and stores it's data from/to dataDB not thread safe, meant to be used as logic within other code blocks

func ComputeAttributeIndexes added in v0.10.3

func ComputeAttributeIndexes(dm *DataManager, tenant, context string, attrIDs *[]string,
	transactionID string) (filterIndexer *FilterIndexer, err error)

func ComputeChargerIndexes added in v0.10.3

func ComputeChargerIndexes(dm *DataManager, tenant string, cppIDs *[]string,
	transactionID string) (filterIndexer *FilterIndexer, err error)

func ComputeDispatcherIndexes added in v0.10.3

func ComputeDispatcherIndexes(dm *DataManager, tenant, context string, dspIDs *[]string,
	transactionID string) (filterIndexer *FilterIndexer, err error)

func ComputeResourceIndexes added in v0.10.3

func ComputeResourceIndexes(dm *DataManager, tenant string, rsIDs *[]string,
	transactionID string) (filterIndexer *FilterIndexer, err error)

func ComputeStatIndexes added in v0.10.3

func ComputeStatIndexes(dm *DataManager, tenant string, stIDs *[]string,
	transactionID string) (filterIndexer *FilterIndexer, err error)

func ComputeSupplierIndexes added in v0.10.3

func ComputeSupplierIndexes(dm *DataManager, tenant string, sppIDs *[]string,
	transactionID string) (filterIndexer *FilterIndexer, err error)

func ComputeThresholdIndexes added in v0.10.3

func ComputeThresholdIndexes(dm *DataManager, tenant string, thIDs *[]string,
	transactionID string) (filterIndexer *FilterIndexer, err error)

func NewFilterIndexer

func NewFilterIndexer(dm *DataManager, itemType, dbKeySuffix string) *FilterIndexer

NewFilterIndexer creates the FilterIndexes without any indexes in it

func NewFilterIndexerWithIndexes added in v0.10.3

func NewFilterIndexerWithIndexes(dm *DataManager, itemType, dbKeySuffix string,
	oldIdx map[string]utils.StringMap) *FilterIndexer

NewFilterIndexerWithIndexes creates the FilterIndexes that contains already the old indexes

func (*FilterIndexer) IndexTPFilter

func (rfi *FilterIndexer) IndexTPFilter(tpFltr *utils.TPFilterProfile, itemID string)

IndexTPFilter parses reqFltrs, adding itemID in the indexes and marks the changed keys in chngdIndxKeys

func (*FilterIndexer) RemoveItemFromIndex

func (rfi *FilterIndexer) RemoveItemFromIndex(tenant, itemID string, oldFilters []string) (err error)

RemoveItemFromIndex remove Indexes for a specific itemID

func (*FilterIndexer) StoreIndexes

func (rfi *FilterIndexer) StoreIndexes(commit bool, transactionID string) (err error)

StoreIndexes handles storing the indexes to dataDB

type FilterRule

type FilterRule struct {
	Type    string   // Filter type (*string, *timing, *rsr_filters, *stats, *lt, *lte, *gt, *gte)
	Element string   // Name of the field providing us the Values to check (used in case of some )
	Values  []string // Filter definition
	// contains filtered or unexported fields
}

FilterRule filters requests coming into various places Pass rule: default negative, one mathing rule should pass the filter

func NewFilterRule

func NewFilterRule(rfType, fieldName string, vals []string) (*FilterRule, error)

NewFilterRule returns a new filter

func (*FilterRule) CompileValues

func (fltr *FilterRule) CompileValues() (err error)

CompileValues compiles RSR fields

func (*FilterRule) Pass

func (fltr *FilterRule) Pass(fieldNameDP utils.DataProvider,
	fieldValuesDP []utils.DataProvider) (result bool, err error)

Pass is the method which should be used from outside.

type FilterS

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

FilterS is a service used to take decisions in case of filters uses lazy connections where necessary to avoid deadlocks on service startup

func NewFilterS

func NewFilterS(cfg *config.CGRConfig, connMgr *ConnManager, dm *DataManager) (fS *FilterS)

NewFilterS initializtes the filter service

func (*FilterS) Pass

func (fS *FilterS) Pass(tenant string, filterIDs []string,
	ev utils.DataProvider) (pass bool, err error)

Pass will check all filters wihin filterIDs and require them passing for dataProvider there should be at least one filter passing, ie: if filters are not active event will fail to pass receives the event as DataProvider so we can accept undecoded data (ie: HttpRequest)

type GOBMarshaler

type GOBMarshaler struct{}

func (*GOBMarshaler) Marshal

func (gm *GOBMarshaler) Marshal(v any) (data []byte, err error)

func (*GOBMarshaler) Unmarshal

func (gm *GOBMarshaler) Unmarshal(data []byte, v any) error

type HTTPPoster

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

HTTPPoster used to post cdrs

func NewHTTPPoster

func NewHTTPPoster(skipTLSVerify bool, replyTimeout time.Duration,
	addr, contentType string, attempts int) (httposter *HTTPPoster, err error)

NewHTTPPoster return a new HTTP poster

func (*HTTPPoster) GetResponse

func (pstr *HTTPPoster) GetResponse(content any) (respBody []byte, err error)

GetResponse will post the event and return the response

func (*HTTPPoster) Post

func (pstr *HTTPPoster) Post(content any, key string) (err error)

Post will post the event

type HighestBalancesSorter

type HighestBalancesSorter []*Balance

func (HighestBalancesSorter) Len

func (hbcs HighestBalancesSorter) Len() int

func (HighestBalancesSorter) Less

func (hbcs HighestBalancesSorter) Less(i, j int) bool

func (HighestBalancesSorter) Swap

func (hbcs HighestBalancesSorter) Swap(i, j int)

type HightCostSorter

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

HightCostSorter sorts suppliers based on their cost

func NewHighestCostSorter

func NewHighestCostSorter(spS *SupplierService) *HightCostSorter

func (*HightCostSorter) SortSuppliers

func (hcs *HightCostSorter) SortSuppliers(prflID string, suppls []*Supplier,
	ev *utils.CGREvent, extraOpts *optsGetSuppliers, argDsp *utils.ArgDispatcher) (sortedSuppls *SortedSuppliers, err error)

type Increment

type Increment struct {
	Duration       time.Duration
	Cost           float64
	BalanceInfo    *DebitInfo // need more than one for units with cost
	CompressFactor int
	// contains filtered or unexported fields
}

func (*Increment) Clone

func (incr *Increment) Clone() *Increment

func (*Increment) Equal

func (incr *Increment) Equal(other *Increment) bool

func (*Increment) GetCompressFactor

func (incr *Increment) GetCompressFactor() int

func (*Increment) GetCost

func (incr *Increment) GetCost() float64

type Increments

type Increments []*Increment

func (Increments) Clone

func (incs Increments) Clone() (cln Increments)

func (*Increments) Compress

func (incs *Increments) Compress()

func (*Increments) Decompress

func (incs *Increments) Decompress()

func (Increments) Equal

func (incs Increments) Equal(other Increments) bool

func (Increments) GetTotalCost

func (incs Increments) GetTotalCost() float64

func (Increments) Length

func (incs Increments) Length() (length int)

func (Increments) SharingSignature

func (incs Increments) SharingSignature(other Increments) bool

Estimate whether the increments are the same ignoring the CompressFactor

type IndexHealthArgsWith2Ch added in v0.10.3

type IndexHealthArgsWith2Ch struct {
	IndexCacheLimit     int
	IndexCacheTTL       time.Duration
	IndexCacheStaticTTL bool

	ObjectCacheLimit     int
	ObjectCacheTTL       time.Duration
	ObjectCacheStaticTTL bool
}

type IndexHealthArgsWith3Ch added in v0.10.3

type IndexHealthArgsWith3Ch struct {
	IndexCacheLimit     int
	IndexCacheTTL       time.Duration
	IndexCacheStaticTTL bool

	ObjectCacheLimit     int
	ObjectCacheTTL       time.Duration
	ObjectCacheStaticTTL bool

	FilterCacheLimit     int
	FilterCacheTTL       time.Duration
	FilterCacheStaticTTL bool
}

type InternalDB

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

func NewInternalDB

func NewInternalDB(stringIndexedFields, prefixIndexedFields []string,
	isDataDB bool, itemsCacheCfg map[string]*config.ItemOpt) (iDB *InternalDB)

NewInternalDB constructs an InternalDB

func (*InternalDB) AddLoadHistory

func (iDB *InternalDB) AddLoadHistory(*utils.LoadInstance, int, string) error

func (*InternalDB) Close

func (iDB *InternalDB) Close()

func (*InternalDB) Flush

func (iDB *InternalDB) Flush(_ string) error

func (*InternalDB) GetAccountActionPlansDrv

func (iDB *InternalDB) GetAccountActionPlansDrv(acntID string) (apIDs []string, err error)

func (*InternalDB) GetAccountDrv

func (iDB *InternalDB) GetAccountDrv(id string) (acc *Account, err error)

func (*InternalDB) GetActionPlanDrv

func (iDB *InternalDB) GetActionPlanDrv(key string) (ats *ActionPlan, err error)

func (*InternalDB) GetActionTriggersDrv

func (iDB *InternalDB) GetActionTriggersDrv(id string) (at ActionTriggers, err error)

func (*InternalDB) GetActionsDrv

func (iDB *InternalDB) GetActionsDrv(id string) (acts Actions, err error)

func (*InternalDB) GetAllActionPlansDrv

func (iDB *InternalDB) GetAllActionPlansDrv() (ats map[string]*ActionPlan, err error)

func (*InternalDB) GetAttributeProfileDrv

func (iDB *InternalDB) GetAttributeProfileDrv(tenant, id string) (attr *AttributeProfile, err error)

func (*InternalDB) GetCDRs

func (iDB *InternalDB) GetCDRs(filter *utils.CDRsFilter, remove bool) (cdrs []*CDR, count int64, err error)

GetCDRs returns the CDRs from DB based on given filters

func (*InternalDB) GetChargerProfileDrv

func (iDB *InternalDB) GetChargerProfileDrv(tenant, id string) (ch *ChargerProfile, err error)

func (*InternalDB) GetDestinationDrv

func (iDB *InternalDB) GetDestinationDrv(key string, skipCache bool, transactionID string) (dest *Destination, err error)

func (*InternalDB) GetDispatcherHostDrv

func (iDB *InternalDB) GetDispatcherHostDrv(tenant, id string) (dpp *DispatcherHost, err error)

func (*InternalDB) GetDispatcherProfileDrv

func (iDB *InternalDB) GetDispatcherProfileDrv(tenant, id string) (dpp *DispatcherProfile, err error)

func (*InternalDB) GetFilterDrv

func (iDB *InternalDB) GetFilterDrv(tenant, id string) (fltr *Filter, err error)

func (*InternalDB) GetFilterIndexesDrv

func (iDB *InternalDB) GetFilterIndexesDrv(cacheID, tntCtx, filterType string,
	fldNameVal map[string]string) (indexes map[string]utils.StringMap, err error)

func (*InternalDB) GetItemLoadIDsDrv

func (iDB *InternalDB) GetItemLoadIDsDrv(itemIDPrefix string) (loadIDs map[string]int64, err error)

func (*InternalDB) GetKeysForPrefix

func (iDB *InternalDB) GetKeysForPrefix(prefix string) ([]string, error)

func (*InternalDB) GetLoadHistory

func (iDB *InternalDB) GetLoadHistory(int, bool, string) ([]*utils.LoadInstance, error)

func (*InternalDB) GetRatingPlanDrv

func (iDB *InternalDB) GetRatingPlanDrv(id string) (rp *RatingPlan, err error)

func (*InternalDB) GetRatingProfileDrv

func (iDB *InternalDB) GetRatingProfileDrv(id string) (rp *RatingProfile, err error)

func (*InternalDB) GetResourceDrv

func (iDB *InternalDB) GetResourceDrv(tenant, id string) (r *Resource, err error)

func (*InternalDB) GetResourceProfileDrv

func (iDB *InternalDB) GetResourceProfileDrv(tenant, id string) (rp *ResourceProfile, err error)

func (*InternalDB) GetReverseDestinationDrv

func (iDB *InternalDB) GetReverseDestinationDrv(prefix string,
	skipCache bool, transactionID string) (ids []string, err error)

func (*InternalDB) GetSMCosts

func (iDB *InternalDB) GetSMCosts(cgrid, runid, originHost, originIDPrfx string) (smCosts []*SMCost, err error)

func (*InternalDB) GetSharedGroupDrv

func (iDB *InternalDB) GetSharedGroupDrv(id string) (sh *SharedGroup, err error)

func (*InternalDB) GetStatQueueDrv

func (iDB *InternalDB) GetStatQueueDrv(tenant, id string) (sq *StatQueue, err error)

func (*InternalDB) GetStatQueueProfileDrv

func (iDB *InternalDB) GetStatQueueProfileDrv(tenant string, id string) (sq *StatQueueProfile, err error)

func (*InternalDB) GetStorageType

func (iDB *InternalDB) GetStorageType() string

func (*InternalDB) GetSupplierProfileDrv

func (iDB *InternalDB) GetSupplierProfileDrv(tenant, id string) (spp *SupplierProfile, err error)

func (*InternalDB) GetTPAccountActions

func (iDB *InternalDB) GetTPAccountActions(filter *utils.TPAccountActions) (accounts []*utils.TPAccountActions, err error)

func (*InternalDB) GetTPActionPlans

func (iDB *InternalDB) GetTPActionPlans(tpid, id string) (aPlans []*utils.TPActionPlan, err error)

func (*InternalDB) GetTPActionTriggers

func (iDB *InternalDB) GetTPActionTriggers(tpid, id string) (aTriggers []*utils.TPActionTriggers, err error)

func (*InternalDB) GetTPActions

func (iDB *InternalDB) GetTPActions(tpid, id string) (actions []*utils.TPActions, err error)

func (*InternalDB) GetTPAttributes

func (iDB *InternalDB) GetTPAttributes(tpid, tenant, id string) (attrs []*utils.TPAttributeProfile, err error)

func (*InternalDB) GetTPChargers

func (iDB *InternalDB) GetTPChargers(tpid, tenant, id string) (cpps []*utils.TPChargerProfile, err error)

func (*InternalDB) GetTPDestinationRates

func (iDB *InternalDB) GetTPDestinationRates(tpid, id string,
	paginator *utils.Paginator) (dRates []*utils.TPDestinationRate, err error)

func (*InternalDB) GetTPDestinations

func (iDB *InternalDB) GetTPDestinations(tpid, id string) (dsts []*utils.TPDestination, err error)

func (*InternalDB) GetTPDispatcherHosts

func (iDB *InternalDB) GetTPDispatcherHosts(tpid, tenant, id string) (dpps []*utils.TPDispatcherHost, err error)

func (*InternalDB) GetTPDispatcherProfiles

func (iDB *InternalDB) GetTPDispatcherProfiles(tpid, tenant, id string) (dpps []*utils.TPDispatcherProfile, err error)

func (*InternalDB) GetTPFilters

func (iDB *InternalDB) GetTPFilters(tpid, tenant, id string) (fltrs []*utils.TPFilterProfile, err error)

func (*InternalDB) GetTPRates

func (iDB *InternalDB) GetTPRates(tpid, id string) (rates []*utils.TPRate, err error)

func (*InternalDB) GetTPRatingPlans

func (iDB *InternalDB) GetTPRatingPlans(tpid, id string, paginator *utils.Paginator) (rPlans []*utils.TPRatingPlan, err error)

func (*InternalDB) GetTPRatingProfiles

func (iDB *InternalDB) GetTPRatingProfiles(filter *utils.TPRatingProfile) (rProfiles []*utils.TPRatingProfile, err error)

func (*InternalDB) GetTPResources

func (iDB *InternalDB) GetTPResources(tpid, tenant, id string) (resources []*utils.TPResourceProfile, err error)

func (*InternalDB) GetTPSharedGroups

func (iDB *InternalDB) GetTPSharedGroups(tpid, id string) (sGroups []*utils.TPSharedGroups, err error)

func (*InternalDB) GetTPStats

func (iDB *InternalDB) GetTPStats(tpid, tenant, id string) (stats []*utils.TPStatProfile, err error)

func (*InternalDB) GetTPSuppliers

func (iDB *InternalDB) GetTPSuppliers(tpid, tenant, id string) (supps []*utils.TPSupplierProfile, err error)

func (*InternalDB) GetTPThresholds

func (iDB *InternalDB) GetTPThresholds(tpid, tenant, id string) (ths []*utils.TPThresholdProfile, err error)

func (*InternalDB) GetTPTimings

func (iDB *InternalDB) GetTPTimings(tpid, id string) (timings []*utils.ApierTPTiming, err error)

func (*InternalDB) GetThresholdDrv

func (iDB *InternalDB) GetThresholdDrv(tenant, id string) (th *Threshold, err error)

func (*InternalDB) GetThresholdProfileDrv

func (iDB *InternalDB) GetThresholdProfileDrv(tenant, id string) (tp *ThresholdProfile, err error)

func (*InternalDB) GetTimingDrv

func (iDB *InternalDB) GetTimingDrv(id string) (tmg *utils.TPTiming, err error)

func (*InternalDB) GetTpIds

func (iDB *InternalDB) GetTpIds(colName string) (ids []string, err error)

implement LoadReader interface

func (*InternalDB) GetTpTableIds

func (iDB *InternalDB) GetTpTableIds(tpid, table string, distinct utils.TPDistinctIds,
	filters map[string]string, paginator *utils.PaginatorWithSearch) (ids []string, err error)

func (*InternalDB) GetVersions

func (iDB *InternalDB) GetVersions(itm string) (vrs Versions, err error)

func (*InternalDB) HasDataDrv

func (iDB *InternalDB) HasDataDrv(category, subject, tenant string) (bool, error)

func (*InternalDB) IsDBEmpty

func (iDB *InternalDB) IsDBEmpty() (resp bool, err error)

func (*InternalDB) MatchFilterIndexDrv

func (iDB *InternalDB) MatchFilterIndexDrv(cacheID, tntCtx,
	filterType, fieldName, fieldVal string) (itemIDs utils.StringMap, err error)

func (*InternalDB) PopTask

func (iDB *InternalDB) PopTask() (t *Task, err error)

func (*InternalDB) PushTask

func (iDB *InternalDB) PushTask(t *Task) (err error)

func (*InternalDB) RemAccountActionPlansDrv

func (iDB *InternalDB) RemAccountActionPlansDrv(acntID string) (err error)

func (*InternalDB) RemStatQueueDrv

func (iDB *InternalDB) RemStatQueueDrv(tenant, id string) (err error)

func (*InternalDB) RemStatQueueProfileDrv

func (iDB *InternalDB) RemStatQueueProfileDrv(tenant, id string) (err error)

func (*InternalDB) RemThresholdProfileDrv

func (iDB *InternalDB) RemThresholdProfileDrv(tenant, id string) (err error)

func (*InternalDB) RemTpData

func (iDB *InternalDB) RemTpData(table, tpid string, args map[string]string) (err error)

implement LoadWriter interface

func (*InternalDB) RemoveAccountDrv

func (iDB *InternalDB) RemoveAccountDrv(id string) (err error)

func (*InternalDB) RemoveActionPlanDrv

func (iDB *InternalDB) RemoveActionPlanDrv(key string) (err error)

func (*InternalDB) RemoveActionTriggersDrv

func (iDB *InternalDB) RemoveActionTriggersDrv(id string) (err error)

func (*InternalDB) RemoveActionsDrv

func (iDB *InternalDB) RemoveActionsDrv(id string) (err error)

func (*InternalDB) RemoveAttributeProfileDrv

func (iDB *InternalDB) RemoveAttributeProfileDrv(tenant, id string) (err error)

func (*InternalDB) RemoveChargerProfileDrv

func (iDB *InternalDB) RemoveChargerProfileDrv(tenant, id string) (err error)

func (*InternalDB) RemoveDestinationDrv

func (iDB *InternalDB) RemoveDestinationDrv(destID string, transactionID string) (err error)

func (*InternalDB) RemoveDispatcherHostDrv

func (iDB *InternalDB) RemoveDispatcherHostDrv(tenant, id string) (err error)

func (*InternalDB) RemoveDispatcherProfileDrv

func (iDB *InternalDB) RemoveDispatcherProfileDrv(tenant, id string) (err error)

func (*InternalDB) RemoveFilterDrv

func (iDB *InternalDB) RemoveFilterDrv(tenant, id string) (err error)

func (*InternalDB) RemoveFilterIndexesDrv

func (iDB *InternalDB) RemoveFilterIndexesDrv(cacheID, tntCtx string) (err error)

func (*InternalDB) RemoveKeysForPrefix added in v0.10.3

func (iDB *InternalDB) RemoveKeysForPrefix(prefix string) (err error)

func (*InternalDB) RemoveLoadIDsDrv

func (iDB *InternalDB) RemoveLoadIDsDrv() (err error)

func (*InternalDB) RemoveRatingPlanDrv

func (iDB *InternalDB) RemoveRatingPlanDrv(id string) (err error)

func (*InternalDB) RemoveRatingProfileDrv

func (iDB *InternalDB) RemoveRatingProfileDrv(id string) (err error)

func (*InternalDB) RemoveResourceDrv

func (iDB *InternalDB) RemoveResourceDrv(tenant, id string) (err error)

func (*InternalDB) RemoveResourceProfileDrv

func (iDB *InternalDB) RemoveResourceProfileDrv(tenant, id string) (err error)

func (*InternalDB) RemoveSMCost

func (iDB *InternalDB) RemoveSMCost(smc *SMCost) (err error)

func (*InternalDB) RemoveSMCosts

func (iDB *InternalDB) RemoveSMCosts(qryFltr *utils.SMCostFilter) error

func (*InternalDB) RemoveSharedGroupDrv

func (iDB *InternalDB) RemoveSharedGroupDrv(id string) (err error)

func (*InternalDB) RemoveSupplierProfileDrv

func (iDB *InternalDB) RemoveSupplierProfileDrv(tenant, id string) (err error)

func (*InternalDB) RemoveThresholdDrv

func (iDB *InternalDB) RemoveThresholdDrv(tenant, id string) (err error)

func (*InternalDB) RemoveTimingDrv

func (iDB *InternalDB) RemoveTimingDrv(id string) (err error)

func (*InternalDB) RemoveVersions

func (iDB *InternalDB) RemoveVersions(vrs Versions) (err error)

func (*InternalDB) SelectDatabase

func (iDB *InternalDB) SelectDatabase(dbName string) (err error)

func (*InternalDB) SetAccountActionPlansDrv

func (iDB *InternalDB) SetAccountActionPlansDrv(acntID string, apIDs []string) (err error)

func (*InternalDB) SetAccountDrv

func (iDB *InternalDB) SetAccountDrv(acc *Account) (err error)

func (*InternalDB) SetActionPlanDrv

func (iDB *InternalDB) SetActionPlanDrv(key string, ats *ActionPlan) (err error)

func (*InternalDB) SetActionTriggersDrv

func (iDB *InternalDB) SetActionTriggersDrv(id string, at ActionTriggers) (err error)

func (*InternalDB) SetActionsDrv

func (iDB *InternalDB) SetActionsDrv(id string, acts Actions) (err error)

func (*InternalDB) SetAttributeProfileDrv

func (iDB *InternalDB) SetAttributeProfileDrv(attr *AttributeProfile) (err error)

func (*InternalDB) SetCDR

func (iDB *InternalDB) SetCDR(cdr *CDR, allowUpdate bool) (err error)

implement CdrStorage interface

func (*InternalDB) SetChargerProfileDrv

func (iDB *InternalDB) SetChargerProfileDrv(chr *ChargerProfile) (err error)

func (*InternalDB) SetDestinationDrv

func (iDB *InternalDB) SetDestinationDrv(dest *Destination, transactionID string) (err error)

func (*InternalDB) SetDispatcherHostDrv

func (iDB *InternalDB) SetDispatcherHostDrv(dpp *DispatcherHost) (err error)

func (*InternalDB) SetDispatcherProfileDrv

func (iDB *InternalDB) SetDispatcherProfileDrv(dpp *DispatcherProfile) (err error)

func (*InternalDB) SetFilterDrv

func (iDB *InternalDB) SetFilterDrv(fltr *Filter) (err error)

func (*InternalDB) SetFilterIndexesDrv

func (iDB *InternalDB) SetFilterIndexesDrv(cacheID, tntCtx string,
	indexes map[string]utils.StringMap, commit bool, transactionID string) (err error)

func (*InternalDB) SetLoadIDsDrv

func (iDB *InternalDB) SetLoadIDsDrv(loadIDs map[string]int64) (err error)

func (*InternalDB) SetPrefixIndexedFields

func (iDB *InternalDB) SetPrefixIndexedFields(prefixIndexedFields []string)

SetPrefixIndexedFields set the prefixIndexedFields, used at StorDB reload (is thread safe)

func (*InternalDB) SetRatingPlanDrv

func (iDB *InternalDB) SetRatingPlanDrv(rp *RatingPlan) (err error)

func (*InternalDB) SetRatingProfileDrv

func (iDB *InternalDB) SetRatingProfileDrv(rp *RatingProfile) (err error)

func (*InternalDB) SetResourceDrv

func (iDB *InternalDB) SetResourceDrv(r *Resource) (err error)

func (*InternalDB) SetResourceProfileDrv

func (iDB *InternalDB) SetResourceProfileDrv(rp *ResourceProfile) (err error)

func (*InternalDB) SetReverseDestinationDrv

func (iDB *InternalDB) SetReverseDestinationDrv(dest *Destination, transactionID string) (err error)

func (*InternalDB) SetSMCost

func (iDB *InternalDB) SetSMCost(smCost *SMCost) (err error)

func (*InternalDB) SetSharedGroupDrv

func (iDB *InternalDB) SetSharedGroupDrv(sh *SharedGroup) (err error)

func (*InternalDB) SetStatQueueDrv

func (iDB *InternalDB) SetStatQueueDrv(ssq *StoredStatQueue, sq *StatQueue) (err error)

func (*InternalDB) SetStatQueueProfileDrv

func (iDB *InternalDB) SetStatQueueProfileDrv(sq *StatQueueProfile) (err error)

func (*InternalDB) SetStringIndexedFields

func (iDB *InternalDB) SetStringIndexedFields(stringIndexedFields []string)

SetStringIndexedFields set the stringIndexedFields, used at StorDB reload (is thread safe)

func (*InternalDB) SetSupplierProfileDrv

func (iDB *InternalDB) SetSupplierProfileDrv(spp *SupplierProfile) (err error)

func (*InternalDB) SetTPAccountActions

func (iDB *InternalDB) SetTPAccountActions(accActions []*utils.TPAccountActions) (err error)

func (*InternalDB) SetTPActionPlans

func (iDB *InternalDB) SetTPActionPlans(aPlans []*utils.TPActionPlan) (err error)

func (*InternalDB) SetTPActionTriggers

func (iDB *InternalDB) SetTPActionTriggers(aTriggers []*utils.TPActionTriggers) (err error)

func (*InternalDB) SetTPActions

func (iDB *InternalDB) SetTPActions(acts []*utils.TPActions) (err error)

func (*InternalDB) SetTPAttributes

func (iDB *InternalDB) SetTPAttributes(attributes []*utils.TPAttributeProfile) (err error)

func (*InternalDB) SetTPChargers

func (iDB *InternalDB) SetTPChargers(cpps []*utils.TPChargerProfile) (err error)

func (*InternalDB) SetTPDestinationRates

func (iDB *InternalDB) SetTPDestinationRates(dRates []*utils.TPDestinationRate) (err error)

func (*InternalDB) SetTPDestinations

func (iDB *InternalDB) SetTPDestinations(dests []*utils.TPDestination) (err error)

func (*InternalDB) SetTPDispatcherHosts

func (iDB *InternalDB) SetTPDispatcherHosts(dpps []*utils.TPDispatcherHost) (err error)

func (*InternalDB) SetTPDispatcherProfiles

func (iDB *InternalDB) SetTPDispatcherProfiles(dpps []*utils.TPDispatcherProfile) (err error)

func (*InternalDB) SetTPFilters

func (iDB *InternalDB) SetTPFilters(filters []*utils.TPFilterProfile) (err error)

func (*InternalDB) SetTPRates

func (iDB *InternalDB) SetTPRates(rates []*utils.TPRate) (err error)

func (*InternalDB) SetTPRatingPlans

func (iDB *InternalDB) SetTPRatingPlans(ratingPlans []*utils.TPRatingPlan) (err error)

func (*InternalDB) SetTPRatingProfiles

func (iDB *InternalDB) SetTPRatingProfiles(ratingProfiles []*utils.TPRatingProfile) (err error)

func (*InternalDB) SetTPResources

func (iDB *InternalDB) SetTPResources(resources []*utils.TPResourceProfile) (err error)

func (*InternalDB) SetTPSharedGroups

func (iDB *InternalDB) SetTPSharedGroups(groups []*utils.TPSharedGroups) (err error)

func (*InternalDB) SetTPStats

func (iDB *InternalDB) SetTPStats(stats []*utils.TPStatProfile) (err error)

func (*InternalDB) SetTPSuppliers

func (iDB *InternalDB) SetTPSuppliers(suppliers []*utils.TPSupplierProfile) (err error)

func (*InternalDB) SetTPThresholds

func (iDB *InternalDB) SetTPThresholds(thresholds []*utils.TPThresholdProfile) (err error)

func (*InternalDB) SetTPTimings

func (iDB *InternalDB) SetTPTimings(timings []*utils.ApierTPTiming) (err error)

func (*InternalDB) SetThresholdDrv

func (iDB *InternalDB) SetThresholdDrv(th *Threshold) (err error)

func (*InternalDB) SetThresholdProfileDrv

func (iDB *InternalDB) SetThresholdProfileDrv(tp *ThresholdProfile) (err error)

func (*InternalDB) SetTimingDrv

func (iDB *InternalDB) SetTimingDrv(timing *utils.TPTiming) (err error)

func (*InternalDB) SetVersions

func (iDB *InternalDB) SetVersions(vrs Versions, overwrite bool) (err error)

func (*InternalDB) UpdateReverseDestinationDrv

func (iDB *InternalDB) UpdateReverseDestinationDrv(oldDest, newDest *Destination,
	transactionID string) error

type JSONBufMarshaler

type JSONBufMarshaler struct{}

func (*JSONBufMarshaler) Marshal

func (jbm *JSONBufMarshaler) Marshal(v any) (data []byte, err error)

func (*JSONBufMarshaler) Unmarshal

func (jbm *JSONBufMarshaler) Unmarshal(data []byte, v any) error

type JSONMarshaler

type JSONMarshaler struct{}

func (*JSONMarshaler) Marshal

func (jm *JSONMarshaler) Marshal(v any) ([]byte, error)

func (*JSONMarshaler) Unmarshal

func (jm *JSONMarshaler) Unmarshal(data []byte, v any) error

type KafkaPoster

type KafkaPoster struct {
	sync.Mutex // protect writer
	// contains filtered or unexported fields
}

KafkaPoster is a kafka poster

func NewKafkaPoster

func NewKafkaPoster(dialURL string, attempts int) (*KafkaPoster, error)

NewKafkaPoster creates a kafka poster

func (*KafkaPoster) Close

func (pstr *KafkaPoster) Close()

Close closes the kafka writer

func (*KafkaPoster) Post

func (pstr *KafkaPoster) Post(content []byte, key 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 LeastCostSorter

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

LeastCostSorter sorts suppliers based on their cost

func NewLeastCostSorter

func NewLeastCostSorter(spS *SupplierService) *LeastCostSorter

func (*LeastCostSorter) SortSuppliers

func (lcs *LeastCostSorter) SortSuppliers(prflID string, suppls []*Supplier,
	ev *utils.CGREvent, extraOpts *optsGetSuppliers, argDsp *utils.ArgDispatcher) (sortedSuppls *SortedSuppliers, err error)

type LoadDistributionSorter

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

ResourceAscendentSorter orders suppliers based on their Resource Usage

func NewLoadDistributionSorter

func NewLoadDistributionSorter(spS *SupplierService) *LoadDistributionSorter

func (*LoadDistributionSorter) SortSuppliers

func (ws *LoadDistributionSorter) SortSuppliers(prflID string,
	suppls []*Supplier, suplEv *utils.CGREvent, extraOpts *optsGetSuppliers, argDsp *utils.ArgDispatcher) (sortedSuppls *SortedSuppliers, err error)

type LoadReader

type LoadReader interface {
	GetTpIds(string) ([]string, error)
	GetTpTableIds(string, string, utils.TPDistinctIds,
		map[string]string, *utils.PaginatorWithSearch) ([]string, error)
	GetTPTimings(string, string) ([]*utils.ApierTPTiming, error)
	GetTPDestinations(string, string) ([]*utils.TPDestination, error)
	GetTPRates(string, string) ([]*utils.TPRate, error)
	GetTPDestinationRates(string, string, *utils.Paginator) ([]*utils.TPDestinationRate, error)
	GetTPRatingPlans(string, string, *utils.Paginator) ([]*utils.TPRatingPlan, error)
	GetTPRatingProfiles(*utils.TPRatingProfile) ([]*utils.TPRatingProfile, error)
	GetTPSharedGroups(string, string) ([]*utils.TPSharedGroups, error)
	GetTPActions(string, string) ([]*utils.TPActions, error)
	GetTPActionPlans(string, string) ([]*utils.TPActionPlan, error)
	GetTPActionTriggers(string, string) ([]*utils.TPActionTriggers, error)
	GetTPAccountActions(*utils.TPAccountActions) ([]*utils.TPAccountActions, error)
	GetTPResources(string, string, string) ([]*utils.TPResourceProfile, error)
	GetTPStats(string, string, string) ([]*utils.TPStatProfile, error)
	GetTPThresholds(string, string, string) ([]*utils.TPThresholdProfile, error)
	GetTPFilters(string, string, string) ([]*utils.TPFilterProfile, error)
	GetTPSuppliers(string, string, string) ([]*utils.TPSupplierProfile, error)
	GetTPAttributes(string, string, string) ([]*utils.TPAttributeProfile, error)
	GetTPChargers(string, string, string) ([]*utils.TPChargerProfile, error)
	GetTPDispatcherProfiles(string, string, string) ([]*utils.TPDispatcherProfile, error)
	GetTPDispatcherHosts(string, string, string) ([]*utils.TPDispatcherHost, error)
}

LoadReader reads from .csv or TP tables and provides the data ready for the tp_db or data_db.

type LoadStorage

type LoadStorage interface {
	Storage
	LoadReader
	LoadWriter
}

type LoadWriter

type LoadWriter interface {
	RemTpData(string, string, map[string]string) error
	SetTPTimings([]*utils.ApierTPTiming) error
	SetTPDestinations([]*utils.TPDestination) error
	SetTPRates([]*utils.TPRate) error
	SetTPDestinationRates([]*utils.TPDestinationRate) error
	SetTPRatingPlans([]*utils.TPRatingPlan) error
	SetTPRatingProfiles([]*utils.TPRatingProfile) error
	SetTPSharedGroups([]*utils.TPSharedGroups) error
	SetTPActions([]*utils.TPActions) error
	SetTPActionPlans([]*utils.TPActionPlan) error
	SetTPActionTriggers([]*utils.TPActionTriggers) error
	SetTPAccountActions([]*utils.TPAccountActions) error
	SetTPResources([]*utils.TPResourceProfile) error
	SetTPStats([]*utils.TPStatProfile) error
	SetTPThresholds([]*utils.TPThresholdProfile) error
	SetTPFilters([]*utils.TPFilterProfile) error
	SetTPSuppliers([]*utils.TPSupplierProfile) error
	SetTPAttributes([]*utils.TPAttributeProfile) error
	SetTPChargers([]*utils.TPChargerProfile) error
	SetTPDispatcherProfiles([]*utils.TPDispatcherProfile) error
	SetTPDispatcherHosts([]*utils.TPDispatcherHost) error
}

type LowestBalancesSorter

type LowestBalancesSorter []*Balance

func (LowestBalancesSorter) Len

func (lbcs LowestBalancesSorter) Len() int

func (LowestBalancesSorter) Less

func (lbcs LowestBalancesSorter) Less(i, j int) bool

func (LowestBalancesSorter) Swap

func (lbcs LowestBalancesSorter) Swap(i, j int)

type MapEvent

type MapEvent map[string]any

MapEvent is a map[string]any with convenience methods on top

func NewMapEvent

func NewMapEvent(mp map[string]any) (me MapEvent)

NewMapEvent makes sure the content is not nil

func (MapEvent) AsCDR

func (me MapEvent) AsCDR(cfg *config.CGRConfig, tnt, tmz string) (cdr *CDR, err error)

AsCDR exports the MapEvent as CDR

func (MapEvent) AsMapString

func (me MapEvent) AsMapString(ignoredFlds utils.StringSet) (mp map[string]string)

AsMapString returns a map[string]string out of mp, ignoring specific fields if needed most used when needing to export extraFields

func (MapEvent) Clone

func (me MapEvent) Clone() (mp MapEvent)

Clone returns the cloned map

func (MapEvent) Data

func (me MapEvent) Data() map[string]any

Data returns the MapEvent as a map[string]any

func (MapEvent) FieldAsInterface

func (me MapEvent) FieldAsInterface(fldPath []string) (any, error)

func (MapEvent) FieldAsString

func (me MapEvent) FieldAsString(fldPath []string) (string, error)

func (MapEvent) GetDuration

func (me MapEvent) GetDuration(fldName string) (d time.Duration, err error)

GetDuration returns a field as Duration

func (MapEvent) GetDurationIgnoreErrors

func (me MapEvent) GetDurationIgnoreErrors(fldName string) (d time.Duration)

GetDuration returns a field as Duration, ignoring errors

func (MapEvent) GetDurationPtr

func (me MapEvent) GetDurationPtr(fldName string) (d *time.Duration, err error)

GetDurationPointer returns pointer towards duration, useful to detect presence of duration

func (MapEvent) GetDurationPtrIgnoreErrors

func (me MapEvent) GetDurationPtrIgnoreErrors(fldName string) (d *time.Duration)

GetDurationPointer returns pointer towards duration, useful to detect presence of duration

func (MapEvent) GetDurationPtrOrDefault

func (me MapEvent) GetDurationPtrOrDefault(fldName string, dflt *time.Duration) (d *time.Duration, err error)

GetDurationPtrOrDefault returns pointer or default if fldName is missing

func (MapEvent) GetString

func (me MapEvent) GetString(fldName string) (out string, err error)

func (MapEvent) GetStringIgnoreErrors

func (me MapEvent) GetStringIgnoreErrors(fldName string) (out string)

func (MapEvent) GetTInt64

func (me MapEvent) GetTInt64(fldName string) (out int64, err error)

func (MapEvent) GetTime

func (me MapEvent) GetTime(fldName string, timezone string) (t time.Time, err error)

GetTime returns a field as Time

func (MapEvent) GetTimeIgnoreErrors

func (me MapEvent) GetTimeIgnoreErrors(fldName string, tmz string) (t time.Time)

GetTimeIgnoreErrors returns a field as Time instance, ignoring errors

func (MapEvent) GetTimePtr

func (me MapEvent) GetTimePtr(fldName, tmz string) (t *time.Time, err error)

GetTimePtr returns a pointer towards time or error

func (MapEvent) GetTimePtrIgnoreErrors

func (me MapEvent) GetTimePtrIgnoreErrors(fldName, tmz string) (t *time.Time)

GetTimePtrIgnoreErrors returns a pointer towards time or nil if errors

func (MapEvent) HasField

func (me MapEvent) HasField(fldName string) (has bool)

func (MapEvent) RemoteHost

func (me MapEvent) RemoteHost() net.Addr

func (MapEvent) String

func (me MapEvent) String() string

type Marshaler

type Marshaler interface {
	Marshal(v any) ([]byte, error)
	Unmarshal(data []byte, v any) error
}

func NewMarshaler

func NewMarshaler(mrshlerStr string) (ms Marshaler, err error)

NewMarshaler returns the marshaler type selected by mrshlerStr

type MetricWithFilters

type MetricWithFilters struct {
	FilterIDs []string
	MetricID  string
}

type MonetaryInfo

type MonetaryInfo struct {
	UUID         string
	ID           string
	Value        float64
	RateInterval *RateInterval
}

func (*MonetaryInfo) Clone

func (mi *MonetaryInfo) Clone() *MonetaryInfo

func (*MonetaryInfo) Equal

func (mi *MonetaryInfo) Equal(other *MonetaryInfo) bool

type MongoStorage

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

MongoStorage represents a storage interface for the new MongoDB driver.

func NewMongoStorage

func NewMongoStorage(host, port, db, user, pass, mrshlerStr string, cdrsIndexes []string,
	isDataDB bool,
) (*MongoStorage, error)

NewMongoStorage initializes a new MongoDB storage instance with provided connection parameters and settings. Returns an error if the setup fails.

func (*MongoStorage) AddLoadHistory

func (ms *MongoStorage) AddLoadHistory(ldInst *utils.LoadInstance,
	loadHistSize int, transactionID string,
) error

AddLoadHistory adds a single load instance to the load history.

func (*MongoStorage) Close

func (ms *MongoStorage) Close()

Close disconnects the MongoDB client.

func (*MongoStorage) DB

func (ms *MongoStorage) DB() *mongo.Database

DB returns the database object associated with the MongoDB client.

func (*MongoStorage) EnsureIndexes

func (ms *MongoStorage) EnsureIndexes(cols ...string) error

EnsureIndexes creates database indexes for the specified collections.

func (*MongoStorage) Flush

func (ms *MongoStorage) Flush(_ string) (err error)

Flush drops the datatable and recreates the indexes.

func (*MongoStorage) GetAccountActionPlansDrv

func (ms *MongoStorage) GetAccountActionPlansDrv(acntID string) ([]string, error)

func (*MongoStorage) GetAccountDrv

func (ms *MongoStorage) GetAccountDrv(key string) (*Account, error)

func (*MongoStorage) GetActionPlanDrv

func (ms *MongoStorage) GetActionPlanDrv(key string) (*ActionPlan, error)

func (*MongoStorage) GetActionTriggersDrv

func (ms *MongoStorage) GetActionTriggersDrv(key string) (ActionTriggers, error)

func (*MongoStorage) GetActionsDrv

func (ms *MongoStorage) GetActionsDrv(key string) (Actions, error)

func (*MongoStorage) GetAllActionPlansDrv

func (ms *MongoStorage) GetAllActionPlansDrv() (map[string]*ActionPlan, error)

func (*MongoStorage) GetAttributeProfileDrv

func (ms *MongoStorage) GetAttributeProfileDrv(tenant, id string) (*AttributeProfile, error)

func (*MongoStorage) GetCDRs

func (ms *MongoStorage) GetCDRs(qryFltr *utils.CDRsFilter, remove bool) (cdrs []*CDR, n int64, err error)

func (*MongoStorage) GetChargerProfileDrv

func (ms *MongoStorage) GetChargerProfileDrv(tenant, id string) (*ChargerProfile, error)

func (*MongoStorage) GetContext

func (ms *MongoStorage) GetContext() context.Context

GetContext returns the context used for the current database.

func (*MongoStorage) GetDestinationDrv

func (ms *MongoStorage) GetDestinationDrv(key string, skipCache bool,
	transactionID string,
) (*Destination, error)

func (*MongoStorage) GetDispatcherHostDrv

func (ms *MongoStorage) GetDispatcherHostDrv(tenant, id string) (*DispatcherHost, error)

func (*MongoStorage) GetDispatcherProfileDrv

func (ms *MongoStorage) GetDispatcherProfileDrv(tenant, id string) (*DispatcherProfile, error)

func (*MongoStorage) GetFilterDrv

func (ms *MongoStorage) GetFilterDrv(tenant, id string) (*Filter, error)

func (*MongoStorage) GetFilterIndexesDrv

func (ms *MongoStorage) GetFilterIndexesDrv(cacheID, itemIDPrefix, filterType string,
	fldNameVal map[string]string,
) (map[string]utils.StringMap, error)

GetFilterIndexesDrv retrieves indexes from the dataDB based on the specified parameters. filterType and fldNameVal are used together for specific searches.

func (*MongoStorage) GetItemLoadIDsDrv

func (ms *MongoStorage) GetItemLoadIDsDrv(itemIDPrefix string) (map[string]int64, error)

func (*MongoStorage) GetKeysForPrefix

func (ms *MongoStorage) GetKeysForPrefix(prefix string) ([]string, error)

GetKeysForPrefix retrieves keys matching the specified prefix across different categories.

func (*MongoStorage) GetLoadHistory

func (ms *MongoStorage) GetLoadHistory(limit int, skipCache bool,
	transactionID string,
) ([]*utils.LoadInstance, error)

GetLoadHistory retrieves the last n items from the load history, newest first.

func (*MongoStorage) GetRatingPlanDrv

func (ms *MongoStorage) GetRatingPlanDrv(key string) (*RatingPlan, error)

func (*MongoStorage) GetRatingProfileDrv

func (ms *MongoStorage) GetRatingProfileDrv(key string) (*RatingProfile, error)

func (*MongoStorage) GetResourceDrv

func (ms *MongoStorage) GetResourceDrv(tenant, id string) (*Resource, error)

func (*MongoStorage) GetResourceProfileDrv

func (ms *MongoStorage) GetResourceProfileDrv(tenant, id string) (*ResourceProfile, error)

func (*MongoStorage) GetReverseDestinationDrv

func (ms *MongoStorage) GetReverseDestinationDrv(prefix string, skipCache bool,
	transactionID string,
) ([]string, error)

func (*MongoStorage) GetSMCosts

func (ms *MongoStorage) GetSMCosts(cgrid, runid, originHost, originIDPrefix string) (smcs []*SMCost, err error)

func (*MongoStorage) GetSharedGroupDrv

func (ms *MongoStorage) GetSharedGroupDrv(key string) (*SharedGroup, error)

func (*MongoStorage) GetStatQueueDrv

func (ms *MongoStorage) GetStatQueueDrv(tenant, id string) (*StatQueue, error)

GetStatQueueDrv retrieves a StoredStatQueue from the dataDB based on the specified tenant and ID.

func (*MongoStorage) GetStatQueueProfileDrv

func (ms *MongoStorage) GetStatQueueProfileDrv(tenant, id string) (*StatQueueProfile, error)

GetStatQueueProfileDrv retrieves a StatQueueProfile from the dataDB based on the specified tenant and ID.

func (*MongoStorage) GetStorageType

func (ms *MongoStorage) GetStorageType() string

func (*MongoStorage) GetSupplierProfileDrv

func (ms *MongoStorage) GetSupplierProfileDrv(tenant, id string) (*SupplierProfile, error)

func (*MongoStorage) GetTPAccountActions

func (ms *MongoStorage) GetTPAccountActions(tp *utils.TPAccountActions) ([]*utils.TPAccountActions, error)

func (*MongoStorage) GetTPActionPlans

func (ms *MongoStorage) GetTPActionPlans(tpid, id string) ([]*utils.TPActionPlan, error)

func (*MongoStorage) GetTPActionTriggers

func (ms *MongoStorage) GetTPActionTriggers(tpid, id string) ([]*utils.TPActionTriggers, error)

func (*MongoStorage) GetTPActions

func (ms *MongoStorage) GetTPActions(tpid, id string) ([]*utils.TPActions, error)

func (*MongoStorage) GetTPAttributes

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

func (*MongoStorage) GetTPChargers

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

func (*MongoStorage) GetTPDestinationRates

func (ms *MongoStorage) GetTPDestinationRates(tpid, id string, pag *utils.Paginator) ([]*utils.TPDestinationRate, error)

func (*MongoStorage) GetTPDestinations

func (ms *MongoStorage) GetTPDestinations(tpid, id string) ([]*utils.TPDestination, error)

func (*MongoStorage) GetTPDispatcherHosts

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

func (*MongoStorage) GetTPDispatcherProfiles

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

func (*MongoStorage) GetTPFilters

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

func (*MongoStorage) GetTPRates

func (ms *MongoStorage) GetTPRates(tpid, id string) ([]*utils.TPRate, error)

func (*MongoStorage) GetTPRatingPlans

func (ms *MongoStorage) GetTPRatingPlans(tpid, id string, pag *utils.Paginator) ([]*utils.TPRatingPlan, error)

func (*MongoStorage) GetTPRatingProfiles

func (ms *MongoStorage) GetTPRatingProfiles(tp *utils.TPRatingProfile) ([]*utils.TPRatingProfile, error)

func (*MongoStorage) GetTPResources

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

func (*MongoStorage) GetTPSharedGroups

func (ms *MongoStorage) GetTPSharedGroups(tpid, id string) ([]*utils.TPSharedGroups, error)

func (*MongoStorage) GetTPStats

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

func (*MongoStorage) GetTPSuppliers

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

func (*MongoStorage) GetTPThresholds

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

func (*MongoStorage) GetTPTimings

func (ms *MongoStorage) GetTPTimings(tpid, id string) ([]*utils.ApierTPTiming, error)

func (*MongoStorage) GetThresholdDrv

func (ms *MongoStorage) GetThresholdDrv(tenant, id string) (*Threshold, error)

func (*MongoStorage) GetThresholdProfileDrv

func (ms *MongoStorage) GetThresholdProfileDrv(tenant, id string) (*ThresholdProfile, error)

GetThresholdProfileDrv retrieves a ThresholdProfile from the dataDB based on the specified tenant and ID.

func (*MongoStorage) GetTimingDrv

func (ms *MongoStorage) GetTimingDrv(id string) (*utils.TPTiming, error)

func (*MongoStorage) GetTpIds

func (ms *MongoStorage) GetTpIds(colName string) (tpids []string, err error)

func (*MongoStorage) GetTpTableIds

func (ms *MongoStorage) GetTpTableIds(tpid, table string, distinctIDs utils.TPDistinctIds,
	filter map[string]string, pag *utils.PaginatorWithSearch,
) ([]string, error)

func (*MongoStorage) GetVersions

func (ms *MongoStorage) GetVersions(itm string) (Versions, error)

func (*MongoStorage) HasDataDrv

func (ms *MongoStorage) HasDataDrv(category, subject, tenant string) (has bool, err error)

func (*MongoStorage) IsDBEmpty

func (ms *MongoStorage) IsDBEmpty() (bool, error)

IsDBEmpty checks if the database is empty by verifying if each collection is empty.

func (*MongoStorage) IsDataDB

func (ms *MongoStorage) IsDataDB() bool

IsDataDB returns whether the storage is used for DataDB.

func (*MongoStorage) MatchFilterIndexDrv

func (ms *MongoStorage) MatchFilterIndexDrv(cacheID, itemIDPrefix,
	filterType, fldName, fldVal string,
) (utils.StringMap, error)

func (*MongoStorage) PopTask

func (ms *MongoStorage) PopTask() (*Task, error)

func (*MongoStorage) PushTask

func (ms *MongoStorage) PushTask(t *Task) error

func (*MongoStorage) RemAccountActionPlansDrv

func (ms *MongoStorage) RemAccountActionPlansDrv(acntID string) error

ToDo: check return len(aPlIDs) == 0

func (*MongoStorage) RemStatQueueDrv

func (ms *MongoStorage) RemStatQueueDrv(tenant, id string) error

RemStatQueueDrv removes stored metrics for a StoredStatQueue from the dataDB based on the specified tenant and ID.

func (*MongoStorage) RemStatQueueProfileDrv

func (ms *MongoStorage) RemStatQueueProfileDrv(tenant, id string) error

RemStatQueueProfileDrv removes a StatQueueProfile from the dataDB based on the specified tenant and ID.

func (*MongoStorage) RemThresholdProfileDrv

func (ms *MongoStorage) RemThresholdProfileDrv(tenant, id string) error

RemThresholdProfileDrv removes a ThresholdProfile from the dataDB based on the specified tenant and ID.

func (*MongoStorage) RemTpData

func (ms *MongoStorage) RemTpData(table, tpid string, args map[string]string) error

func (*MongoStorage) RemoveAccountDrv

func (ms *MongoStorage) RemoveAccountDrv(key string) error

func (*MongoStorage) RemoveActionPlanDrv

func (ms *MongoStorage) RemoveActionPlanDrv(key string) error

func (*MongoStorage) RemoveActionTriggersDrv

func (ms *MongoStorage) RemoveActionTriggersDrv(key string) error

func (*MongoStorage) RemoveActionsDrv

func (ms *MongoStorage) RemoveActionsDrv(key string) error

func (*MongoStorage) RemoveAttributeProfileDrv

func (ms *MongoStorage) RemoveAttributeProfileDrv(tenant, id string) error

func (*MongoStorage) RemoveChargerProfileDrv

func (ms *MongoStorage) RemoveChargerProfileDrv(tenant, id string) error

func (*MongoStorage) RemoveDestinationDrv

func (ms *MongoStorage) RemoveDestinationDrv(destID string,
	transactionID string,
) error

func (*MongoStorage) RemoveDispatcherHostDrv

func (ms *MongoStorage) RemoveDispatcherHostDrv(tenant, id string) error

func (*MongoStorage) RemoveDispatcherProfileDrv

func (ms *MongoStorage) RemoveDispatcherProfileDrv(tenant, id string) error

func (*MongoStorage) RemoveFilterDrv

func (ms *MongoStorage) RemoveFilterDrv(tenant, id string) error

func (*MongoStorage) RemoveFilterIndexesDrv

func (ms *MongoStorage) RemoveFilterIndexesDrv(cacheID, itemIDPrefix string) error

func (*MongoStorage) RemoveKeysForPrefix added in v0.10.3

func (ms *MongoStorage) RemoveKeysForPrefix(prefix string) error

func (*MongoStorage) RemoveLoadIDsDrv

func (ms *MongoStorage) RemoveLoadIDsDrv() error

func (*MongoStorage) RemoveRatingPlanDrv

func (ms *MongoStorage) RemoveRatingPlanDrv(key string) error

func (*MongoStorage) RemoveRatingProfileDrv

func (ms *MongoStorage) RemoveRatingProfileDrv(key string) error

func (*MongoStorage) RemoveResourceDrv

func (ms *MongoStorage) RemoveResourceDrv(tenant, id string) error

func (*MongoStorage) RemoveResourceProfileDrv

func (ms *MongoStorage) RemoveResourceProfileDrv(tenant, id string) error

func (*MongoStorage) RemoveSMCost

func (ms *MongoStorage) RemoveSMCost(smc *SMCost) error

func (*MongoStorage) RemoveSMCosts

func (ms *MongoStorage) RemoveSMCosts(qryFltr *utils.SMCostFilter) error

func (*MongoStorage) RemoveSharedGroupDrv

func (ms *MongoStorage) RemoveSharedGroupDrv(id string) error

func (*MongoStorage) RemoveSupplierProfileDrv

func (ms *MongoStorage) RemoveSupplierProfileDrv(tenant, id string) error

func (*MongoStorage) RemoveThresholdDrv

func (ms *MongoStorage) RemoveThresholdDrv(tenant, id string) error

func (*MongoStorage) RemoveTimingDrv

func (ms *MongoStorage) RemoveTimingDrv(id string) error

func (*MongoStorage) RemoveVersions

func (ms *MongoStorage) RemoveVersions(vrs Versions) (err error)

func (*MongoStorage) SelectDatabase

func (ms *MongoStorage) SelectDatabase(dbName string) error

SelectDatabase selects the specified database.

func (*MongoStorage) SetAccountActionPlansDrv

func (ms *MongoStorage) SetAccountActionPlansDrv(acntID string, aPlIDs []string) error

func (*MongoStorage) SetAccountDrv

func (ms *MongoStorage) SetAccountDrv(acc *Account) error

func (*MongoStorage) SetActionPlanDrv

func (ms *MongoStorage) SetActionPlanDrv(key string, ats *ActionPlan) error

func (*MongoStorage) SetActionTriggersDrv

func (ms *MongoStorage) SetActionTriggersDrv(key string, atrs ActionTriggers) error

func (*MongoStorage) SetActionsDrv

func (ms *MongoStorage) SetActionsDrv(key string, as Actions) error

func (*MongoStorage) SetAttributeProfileDrv

func (ms *MongoStorage) SetAttributeProfileDrv(r *AttributeProfile) error

func (*MongoStorage) SetCDR

func (ms *MongoStorage) SetCDR(cdr *CDR, allowUpdate bool) error

func (*MongoStorage) SetChargerProfileDrv

func (ms *MongoStorage) SetChargerProfileDrv(r *ChargerProfile) error

func (*MongoStorage) SetDestinationDrv

func (ms *MongoStorage) SetDestinationDrv(dest *Destination, _ string) error

func (*MongoStorage) SetDispatcherHostDrv

func (ms *MongoStorage) SetDispatcherHostDrv(r *DispatcherHost) error

func (*MongoStorage) SetDispatcherProfileDrv

func (ms *MongoStorage) SetDispatcherProfileDrv(r *DispatcherProfile) error

func (*MongoStorage) SetFilterDrv

func (ms *MongoStorage) SetFilterDrv(r *Filter) error

func (*MongoStorage) SetFilterIndexesDrv

func (ms *MongoStorage) SetFilterIndexesDrv(cacheID, itemIDPrefix string,
	indexes map[string]utils.StringMap, commit bool, transactionID string,
) error

SetFilterIndexesDrv stores indexes into the DataDB based on the specified parameters.

func (*MongoStorage) SetLoadIDsDrv

func (ms *MongoStorage) SetLoadIDsDrv(loadIDs map[string]int64) error

func (*MongoStorage) SetRatingPlanDrv

func (ms *MongoStorage) SetRatingPlanDrv(rp *RatingPlan) error

func (*MongoStorage) SetRatingProfileDrv

func (ms *MongoStorage) SetRatingProfileDrv(rp *RatingProfile) error

func (*MongoStorage) SetResourceDrv

func (ms *MongoStorage) SetResourceDrv(r *Resource) error

func (*MongoStorage) SetResourceProfileDrv

func (ms *MongoStorage) SetResourceProfileDrv(rp *ResourceProfile) error

func (*MongoStorage) SetReverseDestinationDrv

func (ms *MongoStorage) SetReverseDestinationDrv(dest *Destination, _ string) error

func (*MongoStorage) SetSMCost

func (ms *MongoStorage) SetSMCost(smc *SMCost) error

func (*MongoStorage) SetSharedGroupDrv

func (ms *MongoStorage) SetSharedGroupDrv(sg *SharedGroup) error

func (*MongoStorage) SetStatQueueDrv

func (ms *MongoStorage) SetStatQueueDrv(ssq *StoredStatQueue, _ *StatQueue) error

SetStatQueueDrv stores the metrics for a StoredStatQueue into the dataDB.

func (*MongoStorage) SetStatQueueProfileDrv

func (ms *MongoStorage) SetStatQueueProfileDrv(sq *StatQueueProfile) error

SetStatQueueProfileDrv stores a StatQueueProfile into the DataDB.

func (*MongoStorage) SetSupplierProfileDrv

func (ms *MongoStorage) SetSupplierProfileDrv(r *SupplierProfile) error

func (*MongoStorage) SetTPAccountActions

func (ms *MongoStorage) SetTPAccountActions(tps []*utils.TPAccountActions) error

func (*MongoStorage) SetTPActionPlans

func (ms *MongoStorage) SetTPActionPlans(tps []*utils.TPActionPlan) error

func (*MongoStorage) SetTPActionTriggers

func (ms *MongoStorage) SetTPActionTriggers(tps []*utils.TPActionTriggers) error

func (*MongoStorage) SetTPActions

func (ms *MongoStorage) SetTPActions(tps []*utils.TPActions) error

func (*MongoStorage) SetTPAttributes

func (ms *MongoStorage) SetTPAttributes(tpSPs []*utils.TPAttributeProfile) (err error)

func (*MongoStorage) SetTPChargers

func (ms *MongoStorage) SetTPChargers(tpCPP []*utils.TPChargerProfile) (err error)

func (*MongoStorage) SetTPDestinationRates

func (ms *MongoStorage) SetTPDestinationRates(tps []*utils.TPDestinationRate) error

func (*MongoStorage) SetTPDestinations

func (ms *MongoStorage) SetTPDestinations(tpDsts []*utils.TPDestination) (err error)

func (*MongoStorage) SetTPDispatcherHosts

func (ms *MongoStorage) SetTPDispatcherHosts(tpDPPs []*utils.TPDispatcherHost) (err error)

func (*MongoStorage) SetTPDispatcherProfiles

func (ms *MongoStorage) SetTPDispatcherProfiles(tpDPPs []*utils.TPDispatcherProfile) (err error)

func (*MongoStorage) SetTPFilters

func (ms *MongoStorage) SetTPFilters(tpTHs []*utils.TPFilterProfile) (err error)

func (*MongoStorage) SetTPRStats

func (ms *MongoStorage) SetTPRStats(tps []*utils.TPStatProfile) (err error)

func (*MongoStorage) SetTPRates

func (ms *MongoStorage) SetTPRates(tps []*utils.TPRate) error

func (*MongoStorage) SetTPRatingPlans

func (ms *MongoStorage) SetTPRatingPlans(tps []*utils.TPRatingPlan) error

func (*MongoStorage) SetTPRatingProfiles

func (ms *MongoStorage) SetTPRatingProfiles(tps []*utils.TPRatingProfile) error

func (*MongoStorage) SetTPResources

func (ms *MongoStorage) SetTPResources(tpRLs []*utils.TPResourceProfile) (err error)

func (*MongoStorage) SetTPSharedGroups

func (ms *MongoStorage) SetTPSharedGroups(tps []*utils.TPSharedGroups) error

func (*MongoStorage) SetTPStats

func (ms *MongoStorage) SetTPStats(tpSTs []*utils.TPStatProfile) (err error)

func (*MongoStorage) SetTPSuppliers

func (ms *MongoStorage) SetTPSuppliers(tpSPs []*utils.TPSupplierProfile) (err error)

func (*MongoStorage) SetTPThresholds

func (ms *MongoStorage) SetTPThresholds(tpTHs []*utils.TPThresholdProfile) (err error)

func (*MongoStorage) SetTPTimings

func (ms *MongoStorage) SetTPTimings(tps []*utils.ApierTPTiming) error

func (*MongoStorage) SetTTL

func (ms *MongoStorage) SetTTL(ttl time.Duration)

SetTTL sets the context TTL used for queries (Thread-safe).

func (*MongoStorage) SetThresholdDrv

func (ms *MongoStorage) SetThresholdDrv(r *Threshold) error

func (*MongoStorage) SetThresholdProfileDrv

func (ms *MongoStorage) SetThresholdProfileDrv(tp *ThresholdProfile) error

SetThresholdProfileDrv stores a ThresholdProfile into the DataDB.

func (*MongoStorage) SetTimingDrv

func (ms *MongoStorage) SetTimingDrv(t *utils.TPTiming) error

func (*MongoStorage) SetVersions

func (ms *MongoStorage) SetVersions(vrs Versions, overwrite bool) error

func (*MongoStorage) UpdateReverseDestinationDrv

func (ms *MongoStorage) UpdateReverseDestinationDrv(oldDest, newDest *Destination,
	transactionID string,
) error

type MySQLStorage

type MySQLStorage struct {
	SQLStorage
}

func (*MySQLStorage) GetStorageType

func (self *MySQLStorage) GetStorageType() string

func (*MySQLStorage) SetVersions

func (self *MySQLStorage) SetVersions(vrs Versions, overwrite bool) (err error)

SetVersions will set a slice of versions, updating existing

type PjsuaAccount

type PjsuaAccount struct {
	Id, Username, Password, Realm, Registrar string
}

type Poster

type Poster interface {
	Post(body []byte, key string) error
	Close()
}

func NewAMQPv1Poster

func NewAMQPv1Poster(dialURL string, attempts int) (Poster, error)

NewAMQPv1Poster creates a poster for amqpv1

func NewS3Poster

func NewS3Poster(dialURL string, attempts int) (Poster, error)

NewS3Poster creates a s3 poster

func NewSQSPoster

func NewSQSPoster(dialURL string, attempts int) (Poster, error)

NewSQSPoster creates a poster for sqs

type PosterCache

type PosterCache struct {
	sync.Mutex
	// contains filtered or unexported fields
}
var PostersCache *PosterCache

func (*PosterCache) Close

func (pc *PosterCache) Close()

Close closes all cached posters

func (*PosterCache) GetAMQPPoster

func (pc *PosterCache) GetAMQPPoster(dialURL string, attempts int) (pstr Poster, err error)

GetAMQPPoster creates a new poster only if not already cached uses dialURL as cache key

func (*PosterCache) GetAMQPv1Poster

func (pc *PosterCache) GetAMQPv1Poster(dialURL string, attempts int) (pstr Poster, err error)

GetAMQPv1Poster creates a new poster only if not already cached

func (*PosterCache) GetKafkaPoster

func (pc *PosterCache) GetKafkaPoster(dialURL string, attempts int) (pstr Poster, err error)

GetKafkaPoster creates a new poster only if not already cached

func (*PosterCache) GetS3Poster

func (pc *PosterCache) GetS3Poster(dialURL string, attempts int) (pstr Poster, err error)

GetS3Poster creates a new poster only if not already cached

func (*PosterCache) GetSQSPoster

func (pc *PosterCache) GetSQSPoster(dialURL string, attempts int) (pstr Poster, err error)

GetSQSPoster creates a new poster only if not already cached

func (*PosterCache) PostAMQP

func (pc *PosterCache) PostAMQP(dialURL string, attempts int,
	content []byte) error

func (*PosterCache) PostAMQPv1

func (pc *PosterCache) PostAMQPv1(dialURL string, attempts int,
	content []byte) error

func (*PosterCache) PostKafka

func (pc *PosterCache) PostKafka(dialURL string, attempts int,
	content []byte, key string) error

func (*PosterCache) PostS3

func (pc *PosterCache) PostS3(dialURL string, attempts int,
	content []byte, key string) error

func (*PosterCache) PostSQS

func (pc *PosterCache) PostSQS(dialURL string, attempts int,
	content []byte) error

type PostgresStorage

type PostgresStorage struct {
	SQLStorage
}

func (*PostgresStorage) GetStorageType

func (self *PostgresStorage) GetStorageType() string

func (*PostgresStorage) SetVersions

func (self *PostgresStorage) SetVersions(vrs Versions, overwrite bool) (err error)

type QOSSupplierSorter

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

QOSSorter sorts suppliers based on stats

func NewQOSSupplierSorter

func NewQOSSupplierSorter(spS *SupplierService) *QOSSupplierSorter

func (*QOSSupplierSorter) SortSuppliers

func (qos *QOSSupplierSorter) SortSuppliers(prflID string, suppls []*Supplier,
	ev *utils.CGREvent, extraOpts *optsGetSuppliers, argDsp *utils.ArgDispatcher) (sortedSuppls *SortedSuppliers, err error)

type RIRate

type RIRate struct {
	ConnectFee       float64
	RoundingMethod   string
	RoundingDecimals int
	MaxCost          float64
	MaxCostStrategy  string
	Rates            RateGroups // GroupRateInterval (start time): Rate
	// contains filtered or unexported fields
}

Separate structure used for rating plan size optimization

func (*RIRate) Clone

func (rit *RIRate) Clone() (cln *RIRate)

Clone clones RIRate

func (*RIRate) Stringify

func (rir *RIRate) Stringify() string

type RITiming

type RITiming struct {
	Years              utils.Years
	Months             utils.Months
	MonthDays          utils.MonthDays
	WeekDays           utils.WeekDays
	StartTime, EndTime string // ##:##:## format
	// contains filtered or unexported fields
}

Separate structure used for rating plan size optimization

func (*RITiming) Clone

func (rit *RITiming) Clone() (cln *RITiming)

Clone clones RITiming

func (*RITiming) CronString

func (rit *RITiming) CronString() string

func (*RITiming) IsActive

func (rit *RITiming) IsActive() bool

IsActive returns whether the Timing is active now

func (*RITiming) IsActiveAt

func (rit *RITiming) IsActiveAt(t time.Time) bool

Returns whether the Timing is active at the specified time

func (*RITiming) IsBlank

func (rit *RITiming) IsBlank() bool

func (*RITiming) Stringify

func (rit *RITiming) Stringify() string

type RPCClientSet

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

RPCClientSet is a RPC ClientConnector for the internal subsystems

var IntRPC *RPCClientSet

IntRPC is the global variable that is used to comunicate with all the subsystems internally

func NewRPCClientSet

func NewRPCClientSet() (s *RPCClientSet)

NewRPCClientSet initilalizates the map of connections

func (*RPCClientSet) AddInternalRPCClient

func (s *RPCClientSet) AddInternalRPCClient(name string, connChan chan birpc.ClientConnector)

AddInternalRPCClient creates and adds to the set a new rpc client using the provided configuration

func (*RPCClientSet) Call

func (s *RPCClientSet) Call(ctx *context.Context, method string, args any, reply any) error

Call the implementation of the birpc.ClientConnector interface

func (*RPCClientSet) GetInternalChanel

func (s *RPCClientSet) GetInternalChanel() chan birpc.ClientConnector

GetInternalChanel is used when RPCClientSet is passed as internal connection for RPCPool

type RPCRequest

type RPCRequest struct {
	Address   string
	Transport string
	Method    string
	Attempts  int
	Async     bool
	Params    map[string]any
}

RPCRequest used by rpc action

type RPRate

type RPRate struct {
	Timing string
	Rating string
	Weight float64
}

func (*RPRate) Equal

func (rpr *RPRate) Equal(orpr *RPRate) bool

type RPRateList

type RPRateList []*RPRate

type RandomBalancesSorter

type RandomBalancesSorter []*Balance

func (*RandomBalancesSorter) Sort

func (rbcs *RandomBalancesSorter) Sort()

type Rate

type Rate struct {
	GroupIntervalStart time.Duration
	Value              float64
	RateIncrement      time.Duration
	RateUnit           time.Duration
}

func (*Rate) Clone

func (r *Rate) Clone() (cln *Rate)

Clone clones Rates

func (*Rate) Equal

func (p *Rate) Equal(o *Rate) bool

func (*Rate) FieldAsInterface

func (r *Rate) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface func to help EventCost FieldAsInterface

func (*Rate) Stringify

func (r *Rate) Stringify() string

type RateGroups

type RateGroups []*Rate

func (*RateGroups) AddRate

func (pg *RateGroups) AddRate(ps ...*Rate)

func (RateGroups) Clone

func (pg RateGroups) Clone() (cln RateGroups)

func (RateGroups) Equal

func (pg RateGroups) Equal(og RateGroups) bool

func (RateGroups) Equals

func (pg RateGroups) Equals(oRG RateGroups) bool

func (RateGroups) Len

func (pg RateGroups) Len() int

func (RateGroups) Less

func (pg RateGroups) Less(i, j int) bool

func (RateGroups) Sort

func (pg RateGroups) Sort()

func (RateGroups) Swap

func (pg RateGroups) Swap(i, j int)

type RateInterval

type RateInterval struct {
	Timing *RITiming
	Rating *RIRate
	Weight float64
}

Defines a time interval for which a certain set of prices will apply

func GetRateInterval

func GetRateInterval(rpl *utils.TPRatingPlanBinding, dr *utils.DestinationRate) (i *RateInterval)

func (*RateInterval) Clone

func (i *RateInterval) Clone() (cln *RateInterval)

Clone clones RateInterval

func (*RateInterval) Contains

func (i *RateInterval) Contains(t time.Time, endTime bool) bool

Returns true if the received time result inside the interval

func (*RateInterval) Equal

func (i *RateInterval) Equal(o *RateInterval) bool

func (*RateInterval) GetCost

func (i *RateInterval) GetCost(duration, startSecond time.Duration) float64

func (*RateInterval) GetMaxCost

func (ri *RateInterval) GetMaxCost() (float64, string)

func (*RateInterval) GetRateParameters

func (i *RateInterval) GetRateParameters(startSecond time.Duration) (rate float64, rateIncrement, rateUnit time.Duration)

Gets the price for a the provided start second

func (*RateInterval) String_DISABLED

func (i *RateInterval) String_DISABLED() string

type RateIntervalList

type RateIntervalList []*RateInterval

Structure to store intervals according to weight

func (RateIntervalList) GetWeight

func (rl RateIntervalList) GetWeight() float64

type RateIntervalTimeSorter

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

Structure to store intervals according to weight

func (*RateIntervalTimeSorter) Len

func (il *RateIntervalTimeSorter) Len() int

func (*RateIntervalTimeSorter) Less

func (il *RateIntervalTimeSorter) Less(j, i int) bool

we need higher weights earlyer in the list

func (*RateIntervalTimeSorter) Sort

func (il *RateIntervalTimeSorter) Sort() []*RateInterval

func (*RateIntervalTimeSorter) Swap

func (il *RateIntervalTimeSorter) Swap(i, j int)

type Rating

type Rating map[string]*RatingUnit

Rating the map of rating units

func (Rating) Clone

func (crus Rating) Clone() (cln Rating)

Clone creates a copy of Rating

func (Rating) FieldAsInterface

func (crus Rating) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface func to help EventCost FieldAsInterface

func (Rating) GetIDWithSet

func (crus Rating) GetIDWithSet(cru *RatingUnit) string

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

type RatingFilters

type RatingFilters map[string]RatingMatchedFilters // so we can define search methods

RatingFilters the map of rating filters

func (RatingFilters) Clone

func (rfs RatingFilters) Clone() (cln RatingFilters)

Clone creates a copy of RatingFilters

func (RatingFilters) FieldAsInterface

func (rfs RatingFilters) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface func to help EventCost FieldAsInterface

func (RatingFilters) GetIDWithSet

func (rfs RatingFilters) GetIDWithSet(rmf RatingMatchedFilters) string

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

type RatingInfo

type RatingInfo struct {
	MatchedSubject string
	RatingPlanId   string
	MatchedPrefix  string
	MatchedDestId  string
	ActivationTime time.Time
	RateIntervals  RateIntervalList
	FallbackKeys   []string
}

func (RatingInfo) SelectRatingIntevalsForTimespan

func (ri RatingInfo) SelectRatingIntevalsForTimespan(ts *TimeSpan) (result RateIntervalList)

SelectRatingIntevalsForTimespan orders rate intervals in time preserving only those which aply to the specified timestamp

type RatingInfos

type RatingInfos []*RatingInfo

func (RatingInfos) Len

func (ris RatingInfos) Len() int

func (RatingInfos) Less

func (ris RatingInfos) Less(i, j int) bool

func (RatingInfos) Sort

func (ris RatingInfos) Sort()

func (RatingInfos) String

func (ris RatingInfos) String() string

func (RatingInfos) Swap

func (ris RatingInfos) Swap(i, j int)

type RatingMatchedFilters

type RatingMatchedFilters map[string]any

RatingMatchedFilters a rating filter

func (RatingMatchedFilters) Clone

func (rf RatingMatchedFilters) Clone() (cln map[string]any)

Clone creates a copy of RatingMatchedFilters

func (RatingMatchedFilters) Equals

Equals returns if the RatingMatchedFilters are equal

func (RatingMatchedFilters) FieldAsInterface

func (rf RatingMatchedFilters) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface func to help EventCost FieldAsInterface

type RatingPlan

type RatingPlan struct {
	Id               string
	Timings          map[string]*RITiming
	Ratings          map[string]*RIRate
	DestinationRates map[string]RPRateList
}

The struture that is saved to storage.

func (*RatingPlan) AddRateInterval

func (rp *RatingPlan) AddRateInterval(dId string, ris ...*RateInterval)

Adds one ore more intervals to the internal interval list only if it is not already in the list.

func (*RatingPlan) Equal

func (rp *RatingPlan) Equal(o *RatingPlan) bool

func (*RatingPlan) RateIntervalList

func (rp *RatingPlan) RateIntervalList(dId string) RateIntervalList

type RatingPlanActivation

type RatingPlanActivation struct {
	ActivationTime time.Time
	RatingPlanId   string
	FallbackKeys   []string
}

func (*RatingPlanActivation) Equal

type RatingPlanActivations

type RatingPlanActivations []*RatingPlanActivation

func (RatingPlanActivations) GetActiveForCall

func (rpas RatingPlanActivations) GetActiveForCall(cd *CallDescriptor) RatingPlanActivations

func (RatingPlanActivations) Len

func (rpas RatingPlanActivations) Len() int

func (RatingPlanActivations) Less

func (rpas RatingPlanActivations) Less(i, j int) bool

func (RatingPlanActivations) Sort

func (rpas RatingPlanActivations) Sort()

func (RatingPlanActivations) Swap

func (rpas RatingPlanActivations) Swap(i, j int)

type RatingProfile

type RatingProfile struct {
	Id                    string
	RatingPlanActivations RatingPlanActivations
}

func RatingProfileSubjectPrefixMatching

func RatingProfileSubjectPrefixMatching(key string) (rp *RatingProfile, err error)

func (*RatingProfile) GetRatingPlansForPrefix

func (rpf *RatingProfile) GetRatingPlansForPrefix(cd *CallDescriptor) (err error)

type RatingUnit

type RatingUnit struct {
	ConnectFee       float64
	RoundingMethod   string
	RoundingDecimals int
	MaxCost          float64
	MaxCostStrategy  string
	TimingID         string // This RatingUnit is bounded to specific timing profile
	RatesID          string
	RatingFiltersID  string
}

RatingUnit represents one unit out of RatingPlan matching for an event

func (*RatingUnit) Clone

func (ru *RatingUnit) Clone() (cln *RatingUnit)

Clone creates a copy of RatingUnit

func (*RatingUnit) Equals

func (ru *RatingUnit) Equals(oRU *RatingUnit) bool

Equals returns if RatingUnit is equal to the other

func (RatingUnit) FieldAsInterface

func (ru RatingUnit) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface func to help EventCost FieldAsInterface

type RawCdr

type RawCdr interface {
	AsCDR(string) *CDR // Convert the inbound Cdr into internally used one, CgrCdr
}

RawCDR is the original CDR received from external sources (eg: FreeSWITCH)

type RedisStorage

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

func NewRedisStorage

func NewRedisStorage(address string, db int, pass, mrshlerStr string,
	maxConns int, sentinelName string) (*RedisStorage, error)

func (*RedisStorage) AddLoadHistory

func (rs *RedisStorage) AddLoadHistory(ldInst *utils.LoadInstance, loadHistSize int, transactionID string) error

Adds a single load instance to load history

func (*RedisStorage) Close

func (rs *RedisStorage) Close()

func (*RedisStorage) Cmd

func (rs *RedisStorage) Cmd(cmd string, args ...any) *redis.Resp

This CMD function get a connection from the pool. Handles automatic failover in case of network disconnects

func (*RedisStorage) Flush

func (rs *RedisStorage) Flush(ignore string) error

func (*RedisStorage) GetAccountActionPlansDrv

func (rs *RedisStorage) GetAccountActionPlansDrv(acntID string) (aPlIDs []string, err error)

func (*RedisStorage) GetAccountDrv

func (rs *RedisStorage) GetAccountDrv(key string) (*Account, error)

func (*RedisStorage) GetActionPlanDrv

func (rs *RedisStorage) GetActionPlanDrv(key string) (ats *ActionPlan, err error)

func (*RedisStorage) GetActionTriggersDrv

func (rs *RedisStorage) GetActionTriggersDrv(key string) (atrs ActionTriggers, err error)

func (*RedisStorage) GetActionsDrv

func (rs *RedisStorage) GetActionsDrv(key string) (as Actions, err error)

func (*RedisStorage) GetAllActionPlansDrv

func (rs *RedisStorage) GetAllActionPlansDrv() (ats map[string]*ActionPlan, err error)

func (*RedisStorage) GetAttributeProfileDrv

func (rs *RedisStorage) GetAttributeProfileDrv(tenant, id string) (r *AttributeProfile, err error)

func (*RedisStorage) GetChargerProfileDrv

func (rs *RedisStorage) GetChargerProfileDrv(tenant, id string) (r *ChargerProfile, err error)

func (*RedisStorage) GetDestinationDrv

func (rs *RedisStorage) GetDestinationDrv(key string, skipCache bool,
	transactionID string) (dest *Destination, err error)

GetDestination retrieves a destination with id from tp_db

func (*RedisStorage) GetDispatcherHostDrv

func (rs *RedisStorage) GetDispatcherHostDrv(tenant, id string) (r *DispatcherHost, err error)

func (*RedisStorage) GetDispatcherProfileDrv

func (rs *RedisStorage) GetDispatcherProfileDrv(tenant, id string) (r *DispatcherProfile, err error)

func (*RedisStorage) GetFilterDrv

func (rs *RedisStorage) GetFilterDrv(tenant, id string) (r *Filter, err error)

func (*RedisStorage) GetFilterIndexesDrv

func (rs *RedisStorage) GetFilterIndexesDrv(cacheID, itemIDPrefix, filterType string,
	fldNameVal map[string]string) (indexes map[string]utils.StringMap, err error)

GetFilterIndexesDrv retrieves Indexes from dataDB filterType is used together with fieldName:Val

func (*RedisStorage) GetItemLoadIDsDrv

func (rs *RedisStorage) GetItemLoadIDsDrv(itemIDPrefix string) (loadIDs map[string]int64, err error)

func (*RedisStorage) GetKeysForPrefix

func (rs *RedisStorage) GetKeysForPrefix(prefix string) ([]string, error)

func (*RedisStorage) GetLoadHistory

func (rs *RedisStorage) GetLoadHistory(limit int, skipCache bool,
	transactionID string) ([]*utils.LoadInstance, error)

Limit will only retrieve the last n items out of history, newest first

func (*RedisStorage) GetRatingPlanDrv

func (rs *RedisStorage) GetRatingPlanDrv(key string) (rp *RatingPlan, err error)

func (*RedisStorage) GetRatingProfileDrv

func (rs *RedisStorage) GetRatingProfileDrv(key string) (rpf *RatingProfile, err error)

func (*RedisStorage) GetResourceDrv

func (rs *RedisStorage) GetResourceDrv(tenant, id string) (r *Resource, err error)

func (*RedisStorage) GetResourceProfileDrv

func (rs *RedisStorage) GetResourceProfileDrv(tenant, id string) (rsp *ResourceProfile, err error)

func (*RedisStorage) GetReverseDestinationDrv

func (rs *RedisStorage) GetReverseDestinationDrv(key string,
	skipCache bool, transactionID string) (ids []string, err error)

func (*RedisStorage) GetSharedGroupDrv

func (rs *RedisStorage) GetSharedGroupDrv(key string) (sg *SharedGroup, err error)

func (*RedisStorage) GetStatQueueDrv

func (rs *RedisStorage) GetStatQueueDrv(tenant, id string) (sq *StatQueue, err error)

GetStoredStatQueue retrieves the stored metrics for a StatsQueue

func (*RedisStorage) GetStatQueueProfileDrv

func (rs *RedisStorage) GetStatQueueProfileDrv(tenant string, id string) (sq *StatQueueProfile, err error)

GetStatQueueProfileDrv retrieves a StatQueueProfile from dataDB

func (*RedisStorage) GetStorageType

func (rs *RedisStorage) GetStorageType() string

func (*RedisStorage) GetSupplierProfileDrv

func (rs *RedisStorage) GetSupplierProfileDrv(tenant, id string) (r *SupplierProfile, err error)

func (*RedisStorage) GetThresholdDrv

func (rs *RedisStorage) GetThresholdDrv(tenant, id string) (r *Threshold, err error)

func (*RedisStorage) GetThresholdProfileDrv

func (rs *RedisStorage) GetThresholdProfileDrv(tenant, ID string) (tp *ThresholdProfile, err error)

GetThresholdProfileDrv retrieves a ThresholdProfile from dataDB

func (*RedisStorage) GetTimingDrv

func (rs *RedisStorage) GetTimingDrv(id string) (t *utils.TPTiming, err error)

func (*RedisStorage) GetVersions

func (rs *RedisStorage) GetVersions(itm string) (vrs Versions, err error)

func (*RedisStorage) HasDataDrv

func (rs *RedisStorage) HasDataDrv(category, subject, tenant string) (bool, error)

Used to check if specific subject is stored using prefix key attached to entity

func (*RedisStorage) IsDBEmpty

func (rs *RedisStorage) IsDBEmpty() (resp bool, err error)

func (*RedisStorage) Marshaler

func (rs *RedisStorage) Marshaler() Marshaler

func (*RedisStorage) MatchFilterIndexDrv

func (rs *RedisStorage) MatchFilterIndexDrv(cacheID, itemIDPrefix,
	filterType, fldName, fldVal string) (itemIDs utils.StringMap, err error)

func (*RedisStorage) PopTask

func (rs *RedisStorage) PopTask() (t *Task, err error)

func (*RedisStorage) PushTask

func (rs *RedisStorage) PushTask(t *Task) error

func (*RedisStorage) RebbuildActionPlanKeys

func (rs *RedisStorage) RebbuildActionPlanKeys() error

func (*RedisStorage) RemAccountActionPlansDrv

func (rs *RedisStorage) RemAccountActionPlansDrv(acntID string) (err error)

func (*RedisStorage) RemStatQueueDrv

func (rs *RedisStorage) RemStatQueueDrv(tenant, id string) (err error)

RemoveStatQueue removes a StatsQueue

func (*RedisStorage) RemStatQueueProfileDrv

func (rs *RedisStorage) RemStatQueueProfileDrv(tenant, id string) (err error)

RemStatsQueueDrv removes a StatsQueue from dataDB

func (*RedisStorage) RemThresholdProfileDrv

func (rs *RedisStorage) RemThresholdProfileDrv(tenant, id string) (err error)

RemoveThresholdProfile removes a ThresholdProfile from dataDB/cache

func (*RedisStorage) RemoveAccountDrv

func (rs *RedisStorage) RemoveAccountDrv(key string) (err error)

func (*RedisStorage) RemoveActionPlanDrv

func (rs *RedisStorage) RemoveActionPlanDrv(key string) error

func (*RedisStorage) RemoveActionTriggersDrv

func (rs *RedisStorage) RemoveActionTriggersDrv(key string) (err error)

func (*RedisStorage) RemoveActionsDrv

func (rs *RedisStorage) RemoveActionsDrv(key string) (err error)

func (*RedisStorage) RemoveAttributeProfileDrv

func (rs *RedisStorage) RemoveAttributeProfileDrv(tenant, id string) (err error)

func (*RedisStorage) RemoveChargerProfileDrv

func (rs *RedisStorage) RemoveChargerProfileDrv(tenant, id string) (err error)

func (*RedisStorage) RemoveDestinationDrv

func (rs *RedisStorage) RemoveDestinationDrv(destID, transactionID string) (err error)

func (*RedisStorage) RemoveDispatcherHostDrv

func (rs *RedisStorage) RemoveDispatcherHostDrv(tenant, id string) (err error)

func (*RedisStorage) RemoveDispatcherProfileDrv

func (rs *RedisStorage) RemoveDispatcherProfileDrv(tenant, id string) (err error)

func (*RedisStorage) RemoveFilterDrv

func (rs *RedisStorage) RemoveFilterDrv(tenant, id string) (err error)

func (*RedisStorage) RemoveFilterIndexesDrv

func (rs *RedisStorage) RemoveFilterIndexesDrv(cacheID, itemIDPrefix string) (err error)

func (*RedisStorage) RemoveKeysForPrefix added in v0.10.3

func (rs *RedisStorage) RemoveKeysForPrefix(prefix string) (err error)

func (*RedisStorage) RemoveLoadIDsDrv

func (rs *RedisStorage) RemoveLoadIDsDrv() (err error)

func (*RedisStorage) RemoveRatingPlanDrv

func (rs *RedisStorage) RemoveRatingPlanDrv(key string) error

func (*RedisStorage) RemoveRatingProfileDrv

func (rs *RedisStorage) RemoveRatingProfileDrv(key string) error

func (*RedisStorage) RemoveResourceDrv

func (rs *RedisStorage) RemoveResourceDrv(tenant, id string) (err error)

func (*RedisStorage) RemoveResourceProfileDrv

func (rs *RedisStorage) RemoveResourceProfileDrv(tenant, id string) (err error)

func (*RedisStorage) RemoveSharedGroupDrv

func (rs *RedisStorage) RemoveSharedGroupDrv(id string) (err error)

func (*RedisStorage) RemoveSupplierProfileDrv

func (rs *RedisStorage) RemoveSupplierProfileDrv(tenant, id string) (err error)

func (*RedisStorage) RemoveThresholdDrv

func (rs *RedisStorage) RemoveThresholdDrv(tenant, id string) (err error)

func (*RedisStorage) RemoveTimingDrv

func (rs *RedisStorage) RemoveTimingDrv(id string) (err error)

func (*RedisStorage) RemoveVersions

func (rs *RedisStorage) RemoveVersions(vrs Versions) (err error)

func (*RedisStorage) SelectDatabase

func (rs *RedisStorage) SelectDatabase(dbName string) (err error)

func (*RedisStorage) SetAccountActionPlansDrv

func (rs *RedisStorage) SetAccountActionPlansDrv(acntID string, aPlIDs []string) (err error)

func (*RedisStorage) SetAccountDrv

func (rs *RedisStorage) SetAccountDrv(acc *Account) (err error)

func (*RedisStorage) SetActionPlanDrv

func (rs *RedisStorage) SetActionPlanDrv(key string, ats *ActionPlan) (err error)

func (*RedisStorage) SetActionTriggersDrv

func (rs *RedisStorage) SetActionTriggersDrv(key string, atrs ActionTriggers) (err error)

func (*RedisStorage) SetActionsDrv

func (rs *RedisStorage) SetActionsDrv(key string, as Actions) (err error)

func (*RedisStorage) SetAttributeProfileDrv

func (rs *RedisStorage) SetAttributeProfileDrv(r *AttributeProfile) (err error)

func (*RedisStorage) SetChargerProfileDrv

func (rs *RedisStorage) SetChargerProfileDrv(r *ChargerProfile) (err error)

func (*RedisStorage) SetDestinationDrv

func (rs *RedisStorage) SetDestinationDrv(dest *Destination, transactionID string) (err error)

func (*RedisStorage) SetDispatcherHostDrv

func (rs *RedisStorage) SetDispatcherHostDrv(r *DispatcherHost) (err error)

func (*RedisStorage) SetDispatcherProfileDrv

func (rs *RedisStorage) SetDispatcherProfileDrv(r *DispatcherProfile) (err error)

func (*RedisStorage) SetFilterDrv

func (rs *RedisStorage) SetFilterDrv(r *Filter) (err error)

func (*RedisStorage) SetFilterIndexesDrv

func (rs *RedisStorage) SetFilterIndexesDrv(cacheID, itemIDPrefix string,
	indexes map[string]utils.StringMap, commit bool, transactionID string) (err error)

SetFilterIndexesDrv stores Indexes into DataDB

func (*RedisStorage) SetLoadIDsDrv

func (rs *RedisStorage) SetLoadIDsDrv(loadIDs map[string]int64) error

func (*RedisStorage) SetRatingPlanDrv

func (rs *RedisStorage) SetRatingPlanDrv(rp *RatingPlan) (err error)

func (*RedisStorage) SetRatingProfileDrv

func (rs *RedisStorage) SetRatingProfileDrv(rpf *RatingProfile) (err error)

func (*RedisStorage) SetResourceDrv

func (rs *RedisStorage) SetResourceDrv(r *Resource) (err error)

func (*RedisStorage) SetResourceProfileDrv

func (rs *RedisStorage) SetResourceProfileDrv(rsp *ResourceProfile) error

func (*RedisStorage) SetReverseDestinationDrv

func (rs *RedisStorage) SetReverseDestinationDrv(dest *Destination, transactionID string) (err error)

func (*RedisStorage) SetSharedGroupDrv

func (rs *RedisStorage) SetSharedGroupDrv(sg *SharedGroup) (err error)

func (*RedisStorage) SetStatQueueDrv

func (rs *RedisStorage) SetStatQueueDrv(ssq *StoredStatQueue, sq *StatQueue) (err error)

SetStoredStatQueue stores the metrics for a StatsQueue

func (*RedisStorage) SetStatQueueProfileDrv

func (rs *RedisStorage) SetStatQueueProfileDrv(sq *StatQueueProfile) (err error)

SetStatsQueueDrv stores a StatsQueue into DataDB

func (*RedisStorage) SetSupplierProfileDrv

func (rs *RedisStorage) SetSupplierProfileDrv(r *SupplierProfile) (err error)

func (*RedisStorage) SetThresholdDrv

func (rs *RedisStorage) SetThresholdDrv(r *Threshold) (err error)

func (*RedisStorage) SetThresholdProfileDrv

func (rs *RedisStorage) SetThresholdProfileDrv(tp *ThresholdProfile) (err error)

SetThresholdProfileDrv stores a ThresholdProfile into DataDB

func (*RedisStorage) SetTimingDrv

func (rs *RedisStorage) SetTimingDrv(t *utils.TPTiming) error

func (*RedisStorage) SetVersions

func (rs *RedisStorage) SetVersions(vrs Versions, overwrite bool) (err error)

func (*RedisStorage) UpdateReverseDestinationDrv

func (rs *RedisStorage) UpdateReverseDestinationDrv(oldDest, newDest *Destination, transactionID string) error

type RemAccountActionPlansArgs

type RemAccountActionPlansArgs struct {
	AcntID string
	ApIDs  []string
}

type Resource

type Resource struct {
	Tenant string
	ID     string
	Usages map[string]*ResourceUsage
	TTLIdx []string // holds ordered list of ResourceIDs based on their TTL, empty if feature is disableda
	// contains filtered or unexported fields
}

Resource represents a resource in the system not thread safe, needs locking at process level

func (*Resource) TenantID

func (r *Resource) TenantID() string

TenantID returns the unique ID in a multi-tenant environment

func (*Resource) TotalUsage

func (r *Resource) TotalUsage() (tU float64)

TotalUsage returns the sum of all usage units Exported to be used in FilterS

type ResourceAscendentSorter

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

ResourceAscendentSorter orders suppliers based on their Resource Usage

func NewResourceAscendetSorter

func NewResourceAscendetSorter(spS *SupplierService) *ResourceAscendentSorter

func (*ResourceAscendentSorter) SortSuppliers

func (ws *ResourceAscendentSorter) SortSuppliers(prflID string,
	suppls []*Supplier, suplEv *utils.CGREvent, extraOpts *optsGetSuppliers, argDsp *utils.ArgDispatcher) (sortedSuppls *SortedSuppliers, err error)

type ResourceDescendentSorter

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

ResourceAscendentSorter orders suppliers based on their Resource Usage

func NewResourceDescendentSorter

func NewResourceDescendentSorter(spS *SupplierService) *ResourceDescendentSorter

func (*ResourceDescendentSorter) SortSuppliers

func (ws *ResourceDescendentSorter) SortSuppliers(prflID string,
	suppls []*Supplier, suplEv *utils.CGREvent, extraOpts *optsGetSuppliers, argDsp *utils.ArgDispatcher) (sortedSuppls *SortedSuppliers, err error)

type ResourceProfile

type ResourceProfile struct {
	Tenant             string
	ID                 string // identifier of this resource
	FilterIDs          []string
	ActivationInterval *utils.ActivationInterval // time when this resource becomes active and expires
	UsageTTL           time.Duration             // auto-expire the usage after this duration
	Limit              float64                   // limit value
	AllocationMessage  string                    // message returned by the winning resource on allocation
	Blocker            bool                      // blocker flag to stop processing on filters matched
	Stored             bool
	Weight             float64  // Weight to sort the resources
	ThresholdIDs       []string // Thresholds to check after changing Limit
	// contains filtered or unexported fields
}

ResourceProfile represents the user configuration for the resource

func APItoResource

func APItoResource(tpRL *utils.TPResourceProfile, timezone string) (rp *ResourceProfile, err error)

func (*ResourceProfile) TenantID

func (rp *ResourceProfile) TenantID() string

TenantID returns unique identifier of the ResourceProfile in a multi-tenant environment

type ResourceService

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

ResourceService is the service handling resources

func NewResourceService

func NewResourceService(dm *DataManager, cgrcfg *config.CGRConfig,
	filterS *FilterS, connMgr *ConnManager) (*ResourceService, error)

NewResourceService returns a new ResourceService

func (*ResourceService) ListenAndServe

func (rS *ResourceService) ListenAndServe(exitChan chan bool) error

Called to start the service

func (*ResourceService) Reload

func (rS *ResourceService) Reload()

Reload stops the backupLoop and restarts it

func (*ResourceService) Shutdown

func (rS *ResourceService) Shutdown() error

Called to shutdown the service

func (*ResourceService) StartLoop

func (rS *ResourceService) StartLoop()

StartLoop starts the gorutine with the backup loop

func (*ResourceService) V1AllocateResource

func (rS *ResourceService) V1AllocateResource(args utils.ArgRSv1ResourceUsage, reply *string) (err error)

V1AllocateResource is called when a resource requires allocation

func (*ResourceService) V1AuthorizeResources

func (rS *ResourceService) V1AuthorizeResources(args utils.ArgRSv1ResourceUsage, reply *string) (err error)

V1AuthorizeResources queries service to find if an Usage is allowed

func (*ResourceService) V1GetResource

func (rS *ResourceService) V1GetResource(arg *utils.TenantID, reply *Resource) error

GetResource returns a resource configuration

func (*ResourceService) V1ReleaseResource

func (rS *ResourceService) V1ReleaseResource(args utils.ArgRSv1ResourceUsage, reply *string) (err error)

V1ReleaseResource is called when we need to clear an allocation

func (*ResourceService) V1ResourcesForEvent

func (rS *ResourceService) V1ResourcesForEvent(args utils.ArgRSv1ResourceUsage, reply *Resources) (err error)

V1ResourcesForEvent returns active resource configs matching the event

type ResourceUsage

type ResourceUsage struct {
	Tenant     string
	ID         string // Unique identifier of this ResourceUsage, Eg: FreeSWITCH UUID
	ExpiryTime time.Time
	Units      float64 // Number of units used
}

ResourceUsage represents an usage counted

func (*ResourceUsage) Clone

func (ru *ResourceUsage) Clone() (cln *ResourceUsage)

clone duplicates ru

func (*ResourceUsage) TenantID

func (ru *ResourceUsage) TenantID() string

type Resources

type Resources []*Resource

Resources is an orderable list of Resources based on Weight

func (Resources) IDs

func (rs Resources) IDs() []string

func (Resources) Sort

func (rs Resources) Sort()

sort based on Weight

type Responder

type Responder struct {
	ExitChan         chan bool
	Timeout          time.Duration
	Timezone         string
	MaxComputedUsage map[string]time.Duration
	// contains filtered or unexported fields
}

func (*Responder) Call

func (rs *Responder) Call(ctx *context.Context, serviceMethod string, args any, reply any) error

func (*Responder) Debit

func (rs *Responder) Debit(arg *CallDescriptorWithArgDispatcher, reply *CallCost) (err error)

func (*Responder) GetCost

func (rs *Responder) GetCost(arg *CallDescriptorWithArgDispatcher, reply *CallCost) (err error)

RPC method that provides the external RPC interface for getting the rating information.

func (*Responder) GetCostOnRatingPlans added in v0.10.3

func (rs *Responder) GetCostOnRatingPlans(arg *utils.GetCostOnRatingPlansArgs, reply *map[string]any) (err error)

GetCostOnRatingPlans is used by SupplierS to calculate the cost Receive a list of RatingPlans and pick the first without error

func (*Responder) GetMaxSessionTime

func (rs *Responder) GetMaxSessionTime(arg *CallDescriptorWithArgDispatcher, reply *time.Duration) (err error)

func (*Responder) GetMaxSessionTimeOnAccounts added in v0.10.3

func (rs *Responder) GetMaxSessionTimeOnAccounts(arg *utils.GetMaxSessionTimeOnAccountsArgs,
	reply *map[string]any) (err error)

func (*Responder) MaxDebit

func (rs *Responder) MaxDebit(arg *CallDescriptorWithArgDispatcher, reply *CallCost) (err error)

func (*Responder) Ping

func (chSv1 *Responder) Ping(ign *utils.CGREventWithArgDispatcher, reply *string) error

Ping used to detreminate if component is active

func (*Responder) RefundIncrements

func (rs *Responder) RefundIncrements(arg *CallDescriptorWithArgDispatcher, reply *Account) (err error)

func (*Responder) RefundRounding

func (rs *Responder) RefundRounding(arg *CallDescriptorWithArgDispatcher, reply *Account) (err error)

func (*Responder) SetMaxComputedUsage

func (rs *Responder) SetMaxComputedUsage(mx map[string]time.Duration)

SetMaxComputedUsage sets MaxComputedUsage, used for config reload (is thread safe)

func (*Responder) Shutdown

func (rs *Responder) Shutdown(arg *utils.TenantWithArgDispatcher, reply *string) (err error)

type ReverseDestinationsIHReply added in v0.10.3

type ReverseDestinationsIHReply struct {
	MissingReverseDestinations map[string][]string // list of missing indexes for each object (the map has the key as the indexKey and a list of objects)
	BrokenReferences           map[string][]string // list of broken references (the map has the key as the objectID and a list of indexes)
}

func GetReverseDestinationsIndexHealth added in v0.10.3

func GetReverseDestinationsIndexHealth(dm *DataManager, objLimit, indexLimit int, objTTL, indexTTL time.Duration, objStaticTTL, indexStaticTTL bool) (rply *ReverseDestinationsIHReply, err error)

add cache in args API

type S3Poster

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

S3Poster is a s3 poster

func (*S3Poster) Close

func (pstr *S3Poster) Close()

Close for Poster interface

func (*S3Poster) Post

func (pstr *S3Poster) Post(message []byte, key string) (err error)

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

type SMCost

type SMCost struct {
	CGRID       string
	RunID       string
	OriginHost  string
	OriginID    string
	CostSource  string
	Usage       time.Duration
	CostDetails *EventCost
}

SMCost stores one Cost coming from SM

type SQItem

type SQItem struct {
	EventID    string     // Bounded to the original utils.CGREvent
	ExpiryTime *time.Time // Used to auto-expire events
}

type SQLImpl

type SQLImpl interface {
	// contains filtered or unexported methods
}

type SQLStorage

type SQLStorage struct {
	Db *sql.DB

	StorDB
	SQLImpl
	// contains filtered or unexported fields
}

func NewMySQLStorage

func NewMySQLStorage(host, port, name, user, password string,
	maxConn, maxIdleConn, connMaxLifetime int) (*SQLStorage, error)

func NewPostgresStorage

func NewPostgresStorage(host, port, name, user, password, sslmode string, maxConn, maxIdleConn, connMaxLifetime int) (*SQLStorage, error)

NewPostgresStorage returns the posgres storDB

func (*SQLStorage) Close

func (self *SQLStorage) Close()

func (*SQLStorage) CreateTablesFromScript

func (self *SQLStorage) CreateTablesFromScript(scriptPath string) error

func (*SQLStorage) ExportGormDB

func (self *SQLStorage) ExportGormDB() *gorm.DB

func (*SQLStorage) Flush

func (self *SQLStorage) Flush(scriptsPath string) (err error)

func (*SQLStorage) GetCDRs

func (self *SQLStorage) GetCDRs(qryFltr *utils.CDRsFilter, remove bool) ([]*CDR, int64, error)

GetCDRs has ability to remove the selected CDRs, count them or simply return them qryFltr.Unscoped will ignore soft deletes or delete records permanently

func (*SQLStorage) GetKeysForPrefix

func (self *SQLStorage) GetKeysForPrefix(prefix string) ([]string, error)

func (*SQLStorage) GetSMCosts

func (self *SQLStorage) GetSMCosts(cgrid, runid, originHost, originIDPrefix string) ([]*SMCost, error)

GetSMCosts is used to retrieve one or multiple SMCosts based on filter

func (*SQLStorage) GetTPAccountActions

func (self *SQLStorage) GetTPAccountActions(filter *utils.TPAccountActions) ([]*utils.TPAccountActions, error)

func (*SQLStorage) GetTPActionPlans

func (self *SQLStorage) GetTPActionPlans(tpid, id string) ([]*utils.TPActionPlan, error)

func (*SQLStorage) GetTPActionTriggers

func (self *SQLStorage) GetTPActionTriggers(tpid, id string) ([]*utils.TPActionTriggers, error)

func (*SQLStorage) GetTPActions

func (self *SQLStorage) GetTPActions(tpid, id string) ([]*utils.TPActions, error)

func (*SQLStorage) GetTPAttributes

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

func (*SQLStorage) GetTPChargers

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

func (*SQLStorage) GetTPDestinationRates

func (self *SQLStorage) GetTPDestinationRates(tpid, id string, pagination *utils.Paginator) ([]*utils.TPDestinationRate, error)

func (*SQLStorage) GetTPDestinations

func (self *SQLStorage) GetTPDestinations(tpid, id string) (uTPDsts []*utils.TPDestination, err error)

func (*SQLStorage) GetTPDispatcherHosts

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

func (*SQLStorage) GetTPDispatcherProfiles

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

func (*SQLStorage) GetTPFilters

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

func (*SQLStorage) GetTPRates

func (self *SQLStorage) GetTPRates(tpid, id string) ([]*utils.TPRate, error)

func (*SQLStorage) GetTPRatingPlans

func (self *SQLStorage) GetTPRatingPlans(tpid, id string, pagination *utils.Paginator) ([]*utils.TPRatingPlan, error)

func (*SQLStorage) GetTPRatingProfiles

func (self *SQLStorage) GetTPRatingProfiles(filter *utils.TPRatingProfile) ([]*utils.TPRatingProfile, error)

func (*SQLStorage) GetTPResources

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

func (*SQLStorage) GetTPSharedGroups

func (self *SQLStorage) GetTPSharedGroups(tpid, id string) ([]*utils.TPSharedGroups, error)

func (*SQLStorage) GetTPStats

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

func (*SQLStorage) GetTPSuppliers

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

func (*SQLStorage) GetTPThresholds

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

func (*SQLStorage) GetTPTimings

func (self *SQLStorage) GetTPTimings(tpid, id string) ([]*utils.ApierTPTiming, error)

func (*SQLStorage) GetTpIds

func (self *SQLStorage) GetTpIds(colName string) ([]string, error)

update Return a list with all TPids defined in the system, even if incomplete, isolated in some table.

func (*SQLStorage) GetTpTableIds

func (self *SQLStorage) GetTpTableIds(tpid, table string, distinct utils.TPDistinctIds,
	filters map[string]string, pagination *utils.PaginatorWithSearch) ([]string, error)

ToDo: TEST

func (*SQLStorage) GetVersions

func (self *SQLStorage) GetVersions(itm string) (vrs Versions, err error)

GetVersions returns slice of all versions or a specific version if tag is specified

func (*SQLStorage) IsDBEmpty

func (self *SQLStorage) IsDBEmpty() (resp bool, err error)

func (*SQLStorage) RebuildReverseForPrefix

func (self *SQLStorage) RebuildReverseForPrefix(prefix string) error

func (*SQLStorage) RemTpData

func (self *SQLStorage) RemTpData(table, tpid string, args map[string]string) error

func (*SQLStorage) RemoveSMCost

func (self *SQLStorage) RemoveSMCost(smc *SMCost) error

func (*SQLStorage) RemoveSMCosts

func (self *SQLStorage) RemoveSMCosts(qryFltr *utils.SMCostFilter) error

func (*SQLStorage) RemoveVersions

func (self *SQLStorage) RemoveVersions(vrs Versions) (err error)

RemoveVersions will remove specific versions out of storage

func (*SQLStorage) SelectDatabase

func (rs *SQLStorage) SelectDatabase(dbName string) (err error)

func (*SQLStorage) SetCDR

func (self *SQLStorage) SetCDR(cdr *CDR, allowUpdate bool) error

func (*SQLStorage) SetSMCost

func (self *SQLStorage) SetSMCost(smc *SMCost) error

func (*SQLStorage) SetTPAccountActions

func (self *SQLStorage) SetTPAccountActions(aas []*utils.TPAccountActions) error

Sets a group of account actions. Map key has the role of grouping within a tpid

func (*SQLStorage) SetTPActionPlans

func (self *SQLStorage) SetTPActionPlans(ats []*utils.TPActionPlan) error

func (*SQLStorage) SetTPActionTriggers

func (self *SQLStorage) SetTPActionTriggers(ats []*utils.TPActionTriggers) error

func (*SQLStorage) SetTPActions

func (self *SQLStorage) SetTPActions(acts []*utils.TPActions) error

func (*SQLStorage) SetTPAttributes

func (self *SQLStorage) SetTPAttributes(tpAttrs []*utils.TPAttributeProfile) error

func (*SQLStorage) SetTPChargers

func (self *SQLStorage) SetTPChargers(tpCPPs []*utils.TPChargerProfile) error

func (*SQLStorage) SetTPDestinationRates

func (self *SQLStorage) SetTPDestinationRates(drs []*utils.TPDestinationRate) error

func (*SQLStorage) SetTPDestinations

func (self *SQLStorage) SetTPDestinations(dests []*utils.TPDestination) error

func (*SQLStorage) SetTPDispatcherHosts

func (self *SQLStorage) SetTPDispatcherHosts(tpDPPs []*utils.TPDispatcherHost) error

func (*SQLStorage) SetTPDispatcherProfiles

func (self *SQLStorage) SetTPDispatcherProfiles(tpDPPs []*utils.TPDispatcherProfile) error

func (*SQLStorage) SetTPFilters

func (self *SQLStorage) SetTPFilters(ths []*utils.TPFilterProfile) error

func (*SQLStorage) SetTPRates

func (self *SQLStorage) SetTPRates(rs []*utils.TPRate) error

func (*SQLStorage) SetTPRatingPlans

func (self *SQLStorage) SetTPRatingPlans(rps []*utils.TPRatingPlan) error

func (*SQLStorage) SetTPRatingProfiles

func (self *SQLStorage) SetTPRatingProfiles(rpfs []*utils.TPRatingProfile) error

func (*SQLStorage) SetTPResources

func (self *SQLStorage) SetTPResources(rls []*utils.TPResourceProfile) error

func (*SQLStorage) SetTPSharedGroups

func (self *SQLStorage) SetTPSharedGroups(sgs []*utils.TPSharedGroups) error

func (*SQLStorage) SetTPStats

func (self *SQLStorage) SetTPStats(sts []*utils.TPStatProfile) error

func (*SQLStorage) SetTPSuppliers

func (self *SQLStorage) SetTPSuppliers(tpSPs []*utils.TPSupplierProfile) error

func (*SQLStorage) SetTPThresholds

func (self *SQLStorage) SetTPThresholds(ths []*utils.TPThresholdProfile) error

func (*SQLStorage) SetTPTimings

func (self *SQLStorage) SetTPTimings(timings []*utils.ApierTPTiming) error

type SQSPoster

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

SQSPoster is a poster for sqs

func (*SQSPoster) Close

func (pstr *SQSPoster) Close()

Close for Poster interface

func (*SQSPoster) Post

func (pstr *SQSPoster) Post(message []byte, _ string) (err error)

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

type STGroup

type STGroup struct {
	StateCode      string       // Tax State
	InvoiceNumber  string       // Invoice Number
	CustomerNumber string       // Customer number
	TaxList        []*STTaxItem // contains one-to-many Tax Items
}

Part of the SureTax Response

type STItemMessage

type STItemMessage struct {
	LineNumber   string // value corresponding to the line number in the web request
	ResponseCode string // a value in the range 9100-9400
	Message      string // the error message corresponding to the ResponseCode
}

Part of the SureTax Response

type STRequest

type STRequest struct {
	ClientNumber      string           // Client ID Number – provided by SureTax. Required. Max Len: 10
	BusinessUnit      string           // Client’s Business Unit. Value for this field is not required. Max Len: 20
	ValidationKey     string           // Validation Key provided by SureTax. Required for client access to API function. Max Len: 36
	DataYear          string           // Required. YYYY – Year to use for tax calculation purposes
	DataMonth         string           // Required. MM – Month to use for tax calculation purposes. Leading zero is preferred.
	TotalRevenue      float64          // Required. Format: $$$$$$$$$.CCCC. For Negative charges, the first position should have a minus ‘-‘ indicator.
	ReturnFileCode    string           // Required. 0 – Default.Q – Quote purposes – taxes are computed and returned in the response message for generating quotes.
	ClientTracking    string           // Field for client transaction tracking. This value will be provided in the response data. Value for this field is not required, but preferred. Max Len: 100
	IndustryExemption string           // Reserved for future use.
	ResponseGroup     string           // Required. Determines how taxes are grouped for the response.
	ResponseType      string           // Required. Determines the granularity of taxes and (optionally) the decimal precision for the tax calculations and amounts in the response.
	ItemList          []*STRequestItem // List of Item records
}

SureTax Request type

type STRequestItem

type STRequestItem struct {
	LineNumber           string   // Used to identify an item within the request. If no value is provided, requests are numbered sequentially. Max Len: 40
	InvoiceNumber        string   // Used for tax aggregation by Invoice. Must be alphanumeric. Max Len: 40
	CustomerNumber       string   // Used for tax aggregation by Customer. Must be alphanumeric. Max Len: 40
	OrigNumber           string   // Required when using Tax Situs Rule 01 or 03. Format: NPANXXNNNN
	TermNumber           string   // Required when using Tax Situs Rule 01. Format: NPANXXNNNN
	BillToNumber         string   // Required when using Tax Situs Rule 01 or 02. Format: NPANXXNNNN
	Zipcode              string   // Required when using Tax Situs Rule 04, 05, or 14.
	Plus4                string   // Zip code extension in format: 9999 (not applicable for Tax Situs Rule 14)
	P2PZipcode           string   // Secondary zip code in format: 99999 (US or US territory) or X9X9X9 (Canadian)
	P2PPlus4             string   // Secondary zip code extension in format: 99999 (US or US territory) or X9X9X9         (Canadian)
	TransDate            string   // Required. Date of transaction. Valid date formats include: MM/DD/YYYY, MM-DD-YYYY, YYYY-MM-DDTHH:MM:SS
	Revenue              float64  // Required. Format: $$$$$$$$$.CCCC. For Negative charges, the first position should have a minus ‘-‘indicator.
	Units                int64    // Required. Units representing number of “lines” or unique charges contained within the revenue. This value is essentially a multiplier on unit-based fees (e.g. E911 fees). Format: 99999. Default should be 1 (one unit).
	UnitType             string   // Required. 00 – Default / Number of unique access lines.
	Seconds              int64    // Required. Duration of call in seconds. Format 99999. Default should be 1.
	TaxIncludedCode      string   // Required. Values: 0 – Default (No Tax Included) 1 – Tax Included in Revenue
	TaxSitusRule         string   // Required.
	TransTypeCode        string   // Required. Transaction Type Indicator.
	SalesTypeCode        string   // Required. Values: R – Residential customer (default) B – Business customer I – Industrial customer L – Lifeline customer
	RegulatoryCode       string   // Required. Provider Type.
	TaxExemptionCodeList []string // Required. Tax Exemption to be applied to this item only.
}

Part of SureTax Request

type STResponse

type STResponse struct {
	Successful     string           // Response will be either ‘Y' or ‘N' : Y = Success / Success with Item error N = Failure
	ResponseCode   string           // ResponseCode: 9999 – Request was successful. 1101-1400 – Range of values for a failed request (no processing occurred) 9001 – Request was successful, but items within the request have errors. The specific items with errors are provided in the ItemMessages field.
	HeaderMessage  string           // Response message: For ResponseCode 9999 – “Success”For ResponseCode 9001 – “Success with Item errors”.  For ResponseCode 1100-1400 – Unsuccessful / declined web request.
	ItemMessages   []*STItemMessage // This field contains a list of items that were not able to be processed due to bad or invalid data (see Response Code of “9001”).
	ClientTracking string           // Client transaction tracking provided in web request.
	TotalTax       string           // Total Tax – a total of all taxes included in the TaxList
	TransId        int              // Transaction ID – provided by SureTax
	GroupList      []*STGroup       // contains one-to-many Groups
}

type STTaxItem

type STTaxItem struct {
	TaxTypeCode string // Tax Type Code
	TaxTypeDesc string // Tax Type Description
	TaxAmount   string // Tax Amount
}

Part of the SureTax Response

type SafEvent

type SafEvent struct {
	sync.RWMutex
	Me MapEvent // need it exportable so we can pass it on network
}

SafEvent is a generic event which is safe to read/write from multiple goroutines

func NewSafEvent

func NewSafEvent(mp map[string]any) *SafEvent

func (*SafEvent) AsCDR

func (se *SafEvent) AsCDR(cfg *config.CGRConfig, tnt, tmz string) (cdr *CDR, err error)

AsCDR exports the SafEvent as CDR

func (*SafEvent) AsCGREvent

func (se *SafEvent) AsCGREvent(tnt string) (cgrEv *utils.CGREvent)

AsCGREvent exports the SafEvent as CGREvent

func (*SafEvent) AsMapInterface

func (se *SafEvent) AsMapInterface() (mp map[string]any)

AsMapInterface returns the cloned map stored internally

func (*SafEvent) AsMapString

func (se *SafEvent) AsMapString(ignoredFlds utils.StringSet) (mp map[string]string)

AsMapString returns a map[string]string out of mp, ignoring specific fields if needed most used when needing to export extraFields

func (*SafEvent) Clone

func (se *SafEvent) Clone() (cln *SafEvent)

func (*SafEvent) FieldAsInterface

func (se *SafEvent) FieldAsInterface(fldPath []string) (out any, err error)

func (*SafEvent) FieldAsString

func (se *SafEvent) FieldAsString(fldPath []string) (out string, err error)

func (*SafEvent) Get

func (se *SafEvent) Get(fldName string) (out any, has bool)

func (*SafEvent) GetDuration

func (se *SafEvent) GetDuration(fldName string) (d time.Duration, err error)

GetDuration returns a field as Duration

func (*SafEvent) GetDurationIgnoreErrors

func (se *SafEvent) GetDurationIgnoreErrors(fldName string) (d time.Duration)

GetDuration returns a field as Duration, ignoring errors

func (*SafEvent) GetDurationOrDefault

func (se *SafEvent) GetDurationOrDefault(fldName string, dflt time.Duration) (d time.Duration, err error)

GetDurationPointer returns pointer towards duration, useful to detect presence of duration

func (*SafEvent) GetDurationPtr

func (se *SafEvent) GetDurationPtr(fldName string) (d *time.Duration, err error)

GetDurationPointer returns pointer towards duration, useful to detect presence of duration

func (*SafEvent) GetDurationPtrIgnoreErrors

func (se *SafEvent) GetDurationPtrIgnoreErrors(fldName string) (d *time.Duration)

GetDurationPointer returns pointer towards duration, useful to detect presence of duration

func (*SafEvent) GetDurationPtrOrDefault

func (se *SafEvent) GetDurationPtrOrDefault(fldName string, dflt *time.Duration) (d *time.Duration, err error)

GetDurationPointer returns pointer towards duration, useful to detect presence of duration

func (*SafEvent) GetIgnoreErrors

func (se *SafEvent) GetIgnoreErrors(fldName string) (out any)

func (*SafEvent) GetMapInterface

func (se *SafEvent) GetMapInterface() (mp map[string]any)

GetMapInterface returns the map stored internally without cloning it

func (*SafEvent) GetSetString

func (se *SafEvent) GetSetString(fldName string, setVal string) (out string, err error)

GetSet will attempt to get a field value if field not present set it to the value received as parameter

func (*SafEvent) GetString

func (se *SafEvent) GetString(fldName string) (out string, err error)

func (*SafEvent) GetStringIgnoreErrors

func (se *SafEvent) GetStringIgnoreErrors(fldName string) (out string)

func (SafEvent) GetTInt64

func (se SafEvent) GetTInt64(fldName string) (out int64, err error)

func (*SafEvent) GetTime

func (se *SafEvent) GetTime(fldName string, tmz string) (t time.Time, err error)

GetTime returns a field as Time

func (*SafEvent) GetTimeIgnoreErrors

func (se *SafEvent) GetTimeIgnoreErrors(fldName string, tmz string) (t time.Time)

GetTimeIgnoreErrors returns a field as Time instance, ignoring errors

func (*SafEvent) HasField

func (se *SafEvent) HasField(fldName string) (has bool)

func (*SafEvent) MapEvent

func (se *SafEvent) MapEvent() (mp MapEvent)

MapEvent offers access to MapEvent methods, avoiding locks

func (*SafEvent) RemoteHost

func (se *SafEvent) RemoteHost() (out net.Addr)

func (*SafEvent) Remove

func (se *SafEvent) Remove(fldName string)

Remove will remove a field from map

func (*SafEvent) Set

func (se *SafEvent) Set(fldName string, val any)

Set will set a field's value

func (*SafEvent) String

func (se *SafEvent) String() (out string)

type SessionCostsSQL

type SessionCostsSQL struct {
	ID          int64
	Cgrid       string
	RunID       string
	OriginHost  string
	OriginID    string
	CostSource  string
	Usage       int64
	CostDetails string
	CreatedAt   time.Time
	DeletedAt   *time.Time
}

func (SessionCostsSQL) TableName

func (t SessionCostsSQL) TableName() string

type SetAccountActionPlansArg

type SetAccountActionPlansArg struct {
	AcntID string
	AplIDs []string
}

type SetActionPlanArg

type SetActionPlanArg struct {
	Key string
	Ats *ActionPlan
}

type SetActionTriggersArg

type SetActionTriggersArg struct {
	Key   string
	Attrs ActionTriggers
}

SetActionTriggersArg is used to send the key and the ActionTriggers to Replicator

type SetActionsArgs

type SetActionsArgs struct {
	Key string
	Acs Actions
}

SetActionsArgs is used to send the key and the Actions to replicator

type SharedGroup

type SharedGroup struct {
	Id                string
	AccountParameters map[string]*SharingParameters
	MemberIds         utils.StringMap
}

func (*SharedGroup) Clone

func (sg *SharedGroup) Clone() (sharedGroup *SharedGroup)

Clone clones *SharedGroup

func (*SharedGroup) GetBalances

func (sg *SharedGroup) GetBalances(destination, category, balanceType string, ub *Account, aTime time.Time) (bc Balances)

Returns all shared group's balances collected from user accounts'

func (*SharedGroup) SortBalancesByStrategy

func (sg *SharedGroup) SortBalancesByStrategy(myBalance *Balance, bc Balances) Balances

type SharingParameters

type SharingParameters struct {
	Strategy      string
	RatingSubject string
}

func (*SharingParameters) Clone

func (sp *SharingParameters) Clone() *SharingParameters

Clone clones *SharingParameters

type SortedSupplier

type SortedSupplier struct {
	SupplierID         string
	SupplierParameters string
	SortingData        map[string]any // store here extra info like cost or stats
}

SupplierReply represents one supplier in

func (*SortedSupplier) AsNavigableMap added in v0.10.1

func (ss *SortedSupplier) AsNavigableMap() (nm utils.NavigableMap2)

type SortedSuppliers

type SortedSuppliers struct {
	ProfileID       string            // Profile matched
	Sorting         string            // Sorting algorithm
	Count           int               // number of suppliers returned
	SortedSuppliers []*SortedSupplier // list of supplier IDs and SortingData data
}

SuppliersReply is returned as part of GetSuppliers call

func (*SortedSuppliers) AsNavigableMap

func (sSpls *SortedSuppliers) AsNavigableMap() (nm utils.NavigableMap2)

func (*SortedSuppliers) Digest

func (sSpls *SortedSuppliers) Digest() string

Digest returns list of supplierIDs + parameters for easier outside access format suppl1:suppl1params,suppl2:suppl2params

func (*SortedSuppliers) SortHighestCost

func (sSpls *SortedSuppliers) SortHighestCost()

SortHighestCost is part of sort interface, sort descendent based on Cost with fallback on Weight

func (*SortedSuppliers) SortLeastCost

func (sSpls *SortedSuppliers) SortLeastCost()

SortLeastCost is part of sort interface, sort ascendent based on Cost with fallback on Weight

func (*SortedSuppliers) SortLoadDistribution

func (sSpls *SortedSuppliers) SortLoadDistribution()

SortLoadDistribution is part of sort interface, sort based on the following formula (float64(ratio + metricVal) / float64(ratio)) -1 with fallback on Weight

func (*SortedSuppliers) SortQOS

func (sSpls *SortedSuppliers) SortQOS(params []string)

SortQOS is part of sort interface, sort based on Stats

func (*SortedSuppliers) SortResourceAscendent

func (sSpls *SortedSuppliers) SortResourceAscendent()

SortResourceAscendent is part of sort interface, sort ascendent based on ResourceUsage with fallback on Weight

func (*SortedSuppliers) SortResourceDescendent

func (sSpls *SortedSuppliers) SortResourceDescendent()

SortResourceDescendent is part of sort interface, sort descendent based on ResourceUsage with fallback on Weight

func (*SortedSuppliers) SortWeight

func (sSpls *SortedSuppliers) SortWeight()

SortWeight is part of sort interface, sort based on Weight

func (*SortedSuppliers) SupplierIDs

func (sSpls *SortedSuppliers) SupplierIDs() (sIDs []string)

SupplierIDs returns list of suppliers

func (*SortedSuppliers) SuppliersWithParams

func (sSpls *SortedSuppliers) SuppliersWithParams() (sPs []string)

SupplierIDs returns list of suppliers

type StatACC

type StatACC struct {
	FilterIDs []string
	Sum       float64
	Count     int64
	Events    map[string]*StatWithCompress // map[EventTenantID]Cost
	MinItems  int
	// contains filtered or unexported fields
}

ACC implements AverageCallCost metric

func (*StatACC) AddEvent

func (acc *StatACC) AddEvent(ev *utils.CGREvent) (err error)

func (*StatACC) Compress

func (acc *StatACC) Compress(queueLen int64, defaultID string) (eventIDs []string)

Compress is part of StatMetric interface

func (*StatACC) GetCompressFactor

func (acc *StatACC) GetCompressFactor(events map[string]int) map[string]int

Compress is part of StatMetric interface

func (*StatACC) GetFilterIDs

func (acc *StatACC) GetFilterIDs() []string

GetFilterIDs is part of StatMetric interface

func (*StatACC) GetFloat64Value

func (acc *StatACC) GetFloat64Value() (v float64)

func (*StatACC) GetStringValue

func (acc *StatACC) GetStringValue(fmtOpts string) (valStr string)

func (*StatACC) GetValue

func (acc *StatACC) GetValue() (v any)

func (*StatACC) LoadMarshaled

func (acc *StatACC) LoadMarshaled(ms Marshaler, marshaled []byte) (err error)

func (*StatACC) Marshal

func (acc *StatACC) Marshal(ms Marshaler) (marshaled []byte, err error)

func (*StatACC) RemEvent

func (acc *StatACC) RemEvent(evID string) (err error)

type StatACD

type StatACD struct {
	FilterIDs []string
	Sum       time.Duration
	Count     int64
	Events    map[string]*DurationWithCompress // map[EventTenantID]Duration
	MinItems  int
	// contains filtered or unexported fields
}

ACD implements AverageCallDuration metric

func (*StatACD) AddEvent

func (acd *StatACD) AddEvent(ev *utils.CGREvent) (err error)

func (*StatACD) Compress

func (acd *StatACD) Compress(queueLen int64, defaultID string) (eventIDs []string)

Compress is part of StatMetric interface

func (*StatACD) GetCompressFactor

func (acd *StatACD) GetCompressFactor(events map[string]int) map[string]int

Compress is part of StatMetric interface

func (*StatACD) GetFilterIDs

func (acd *StatACD) GetFilterIDs() []string

GetFilterIDs is part of StatMetric interface

func (*StatACD) GetFloat64Value

func (acd *StatACD) GetFloat64Value() (v float64)

func (*StatACD) GetStringValue

func (acd *StatACD) GetStringValue(fmtOpts string) (valStr string)

func (*StatACD) GetValue

func (acd *StatACD) GetValue() (v any)

func (*StatACD) LoadMarshaled

func (acd *StatACD) LoadMarshaled(ms Marshaler, marshaled []byte) (err error)

func (*StatACD) Marshal

func (acd *StatACD) Marshal(ms Marshaler) (marshaled []byte, err error)

func (*StatACD) RemEvent

func (acd *StatACD) RemEvent(evID string) (err error)

type StatASR

type StatASR struct {
	FilterIDs []string
	Answered  float64
	Count     int64
	Events    map[string]*StatWithCompress // map[EventTenantID]Answered
	MinItems  int
	// contains filtered or unexported fields
}

ASR implements AverageSuccessRatio metric

func (*StatASR) AddEvent

func (asr *StatASR) AddEvent(ev *utils.CGREvent) (err error)

AddEvent is part of StatMetric interface

func (*StatASR) Compress

func (asr *StatASR) Compress(queueLen int64, defaultID string) (eventIDs []string)

Compress is part of StatMetric interface

func (*StatASR) GetCompressFactor

func (asr *StatASR) GetCompressFactor(events map[string]int) map[string]int

Compress is part of StatMetric interface

func (*StatASR) GetFilterIDs

func (asr *StatASR) GetFilterIDs() []string

GetFilterIDs is part of StatMetric interface

func (*StatASR) GetFloat64Value

func (asr *StatASR) GetFloat64Value() (val float64)

GetFloat64Value is part of StatMetric interface

func (*StatASR) GetStringValue

func (asr *StatASR) GetStringValue(fmtOpts string) (valStr string)

func (*StatASR) GetValue

func (asr *StatASR) GetValue() (v any)

GetValue returns the ASR value as part of StatMetric interface

func (*StatASR) LoadMarshaled

func (asr *StatASR) LoadMarshaled(ms Marshaler, marshaled []byte) (err error)

LoadMarshaled is part of StatMetric interface

func (*StatASR) Marshal

func (asr *StatASR) Marshal(ms Marshaler) (marshaled []byte, err error)

Marshal is part of StatMetric interface

func (*StatASR) RemEvent

func (asr *StatASR) RemEvent(evID string) (err error)

type StatAverage

type StatAverage struct {
	FilterIDs []string
	Sum       float64
	Count     int64
	Events    map[string]*StatWithCompress // map[EventTenantID]Cost
	MinItems  int
	FieldName string
	// contains filtered or unexported fields
}

StatAverage implements TotalCallCost metric

func (*StatAverage) AddEvent

func (avg *StatAverage) AddEvent(ev *utils.CGREvent) (err error)

func (*StatAverage) Compress

func (avg *StatAverage) Compress(queueLen int64, defaultID string) (eventIDs []string)

Compress is part of StatMetric interface

func (*StatAverage) GetCompressFactor

func (avg *StatAverage) GetCompressFactor(events map[string]int) map[string]int

Compress is part of StatMetric interface

func (*StatAverage) GetFilterIDs

func (avg *StatAverage) GetFilterIDs() []string

GetFilterIDs is part of StatMetric interface

func (*StatAverage) GetFloat64Value

func (avg *StatAverage) GetFloat64Value() (v float64)

func (*StatAverage) GetStringValue

func (avg *StatAverage) GetStringValue(fmtOpts string) (valStr string)

func (*StatAverage) GetValue

func (avg *StatAverage) GetValue() (v any)

func (*StatAverage) LoadMarshaled

func (avg *StatAverage) LoadMarshaled(ms Marshaler, marshaled []byte) (err error)

func (*StatAverage) Marshal

func (avg *StatAverage) Marshal(ms Marshaler) (marshaled []byte, err error)

func (*StatAverage) RemEvent

func (avg *StatAverage) RemEvent(evID string) (err error)

type StatDDC

type StatDDC struct {
	FilterIDs   []string
	FieldValues map[string]map[string]struct{} // map[fieldValue]map[eventID]
	Events      map[string]map[string]int64    // map[EventTenantID]map[fieldValue]compressfactor
	MinItems    int
	Count       int64
}

func (*StatDDC) AddEvent

func (ddc *StatDDC) AddEvent(ev *utils.CGREvent) (err error)

func (*StatDDC) Compress

func (ddc *StatDDC) Compress(queueLen int64, defaultID string) (eventIDs []string)

func (*StatDDC) GetCompressFactor

func (ddc *StatDDC) GetCompressFactor(events map[string]int) map[string]int

Compress is part of StatMetric interface

func (*StatDDC) GetFilterIDs

func (ddc *StatDDC) GetFilterIDs() []string

GetFilterIDs is part of StatMetric interface

func (*StatDDC) GetFloat64Value

func (ddc *StatDDC) GetFloat64Value() (v float64)

func (*StatDDC) GetStringValue

func (ddc *StatDDC) GetStringValue(fmtOpts string) (valStr string)

func (*StatDDC) GetValue

func (ddc *StatDDC) GetValue() (v any)

func (*StatDDC) LoadMarshaled

func (ddc *StatDDC) LoadMarshaled(ms Marshaler, marshaled []byte) (err error)

func (*StatDDC) Marshal

func (ddc *StatDDC) Marshal(ms Marshaler) (marshaled []byte, err error)

func (*StatDDC) RemEvent

func (ddc *StatDDC) RemEvent(evID string) (err error)

type StatDistinct

type StatDistinct struct {
	FilterIDs   []string
	FieldValues map[string]map[string]struct{} // map[fieldValue]map[eventID]
	Events      map[string]map[string]int64    // map[EventTenantID]map[fieldValue]compressfactor
	MinItems    int
	FieldName   string
	Count       int64
}

func (*StatDistinct) AddEvent

func (dst *StatDistinct) AddEvent(ev *utils.CGREvent) (err error)

func (*StatDistinct) Compress

func (dst *StatDistinct) Compress(queueLen int64, defaultID string) (eventIDs []string)

func (*StatDistinct) GetCompressFactor

func (dst *StatDistinct) GetCompressFactor(events map[string]int) map[string]int

Compress is part of StatMetric interface

func (*StatDistinct) GetFilterIDs

func (dst *StatDistinct) GetFilterIDs() []string

GetFilterIDs is part of StatMetric interface

func (*StatDistinct) GetFloat64Value

func (dst *StatDistinct) GetFloat64Value() (v float64)

func (*StatDistinct) GetStringValue

func (dst *StatDistinct) GetStringValue(fmtOpts string) (valStr string)

func (*StatDistinct) GetValue

func (dst *StatDistinct) GetValue() (v any)

func (*StatDistinct) LoadMarshaled

func (dst *StatDistinct) LoadMarshaled(ms Marshaler, marshaled []byte) (err error)

func (*StatDistinct) Marshal

func (dst *StatDistinct) Marshal(ms Marshaler) (marshaled []byte, err error)

func (*StatDistinct) RemEvent

func (dst *StatDistinct) RemEvent(evID string) (err error)

type StatMetric

type StatMetric interface {
	GetValue() any
	GetStringValue(fmtOpts string) (val string)
	GetFloat64Value() (val float64)
	AddEvent(ev *utils.CGREvent) error
	RemEvent(evTenantID string) error
	Marshal(ms Marshaler) (marshaled []byte, err error)
	LoadMarshaled(ms Marshaler, marshaled []byte) (err error)
	GetFilterIDs() (filterIDs []string)
	Compress(queueLen int64, defaultID string) (eventIDs []string)
	GetCompressFactor(events map[string]int) map[string]int
}

StatMetric is the interface which a metric should implement

func NewACC

func NewACC(minItems int, extraParams string, filterIDs []string) (StatMetric, error)

func NewACD

func NewACD(minItems int, extraParams string, filterIDs []string) (StatMetric, error)

func NewASR

func NewASR(minItems int, extraParams string, filterIDs []string) (StatMetric, error)

func NewDDC

func NewDDC(minItems int, extraParams string, filterIDs []string) (StatMetric, error)

func NewPDD

func NewPDD(minItems int, extraParams string, filterIDs []string) (StatMetric, error)

func NewStatAverage

func NewStatAverage(minItems int, extraParams string, filterIDs []string) (StatMetric, error)

func NewStatDistinct

func NewStatDistinct(minItems int, extraParams string, filterIDs []string) (StatMetric, error)

func NewStatMetric

func NewStatMetric(metricID string, minItems int, filterIDs []string) (sm StatMetric, err error)

NewStatMetric instantiates the StatMetric cfg serves as general purpose container to pass config options to metric

func NewStatSum

func NewStatSum(minItems int, extraParams string, filterIDs []string) (StatMetric, error)

func NewTCC

func NewTCC(minItems int, extraParams string, filterIDs []string) (StatMetric, error)

func NewTCD

func NewTCD(minItems int, extraParams string, filterIDs []string) (StatMetric, error)

type StatPDD

type StatPDD struct {
	FilterIDs []string
	Sum       time.Duration
	Count     int64
	Events    map[string]*DurationWithCompress // map[EventTenantID]Duration
	MinItems  int
	// contains filtered or unexported fields
}

PDD implements Post Dial Delay (average) metric

func (*StatPDD) AddEvent

func (pdd *StatPDD) AddEvent(ev *utils.CGREvent) (err error)

func (*StatPDD) Compress

func (pdd *StatPDD) Compress(queueLen int64, defaultID string) (eventIDs []string)

Compress is part of StatMetric interface

func (*StatPDD) GetCompressFactor

func (pdd *StatPDD) GetCompressFactor(events map[string]int) map[string]int

Compress is part of StatMetric interface

func (*StatPDD) GetFilterIDs

func (pdd *StatPDD) GetFilterIDs() []string

GetFilterIDs is part of StatMetric interface

func (*StatPDD) GetFloat64Value

func (pdd *StatPDD) GetFloat64Value() (v float64)

func (*StatPDD) GetStringValue

func (pdd *StatPDD) GetStringValue(fmtOpts string) (valStr string)

func (*StatPDD) GetValue

func (pdd *StatPDD) GetValue() (v any)

func (*StatPDD) LoadMarshaled

func (pdd *StatPDD) LoadMarshaled(ms Marshaler, marshaled []byte) (err error)

func (*StatPDD) Marshal

func (pdd *StatPDD) Marshal(ms Marshaler) (marshaled []byte, err error)

func (*StatPDD) RemEvent

func (pdd *StatPDD) RemEvent(evID string) (err error)

type StatQueue

type StatQueue struct {
	Tenant    string
	ID        string
	SQItems   []SQItem
	SQMetrics map[string]StatMetric
	MinItems  int
	// contains filtered or unexported fields
}

StatQueue represents an individual stats instance

func (*StatQueue) Compress

func (sq *StatQueue) Compress(maxQL int64) bool

func (*StatQueue) Expand

func (sq *StatQueue) Expand()

func (*StatQueue) Lock added in v0.10.1

func (sq *StatQueue) Lock()

Lock only to implement sync.RWMutex methods

func (*StatQueue) ProcessEvent

func (sq *StatQueue) ProcessEvent(ev *utils.CGREvent, filterS *FilterS) (err error)

ProcessEvent processes a utils.CGREvent, returns true if processed

func (*StatQueue) RLock added in v0.10.1

func (sq *StatQueue) RLock()

RLock only to implement sync.RWMutex methods

func (*StatQueue) RUnlock added in v0.10.1

func (sq *StatQueue) RUnlock()

RUnlock only to implement sync.RWMutex methods

func (*StatQueue) TenantID

func (sq *StatQueue) TenantID() string

TenantID will compose the unique identifier for the StatQueue out of Tenant and ID

func (*StatQueue) Unlock added in v0.10.1

func (sq *StatQueue) Unlock()

Unlock only to implement sync.RWMutex methods

type StatQueueProfile

type StatQueueProfile struct {
	Tenant             string
	ID                 string // QueueID
	FilterIDs          []string
	ActivationInterval *utils.ActivationInterval // Activation interval
	QueueLength        int
	TTL                time.Duration
	MinItems           int
	Metrics            []*MetricWithFilters // list of metrics to build
	Stored             bool
	Blocker            bool // blocker flag to stop processing on filters matched
	Weight             float64
	ThresholdIDs       []string // list of thresholds to be checked after changes
}

StatsConfig represents the configuration of a StatsInstance in StatS

func APItoStats

func APItoStats(tpST *utils.TPStatProfile, timezone string) (st *StatQueueProfile, err error)

func (*StatQueueProfile) TenantID

func (sqp *StatQueueProfile) TenantID() string

type StatQueueWithCache added in v0.10.1

type StatQueueWithCache struct {
	*StatQueueProfile
	Cache *string
}

type StatQueues

type StatQueues []*StatQueue

StatQueues is a sortable list of StatQueue

func (StatQueues) Sort

func (sis StatQueues) Sort()

Sort is part of sort interface, sort based on Weight

type StatService

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

StatService builds stats for events

func NewStatService

func NewStatService(dm *DataManager, cgrcfg *config.CGRConfig,
	filterS *FilterS, connMgr *ConnManager) (ss *StatService, err error)

NewStatService initializes a StatService

func (*StatService) Call

func (ss *StatService) Call(ctx *context.Context, serviceMethod string, args any, reply any) error

Call implements birpc.ClientConnector interface for internal RPC here for cases when passing StatsService as rpccclient.RpcClientConnection

func (*StatService) ListenAndServe

func (sS *StatService) ListenAndServe(exitChan chan bool) error

ListenAndServe loops keeps the service alive

func (*StatService) Reload

func (sS *StatService) Reload()

Reload stops the backupLoop and restarts it

func (*StatService) Shutdown

func (sS *StatService) Shutdown() error

Shutdown is called to shutdown the service

func (*StatService) StartLoop

func (sS *StatService) StartLoop()

StartLoop starsS the gorutine with the backup loop

func (*StatService) StoreStatQueue

func (sS *StatService) StoreStatQueue(sq *StatQueue) (err error)

StoreStatQueue stores the statQueue in DB and corrects dirty flag

func (*StatService) V1GetQueueFloatMetrics

func (sS *StatService) V1GetQueueFloatMetrics(args *utils.TenantID, reply *map[string]float64) (err error)

V1GetFloatMetrics returns the metrics as float64 values

func (*StatService) V1GetQueueIDs

func (sS *StatService) V1GetQueueIDs(tenant string, qIDs *[]string) (err error)

V1GetQueueIDs returns list of queueIDs registered for a tenant

func (*StatService) V1GetQueueStringMetrics

func (sS *StatService) V1GetQueueStringMetrics(args *utils.TenantID, reply *map[string]string) (err error)

V1GetQueueStringMetrics returns the metrics of a Queue as string values

func (*StatService) V1GetStatQueue added in v0.10.1

func (sS *StatService) V1GetStatQueue(args *utils.TenantIDWithArgDispatcher, reply *StatQueue) (err error)

V1GetStatQueue returns a StatQueue object

func (*StatService) V1GetStatQueuesForEvent

func (sS *StatService) V1GetStatQueuesForEvent(args *StatsArgsProcessEvent, reply *[]string) (err error)

V1StatQueuesForEvent implements StatV1 method for processing an Event

func (*StatService) V1ProcessEvent

func (sS *StatService) V1ProcessEvent(args *StatsArgsProcessEvent, reply *[]string) (err error)

V1ProcessEvent implements StatV1 method for processing an Event

type StatSum

type StatSum struct {
	FilterIDs []string
	Sum       float64
	Count     int64
	Events    map[string]*StatWithCompress // map[EventTenantID]Cost
	MinItems  int
	FieldName string
	// contains filtered or unexported fields
}

func (*StatSum) AddEvent

func (sum *StatSum) AddEvent(ev *utils.CGREvent) (err error)

func (*StatSum) Compress

func (sum *StatSum) Compress(queueLen int64, defaultID string) (eventIDs []string)

Compress is part of StatMetric interface

func (*StatSum) GetCompressFactor

func (sum *StatSum) GetCompressFactor(events map[string]int) map[string]int

Compress is part of StatMetric interface

func (*StatSum) GetFilterIDs

func (sum *StatSum) GetFilterIDs() []string

GetFilterIDs is part of StatMetric interface

func (*StatSum) GetFloat64Value

func (sum *StatSum) GetFloat64Value() (v float64)

func (*StatSum) GetStringValue

func (sum *StatSum) GetStringValue(fmtOpts string) (valStr string)

func (*StatSum) GetValue

func (sum *StatSum) GetValue() (v any)

func (*StatSum) LoadMarshaled

func (sum *StatSum) LoadMarshaled(ms Marshaler, marshaled []byte) (err error)

func (*StatSum) Marshal

func (sum *StatSum) Marshal(ms Marshaler) (marshaled []byte, err error)

func (*StatSum) RemEvent

func (sum *StatSum) RemEvent(evID string) (err error)

type StatTCC

type StatTCC struct {
	FilterIDs []string
	Sum       float64
	Count     int64
	Events    map[string]*StatWithCompress // map[EventTenantID]Cost
	MinItems  int
	// contains filtered or unexported fields
}

TCC implements TotalCallCost metric

func (*StatTCC) AddEvent

func (tcc *StatTCC) AddEvent(ev *utils.CGREvent) (err error)

func (*StatTCC) Compress

func (tcc *StatTCC) Compress(queueLen int64, defaultID string) (eventIDs []string)

Compress is part of StatMetric interface

func (*StatTCC) GetCompressFactor

func (tcc *StatTCC) GetCompressFactor(events map[string]int) map[string]int

Compress is part of StatMetric interface

func (*StatTCC) GetFilterIDs

func (tcc *StatTCC) GetFilterIDs() []string

GetFilterIDs is part of StatMetric interface

func (*StatTCC) GetFloat64Value

func (tcc *StatTCC) GetFloat64Value() (v float64)

func (*StatTCC) GetStringValue

func (tcc *StatTCC) GetStringValue(fmtOpts string) (valStr string)

func (*StatTCC) GetValue

func (tcc *StatTCC) GetValue() (v any)

func (*StatTCC) LoadMarshaled

func (tcc *StatTCC) LoadMarshaled(ms Marshaler, marshaled []byte) (err error)

func (*StatTCC) Marshal

func (tcc *StatTCC) Marshal(ms Marshaler) (marshaled []byte, err error)

func (*StatTCC) RemEvent

func (tcc *StatTCC) RemEvent(evID string) (err error)

type StatTCD

type StatTCD struct {
	FilterIDs []string
	Sum       time.Duration
	Count     int64
	Events    map[string]*DurationWithCompress // map[EventTenantID]Duration
	MinItems  int
	// contains filtered or unexported fields
}

TCD implements TotalCallDuration metric

func (*StatTCD) AddEvent

func (tcd *StatTCD) AddEvent(ev *utils.CGREvent) (err error)

func (*StatTCD) Compress

func (tcd *StatTCD) Compress(queueLen int64, defaultID string) (eventIDs []string)

Compress is part of StatMetric interface

func (*StatTCD) GetCompressFactor

func (tcd *StatTCD) GetCompressFactor(events map[string]int) map[string]int

Compress is part of StatMetric interface

func (*StatTCD) GetFilterIDs

func (tcd *StatTCD) GetFilterIDs() []string

GetFilterIDs is part of StatMetric interface

func (*StatTCD) GetFloat64Value

func (tcd *StatTCD) GetFloat64Value() (v float64)

func (*StatTCD) GetStringValue

func (tcd *StatTCD) GetStringValue(fmtOpts string) (valStr string)

func (*StatTCD) GetValue

func (tcd *StatTCD) GetValue() (v any)

func (*StatTCD) LoadMarshaled

func (tcd *StatTCD) LoadMarshaled(ms Marshaler, marshaled []byte) (err error)

func (*StatTCD) Marshal

func (tcd *StatTCD) Marshal(ms Marshaler) (marshaled []byte, err error)

func (*StatTCD) RemEvent

func (tcd *StatTCD) RemEvent(evID string) (err error)

type StatWithCompress

type StatWithCompress struct {
	Stat           float64
	CompressFactor int
}

ACDHelper structure

type StatsArgsProcessEvent

type StatsArgsProcessEvent struct {
	StatIDs []string
	*utils.CGREvent
	*utils.ArgDispatcher
}

type StorDB

type StorDB interface {
	CdrStorage
	LoadReader
	LoadWriter
}

func NewStorDBConn

func NewStorDBConn(dbType, host, port, name, user, pass, marshaler, sslmode string,
	maxConn, maxIdleConn, connMaxLifetime int,
	stringIndexedFields, prefixIndexedFields []string,
	itemsCacheCfg map[string]*config.ItemOpt) (db StorDB, err error)

NewStorDBConn returns a StorDB(implements Storage interface) based on dbType

type Storage

type Storage interface {
	Close()
	Flush(string) error
	GetKeysForPrefix(string) ([]string, error)
	RemoveKeysForPrefix(string) error
	GetVersions(itm string) (vrs Versions, err error)
	SetVersions(vrs Versions, overwrite bool) (err error)
	RemoveVersions(vrs Versions) (err error)
	SelectDatabase(dbName string) (err error)
	GetStorageType() string
	IsDBEmpty() (resp bool, err error)
}

type StoredStatQueue

type StoredStatQueue struct {
	Tenant     string
	ID         string
	SQItems    []SQItem
	SQMetrics  map[string][]byte
	MinItems   int
	Compressed bool
}

StoredStatQueue differs from StatQueue due to serialization of SQMetrics

func NewStoredStatQueue

func NewStoredStatQueue(sq *StatQueue, ms Marshaler) (sSQ *StoredStatQueue, err error)

NewStoredStatQueue initiates a StoredStatQueue out of StatQueue

func (*StoredStatQueue) AsStatQueue

func (ssq *StoredStatQueue) AsStatQueue(ms Marshaler) (sq *StatQueue, err error)

AsStatQueue converts into StatQueue unmarshaling SQMetrics

func (*StoredStatQueue) SqID

func (ssq *StoredStatQueue) SqID() string

SqID will compose the unique identifier for the StatQueue out of Tenant and ID

type Supplier

type Supplier struct {
	ID                 string // SupplierID
	FilterIDs          []string
	AccountIDs         []string
	RatingPlanIDs      []string // used when computing price
	ResourceIDs        []string // queried in some strategies
	StatIDs            []string // queried in some strategies
	Weight             float64
	Blocker            bool // do not process further supplier after this one
	SupplierParameters string
	// contains filtered or unexported fields
}

Supplier defines supplier related information used within a SupplierProfile

type SupplierProfile

type SupplierProfile struct {
	Tenant             string
	ID                 string // LCR Profile ID
	FilterIDs          []string
	ActivationInterval *utils.ActivationInterval // Activation interval
	Sorting            string                    // Sorting strategy
	SortingParameters  []string
	Suppliers          []*Supplier
	Weight             float64
	// contains filtered or unexported fields
}

SupplierProfile represents the configuration of a Supplier profile

func APItoSupplierProfile

func APItoSupplierProfile(tpSPP *utils.TPSupplierProfile, timezone string) (spp *SupplierProfile, err error)

func (*SupplierProfile) Compile

func (sp *SupplierProfile) Compile() error

Compile is a wrapper for convenience setting up the SupplierProfile

func (*SupplierProfile) TenantID

func (rp *SupplierProfile) TenantID() string

TenantID returns unique identifier of the LCRProfile in a multi-tenant environment

type SupplierProfiles

type SupplierProfiles []*SupplierProfile

SupplierProfiles is a sortable list of SupplierProfile

func (SupplierProfiles) Sort

func (lps SupplierProfiles) Sort()

Sort is part of sort interface, sort based on Weight

type SupplierService

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

SupplierService is the service computing Supplier queries

func NewSupplierService

func NewSupplierService(dm *DataManager,
	filterS *FilterS, cgrcfg *config.CGRConfig, connMgr *ConnManager) (spS *SupplierService, err error)

NewSupplierService initializes the Supplier Service

func (*SupplierService) ListenAndServe

func (spS *SupplierService) ListenAndServe(exitChan chan bool) error

ListenAndServe will initialize the service

func (*SupplierService) Shutdown

func (spS *SupplierService) Shutdown() error

Shutdown is called to shutdown the service

func (*SupplierService) V1GetSupplierProfilesForEvent

func (spS *SupplierService) V1GetSupplierProfilesForEvent(args *utils.CGREventWithArgDispatcher, reply *[]*SupplierProfile) (err error)

V1GetSupplierProfilesForEvent returns the list of valid supplier profiles

func (*SupplierService) V1GetSuppliers

func (spS *SupplierService) V1GetSuppliers(args *ArgsGetSuppliers, reply *SortedSuppliers) (err error)

V1GetSupplierProfilesForEvent returns the list of valid supplier IDs

type SupplierSortDispatcher

type SupplierSortDispatcher map[string]SuppliersSorter

SupplierStrategyHandler will initialize strategies and dispatch requests to them

func NewSupplierSortDispatcher

func NewSupplierSortDispatcher(lcrS *SupplierService) (ssd SupplierSortDispatcher, err error)

NewSupplierSortDispatcher constructs SupplierSortDispatcher

func (SupplierSortDispatcher) SortSuppliers

func (ssd SupplierSortDispatcher) SortSuppliers(prflID, strategy string,
	suppls []*Supplier, suplEv *utils.CGREvent, extraOpts *optsGetSuppliers, argDsp *utils.ArgDispatcher) (sortedSuppls *SortedSuppliers, err error)

type SupplierWithParams

type SupplierWithParams struct {
	SupplierName   string
	SupplierParams string
}

type SuppliersSorter

type SuppliersSorter interface {
	SortSuppliers(string, []*Supplier, *utils.CGREvent, *optsGetSuppliers, *utils.ArgDispatcher) (*SortedSuppliers, error)
}

SuppliersSorter is the interface which needs to be implemented by supplier sorters

type SureTaxRequest

type SureTaxRequest struct {
	Request string `json:"request"` // SureTax Requires us to encapsulate the content into a request element
}

SureTax JSON Request

func NewSureTaxRequest

func NewSureTaxRequest(cdr *CDR, stCfg *config.SureTaxCfg) (*SureTaxRequest, error)

Init a new request to be sent out to SureTax

type SureTaxResponse

type SureTaxResponse struct {
	D string // SureTax requires encapsulating reply into a D object
}

SureTax JSON Response

type TBLVersion

type TBLVersion struct {
	ID      uint
	Item    string
	Version int64
}

func (TBLVersion) TableName

func (t TBLVersion) TableName() string

type TPAttribute

type TPAttribute struct {
	PK                 uint `gorm:"primary_key"`
	Tpid               string
	Tenant             string  `index:"0" re:""`
	ID                 string  `index:"1" re:""`
	Contexts           string  `index:"2" re:""`
	FilterIDs          string  `index:"3" re:""`
	ActivationInterval string  `index:"4" re:""`
	AttributeFilterIDs string  `index:"5" re:""`
	Path               string  `index:"6" re:""`
	Type               string  `index:"7" re:""`
	Value              string  `index:"8" re:""`
	Blocker            bool    `index:"9" re:""`
	Weight             float64 `index:"10" re:"\d+\.?\d*"`
	CreatedAt          time.Time
}

type TPAttributes

type TPAttributes []*TPAttribute

func APItoModelTPAttribute

func APItoModelTPAttribute(th *utils.TPAttributeProfile) (mdls TPAttributes)

func (TPAttributes) AsTPAttributes

func (tps TPAttributes) AsTPAttributes() (result []*utils.TPAttributeProfile)

type TPCSVImporter

type TPCSVImporter struct {
	TPid     string     // Load data on this tpid
	StorDb   LoadWriter // StorDb connection handle
	DirPath  string     // Directory path to import from
	Sep      rune       // Separator in the csv file
	Verbose  bool       // If true will print a detailed information instead of silently discarding it
	ImportId string     // Use this to differentiate between imports (eg: when autogenerating fields like RatingProfileID
	// contains filtered or unexported fields
}

Import tariff plan from csv into storDb

func (*TPCSVImporter) Run

func (self *TPCSVImporter) Run() error

type TPCharger

type TPCharger struct {
	PK                 uint `gorm:"primary_key"`
	Tpid               string
	Tenant             string  `index:"0" re:""`
	ID                 string  `index:"1" re:""`
	FilterIDs          string  `index:"2" re:""`
	ActivationInterval string  `index:"3" re:""`
	RunID              string  `index:"4" re:""`
	AttributeIDs       string  `index:"5" re:""`
	Weight             float64 `index:"6" re:"\d+\.?\d*"`
	CreatedAt          time.Time
}

type TPChargers

type TPChargers []*TPCharger

func APItoModelTPCharger

func APItoModelTPCharger(tpCPP *utils.TPChargerProfile) (mdls TPChargers)

func (TPChargers) AsTPChargers

func (tps TPChargers) AsTPChargers() (result []*utils.TPChargerProfile)

type TPDispatcherHost

type TPDispatcherHost struct {
	PK        uint   `gorm:"primary_key"`
	Tpid      string //
	Tenant    string `index:"0" re:""`
	ID        string `index:"1" re:""`
	Address   string `index:"2" re:""`
	Transport string `index:"3" re:""`
	TLS       bool   `index:"4" re:""`
	CreatedAt time.Time
}

type TPDispatcherHosts

type TPDispatcherHosts []*TPDispatcherHost

TPHosts

func APItoModelTPDispatcherHost

func APItoModelTPDispatcherHost(tpDPH *utils.TPDispatcherHost) (mdls TPDispatcherHosts)

func (TPDispatcherHosts) AsTPDispatcherHosts

func (tps TPDispatcherHosts) AsTPDispatcherHosts() (result []*utils.TPDispatcherHost)

type TPDispatcherProfile

type TPDispatcherProfile struct {
	PK                 uint    `gorm:"primary_key"`
	Tpid               string  //
	Tenant             string  `index:"0" re:""`
	ID                 string  `index:"1" re:""`
	Subsystems         string  `index:"2" re:""`
	FilterIDs          string  `index:"3" re:""`
	ActivationInterval string  `index:"4" re:""`
	Strategy           string  `index:"5" re:""`
	StrategyParameters string  `index:"6" re:""`
	ConnID             string  `index:"7" re:""`
	ConnFilterIDs      string  `index:"8" re:""`
	ConnWeight         float64 `index:"9" re:"\d+\.?\d*"`
	ConnBlocker        bool    `index:"10" re:""`
	ConnParameters     string  `index:"11" re:""`
	Weight             float64 `index:"12" re:"\d+\.?\d*"`
	CreatedAt          time.Time
}

type TPDispatcherProfiles

type TPDispatcherProfiles []*TPDispatcherProfile

func APItoModelTPDispatcherProfile

func APItoModelTPDispatcherProfile(tpDPP *utils.TPDispatcherProfile) (mdls TPDispatcherProfiles)

func (TPDispatcherProfiles) AsTPDispatcherProfiles

func (tps TPDispatcherProfiles) AsTPDispatcherProfiles() (result []*utils.TPDispatcherProfile)

type TPExporter

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

Export TariffPlan to a folder

func NewTPExporter

func NewTPExporter(storDb LoadStorage, tpID, expPath, fileFormat, sep string, compress bool) (*TPExporter, error)

func (*TPExporter) ExportStats

func (self *TPExporter) ExportStats() *utils.ExportedTPStats

func (*TPExporter) GetCacheBuffer

func (self *TPExporter) GetCacheBuffer() *bytes.Buffer

func (*TPExporter) Run

func (self *TPExporter) Run() error

type TPLoader

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

TPLoader will read a record from TPReader and write it out to dataManager

type TPReader

type TPReader interface {
	// Read will read one record from data source
	Read() (any, error)
}

TPReader is the data source for TPLoader

type Task

type Task struct {
	Uuid      string
	AccountID string
	ActionsID string
}

Task is a one time action executed by the scheduler

func (*Task) Execute

func (t *Task) Execute() error

func (*Task) FieldAsInterface

func (t *Task) FieldAsInterface(fldPath []string) (iface any, err error)

FieldAsInterface implements utils.DataProvider ToDo: support Action fields

func (*Task) FieldAsString

func (t *Task) FieldAsString(fldPath []string) (s string, err error)

FieldAsInterface implements utils.DataProvider ToDo: support Action fields

func (*Task) RemoteHost

func (t *Task) RemoteHost() (rh net.Addr)

RemoteHost implements utils.DataProvider

func (*Task) String

func (t *Task) String() string

String implements utils.DataProvider

type TenantRatingSubject

type TenantRatingSubject struct {
	Tenant, Subject string
}

type Threshold

type Threshold struct {
	Tenant string
	ID     string
	Hits   int       // number of hits for this threshold
	Snooze time.Time // prevent threshold to run too early
	// contains filtered or unexported fields
}

Threshold is the unit matched by filters

func (*Threshold) ProcessEvent

func (t *Threshold) ProcessEvent(args *ArgsProcessEvent, dm *DataManager) (err error)

ProcessEvent processes an ThresholdEvent concurrentActions limits the number of simultaneous action sets executed

func (*Threshold) TenantID

func (t *Threshold) TenantID() string

type ThresholdProfile

type ThresholdProfile struct {
	Tenant             string
	ID                 string
	FilterIDs          []string
	ActivationInterval *utils.ActivationInterval // Time when this limit becomes active and expires
	MaxHits            int
	MinHits            int
	MinSleep           time.Duration
	Blocker            bool    // blocker flag to stop processing on filters matched
	Weight             float64 // Weight to sort the thresholds
	ActionIDs          []string
	Async              bool
}

func APItoThresholdProfile

func APItoThresholdProfile(tpTH *utils.TPThresholdProfile, timezone string) (th *ThresholdProfile, err error)

func (*ThresholdProfile) TenantID

func (tp *ThresholdProfile) TenantID() string

type ThresholdService

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

ThresholdService manages Threshold execution and storing them to dataDB

func NewThresholdService

func NewThresholdService(dm *DataManager, cgrcfg *config.CGRConfig, filterS *FilterS) (tS *ThresholdService, err error)

func (*ThresholdService) ListenAndServe

func (tS *ThresholdService) ListenAndServe(exitChan chan bool) error

Called to start the service

func (*ThresholdService) Reload

func (tS *ThresholdService) Reload()

Reload stops the backupLoop and restarts it

func (*ThresholdService) Shutdown

func (tS *ThresholdService) Shutdown() error

Shutdown is called to shutdown the service

func (*ThresholdService) StartLoop

func (tS *ThresholdService) StartLoop()

StartLoop starts the gorutine with the backup loop

func (*ThresholdService) StoreThreshold

func (tS *ThresholdService) StoreThreshold(t *Threshold) (err error)

StoreThreshold stores the threshold in DB and corrects dirty flag

func (*ThresholdService) V1GetThreshold

func (tS *ThresholdService) V1GetThreshold(tntID *utils.TenantID, t *Threshold) (err error)

V1GetThreshold retrieves a Threshold

func (*ThresholdService) V1GetThresholdIDs

func (tS *ThresholdService) V1GetThresholdIDs(tenant string, tIDs *[]string) (err error)

V1GetQueueIDs returns list of thresholdIDs configured for a tenant

func (*ThresholdService) V1GetThresholdsForEvent

func (tS *ThresholdService) V1GetThresholdsForEvent(args *ArgsProcessEvent, reply *Thresholds) (err error)

V1GetThresholdsForEvent queries thresholds matching an Event

func (*ThresholdService) V1ProcessEvent

func (tS *ThresholdService) V1ProcessEvent(args *ArgsProcessEvent, reply *[]string) (err error)

V1ProcessEvent implements ThresholdService method for processing an Event

type ThresholdWithCache

type ThresholdWithCache struct {
	*ThresholdProfile
	Cache *string
}

type Thresholds

type Thresholds []*Threshold

Thresholds is a sortable slice of Threshold

func (Thresholds) Sort

func (ts Thresholds) Sort()

sort based on Weight

type TimeSpan

type TimeSpan struct {
	TimeStart, TimeEnd                                         time.Time
	Cost                                                       float64
	RateInterval                                               *RateInterval
	DurationIndex                                              time.Duration // the call duration so far till TimeEnd
	Increments                                                 Increments
	RoundIncrement                                             *Increment
	MatchedSubject, MatchedPrefix, MatchedDestId, RatingPlanId string
	CompressFactor                                             int
	// contains filtered or unexported fields
}

A unit in which a call will be split that has a specific price related interval attached to it.

func (*TimeSpan) AddIncrement

func (ts *TimeSpan) AddIncrement(inc *Increment)

func (*TimeSpan) CalculateCost

func (ts *TimeSpan) CalculateCost() float64

Returns the cost of the timespan according to the relevant cost interval. It also sets the Cost field of this timespan (used for refund on session manager debit loop where the cost cannot be recalculated)

func (*TimeSpan) Contains

func (ts *TimeSpan) Contains(t time.Time) bool

Returns true if the given time is inside timespan range.

func (*TimeSpan) Equal

func (ts *TimeSpan) Equal(other *TimeSpan) bool

func (*TimeSpan) GetCompressFactor

func (ts *TimeSpan) GetCompressFactor() int

func (*TimeSpan) GetDuration

func (ts *TimeSpan) GetDuration() time.Duration

Returns the duration of the timespan

func (*TimeSpan) GetGroupEnd

func (ts *TimeSpan) GetGroupEnd() time.Duration

func (*TimeSpan) GetGroupStart

func (ts *TimeSpan) GetGroupStart() time.Duration

Returns the starting time of this timespan

func (*TimeSpan) GetTimeStartForIncrement

func (ts *TimeSpan) GetTimeStartForIncrement(index int) time.Time

returns a time for the specified second in the time span

func (*TimeSpan) GetUnitCost

func (ts *TimeSpan) GetUnitCost() float64

func (*TimeSpan) GetUnitDuration

func (ts *TimeSpan) GetUnitDuration() time.Duration

Returns the duration of a unitary timespan in a compressed set

func (*TimeSpan) IsPaid

func (ts *TimeSpan) IsPaid() (bool, int)

returns whether the timespan has all increments marked as paid and if not it also returns the first unpaied increment

func (*TimeSpan) Merge

func (ts *TimeSpan) Merge(other *TimeSpan) bool

Merges timespans if they share the same charging signature, useful to run in SM before compressing

func (*TimeSpan) RoundToDuration

func (ts *TimeSpan) RoundToDuration(duration time.Duration)

func (*TimeSpan) SetNewDurationIndex

func (ts *TimeSpan) SetNewDurationIndex(nts *TimeSpan)

sets the DurationIndex attribute to reflect new timespan

func (*TimeSpan) SetRateInterval

func (ts *TimeSpan) SetRateInterval(interval *RateInterval)

func (*TimeSpan) SharingSignature

func (ts *TimeSpan) SharingSignature(other *TimeSpan) bool

Estimate if they share charging signature

func (*TimeSpan) SplitByDay

func (ts *TimeSpan) SplitByDay() (newTs *TimeSpan)

Splits the given timespan on activation period's activation time.

func (*TimeSpan) SplitByDuration

func (ts *TimeSpan) SplitByDuration(duration time.Duration) *TimeSpan

Split the timespan at the given second

func (*TimeSpan) SplitByIncrement

func (ts *TimeSpan) SplitByIncrement(index int) *TimeSpan

Split the timespan at the given increment start

func (*TimeSpan) SplitByRateInterval

func (ts *TimeSpan) SplitByRateInterval(i *RateInterval, data bool) (nts *TimeSpan)

Splits the given timespan according to how it relates to the interval. It will modify the endtime of the received timespan and it will return a new timespan starting from the end of the received one. The interval will attach itself to the timespan that overlaps the interval.

func (*TimeSpan) SplitByRatingPlan

func (ts *TimeSpan) SplitByRatingPlan(rp *RatingInfo) (newTs *TimeSpan)

Splits the given timespan on activation period's activation time.

type TimeSpans

type TimeSpans []*TimeSpan

func (*TimeSpans) Compress

func (tss *TimeSpans) Compress()

func (*TimeSpans) Decompress

func (tss *TimeSpans) Decompress()

func (*TimeSpans) Merge

func (tss *TimeSpans) Merge()

func (*TimeSpans) OverlapWithTimeSpans

func (timespans *TimeSpans) OverlapWithTimeSpans(paidTs TimeSpans, newTs *TimeSpan, index int) bool

The paidTs will replace the timespans that are exactly `under` them from the reciver list

func (*TimeSpans) RemoveOverlapedFromIndex

func (timespans *TimeSpans) RemoveOverlapedFromIndex(index int)

Will delete all timespans that are `under` the timespan at index

type TpAccountAction

type TpAccountAction struct {
	Id                int64
	Tpid              string
	Loadid            string
	Tenant            string `index:"0" re:"\w+\s*"`
	Account           string `index:"1" re:"(\w+;?)+\s*"`
	ActionPlanTag     string `index:"2" re:"\w+\s*"`
	ActionTriggersTag string `index:"3" re:"\w+\s*"`
	AllowNegative     bool   `index:"4" re:""`
	Disabled          bool   `index:"5" re:""`
	CreatedAt         time.Time
}

func APItoModelAccountAction

func APItoModelAccountAction(aa *utils.TPAccountActions) *TpAccountAction

func (*TpAccountAction) GetAccountActionId

func (aa *TpAccountAction) GetAccountActionId() string

func (*TpAccountAction) SetAccountActionId

func (aa *TpAccountAction) SetAccountActionId(id string) error

type TpAccountActions

type TpAccountActions []TpAccountAction

func APItoModelAccountActions

func APItoModelAccountActions(aas []*utils.TPAccountActions) (result TpAccountActions)

func (TpAccountActions) AsMapTPAccountActions

func (tps TpAccountActions) AsMapTPAccountActions() (map[string]*utils.TPAccountActions, error)

func (TpAccountActions) AsTPAccountActions

func (tps TpAccountActions) AsTPAccountActions() (result []*utils.TPAccountActions, err error)

type TpAction

type TpAction struct {
	Id              int64
	Tpid            string
	Tag             string  `index:"0" re:"\w+\s*"`
	Action          string  `index:"1" re:"\*\w+\s*"`
	ExtraParameters string  `index:"2" re:"\S+\s*"`
	Filter          string  `index:"3" re:"\S+\s*"`
	BalanceTag      string  `index:"4" re:"\w+\s*"`
	BalanceType     string  `index:"5" re:"\*\w+\s*"`
	Categories      string  `index:"6" re:""`
	DestinationTags string  `index:"7" re:"\*any|\w+\s*"`
	RatingSubject   string  `index:"8" re:"\w+\s*"`
	SharedGroups    string  `index:"9" re:"[0-9A-Za-z_;]*"`
	ExpiryTime      string  `index:"10" re:"\*\w+\s*|\+\d+[smh]\s*|\d+\s*"`
	TimingTags      string  `index:"11" re:"[0-9A-Za-z_;]*|\*any"`
	Units           string  `index:"12" re:"\d+\s*"`
	BalanceWeight   string  `index:"13" re:"\d+\.?\d*\s*"`
	BalanceBlocker  string  `index:"14" re:""`
	BalanceDisabled string  `index:"15" re:""`
	Weight          float64 `index:"16" re:"\d+\.?\d*\s*"`
	CreatedAt       time.Time
}

type TpActionPlan

type TpActionPlan struct {
	Id         int64
	Tpid       string
	Tag        string  `index:"0" re:"\w+\s*,\s*"`
	ActionsTag string  `index:"1" re:"\w+\s*,\s*"`
	TimingTag  string  `index:"2" re:"\w+\s*,\s*"|\*any`
	Weight     float64 `index:"3" re:"\d+\.?\d*"`
	CreatedAt  time.Time
}

type TpActionPlans

type TpActionPlans []TpActionPlan

func APItoModelActionPlan

func APItoModelActionPlan(a *utils.TPActionPlan) (result TpActionPlans)

func APItoModelActionPlans

func APItoModelActionPlans(aps []*utils.TPActionPlan) (result TpActionPlans)

func (TpActionPlans) AsMapTPActionPlans

func (tps TpActionPlans) AsMapTPActionPlans() (map[string]*utils.TPActionPlan, error)

func (TpActionPlans) AsTPActionPlans

func (tps TpActionPlans) AsTPActionPlans() (result []*utils.TPActionPlan, err error)

type TpActionTrigger

type TpActionTrigger struct {
	Id                     int64
	Tpid                   string
	Tag                    string  `index:"0" re:"\w+"`
	UniqueId               string  `index:"1" re:"\w+"`
	ThresholdType          string  `index:"2" re:"\*\w+"`
	ThresholdValue         float64 `index:"3" re:"\d+\.?\d*"`
	Recurrent              bool    `index:"4" re:"true|false|"`
	MinSleep               string  `index:"5" re:"\d+[smh]?"`
	ExpiryTime             string  `index:"6" re:""`
	ActivationTime         string  `index:"7" re:""`
	BalanceTag             string  `index:"8" re:"\w+\s*"`
	BalanceType            string  `index:"9" re:"\*\w+"`
	BalanceCategories      string  `index:"10" re:""`
	BalanceDestinationTags string  `index:"11" re:"\w+|\*any"`
	BalanceRatingSubject   string  `index:"12" re:"\w+|\*any"`
	BalanceSharedGroups    string  `index:"13" re:"\w+|\*any"`
	BalanceExpiryTime      string  `index:"14" re:"\*\w+\s*|\+\d+[smh]\s*|\d+\s*"`
	BalanceTimingTags      string  `index:"15" re:"[0-9A-Za-z_;]*|\*any"`
	BalanceWeight          string  `index:"16" re:"\d+\.?\d*"`
	BalanceBlocker         string  `index:"17" re:""`
	BalanceDisabled        string  `index:"18" re:""`
	ActionsTag             string  `index:"19" re:"\w+"`
	Weight                 float64 `index:"20" re:"\d+\.?\d*"`
	CreatedAt              time.Time
}

type TpActionTriggers

type TpActionTriggers []TpActionTrigger

func APItoModelActionTrigger

func APItoModelActionTrigger(ats *utils.TPActionTriggers) (result TpActionTriggers)

func APItoModelActionTriggers

func APItoModelActionTriggers(ts []*utils.TPActionTriggers) (result TpActionTriggers)

func (TpActionTriggers) AsMapTPActionTriggers

func (tps TpActionTriggers) AsMapTPActionTriggers() (map[string]*utils.TPActionTriggers, error)

func (TpActionTriggers) AsTPActionTriggers

func (tps TpActionTriggers) AsTPActionTriggers() (result []*utils.TPActionTriggers, err error)

type TpActions

type TpActions []TpAction

func APItoModelAction

func APItoModelAction(as *utils.TPActions) (result TpActions)

func APItoModelActions

func APItoModelActions(as []*utils.TPActions) (result TpActions)

func (TpActions) AsMapTPActions

func (tps TpActions) AsMapTPActions() (map[string]*utils.TPActions, error)

func (TpActions) AsTPActions

func (tps TpActions) AsTPActions() (result []*utils.TPActions, err error)

type TpDestination

type TpDestination struct {
	Id        int64
	Tpid      string
	Tag       string `index:"0" re:"\w+\s*,\s*"`
	Prefix    string `index:"1" re:"\+?\d+.?\d*"`
	CreatedAt time.Time
}

type TpDestinationRate

type TpDestinationRate struct {
	Id               int64
	Tpid             string
	Tag              string  `index:"0" re:"\w+\s*"`
	DestinationsTag  string  `index:"1" re:"\w+\s*|\*any"`
	RatesTag         string  `index:"2" re:"\w+\s*"`
	RoundingMethod   string  `index:"3" re:"\*up|\*down|\*middle"`
	RoundingDecimals int     `index:"4" re:"\d+"`
	MaxCost          float64 `index:"5" re:"\d+\.*\d*s*"`
	MaxCostStrategy  string  `index:"6" re:"\*free|\*disconnect"`
	CreatedAt        time.Time
}

type TpDestinationRates

type TpDestinationRates []TpDestinationRate

func APItoModelDestinationRate

func APItoModelDestinationRate(d *utils.TPDestinationRate) (result TpDestinationRates)

func APItoModelDestinationRates

func APItoModelDestinationRates(drs []*utils.TPDestinationRate) (result TpDestinationRates)

func (TpDestinationRates) AsMapDestinationRates

func (tps TpDestinationRates) AsMapDestinationRates() (map[string]*utils.TPDestinationRate, error)

func (TpDestinationRates) AsTPDestinationRates

func (tps TpDestinationRates) AsTPDestinationRates() (result []*utils.TPDestinationRate, err error)

type TpDestinations

type TpDestinations []TpDestination

func APItoModelDestination

func APItoModelDestination(d *utils.TPDestination) (result TpDestinations)

func (TpDestinations) AsMapDestinations

func (tps TpDestinations) AsMapDestinations() (map[string]*Destination, error)

func (TpDestinations) AsTPDestinations

func (tps TpDestinations) AsTPDestinations() (result []*utils.TPDestination)

AsTPDestination converts TpDestinations into *utils.TPDestination

type TpFilter

type TpFilter struct {
	PK                 uint `gorm:"primary_key"`
	Tpid               string
	Tenant             string `index:"0" re:""`
	ID                 string `index:"1" re:""`
	Type               string `index:"2" re:"^\*[A-Za-z].*"`
	Element            string `index:"3" re:""`
	Values             string `index:"4" re:""`
	ActivationInterval string `index:"5" re:""`
	CreatedAt          time.Time
}

type TpFilterS

type TpFilterS []*TpFilter

func APItoModelTPFilter

func APItoModelTPFilter(th *utils.TPFilterProfile) (mdls TpFilterS)

func (TpFilterS) AsTPFilter

func (tps TpFilterS) AsTPFilter() (result []*utils.TPFilterProfile)

type TpRate

type TpRate struct {
	Id                 int64
	Tpid               string
	Tag                string  `index:"0" re:"\w+\s*"`
	ConnectFee         float64 `index:"1" re:"\d+\.*\d*s*"`
	Rate               float64 `index:"2" re:"\d+\.*\d*s*"`
	RateUnit           string  `index:"3" re:"\d+\.*\d*(ns|us|µs|ms|s|m|h)*\s*"`
	RateIncrement      string  `index:"4" re:"\d+\.*\d*(ns|us|µs|ms|s|m|h)*\s*"`
	GroupIntervalStart string  `index:"5" re:"\d+\.*\d*(ns|us|µs|ms|s|m|h)*\s*"`
	CreatedAt          time.Time
}

type TpRates

type TpRates []TpRate

func APItoModelRate

func APItoModelRate(r *utils.TPRate) (result TpRates)

func APItoModelRates

func APItoModelRates(rs []*utils.TPRate) (result TpRates)

func (TpRates) AsMapRates

func (tps TpRates) AsMapRates() (map[string]*utils.TPRate, error)

func (TpRates) AsTPRates

func (tps TpRates) AsTPRates() (result []*utils.TPRate, err error)

type TpRatingPlan

type TpRatingPlan struct {
	Id           int64
	Tpid         string
	Tag          string  `index:"0" re:"\w+\s*,\s*"`
	DestratesTag string  `index:"1" re:"\w+\s*,\s*|\*any"`
	TimingTag    string  `index:"2" re:"\w+\s*,\s*|\*any"`
	Weight       float64 `index:"3" re:"\d+.?\d*"`
	CreatedAt    time.Time
}

type TpRatingPlans

type TpRatingPlans []TpRatingPlan

func APItoModelRatingPlan

func APItoModelRatingPlan(rp *utils.TPRatingPlan) (result TpRatingPlans)

func APItoModelRatingPlans

func APItoModelRatingPlans(rps []*utils.TPRatingPlan) (result TpRatingPlans)

func (TpRatingPlans) AsMapTPRatingPlans

func (tps TpRatingPlans) AsMapTPRatingPlans() (map[string]*utils.TPRatingPlan, error)

func (TpRatingPlans) AsTPRatingPlans

func (tps TpRatingPlans) AsTPRatingPlans() (result []*utils.TPRatingPlan, err error)

type TpRatingProfile

type TpRatingProfile struct {
	Id               int64
	Tpid             string
	Loadid           string
	Tenant           string `index:"0" re:"[0-9A-Za-z_\.]+\s*"`
	Category         string `index:"1" re:"\w+\s*"`
	Subject          string `index:"2" re:"\*any\s*|(\w+;?)+\s*"`
	ActivationTime   string `index:"3" re:"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z"`
	RatingPlanTag    string `index:"4" re:"\w+\s*"`
	FallbackSubjects string `index:"5" re:"\w+\s*"`
	CreatedAt        time.Time
}

type TpRatingProfiles

type TpRatingProfiles []TpRatingProfile

func APItoModelRatingProfile

func APItoModelRatingProfile(rp *utils.TPRatingProfile) (result TpRatingProfiles)

func APItoModelRatingProfiles

func APItoModelRatingProfiles(rps []*utils.TPRatingProfile) (result TpRatingProfiles)

func (TpRatingProfiles) AsMapTPRatingProfiles

func (tps TpRatingProfiles) AsMapTPRatingProfiles() (map[string]*utils.TPRatingProfile, error)

func (TpRatingProfiles) AsTPRatingProfiles

func (tps TpRatingProfiles) AsTPRatingProfiles() (result []*utils.TPRatingProfile, err error)

type TpReader

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

func NewTpReader

func NewTpReader(db DataDB, lr LoadReader, tpid, timezone string,
	cacheConns, schedulerConns []string) (*TpReader, error)

func (*TpReader) GetLoadedIds

func (tpr *TpReader) GetLoadedIds(categ string) ([]string, error)

Returns the identities loaded for a specific category, useful for cache reloads

func (*TpReader) Init

func (tpr *TpReader) Init()

func (*TpReader) IsValid

func (tpr *TpReader) IsValid() bool

func (*TpReader) LoadAccountActions

func (tpr *TpReader) LoadAccountActions() (err error)

func (*TpReader) LoadAccountActionsFiltered

func (tpr *TpReader) LoadAccountActionsFiltered(qriedAA *utils.TPAccountActions) error

func (*TpReader) LoadActionPlans

func (tpr *TpReader) LoadActionPlans() (err error)

func (*TpReader) LoadActionTriggers

func (tpr *TpReader) LoadActionTriggers() (err error)

func (*TpReader) LoadActions

func (tpr *TpReader) LoadActions() (err error)

func (*TpReader) LoadAll

func (tpr *TpReader) LoadAll() (err error)

func (*TpReader) LoadAttributeProfiles

func (tpr *TpReader) LoadAttributeProfiles() error

func (*TpReader) LoadAttributeProfilesFiltered

func (tpr *TpReader) LoadAttributeProfilesFiltered(tag string) (err error)

func (*TpReader) LoadChargerProfiles

func (tpr *TpReader) LoadChargerProfiles() error

func (*TpReader) LoadChargerProfilesFiltered

func (tpr *TpReader) LoadChargerProfilesFiltered(tag string) (err error)

func (*TpReader) LoadDestinationRates

func (tpr *TpReader) LoadDestinationRates() (err error)

func (*TpReader) LoadDestinations

func (tpr *TpReader) LoadDestinations() (err error)

func (*TpReader) LoadDestinationsFiltered

func (tpr *TpReader) LoadDestinationsFiltered(tag string) (bool, error)

func (*TpReader) LoadDispatcherHosts

func (tpr *TpReader) LoadDispatcherHosts() error

func (*TpReader) LoadDispatcherHostsFiltered

func (tpr *TpReader) LoadDispatcherHostsFiltered(tag string) (err error)

func (*TpReader) LoadDispatcherProfiles

func (tpr *TpReader) LoadDispatcherProfiles() error

func (*TpReader) LoadDispatcherProfilesFiltered

func (tpr *TpReader) LoadDispatcherProfilesFiltered(tag string) (err error)

func (*TpReader) LoadFilters

func (tpr *TpReader) LoadFilters() error

func (*TpReader) LoadFiltersFiltered

func (tpr *TpReader) LoadFiltersFiltered(tag string) error

func (*TpReader) LoadRates

func (tpr *TpReader) LoadRates() (err error)

func (*TpReader) LoadRatingPlans

func (tpr *TpReader) LoadRatingPlans() (err error)

func (*TpReader) LoadRatingPlansFiltered

func (tpr *TpReader) LoadRatingPlansFiltered(tag string) (bool, error)

Returns true, nil in case of load success, false, nil in case of RatingPlan not found dataStorage

func (*TpReader) LoadRatingProfiles

func (tpr *TpReader) LoadRatingProfiles() (err error)

func (*TpReader) LoadRatingProfilesFiltered

func (tpr *TpReader) LoadRatingProfilesFiltered(qriedRpf *utils.TPRatingProfile) ([]string, error)

func (*TpReader) LoadResourceProfiles

func (tpr *TpReader) LoadResourceProfiles() error

func (*TpReader) LoadResourceProfilesFiltered

func (tpr *TpReader) LoadResourceProfilesFiltered(tag string) (err error)

func (*TpReader) LoadSharedGroups

func (tpr *TpReader) LoadSharedGroups() error

func (*TpReader) LoadSharedGroupsFiltered

func (tpr *TpReader) LoadSharedGroupsFiltered(tag string, save bool) (err error)

func (*TpReader) LoadStats

func (tpr *TpReader) LoadStats() error

func (*TpReader) LoadStatsFiltered

func (tpr *TpReader) LoadStatsFiltered(tag string) (err error)

func (*TpReader) LoadSupplierProfiles

func (tpr *TpReader) LoadSupplierProfiles() error

func (*TpReader) LoadSupplierProfilesFiltered

func (tpr *TpReader) LoadSupplierProfilesFiltered(tag string) (err error)

func (*TpReader) LoadThresholds

func (tpr *TpReader) LoadThresholds() error

func (*TpReader) LoadThresholdsFiltered

func (tpr *TpReader) LoadThresholdsFiltered(tag string) (err error)

func (*TpReader) LoadTimings

func (tpr *TpReader) LoadTimings() (err error)

func (*TpReader) ReloadCache

func (tpr *TpReader) ReloadCache(caching string, verbose bool, argDispatcher *utils.ArgDispatcher, tenant string) (err error)

func (*TpReader) ReloadScheduler

func (tpr *TpReader) ReloadScheduler(verbose bool) (err error)

func (*TpReader) RemoveFromDatabase

func (tpr *TpReader) RemoveFromDatabase(verbose, disable_reverse bool) (err error)

func (*TpReader) ShowStatistics

func (tpr *TpReader) ShowStatistics()

func (*TpReader) WriteToDatabase

func (tpr *TpReader) WriteToDatabase(verbose, disable_reverse bool) (err error)

type TpResource

type TpResource struct {
	PK                 uint `gorm:"primary_key"`
	Tpid               string
	Tenant             string  `index:"0" re:""`
	ID                 string  `index:"1" re:""`
	FilterIDs          string  `index:"2" re:""`
	ActivationInterval string  `index:"3" re:""`
	UsageTTL           string  `index:"4" re:""`
	Limit              string  `index:"5" re:""`
	AllocationMessage  string  `index:"6" re:""`
	Blocker            bool    `index:"7" re:""`
	Stored             bool    `index:"8" re:""`
	Weight             float64 `index:"9" re:"\d+\.?\d*"`
	ThresholdIDs       string  `index:"10" re:""`
	CreatedAt          time.Time
}

type TpResources

type TpResources []*TpResource

func APItoModelResource

func APItoModelResource(rl *utils.TPResourceProfile) (mdls TpResources)

func (TpResources) AsTPResources

func (tps TpResources) AsTPResources() (result []*utils.TPResourceProfile)

type TpSharedGroup

type TpSharedGroup struct {
	Id            int64
	Tpid          string
	Tag           string `index:"0" re:"\w+\s*"`
	Account       string `index:"1" re:"\*?\w+\s*"`
	Strategy      string `index:"2" re:"\*\w+\s*"`
	RatingSubject string `index:"3" re:"\*?\w]+\s*"`
	CreatedAt     time.Time
}

type TpSharedGroups

type TpSharedGroups []TpSharedGroup

func APItoModelSharedGroup

func APItoModelSharedGroup(sgs *utils.TPSharedGroups) (result TpSharedGroups)

func APItoModelSharedGroups

func APItoModelSharedGroups(sgs []*utils.TPSharedGroups) (result TpSharedGroups)

func (TpSharedGroups) AsMapTPSharedGroups

func (tps TpSharedGroups) AsMapTPSharedGroups() (map[string]*utils.TPSharedGroups, error)

func (TpSharedGroups) AsTPSharedGroups

func (tps TpSharedGroups) AsTPSharedGroups() (result []*utils.TPSharedGroups, err error)

type TpStat

type TpStat struct {
	PK                 uint `gorm:"primary_key"`
	Tpid               string
	Tenant             string  `index:"0" re:""`
	ID                 string  `index:"1" re:""`
	FilterIDs          string  `index:"2" re:""`
	ActivationInterval string  `index:"3" re:""`
	QueueLength        int     `index:"4" re:""`
	TTL                string  `index:"5" re:""`
	MinItems           int     `index:"6" re:""`
	MetricIDs          string  `index:"7" re:""`
	MetricFilterIDs    string  `index:"8" re:""`
	Stored             bool    `index:"9" re:""`
	Blocker            bool    `index:"10" re:""`
	Weight             float64 `index:"11" re:"\d+\.?\d*"`
	ThresholdIDs       string  `index:"12" re:""`
	CreatedAt          time.Time
}

type TpStats

type TpStats []*TpStat

func APItoModelStats

func APItoModelStats(st *utils.TPStatProfile) (mdls TpStats)

func (TpStats) AsTPStats

func (models TpStats) AsTPStats() (result []*utils.TPStatProfile)

type TpSupplier

type TpSupplier struct {
	PK                    uint `gorm:"primary_key"`
	Tpid                  string
	Tenant                string  `index:"0" re:""`
	ID                    string  `index:"1" re:""`
	FilterIDs             string  `index:"2" re:""`
	ActivationInterval    string  `index:"3" re:""`
	Sorting               string  `index:"4" re:""`
	SortingParameters     string  `index:"5" re:""`
	SupplierID            string  `index:"6" re:""`
	SupplierFilterIDs     string  `index:"7" re:""`
	SupplierAccountIDs    string  `index:"8" re:""`
	SupplierRatingplanIDs string  `index:"9" re:""`
	SupplierResourceIDs   string  `index:"10" re:""`
	SupplierStatIDs       string  `index:"11" re:""`
	SupplierWeight        float64 `index:"12" re:"\d+\.?\d*"`
	SupplierBlocker       bool    `index:"13" re:""`
	SupplierParameters    string  `index:"14" re:""`
	Weight                float64 `index:"15" re:"\d+\.?\d*"`
	CreatedAt             time.Time
}

type TpSuppliers

type TpSuppliers []*TpSupplier

func APItoModelTPSuppliers

func APItoModelTPSuppliers(st *utils.TPSupplierProfile) (mdls TpSuppliers)

func (TpSuppliers) AsTPSuppliers

func (tps TpSuppliers) AsTPSuppliers() (result []*utils.TPSupplierProfile)

type TpThreshold

type TpThreshold struct {
	PK                 uint `gorm:"primary_key"`
	Tpid               string
	Tenant             string  `index:"0" re:""`
	ID                 string  `index:"1" re:""`
	FilterIDs          string  `index:"2" re:""`
	ActivationInterval string  `index:"3" re:""`
	MaxHits            int     `index:"4" re:""`
	MinHits            int     `index:"5" re:""`
	MinSleep           string  `index:"6" re:""`
	Blocker            bool    `index:"7" re:""`
	Weight             float64 `index:"8" re:"\d+\.?\d*"`
	ActionIDs          string  `index:"9" re:""`
	Async              bool    `index:"10" re:""`
	CreatedAt          time.Time
}

type TpThresholds

type TpThresholds []*TpThreshold

func APItoModelTPThreshold

func APItoModelTPThreshold(th *utils.TPThresholdProfile) (mdls TpThresholds)

func (TpThresholds) AsTPThreshold

func (tps TpThresholds) AsTPThreshold() (result []*utils.TPThresholdProfile)

type TpTiming

type TpTiming struct {
	Id        int64
	Tpid      string
	Tag       string `index:"0" re:"\w+\s*,\s*"`
	Years     string `index:"1" re:"\*any\s*,\s*|(?:\d{1,4};?)+\s*,\s*|\s*,\s*"`
	Months    string `index:"2" re:"\*any\s*,\s*|(?:\d{1,4};?)+\s*,\s*|\s*,\s*"`
	MonthDays string `index:"3" re:"\*any\s*,\s*|(?:\d{1,4};?)+\s*,\s*|\s*,\s*"`
	WeekDays  string `index:"4" re:"\*any\s*,\s*|(?:\d{1,4};?)+\s*,\s*|\s*,\s*"`
	Time      string `index:"5" re:"\d{2}:\d{2}:\d{2}|\*asap"`
	CreatedAt time.Time
}

func APItoModelTiming

func APItoModelTiming(t *utils.ApierTPTiming) (result TpTiming)

type TpTimings

type TpTimings []TpTiming

func APItoModelTimings

func APItoModelTimings(ts []*utils.ApierTPTiming) (result TpTimings)

func (TpTimings) AsMapTPTimings

func (tps TpTimings) AsMapTPTimings() (map[string]*utils.ApierTPTiming, error)

func (TpTimings) AsTPTimings

func (tps TpTimings) AsTPTimings() (result []*utils.ApierTPTiming)

type UnitCounter

type UnitCounter struct {
	CounterType string         // *event or *balance
	Counters    CounterFilters // first balance is the general one (no destination)
}

Amount of a traffic of a certain type

func (*UnitCounter) Clone

func (uc *UnitCounter) Clone() (newUnit *UnitCounter)

Clone clones *UnitCounter

func (*UnitCounter) CopyCounterValues

func (uc *UnitCounter) CopyCounterValues(oldUc *UnitCounter) bool

Returns true if the counters were of the same type Copies the value from old balances

type UnitCounters

type UnitCounters map[string][]*UnitCounter

func (UnitCounters) Clone

func (ucs UnitCounters) Clone() UnitCounters

Clone clones UnitCounters

type UnitInfo

type UnitInfo struct {
	UUID          string
	ID            string
	Value         float64
	DestinationID string
	Consumed      float64
	ToR           string
	RateInterval  *RateInterval
}

func (*UnitInfo) Clone

func (ui *UnitInfo) Clone() *UnitInfo

func (*UnitInfo) Equal

func (ui *UnitInfo) Equal(other *UnitInfo) bool

type UsageRecord

type UsageRecord struct {
	ToR         string
	RequestType string
	Tenant      string
	Category    string
	Account     string
	Subject     string
	Destination string
	SetupTime   string
	AnswerTime  string
	Usage       string
	ExtraFields map[string]string
}

UsageRecord is used when authorizing requests from outside, eg APIerSv1.GetMaxUsage

func (*UsageRecord) AsCDR

func (self *UsageRecord) AsCDR(timezone string) (*CDR, error)

func (*UsageRecord) AsCallDescriptor

func (self *UsageRecord) AsCallDescriptor(timezone string, denyNegative bool) (*CallDescriptor, error)

func (*UsageRecord) GetId

func (self *UsageRecord) GetId() string

type UsageRecordWithArgDispatcher

type UsageRecordWithArgDispatcher struct {
	*UsageRecord
	*utils.ArgDispatcher
}

type V2SMCost

type V2SMCost struct {
	CGRID       string
	RunID       string
	OriginHost  string
	OriginID    string
	CostSource  string
	Usage       time.Duration
	CostDetails *EventCost
}

type ValueFactor

type ValueFactor map[string]float64

func (ValueFactor) GetValue

func (f ValueFactor) GetValue(tor string) float64

type Versions

type Versions map[string]int64 // map[item]versionNr

Versions will keep trac of various item versions

func CurrentAllDBVersions

func CurrentAllDBVersions() Versions

CurrentAllDBVersions returns the both DataDB and StorDB versions

func CurrentDBVersions

func CurrentDBVersions(storType string, isDataDB bool) Versions

CurrentDBVersions returns versions based on dbType

func CurrentDataDBVersions

func CurrentDataDBVersions() Versions

CurrentDataDBVersions returns the needed DataDB versions

func CurrentStorDBVersions

func CurrentStorDBVersions() Versions

CurrentStorDBVersions returns the needed StorDB versions

func (Versions) Compare

func (vers Versions) Compare(current Versions, storType string, isDataDB bool) string

Compare returns the migration message if the versions are not the latest

type WeightSorter

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

WeightSorter orders suppliers based on their weight, no cost involved

func NewWeightSorter

func NewWeightSorter(spS *SupplierService) *WeightSorter

func (*WeightSorter) SortSuppliers

func (ws *WeightSorter) SortSuppliers(prflID string,
	suppls []*Supplier, suplEv *utils.CGREvent, extraOpts *optsGetSuppliers, argDsp *utils.ArgDispatcher) (sortedSuppls *SortedSuppliers, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL