dialog

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GosipAllow             = "ACK, CANCEL, BYE, OPTIONS"
	GosipAllowWithReinvite = "INVITE, ACK, CANCEL, BYE, OPTIONS"
)

Variables

View Source
var (
	ErrAddrPortAlreadySet   = errors.New("socket listen address/port can only be set once")
	ErrProxyAddressNotValid = errors.New("proxy address is not valid")
)
View Source
var (
	ErrLocalLoopDetected = errors.New("local loop detected - maxForwards exceeded")
)

Functions

func AckMatch

func AckMatch(msg, ack *sip.Msg) bool

Returns true if `ack` can be considered an appropriate response to `msg`. We don't enforce a matching Via because some VoIP software will generate a new branch for ACKs.

func ResponseMatch

func ResponseMatch(req, rsp *sip.Msg) bool

Returns true if `resp` can be considered an appropriate response to `msg`. Do not use for ACKs.

func RouteMessage

func RouteMessage(via *sip.Via, contact *sip.Addr, msg *sip.Msg) (host string, port uint16, err error)

Types

type AddressRoute

type AddressRoute struct {
	Address string
	Next    *AddressRoute
}

type Dialog

type Dialog struct {
	OnErr   <-chan error
	OnState <-chan Status
	OnPeer  <-chan *SDPWithContext
	// contains filtered or unexported fields
}

The "public" interface of a SIP dialog

func (*Dialog) Hangup added in v0.2.0

func (d *Dialog) Hangup()

type Manager

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

func NewManager

func NewManager(opts ...ManagerOption) (*Manager, error)

func (*Manager) Close

func (m *Manager) Close() error

func (*Manager) HandleIncomingMessage

func (m *Manager) HandleIncomingMessage(msg *sip.Msg)

Check if the incoming message is part of an existing transaction and send it to that transaction object to be handled

func (*Manager) IsLocalHostPort

func (m *Manager) IsLocalHostPort(uri *sip.URI) bool

func (*Manager) LocalPort

func (m *Manager) LocalPort() uint16

LocalPort returns the local port number that is being used to receive SIP traffic

func (*Manager) NewAck

func (m *Manager) NewAck(msg, invite *sip.Msg) *sip.Msg

http://tools.ietf.org/html/rfc3261#section-17.1.1.3

func (*Manager) NewBye

func (m *Manager) NewBye(invite, remote *sip.Msg, lSeq *int) *sip.Msg

func (*Manager) NewCancel

func (m *Manager) NewCancel(invite *sip.Msg) *sip.Msg

func (*Manager) NewDialog

func (m *Manager) NewDialog(invite *sip.Msg) (*Dialog, error)

Create a new SIP dialog record and send the INVITE

func (*Manager) NewResponse

func (m *Manager) NewResponse(msg *sip.Msg, status int) *sip.Msg

func (*Manager) PopulateMessage

func (m *Manager) PopulateMessage(via *sip.Via, contact *sip.Addr, msg *sip.Msg)

Fill in any missing message fields

func (*Manager) PublicAddress

func (m *Manager) PublicAddress() netip.Addr

PublicAddress returns the configured public IP address, if configured, or the local IP address that is being used to receive SIP traffic

func (*Manager) PublicPort

func (m *Manager) PublicPort() uint16

PublicPort returns the configured port, if configured, or the local port that is being used to receive SIP traffic

func (*Manager) ReceiveMessages

func (m *Manager) ReceiveMessages()

func (*Manager) RouteAddress

func (m *Manager) RouteAddress(host string, port uint16, wantSRV bool) (routes *AddressRoute, err error)

func (*Manager) Send

func (m *Manager) Send(msg *sip.Msg) error

type ManagerOption

type ManagerOption func(*Manager) error

func WithAllowReinvite added in v0.3.2

func WithAllowReinvite(allow bool) ManagerOption

func WithGroupLogger added in v0.2.0

func WithGroupLogger(logger *slog.Logger, groupName string) ManagerOption

func WithListenAddrPort

func WithListenAddrPort(a netip.AddrPort) ManagerOption

Select the local listening address and port

func WithListenPort

func WithListenPort(port uint16) ManagerOption

Select the local listening port (on all addresses)

func WithListenString

func WithListenString(address string) ManagerOption

Select the local listening address:port

func WithMaxResends

func WithMaxResends(num int) ManagerOption

func WithProxyAddrPort

func WithProxyAddrPort(a netip.AddrPort) ManagerOption

func WithPublicAddrPort

func WithPublicAddrPort(a netip.AddrPort) ManagerOption

func WithPublicAddrPortString

func WithPublicAddrPortString(s string) ManagerOption

func WithRawTrace

func WithRawTrace(val bool) ManagerOption

func WithResendInterval

func WithResendInterval(interval time.Duration) ManagerOption

func WithResendIntervalMilliseconds

func WithResendIntervalMilliseconds(interval int) ManagerOption

func WithTimestampTags

func WithTimestampTags(val bool) ManagerOption

func WithUserAgent

func WithUserAgent(ua string) ManagerOption

type SDPWithContext added in v0.3.0

type SDPWithContext struct {
	Payload *sdp.SDP
	Msg     *sip.Msg
}

type Status

type Status int
const (
	StatusProceeding Status = iota + 1
	StatusRinging
	StatusAnswered
	StatusHangup
	StatusFailed
)

Jump to

Keyboard shortcuts

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