sip

package
v0.0.0-...-eec0033 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entity

type Entity struct {
	Username           string           `astconf:"-"`
	Templates          []string         `astconf:"-"`
	Type               Type             `astconf:"type"`
	AccountCode        string           `astconf:"accountcode,omitempty"`
	Disallow           []string         `astconf:"disallow,omitempty"`
	Allow              []string         `astconf:"allow,omitempty"`
	AllowGuest         astval.YesNoNone `astconf:"allowguest,omitempty"`
	AccountingFlags    string           `astconf:"amaflags,omitempty"`
	AsteriskDB         string           `astconf:"astdb,omitempty"`
	Auth               string           `astconf:"auth,omitempty"`
	BusyLevel          int              `astconf:"busylevel,omitempty"`
	CallLimit          int              `astconf:"call-limit,omitempty"`
	CallGroup          string           `astconf:"callgroup,omitempty"` // FIXME: Use a slice of something?
	CallerID           string           `astconf:"callerid,omitempty"`
	CallerPresentation string           `astconf:"callingpres,omitempty"`
	DirectMedia        string           `astconf:"directmedia,omitempty"`
	DirectMediaPermit  []string         `astconf:"directmediapermit,omitempty"`
	DirectMediaDeny    []string         `astconf:"directmediadeny,omitempty"`
	Context            string           `astconf:"context,omitempty"`
	Host               string           `astconf:"host,omitempty"`
	Transport          []string         `astconf:"transport,commaseparated,omitempty"`
	Mailbox            string           `astconf:"mailbox,omitempty"`
	Secret             string           `astconf:"secret,omitempty"`
	Variables          []astval.Var     `astconf:"setvar,omitempty"`
}

Entity is a sip entity.

TODO: Add the rest of the possible fields.

func MergeEntities

func MergeEntities(entities ...Entity) (merged Entity)

MergeEntities returns the merged configuration of all the given entities, in order of priority from least to greatest.

func OverlayEntities

func OverlayEntities(entities ...Entity) (overlayed Entity)

OverlayEntities returns the overlayed configuration of all the given entities, in order of priority from least to greatest.

func (*Entity) SectionName

func (e *Entity) SectionName() string

SectionName returns the name of the section that the entity belongs to.

func (*Entity) SectionTemplates

func (e *Entity) SectionTemplates() []string

SectionTemplates returns the section templates used by an entity.

type EntityMap

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

EntityMap is an ordered map of entities, indexed by entity username.

It should not be copied by value.

An empty entity map is ready for use.

func (*EntityMap) Add

func (m *EntityMap) Add(entity Entity) bool

Add adds an entity to the map. If the map already contains an entry with the entity's username, the map is not changed.

Add returns true if the entity was added to the map.

func (*EntityMap) Contains

func (m *EntityMap) Contains(username string) bool

Contains returns true if the map contains an entity with the given username.

func (*EntityMap) Entities

func (m *EntityMap) Entities() []Entity

Entities returns a slice of all entities in the map.

func (*EntityMap) Entity

func (m *EntityMap) Entity(username string) (entity Entity, ok bool)

Entity returns the entity with the given username.

func (*EntityMap) Merge

func (m *EntityMap) Merge(entity Entity)

Merge adds an entity to the map. If the map already contains an entry with the entity's username, the entries are merged.

func (*EntityMap) Overlay

func (m *EntityMap) Overlay(entity Entity)

Overlay adds an entity to the map. If the map already contains an entry with the entity's username, the entries are overlayed, with priority given to the new entry.

type Type

type Type int

Type is a sip entity type.

The zero value of Type is a valid Default value that is equivalent to Peer. The only difference between Default and Peer is that Default values will not take precedence when types are overlayed.

const (
	Default Type = 0
	Peer    Type = 1
	User    Type = 2
	Friend  Type = 3
)

Sip entity types.

func (Type) MarshalText

func (t Type) MarshalText() (text []byte, err error)

MarshalText returns a string representation of t marshaled as utf-8 bytes. It never returns an error.

func (Type) Specified

func (t Type) Specified() bool

Specified returns true if t holds a non-default value.

func (Type) String

func (t Type) String() string

String returns a string representation of the entity type.

Jump to

Keyboard shortcuts

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