Documentation ¶
Index ¶
- Constants
- Variables
- func AckMatch(msg, ack *sip.Msg) bool
- func ResponseMatch(req, rsp *sip.Msg) bool
- func RouteMessage(via *sip.Via, contact *sip.Addr, msg *sip.Msg) (host string, port uint16, err error)
- type AddressRoute
- type Dialog
- type Manager
- func (m *Manager) Close() error
- func (m *Manager) HandleIncomingMessage(msg *sip.Msg)
- func (m *Manager) IsLocalHostPort(uri *sip.URI) bool
- func (m *Manager) LocalPort() uint16
- func (m *Manager) NewAck(msg, invite *sip.Msg) *sip.Msg
- func (m *Manager) NewBye(invite, remote *sip.Msg, lSeq *int) *sip.Msg
- func (m *Manager) NewCancel(invite *sip.Msg) *sip.Msg
- func (m *Manager) NewDialog(invite *sip.Msg) (*Dialog, error)
- func (m *Manager) NewResponse(msg *sip.Msg, status int) *sip.Msg
- func (m *Manager) PopulateMessage(via *sip.Via, contact *sip.Addr, msg *sip.Msg)
- func (m *Manager) PublicAddress() netip.Addr
- func (m *Manager) PublicPort() uint16
- func (m *Manager) ReceiveMessages()
- func (m *Manager) RouteAddress(host string, port uint16, wantSRV bool) (routes *AddressRoute, err error)
- func (m *Manager) Send(msg *sip.Msg) error
- type ManagerOption
- func WithAllowReinvite(allow bool) ManagerOption
- func WithGroupLogger(logger *slog.Logger, groupName string) ManagerOption
- func WithListenAddrPort(a netip.AddrPort) ManagerOption
- func WithListenPort(port uint16) ManagerOption
- func WithListenString(address string) ManagerOption
- func WithMaxResends(num int) ManagerOption
- func WithProxyAddrPort(a netip.AddrPort) ManagerOption
- func WithPublicAddrPort(a netip.AddrPort) ManagerOption
- func WithPublicAddrPortString(s string) ManagerOption
- func WithRawTrace(val bool) ManagerOption
- func WithResendInterval(interval time.Duration) ManagerOption
- func WithResendIntervalMilliseconds(interval int) ManagerOption
- func WithTimestampTags(val bool) ManagerOption
- func WithUserAgent(ua string) ManagerOption
- type SDPWithContext
- type Status
Constants ¶
const ( GosipAllow = "ACK, CANCEL, BYE, OPTIONS" GosipAllowWithReinvite = "INVITE, ACK, CANCEL, BYE, OPTIONS" )
Variables ¶
var ( ErrAddrPortAlreadySet = errors.New("socket listen address/port can only be set once") ErrProxyAddressNotValid = errors.New("proxy address is not valid") )
var (
ErrLocalLoopDetected = errors.New("local loop detected - maxForwards exceeded")
)
Functions ¶
func AckMatch ¶
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 ¶
Returns true if `resp` can be considered an appropriate response to `msg`. Do not use for ACKs.
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
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(opts ...ManagerOption) (*Manager, error)
func (*Manager) HandleIncomingMessage ¶
Check if the incoming message is part of an existing transaction and send it to that transaction object to be handled
func (*Manager) LocalPort ¶
LocalPort returns the local port number that is being used to receive SIP traffic
func (*Manager) PopulateMessage ¶
Fill in any missing message fields
func (*Manager) PublicAddress ¶
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 ¶
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 ¶
type ManagerOption ¶
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