agents

package
v1.0.0-dev Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2025 License: GPL-3.0 Imports: 45 Imported by: 1

Documentation

Index

Constants

View Source
const (
	CGRAuthAPP            = "cgrates_auth"
	CGRMaxSessionTime     = "CGRMaxSessionTime"
	CGRRoute              = "CGRRoute"
	ARIStasisStart        = "StasisStart"
	ARIChannelStateChange = "ChannelStateChange"
	ARIChannelDestroyed   = "ChannelDestroyed"

	SMAAuthorization         = "SMA_AUTHORIZATION"
	SMASessionStart          = "SMA_SESSION_START"
	SMASessionTerminate      = "SMA_SESSION_TERMINATE"
	ARICGRResourceAllocation = "CGRResourceAllocation"
)

constants used by AsteriskAgent

View Source
const (

	// Freswitch event proprities names
	SUBJECT                  = varPrefix + utils.CGRSubject
	ACCOUNT                  = varPrefix + utils.CGRAccount
	DESTINATION              = varPrefix + utils.CGRDestination
	REQTYPE                  = varPrefix + utils.CGRReqType //prepaid or postpaid
	CATEGORY                 = varPrefix + utils.CGRCategory
	VAR_CGR_ROUTE            = varPrefix + utils.CGRRoute
	UUID                     = "Unique-ID" // -Unique ID for this call leg
	CSTMID                   = varPrefix + utils.CGRTenant
	CALL_DEST_NR             = "Caller-Destination-Number"
	SIP_REQ_USER             = "variable_sip_req_user"
	PARK_TIME                = "Caller-Profile-Created-Time"
	SETUP_TIME               = "Caller-Channel-Created-Time"
	ANSWER_TIME              = "Caller-Channel-Answered-Time"
	END_TIME                 = "Caller-Channel-Hangup-Time"
	DURATION                 = "variable_billsec"
	NAME                     = "Event-Name"
	HEARTBEAT                = "HEARTBEAT"
	ANSWER                   = "CHANNEL_ANSWER"
	HANGUP                   = "CHANNEL_HANGUP_COMPLETE"
	PARK                     = "CHANNEL_PARK"
	AUTH_OK                  = "AUTH_OK"
	DISCONNECT               = "SWITCH DISCONNECT"
	MANAGER_REQUEST          = "MANAGER_REQUEST"
	USERNAME                 = "Caller-Username"
	FS_IPv4                  = "FreeSWITCH-IPv4"
	HANGUP_CAUSE             = "Hangup-Cause"
	PDD_MEDIA_MS             = "variable_progress_mediamsec"
	PDD_NOMEDIA_MS           = "variable_progressmsec"
	IGNOREPARK               = "variable_cgr_ignorepark"
	FS_VARPREFIX             = "variable_"
	VarCGRFlags              = varPrefix + utils.CGRFlags
	VarCGROpts               = varPrefix + utils.CGROpts
	CGRResourceAllocation    = "cgr_resource_allocation"
	VAR_CGR_DISCONNECT_CAUSE = varPrefix + utils.CGRDisconnectCause
	VAR_CGR_CMPUTELCR        = varPrefix + utils.CGRComputeLCR
	FsConnID                 = "FsConnID" // used to share connID info in event for remote disconnects
	VarAnswerEpoch           = "variable_answer_epoch"
	VarCGRACD                = varPrefix + utils.CgrAcd
	VarCGROriginHost         = varPrefix + utils.CGROriginHost
)
View Source
const (
	EVENT                  = "event"
	CGR_AUTH_REQUEST       = "CGR_AUTH_REQUEST"
	CGR_AUTH_REPLY         = "CGR_AUTH_REPLY"
	CGR_SESSION_DISCONNECT = "CGR_SESSION_DISCONNECT"
	CGR_CALL_START         = "CGR_CALL_START"
	CGR_CALL_END           = "CGR_CALL_END"
	CGR_PROCESS_MESSAGE    = "CGR_PROCESS_MESSAGE"
	CGR_PROCESS_CDR        = "CGR_PROCESS_CDR"
	KamTRIndex             = "tr_index"
	KamTRLabel             = "tr_label"
	KamHashEntry           = "h_entry"
	KamHashID              = "h_id"
	KamReplyRoute          = "reply_route"
	EvapiConnID            = "EvapiConnID" // used to share connID info in event for remote disconnects
	CGR_DLG_LIST           = "CGR_DLG_LIST"
)
View Source
const (
	MetaRadReqType     = "*radReqType"
	MetaRadAuth        = "*radAuth"
	MetaRadReplyCode   = "*radReplyCode"
	UserPasswordAVP    = "User-Password"
	CHAPPasswordAVP    = "CHAP-Password"
	MSCHAPChallengeAVP = "MS-CHAP-Challenge"
	MSCHAPResponseAVP  = "MS-CHAP-Response"
	MicrosoftVendor    = "Microsoft"
	MSCHAP2SuccessAVP  = "MS-CHAP2-Success"
)

