Documentation
¶
Index ¶
- Constants
- func BuildSIPToken(params SIPTokenParams) (string, error)
- func DispatchRulePriority(info *livekit.SIPDispatchRuleInfo) int32
- func EvaluateDispatchRule(projectID string, trunk *livekit.SIPInboundTrunkInfo, ...) (*rpc.EvaluateSIPDispatchRulesResponse, error)
- func GetPinAndRoom(info *livekit.SIPDispatchRuleInfo) (room, pin string, err error)
- func MatchDispatchRule(trunk *livekit.SIPInboundTrunkInfo, rules []*livekit.SIPDispatchRuleInfo, ...) (*livekit.SIPDispatchRuleInfo, error)deprecated
- func MatchDispatchRuleIter(trunk *livekit.SIPInboundTrunkInfo, ...) (*livekit.SIPDispatchRuleInfo, error)
- func MatchTrunk(trunks []*livekit.SIPInboundTrunkInfo, call *rpc.SIPCall, ...) (*livekit.SIPInboundTrunkInfo, error)deprecated
- func MatchTrunkIter(it iters.Iter[*livekit.SIPInboundTrunkInfo], call *rpc.SIPCall, ...) (*livekit.SIPInboundTrunkInfo, error)
- func NewCallID() string
- func NormalizeNumber(num string) string
- func SelectDispatchRule(rules []*livekit.SIPDispatchRuleInfo, req *rpc.EvaluateSIPDispatchRulesRequest, ...) (*livekit.SIPDispatchRuleInfo, error)deprecated
- func SortDispatchRules(rules []*livekit.SIPDispatchRuleInfo)
- func ValidateDispatchRules(rules []*livekit.SIPDispatchRuleInfo, opts ...MatchDispatchRuleOpt) errordeprecated
- func ValidateDispatchRulesIter(it iters.Iter[*livekit.SIPDispatchRuleInfo], opts ...MatchDispatchRuleOpt) (best *livekit.SIPDispatchRuleInfo, _ error)
- func ValidateTrunks(trunks []*livekit.SIPInboundTrunkInfo, opts ...MatchTrunkOpt) errordeprecated
- func ValidateTrunksIter(it iters.Iter[*livekit.SIPInboundTrunkInfo], opts ...MatchTrunkOpt) error
- type DispatchRuleConflictFunc
- type DispatchRuleConflictReason
- type DispatchRuleReplaceFunc
- type DispatchRuleValidator
- type ErrNoDispatchMatched
- type MatchDispatchRuleOpt
- type MatchTrunkOpt
- type SIPTokenParams
- type TrunkConflictFunc
- type TrunkConflictReason
- type TrunkFilteredFunc
- type TrunkFilteredReason
- type TrunkMatchResult
- type TrunkMatchType
- type TrunkReplaceFunc
Constants ¶
const ( TrunkFilteredInvalid = TrunkFilteredReason(iota) TrunkFilteredCallingNumberDisallowed TrunkFilteredCalledNumberDisallowed TrunkFilteredSourceAddressDisallowed )
const ( TrunkConflictDefault = TrunkConflictReason(iota) TrunkConflictCalledNumber TrunkConflictCallingNumber )
const (
DispatchRuleConflictGeneric = DispatchRuleConflictReason(iota)
)
Variables ¶
This section is empty.
Functions ¶
func BuildSIPToken ¶ added in v1.9.4
func BuildSIPToken(params SIPTokenParams) (string, error)
func DispatchRulePriority ¶
func DispatchRulePriority(info *livekit.SIPDispatchRuleInfo) int32
DispatchRulePriority returns sorting priority for dispatch rules. Lower value means higher priority.
func EvaluateDispatchRule ¶
func EvaluateDispatchRule(projectID string, trunk *livekit.SIPInboundTrunkInfo, rule *livekit.SIPDispatchRuleInfo, req *rpc.EvaluateSIPDispatchRulesRequest) (*rpc.EvaluateSIPDispatchRulesResponse, error)
EvaluateDispatchRule checks a selected Dispatch Rule against the provided request.
func GetPinAndRoom ¶
func GetPinAndRoom(info *livekit.SIPDispatchRuleInfo) (room, pin string, err error)
GetPinAndRoom returns a room name/prefix and the pin for a dispatch rule. Just a convenience wrapper.
func MatchDispatchRule
deprecated
func MatchDispatchRule(trunk *livekit.SIPInboundTrunkInfo, rules []*livekit.SIPDispatchRuleInfo, req *rpc.EvaluateSIPDispatchRulesRequest, opts ...MatchDispatchRuleOpt) (*livekit.SIPDispatchRuleInfo, error)
MatchDispatchRule finds the best dispatch rule matching the request parameters. Returns an error if no rule matched. Trunk parameter can be nil, in which case only wildcard dispatch rules will be effective (ones without Trunk IDs).
Deprecated: use MatchDispatchRuleIter
func MatchDispatchRuleIter ¶ added in v1.32.0
func MatchDispatchRuleIter(trunk *livekit.SIPInboundTrunkInfo, rules iters.Iter[*livekit.SIPDispatchRuleInfo], req *rpc.EvaluateSIPDispatchRulesRequest, opts ...MatchDispatchRuleOpt) (*livekit.SIPDispatchRuleInfo, error)
MatchDispatchRuleIter finds the best dispatch rule matching the request parameters. Returns an error if no rule matched. Trunk parameter can be nil, in which case only wildcard dispatch rules will be effective (ones without Trunk IDs).
func MatchTrunk
deprecated
func MatchTrunk(trunks []*livekit.SIPInboundTrunkInfo, call *rpc.SIPCall, opts ...MatchTrunkOpt) (*livekit.SIPInboundTrunkInfo, error)
MatchTrunk finds a SIP Trunk definition matching the request. Returns nil if no rules matched or an error if there are conflicting definitions.
Deprecated: use MatchTrunkIter
func MatchTrunkIter ¶ added in v1.32.0
func MatchTrunkIter(it iters.Iter[*livekit.SIPInboundTrunkInfo], call *rpc.SIPCall, opts ...MatchTrunkOpt) (*livekit.SIPInboundTrunkInfo, error)
MatchTrunkIter finds a SIP Trunk definition matching the request. Returns nil if no rules matched or an error if there are conflicting definitions.
func NormalizeNumber ¶ added in v1.35.0
func SelectDispatchRule
deprecated
func SelectDispatchRule(rules []*livekit.SIPDispatchRuleInfo, req *rpc.EvaluateSIPDispatchRulesRequest, opts ...MatchDispatchRuleOpt) (*livekit.SIPDispatchRuleInfo, error)
SelectDispatchRule takes a list of dispatch rules, and takes the decision which one should be selected. It returns an error if there are conflicting rules. Returns nil if no rules match.
Deprecated: use MatchDispatchRuleIter
func SortDispatchRules ¶
func SortDispatchRules(rules []*livekit.SIPDispatchRuleInfo)
SortDispatchRules predictably sorts dispatch rules by priority (first one is highest).
func ValidateDispatchRules
deprecated
added in
v1.10.1
func ValidateDispatchRules(rules []*livekit.SIPDispatchRuleInfo, opts ...MatchDispatchRuleOpt) error
ValidateDispatchRules checks a set of dispatch rules for conflicts.
Deprecated: use ValidateDispatchRulesIter
func ValidateDispatchRulesIter ¶ added in v1.32.0
func ValidateDispatchRulesIter(it iters.Iter[*livekit.SIPDispatchRuleInfo], opts ...MatchDispatchRuleOpt) (best *livekit.SIPDispatchRuleInfo, _ error)
ValidateDispatchRulesIter checks a set of dispatch rules for conflicts.
func ValidateTrunks
deprecated
added in
v1.10.1
func ValidateTrunks(trunks []*livekit.SIPInboundTrunkInfo, opts ...MatchTrunkOpt) error
ValidateTrunks checks a set of trunks for conflicts.
Deprecated: use ValidateTrunksIter
func ValidateTrunksIter ¶ added in v1.32.0
func ValidateTrunksIter(it iters.Iter[*livekit.SIPInboundTrunkInfo], opts ...MatchTrunkOpt) error
ValidateTrunksIter checks a set of trunks for conflicts.
Types ¶
type DispatchRuleConflictFunc ¶ added in v1.34.0
type DispatchRuleConflictFunc func(r1, r2 *livekit.SIPDispatchRuleInfo, reason DispatchRuleConflictReason)
type DispatchRuleConflictReason ¶ added in v1.34.0
type DispatchRuleConflictReason int
func (DispatchRuleConflictReason) String ¶ added in v1.34.0
func (i DispatchRuleConflictReason) String() string
type DispatchRuleReplaceFunc ¶ added in v1.36.0
type DispatchRuleReplaceFunc func(r *livekit.SIPDispatchRuleInfo) *livekit.SIPDispatchRuleInfo
type DispatchRuleValidator ¶ added in v1.32.0
type DispatchRuleValidator struct {
// contains filtered or unexported fields
}
func NewDispatchRuleValidator ¶ added in v1.32.0
func NewDispatchRuleValidator(opts ...MatchDispatchRuleOpt) *DispatchRuleValidator
func (*DispatchRuleValidator) Validate ¶ added in v1.32.0
func (v *DispatchRuleValidator) Validate(r *livekit.SIPDispatchRuleInfo) error
func (*DispatchRuleValidator) ValidateIter ¶ added in v1.32.0
func (v *DispatchRuleValidator) ValidateIter(it iters.Iter[*livekit.SIPDispatchRuleInfo]) iters.Iter[*livekit.SIPDispatchRuleInfo]
type ErrNoDispatchMatched ¶ added in v1.9.9
func (*ErrNoDispatchMatched) Error ¶ added in v1.9.9
func (e *ErrNoDispatchMatched) Error() string
type MatchDispatchRuleOpt ¶ added in v1.34.0
type MatchDispatchRuleOpt func(opt *matchDispatchRuleOpts)
func WithAllowDispatchRuleConflicts ¶ added in v1.34.0
func WithAllowDispatchRuleConflicts() MatchDispatchRuleOpt
WithAllowDispatchRuleConflicts allows conflicting DispatchRule definitions.
func WithDispatchRuleConflict ¶ added in v1.34.0
func WithDispatchRuleConflict(fnc DispatchRuleConflictFunc) MatchDispatchRuleOpt
WithDispatchRuleConflict sets a callback that is called when two DispatchRules conflict.
func WithDispatchRuleReplace ¶ added in v1.36.0
func WithDispatchRuleReplace(fnc DispatchRuleReplaceFunc) MatchDispatchRuleOpt
WithDispatchRuleReplace sets a callback that is called to potentially replace dispatch rules before matching runs.
type MatchTrunkOpt ¶ added in v1.34.0
type MatchTrunkOpt func(opt *matchTrunkOpts)
func WithAllowTrunkConflicts ¶ added in v1.34.0
func WithAllowTrunkConflicts() MatchTrunkOpt
WithAllowTrunkConflicts allows conflicting Trunk definitions by picking the first match.
Using this option will prevent TrunkConflictFunc from firing, since the first match will be returned immediately.
func WithTrunkConflict ¶ added in v1.34.0
func WithTrunkConflict(fnc TrunkConflictFunc) MatchTrunkOpt
WithTrunkConflict sets a callback that is called when two Trunks conflict.
func WithTrunkFiltered ¶ added in v1.34.0
func WithTrunkFiltered(fnc TrunkFilteredFunc) MatchTrunkOpt
WithTrunkFiltered sets a callback that is called when selected Trunk(s) doesn't match the call. If the callback returns true, trunk will not be filtered.
func WithTrunkReplace ¶ added in v1.36.0
func WithTrunkReplace(fnc TrunkReplaceFunc) MatchTrunkOpt
WithTrunkReplace sets a callback that is called to potentially replace trunks before matching runs.
type SIPTokenParams ¶ added in v1.31.0
type TrunkConflictFunc ¶ added in v1.34.0
type TrunkConflictFunc func(t1, t2 *livekit.SIPInboundTrunkInfo, reason TrunkConflictReason)
type TrunkConflictReason ¶ added in v1.34.0
type TrunkConflictReason int
func (TrunkConflictReason) String ¶ added in v1.34.0
func (i TrunkConflictReason) String() string
type TrunkFilteredFunc ¶ added in v1.34.0
type TrunkFilteredFunc func(tr *livekit.SIPInboundTrunkInfo, reason TrunkFilteredReason) bool
type TrunkFilteredReason ¶ added in v1.34.0
type TrunkFilteredReason int
func (TrunkFilteredReason) String ¶ added in v1.34.0
func (i TrunkFilteredReason) String() string
type TrunkMatchResult ¶ added in v1.39.1
type TrunkMatchResult struct {
// The matched trunk, if any
Trunk *livekit.SIPInboundTrunkInfo
// How the trunk was matched
MatchType TrunkMatchType
// Number of default trunks found
DefaultTrunkCount int
}
TrunkMatchResult provides detailed information about the trunk matching process
func MatchTrunkDetailed ¶ added in v1.39.1
func MatchTrunkDetailed(it iters.Iter[*livekit.SIPInboundTrunkInfo], call *rpc.SIPCall, opts ...MatchTrunkOpt) (*TrunkMatchResult, error)
MatchTrunkDetailed is like MatchTrunkIter but returns detailed match information
type TrunkMatchType ¶ added in v1.39.1
type TrunkMatchType int
TrunkMatchType indicates how a trunk was matched
const ( // TrunkMatchEmpty indicates no trunks were defined TrunkMatchEmpty TrunkMatchType = iota // TrunkMatchNone indicates trunks exist but none matched TrunkMatchNone // TrunkMatchDefault indicates only a default trunk (with no specific numbers) matched TrunkMatchDefault // TrunkMatchSpecific indicates a trunk with specific numbers matched TrunkMatchSpecific )
type TrunkReplaceFunc ¶ added in v1.36.0
type TrunkReplaceFunc func(t *livekit.SIPInboundTrunkInfo) *livekit.SIPInboundTrunkInfo