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 ¶
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 ¶
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 ¶
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 ¶
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
func ValidateDispatchRules(rules []*livekit.SIPDispatchRuleInfo, opts ...MatchDispatchRuleOpt) error
ValidateDispatchRules checks a set of dispatch rules for conflicts.
Deprecated: use ValidateDispatchRulesIter
func ValidateDispatchRulesIter ¶
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
func ValidateTrunks(trunks []*livekit.SIPInboundTrunkInfo, opts ...MatchTrunkOpt) error
ValidateTrunks checks a set of trunks for conflicts.
Deprecated: use ValidateTrunksIter
func ValidateTrunksIter ¶
func ValidateTrunksIter(it iters.Iter[*livekit.SIPInboundTrunkInfo], opts ...MatchTrunkOpt) error
ValidateTrunksIter checks a set of trunks for conflicts.
Types ¶
type DispatchRuleConflictFunc ¶
type DispatchRuleConflictFunc func(r1, r2 *livekit.SIPDispatchRuleInfo, reason DispatchRuleConflictReason)
type DispatchRuleConflictReason ¶
type DispatchRuleConflictReason int
func (DispatchRuleConflictReason) String ¶
func (i DispatchRuleConflictReason) String() string
type DispatchRuleReplaceFunc ¶
type DispatchRuleReplaceFunc func(r *livekit.SIPDispatchRuleInfo) *livekit.SIPDispatchRuleInfo
type DispatchRuleValidator ¶
type DispatchRuleValidator struct {
// contains filtered or unexported fields
}
func NewDispatchRuleValidator ¶
func NewDispatchRuleValidator(opts ...MatchDispatchRuleOpt) *DispatchRuleValidator
func (*DispatchRuleValidator) Validate ¶
func (v *DispatchRuleValidator) Validate(r *livekit.SIPDispatchRuleInfo) error
func (*DispatchRuleValidator) ValidateIter ¶
func (v *DispatchRuleValidator) ValidateIter(it iters.Iter[*livekit.SIPDispatchRuleInfo]) iters.Iter[*livekit.SIPDispatchRuleInfo]
type ErrNoDispatchMatched ¶
func (*ErrNoDispatchMatched) Error ¶
func (e *ErrNoDispatchMatched) Error() string
type MatchDispatchRuleOpt ¶
type MatchDispatchRuleOpt func(opt *matchDispatchRuleOpts)
func WithAllowDispatchRuleConflicts ¶
func WithAllowDispatchRuleConflicts() MatchDispatchRuleOpt
WithAllowDispatchRuleConflicts allows conflicting DispatchRule definitions.
func WithDispatchRuleConflict ¶
func WithDispatchRuleConflict(fnc DispatchRuleConflictFunc) MatchDispatchRuleOpt
WithDispatchRuleConflict sets a callback that is called when two DispatchRules conflict.
func WithDispatchRuleReplace ¶
func WithDispatchRuleReplace(fnc DispatchRuleReplaceFunc) MatchDispatchRuleOpt
WithDispatchRuleReplace sets a callback that is called to potentially replace dispatch rules before matching runs.
type MatchTrunkOpt ¶
type MatchTrunkOpt func(opt *matchTrunkOpts)
func WithAllowTrunkConflicts ¶
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 ¶
func WithTrunkConflict(fnc TrunkConflictFunc) MatchTrunkOpt
WithTrunkConflict sets a callback that is called when two Trunks conflict.
func WithTrunkFiltered ¶
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 ¶
func WithTrunkReplace(fnc TrunkReplaceFunc) MatchTrunkOpt
WithTrunkReplace sets a callback that is called to potentially replace trunks before matching runs.
type SIPTokenParams ¶
type TrunkConflictFunc ¶
type TrunkConflictFunc func(t1, t2 *livekit.SIPInboundTrunkInfo, reason TrunkConflictReason)
type TrunkConflictReason ¶
type TrunkConflictReason int
func (TrunkConflictReason) String ¶
func (i TrunkConflictReason) String() string
type TrunkFilteredFunc ¶
type TrunkFilteredFunc func(tr *livekit.SIPInboundTrunkInfo, reason TrunkFilteredReason) bool
type TrunkFilteredReason ¶
type TrunkFilteredReason int
func (TrunkFilteredReason) String ¶
func (i TrunkFilteredReason) String() string
type TrunkMatchResult ¶
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 ¶
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 ¶
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 ¶
type TrunkReplaceFunc func(t *livekit.SIPInboundTrunkInfo) *livekit.SIPInboundTrunkInfo