Variables

This section is empty.

Functions

func SliceAsFsArray

func SliceAsFsArray(slc []string) (arry string)

SliceAsFsArray Converts a slice of strings into a FS array string, contains len(array) at first index since FS does not support len(ARRAY::) for now

Types

type AgentRequest

type AgentRequest struct {
	Request    utils.DataProvider         // request
	Vars       *utils.DataNode            // shared data
	CGRRequest *utils.OrderedNavigableMap // Used in reply to access the request that was send
	CGRReply   *utils.DataNode
	Reply      *utils.OrderedNavigableMap
	Tenant     string
	Timezone   string

	Opts    utils.MapStorage
	Cfg     utils.DataProvider
	ExtraDP map[string]utils.DataProvider
	// contains filtered or unexported fields
}

AgentRequest represents data related to one request towards agent implements utils.DataProvider so we can pass it to filters

func NewAgentRequest

func NewAgentRequest(req utils.DataProvider,
	vars, cgrRply *utils.DataNode,
	rply *utils.OrderedNavigableMap,
	opts utils.MapStorage,
	tntTpl utils.RSRParsers,
	dfltTenant, timezone string,
	filterS *engine.FilterS,
	extraDP map[string]utils.DataProvider) (ar *AgentRequest)

NewAgentRequest returns a new AgentRequest

func (*AgentRequest) Append

func (ar *AgentRequest) Append(fullPath *utils.FullPath, val *utils.DataLeaf) (err error)

Append sets the value at the given path this used with full path and the processed path to not calculate them for every set

func (*AgentRequest) Compose

func (ar *AgentRequest) Compose(fullPath *utils.FullPath, val *utils.DataLeaf) (err error)

Set sets the value at the given path this used with full path and the processed path to not calculate them for every set

func (*AgentRequest) FieldAsInterface

func (ar *AgentRequest) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface implements utils.DataProvider

func (*AgentRequest) FieldAsString

func (ar *AgentRequest) FieldAsString(fldPath []string) (val string, err error)

FieldAsString implements utils.DataProvider

func (*AgentRequest) ParseField

func (ar *AgentRequest) ParseField(
	cfgFld *config.FCTemplate) (out any, err error)

ParseField outputs the value based on the template item

func (*AgentRequest) Remove added in v0.10.1

func (ar *AgentRequest) Remove(fullPath *utils.FullPath) error

Remove deletes the fields found at path with the given prefix

func (*AgentRequest) RemoveAll added in v0.10.1

func (ar *AgentRequest) RemoveAll(prefix string) error

RemoveAll deletes all fields at given prefix

func (*AgentRequest) SetAsSlice

func (ar *AgentRequest) SetAsSlice(fullPath *utils.FullPath, nm *utils.DataLeaf) (err error)

Set implements utils.NMInterface

func (*AgentRequest) SetFields

func (ar *AgentRequest) SetFields(tplFlds []*config.FCTemplate) (err error)

SetFields will populate fields of AgentRequest out of templates

func (*AgentRequest) String

func (ar *AgentRequest) String() string

String implements utils.DataProvider

type AsteriskAgent

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

AsteriskAgent used to cominicate with asterisk

func NewAsteriskAgent

func NewAsteriskAgent(cgrCfg *config.CGRConfig, astConnIdx int,
	connMgr *engine.ConnManager) *AsteriskAgent

NewAsteriskAgent constructs a new Asterisk Agent

func (*AsteriskAgent) ListenAndServe

func (sma *AsteriskAgent) ListenAndServe(stopChan <-chan struct{}) (err error)

ListenAndServe is called to start the service

func (*AsteriskAgent) V1DisconnectPeer

func (*AsteriskAgent) V1DisconnectPeer(_ *context.Context, args *utils.DPRArgs, reply *string) (err error)

V1DisconnectPeer is used to implement the sessions.BiRPClient interface

func (*AsteriskAgent) V1DisconnectSession

func (sma *AsteriskAgent) V1DisconnectSession(_ *context.Context, args utils.AttrDisconnectSession, reply *string) error

V1DisconnectSession is internal method to disconnect session in asterisk

func (*AsteriskAgent) V1GetActiveSessionIDs

func (sma *AsteriskAgent) V1GetActiveSessionIDs(_ *context.Context, _ string,
	sessionIDs *[]*sessions.SessionID) error

V1GetActiveSessionIDs is internal method to get all active sessions in asterisk

func (*AsteriskAgent) V1ReAuthorize

func (*AsteriskAgent) V1ReAuthorize(_ *context.Context, originID string, reply *string) (err error)

V1ReAuthorize is used to implement the sessions.BiRPClient interface

func (*AsteriskAgent) V1WarnDisconnect

func (sma *AsteriskAgent) V1WarnDisconnect(_ *context.Context, args map[string]any, reply *string) (err error)

V1WarnDisconnect is used to implement the sessions.BiRPClient interface

type DNSAgent

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

DNSAgent translates DNS requests towards CGRateS infrastructure

func NewDNSAgent

func NewDNSAgent(cgrCfg *config.CGRConfig, fltrS *engine.FilterS,
	connMgr *engine.ConnManager) (da *DNSAgent, err error)

NewDNSAgent is the constructor for DNSAgent

func (*DNSAgent) ListenAndServe

func (da *DNSAgent) ListenAndServe(stopChan chan struct{}) error

ListenAndServe will run the DNS handler doing also the connection to listen address

func (*DNSAgent) Reload

func (da *DNSAgent) Reload() (err error)

Reload will reinitialize the server this is in order to monitor if we receive error on ListenAndServe

func (*DNSAgent) Shutdown

func (da *DNSAgent) Shutdown() error

Shutdown stops the DNS server

type DiameterAgent

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

DiameterAgent describes the diameter server

func NewDiameterAgent

func NewDiameterAgent(cgrCfg *config.CGRConfig, filterS *engine.FilterS,
	connMgr *engine.ConnManager, caps *engine.Caps) (*DiameterAgent, error)

NewDiameterAgent initializes a new DiameterAgent

func (*DiameterAgent) ListenAndServe

func (da *DiameterAgent) ListenAndServe(stopChan <-chan struct{}) (err error)

ListenAndServe is called when DiameterAgent is started, usually from within cmd/cgr-engine

func (*DiameterAgent) V1DisconnectPeer

func (da *DiameterAgent) V1DisconnectPeer(ctx *context.Context, args *utils.DPRArgs, reply *string) (err error)

V1DisconnectPeer sends a DPR meseage to diameter client

func (*DiameterAgent) V1DisconnectSession

func (da *DiameterAgent) V1DisconnectSession(ctx *context.Context, args utils.AttrDisconnectSession, reply *string) (err error)

V1DisconnectSession is part of the sessions.BiRPClient

func (*DiameterAgent) V1GetActiveSessionIDs

func (da *DiameterAgent) V1GetActiveSessionIDs(ctx *context.Context, _ string,
	sessionIDs *[]*sessions.SessionID) error

V1GetActiveSessionIDs is part of the sessions.BiRPClient

func (*DiameterAgent) V1ReAuthorize

func (da *DiameterAgent) V1ReAuthorize(ctx *context.Context, originID string, reply *string) (err error)

V1ReAuthorize sends a rar message to diameter client

func (*DiameterAgent) V1WarnDisconnect

func (*DiameterAgent) V1WarnDisconnect(ctx *context.Context, args map[string]any, reply *string) (err error)

V1WarnDisconnect is used to implement the sessions.BiRPClient interface

type DiameterClient

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

func NewDiameterClient

func NewDiameterClient(addr, originHost, originRealm string, vendorId int, productName string,
	firmwareRev int, dictsDir string, network string) (dc *DiameterClient, err error)

func (*DiameterClient) ReceivedMessage

func (dc *DiameterClient) ReceivedMessage(rplyTimeout time.Duration) *diam.Message

Returns the message out of received buffer

func (*DiameterClient) SendMessage

func (dc *DiameterClient) SendMessage(m *diam.Message) error

type FSEvent

type FSEvent map[string]string

Event type holding a mapping of all event's proprieties

func NewFSEvent

func NewFSEvent(strEv string) (fsev FSEvent)

func (FSEvent) AsCGREvent

func (fsev FSEvent) AsCGREvent(timezone string) *utils.CGREvent

AsCGREvent converts FSEvent into CGREvent

func (FSEvent) AsMapStringInterface

func (fsev FSEvent) AsMapStringInterface(timezone string) map[string]any

Used with RLs

func (FSEvent) GetADC

func (fsev FSEvent) GetADC(fieldName string) (time.Duration, error)

func (FSEvent) GetAccount

func (fsev FSEvent) GetAccount(fieldName string) string

Account calling

func (FSEvent) GetAnswerTime

func (fsev FSEvent) GetAnswerTime(fieldName, timezone string) (t time.Time, err error)

func (FSEvent) GetCallDestNr

func (fsev FSEvent) GetCallDestNr(fieldName string) string

Original dialed destination number, useful in case of unpark

func (FSEvent) GetCategory

func (fsev FSEvent) GetCategory(fieldName string) string

func (FSEvent) GetDestination

func (fsev FSEvent) GetDestination(fieldName string) string

Charging destination number

func (FSEvent) GetDisconnectCause

func (fsev FSEvent) GetDisconnectCause(fieldName string) string

func (FSEvent) GetDuration

func (fsev FSEvent) GetDuration(fieldName string) (time.Duration, error)

func (FSEvent) GetEndTime

func (fsev FSEvent) GetEndTime(fieldName, timezone string) (t time.Time, err error)

func (FSEvent) GetExtraFields

func (fsev FSEvent) GetExtraFields() map[string]string

func (FSEvent) GetName

func (fsev FSEvent) GetName() string

func (FSEvent) GetOptions

func (fsev FSEvent) GetOptions() (mp map[string]any)

GetOptions returns the possible options

func (FSEvent) GetOriginHost

func (fsev FSEvent) GetOriginHost() string

GetOriginHost returns the first non empty between: fsev[VarCGROriginHost], conns[connId].cfg.Alias and fsev[FS_IPv4]

func (FSEvent) GetOriginatorIP

func (fsev FSEvent) GetOriginatorIP(fieldName string) string

func (FSEvent) GetPdd

func (fsev FSEvent) GetPdd(fieldName string) (time.Duration, error)

func (FSEvent) GetReqType

func (fsev FSEvent) GetReqType(fieldName string) string

func (FSEvent) GetRoute

func (fsev FSEvent) GetRoute(fieldName string) string

func (FSEvent) GetSessionIds

func (fsev FSEvent) GetSessionIds() []string

func (FSEvent) GetSetupTime

func (fsev FSEvent) GetSetupTime(fieldName, timezone string) (t time.Time, err error)

func (FSEvent) GetSubject

func (fsev FSEvent) GetSubject(fieldName string) string

Rating subject being charged

func (FSEvent) GetTenant

func (fsev FSEvent) GetTenant(fieldName string) string

func (FSEvent) GetUUID

func (fsev FSEvent) GetUUID() string

func (FSEvent) MissingParameter

func (fsev FSEvent) MissingParameter(timezone string) string

func (FSEvent) ParseEventValue

func (fsev FSEvent) ParseEventValue(attrName string, rsrFld *utils.RSRParser, timezone string) (parsed string, err error)

Used in derived charging and sittuations when we need to run regexp on fields

func (FSEvent) String

func (fsev FSEvent) String() (result string)

Nice printing for the event object.

type FSsessions

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

FSsessions is the freeswitch session manager it holds a buffer for the network connection and the active sessions

func NewFSsessions

func NewFSsessions(cgrcfg *config.CGRConfig, filterS *engine.FilterS,
	timezone string, connMgr *engine.ConnManager) (*FSsessions, error)

func (*FSsessions) Connect

func (fsa *FSsessions) Connect() error

Connect connects to the freeswitch mod_event_socket server and starts listening for events.

func (*FSsessions) Reload

func (fsa *FSsessions) Reload()

Reload recreates the connection buffers only used on reload

func (*FSsessions) Shutdown

func (fsa *FSsessions) Shutdown() (err error)

Shutdown stops all connected fsock connections

func (*FSsessions) V1DisconnectPeer

func (*FSsessions) V1DisconnectPeer(ctx *context.Context, args *utils.DPRArgs, reply *string) (err error)

V1DisconnectPeer is used to implement the sessions.BiRPClient interface

func (*FSsessions) V1DisconnectSession

func (fsa *FSsessions) V1DisconnectSession(ctx *context.Context, args utils.AttrDisconnectSession, reply *string) (err error)

V1DisconnectSession internal method to disconnect session in FreeSWITCH

func (*FSsessions) V1GetActiveSessionIDs

func (fsa *FSsessions) V1GetActiveSessionIDs(ctx *context.Context, _ string,
	sessionIDs *[]*sessions.SessionID) (err error)

V1GetActiveSessionIDs used to return all active sessions

func (*FSsessions) V1ReAuthorize

func (*FSsessions) V1ReAuthorize(ctx *context.Context, originID string, reply *string) (err error)

V1ReAuthorize is used to implement the sessions.BiRPClient interface

func (*FSsessions) V1WarnDisconnect

func (fsa *FSsessions) V1WarnDisconnect(ctx *context.Context, args map[string]any, reply *string) (err error)

V1WarnDisconnect is called when call goes under the minimum duration threshold, so FreeSWITCH can play an announcement message

type HTTPAgent

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

HTTPAgent is a handler for HTTP requests

func NewHTTPAgent

func NewHTTPAgent(connMgr *engine.ConnManager, sessionConns []string,
	filterS *engine.FilterS, dfltTenant, reqPayload, rplyPayload string,
	reqProcessors []*config.RequestProcessor) *HTTPAgent

NewHttpAgent will construct a HTTPAgent

func (*HTTPAgent) ServeHTTP

func (ha *HTTPAgent) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP implements http.Handler interface

type JanusAgent

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

func NewJanusAgent

func NewJanusAgent(cgrCfg *config.CGRConfig,
	connMgr *engine.ConnManager,
	filterS *engine.FilterS) (*JanusAgent, error)

func (*JanusAgent) AttachPlugin

func (ja *JanusAgent) AttachPlugin(w http.ResponseWriter, r *http.Request)

AttachPlugin will attach a plugin to a session

func (*JanusAgent) CORSOptions

func (ja *JanusAgent) CORSOptions(w http.ResponseWriter, req *http.Request)

ServeHTTP implements http.Handler interface

func (*JanusAgent) Connect

func (ja *JanusAgent) Connect() (err error)

Connect will create the connection to the Janus Server

func (*JanusAgent) CreateSession

func (ja *JanusAgent) CreateSession(w http.ResponseWriter, req *http.Request)

CreateSession will create a new session within janusgo

func (*JanusAgent) HandlePlugin

func (ja *JanusAgent) HandlePlugin(w http.ResponseWriter, r *http.Request)

HandlePlugin will handle requests towards a plugin

func (*JanusAgent) PollSession

func (ja *JanusAgent) PollSession(w http.ResponseWriter, req *http.Request)

PollSession will create a long-poll request to be notified about events and incoming messages from session

func (*JanusAgent) SessionKeepalive

func (ja *JanusAgent) SessionKeepalive(w http.ResponseWriter, r *http.Request)

SessioNKeepalive sends keepalive once OPTIONS are coming for the session from HTTP

func (*JanusAgent) Shutdown

func (ja *JanusAgent) Shutdown() (err error)

Shutdown will close the connection to the Janus Server

func (*JanusAgent) V1AlterSession

func (ja *JanusAgent) V1AlterSession(*context.Context, utils.CGREvent, *string) error

func (*JanusAgent) V1DisconnectPeer

func (ja *JanusAgent) V1DisconnectPeer(*context.Context, *utils.DPRArgs, *string) error

func (*JanusAgent) V1DisconnectSession

func (ja *JanusAgent) V1DisconnectSession(ctx *context.Context, cgrEv utils.CGREvent, reply *string) (err error)

func (*JanusAgent) V1GetActiveSessionIDs

func (ja *JanusAgent) V1GetActiveSessionIDs(ctx *context.Context, ignParam string,
	sessionIDs *[]*sessions.SessionID) error

func (*JanusAgent) V1WarnDisconnect

func (ja *JanusAgent) V1WarnDisconnect(*context.Context, map[string]any, *string) error

type KamDlgReply

type KamDlgReply struct {
	Event        string
	Jsonrpl_body *kamJsonDlgBody
}

func NewKamDlgReply

func NewKamDlgReply(kamEvData []byte) (rpl KamDlgReply, err error)

NewKamDlgReply parses bytes received over the wire from Kamailio into KamDlgReply

func (*KamDlgReply) String

func (kdr *KamDlgReply) String() string

type KamEvent

type KamEvent map[string]string

KamEvent represents one event received from Kamailio

func NewKamEvent

func NewKamEvent(kamEvData []byte, alias, adress string) (KamEvent, error)

NewKamEvent parses bytes received over the wire from Kamailio into KamEvent

func (KamEvent) AsCGREvent

func (kev KamEvent) AsCGREvent(timezone string) *utils.CGREvent

AsCGREvent converts KamEvent into CGREvent

func (KamEvent) AsKamAuthReply

func (kev KamEvent) AsKamAuthReply(authArgs *utils.CGREvent,
	authReply *sessions.V1AuthorizeReply, rplyErr error) (kar *KamReply, err error)

AsKamAuthReply builds up a Kamailio AuthReply based on arguments and reply from SessionS

func (KamEvent) AsKamProcessCDRReply

func (kev KamEvent) AsKamProcessCDRReply(cgrEvWithArgDisp *utils.CGREvent,
	rply *string, rplyErr error) (kar *KamReply, err error)

AsKamProcessCDRReply builds up a Kamailio ProcessEvent based on arguments and reply from SessionS

func (KamEvent) AsKamProcessMessageEmptyReply

func (kev KamEvent) AsKamProcessMessageEmptyReply() (kar *KamReply)

AsKamProcessMessageEmptyReply builds up a Kamailio ProcessEventEmpty

func (KamEvent) AsKamProcessMessageReply

func (kev KamEvent) AsKamProcessMessageReply(procEvArgs *utils.CGREvent,
	procEvReply *sessions.V1ProcessMessageReply, rplyErr error) (kar *KamReply, err error)

AsKamProcessMessageReply builds up a Kamailio ProcessEvent based on arguments and reply from SessionS

func (KamEvent) AsMapStringInterface

func (kev KamEvent) AsMapStringInterface() (mp map[string]any)

AsMapStringInterface converts KamEvent into event used by other subsystems

func (KamEvent) GetOptions

func (kev KamEvent) GetOptions() (mp map[string]any)

GetOptions returns the posible options

func (KamEvent) MissingParameter

func (kev KamEvent) MissingParameter() bool

func (KamEvent) String

func (kev KamEvent) String() string

String is used for pretty printing event in logs

type KamReply

type KamReply struct {
	Event              string // Kamailio will use this to differentiate between requests and replies
	TransactionIndex   string // Original transaction index
	TransactionLabel   string // Original transaction label
	Attributes         string
	ResourceAllocation string
	MaxUsage           float64 // Maximum session time in case of success, -1 for unlimited
	Routes             string  // List of routes, comma separated
	Thresholds         string
	StatQueues         string
	Error              string // Reply in case of error
}

KamReply will be used to send back to kamailio from Authrization,ProcessEvent and ProcessEvent empty (pingPong)

func (*KamReply) String

func (krply *KamReply) String() string

type KamSessionDisconnect

type KamSessionDisconnect struct {
	Event     string
	HashEntry string
	HashId    string
	Reason    string
}

func NewKamSessionDisconnect

func NewKamSessionDisconnect(hEntry, hID, reason string) *KamSessionDisconnect

func (*KamSessionDisconnect) String

func (ksd *KamSessionDisconnect) String() string

type KamailioAgent

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

func NewKamailioAgent

func NewKamailioAgent(kaCfg *config.KamAgentCfg,
	connMgr *engine.ConnManager, timezone string) (ka *KamailioAgent)

func (*KamailioAgent) Connect

func (self *KamailioAgent) Connect() (err error)

func (*KamailioAgent) Reload

func (ka *KamailioAgent) Reload()

Reload recreates the connection buffers only used on reload

func (*KamailioAgent) Shutdown

func (self *KamailioAgent) Shutdown() (err error)

func (*KamailioAgent) V1DisconnectPeer

func (*KamailioAgent) V1DisconnectPeer(ctx *context.Context, args *utils.DPRArgs, reply *string) (err error)

V1DisconnectPeer is used to implement the sessions.BiRPClient interface

func (*KamailioAgent) V1DisconnectSession

func (ka *KamailioAgent) V1DisconnectSession(ctx *context.Context, args utils.AttrDisconnectSession, reply *string) (err error)

Internal method to disconnect session in Kamailio

func (*KamailioAgent) V1GetActiveSessionIDs

func (ka *KamailioAgent) V1GetActiveSessionIDs(ctx *context.Context, _ string, sessionIDs *[]*sessions.SessionID) (err error)

V1GetActiveSessionIDs returns a list of originIDs based on active sessions from agent

func (*KamailioAgent) V1ReAuthorize

func (*KamailioAgent) V1ReAuthorize(ctx *context.Context, originID string, reply *string) (err error)

V1ReAuthorize is used to implement the sessions.BiRPClient interface

func (*KamailioAgent) V1WarnDisconnect

func (*KamailioAgent) V1WarnDisconnect(ctx *context.Context, args map[string]any, reply *string) (err error)

V1WarnDisconnect is used to implement the sessions.BiRPClient interface

type PrometheusAgent

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

PrometheusAgent handles metrics collection for Prometheus. It collects stats from StatQueues and exposes them alongside optional Go runtime and process metrics.

func NewPrometheusAgent

func NewPrometheusAgent(cfg *config.CGRConfig, cm *engine.ConnManager) *PrometheusAgent

NewPrometheusAgent creates and initializes a PrometheusAgent with pre-registered metrics based on the provided configuration.

func (*PrometheusAgent) ServeHTTP

func (pa *PrometheusAgent) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler interface. It updates all metrics on each scrape request before exposing them via the Prometheus HTTP handler.

type RadiusAgent

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

func NewRadiusAgent

func NewRadiusAgent(cgrCfg *config.CGRConfig, filterS *engine.FilterS,
	connMgr *engine.ConnManager) (ra *RadiusAgent, err error)

func (*RadiusAgent) ListenAndServe

func (ra *RadiusAgent) ListenAndServe(stopChan <-chan struct{}) (err error)

type SIPAgent

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

SIPAgent is a handler for SIP requests

func NewSIPAgent

func NewSIPAgent(connMgr *engine.ConnManager, cfg *config.CGRConfig,
	filterS *engine.FilterS) (sa *SIPAgent, err error)

NewSIPAgent will construct a SIPAgent

func (*SIPAgent) InitStopChan

func (sa *SIPAgent) InitStopChan()

func (*SIPAgent) ListenAndServe

func (sa *SIPAgent) ListenAndServe() (err error)

ListenAndServe will run the SIP handler doing also the connection to listen address

func (*SIPAgent) Shutdown

func (sa *SIPAgent) Shutdown()

Shutdown will stop the SIPAgent server

type SMAsteriskEvent

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

func NewSMAsteriskEvent

func NewSMAsteriskEvent(ariEv map[string]any, asteriskIP, asteriskAlias string) *SMAsteriskEvent

func (*SMAsteriskEvent) Account

func (smaEv *SMAsteriskEvent) Account() string

func (*SMAsteriskEvent) AsCGREvent

func (smaEv *SMAsteriskEvent) AsCGREvent() *utils.CGREvent

AsCGREvent converts AsteriskEvent into CGREvent

func (*SMAsteriskEvent) AsMapStringInterface

func (smaEv *SMAsteriskEvent) AsMapStringInterface() (mp map[string]any)

func (*SMAsteriskEvent) Category

func (smaEv *SMAsteriskEvent) Category() string

func (*SMAsteriskEvent) ChannelID

func (smaEv *SMAsteriskEvent) ChannelID() string

func (*SMAsteriskEvent) ChannelState

func (smaEv *SMAsteriskEvent) ChannelState() string

func (*SMAsteriskEvent) Destination

func (smaEv *SMAsteriskEvent) Destination() string

func (*SMAsteriskEvent) DisconnectCause

func (smaEv *SMAsteriskEvent) DisconnectCause() string

func (*SMAsteriskEvent) EventType

func (smaEv *SMAsteriskEvent) EventType() string

func (*SMAsteriskEvent) ExtraParameters

func (smaEv *SMAsteriskEvent) ExtraParameters() (extraParams map[string]string)

func (*SMAsteriskEvent) OriginHost

func (smaEv *SMAsteriskEvent) OriginHost() string

func (*SMAsteriskEvent) OriginatorIP

func (smaEv *SMAsteriskEvent) OriginatorIP() string

func (*SMAsteriskEvent) PDD

func (smaEv *SMAsteriskEvent) PDD() string

func (*SMAsteriskEvent) RequestType

func (smaEv *SMAsteriskEvent) RequestType() string

func (*SMAsteriskEvent) Route

func (smaEv *SMAsteriskEvent) Route() string

func (*SMAsteriskEvent) SetupTime

func (smaEv *SMAsteriskEvent) SetupTime() string

func (*SMAsteriskEvent) Subject

func (smaEv *SMAsteriskEvent) Subject() string

func (*SMAsteriskEvent) Subsystems

func (smaEv *SMAsteriskEvent) Subsystems() string

func (*SMAsteriskEvent) Tenant

func (smaEv *SMAsteriskEvent) Tenant() string

func (*SMAsteriskEvent) Timestamp

func (smaEv *SMAsteriskEvent) Timestamp() string

func (*SMAsteriskEvent) UpdateCGREvent

func (smaEv *SMAsteriskEvent) UpdateCGREvent(cgrEv *utils.CGREvent) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL