stack

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultUserAgent .
	DefaultUserAgent = "Go SipStack/1.0.0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type RequestHandler

type RequestHandler func(req sip.Request, tx sip.ServerTransaction)

RequestHandler is a callback that will be called on the incoming request of the certain method tx argument can be nil for 2xx ACK request

type RequiresChallengeHandler

type RequiresChallengeHandler func(req sip.Request) bool

RequiresChallengeHandler will check if each request requires 401/407 authentication.

type ServerAuthManager

type ServerAuthManager struct {
	Authenticator     *auth.ServerAuthorizer
	RequiresChallenge RequiresChallengeHandler
}

ServerAuthManager .

type SipStack

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

SipStack a golang SIP Stack

func NewSipStack

func NewSipStack(config *SipStackConfig) *SipStack

NewSipStack creates new instance of SipStack.

func (*SipStack) AckInviteRequest

func (s *SipStack) AckInviteRequest(request sip.Request, response sip.Response)

func (*SipStack) CancelRequest

func (s *SipStack) CancelRequest(request sip.Request, response sip.Response)

func (*SipStack) GetNetworkInfo

func (s *SipStack) GetNetworkInfo(protocol string) *transport.Target

func (*SipStack) Listen

func (s *SipStack) Listen(protocol string, listenAddr string) error

func (*SipStack) ListenTLS

func (s *SipStack) ListenTLS(protocol string, listenAddr string, options *transport.TLSConfig) error

ListenTLS starts serving listeners on the provided address

func (*SipStack) Log

func (s *SipStack) Log() log.Logger

Log .

func (*SipStack) OnConnectionError

func (s *SipStack) OnConnectionError(handler func(err *transport.ConnectionError))

func (*SipStack) OnRequest

func (s *SipStack) OnRequest(method sip.RequestMethod, handler RequestHandler) error

OnRequest registers new request callback

func (*SipStack) RememberInviteRequest

func (s *SipStack) RememberInviteRequest(request sip.Request)

func (*SipStack) Request

func (s *SipStack) Request(req sip.Request) (sip.ClientTransaction, error)

Request Send SIP message

func (*SipStack) Respond

func (s *SipStack) Respond(res sip.Response) (sip.ServerTransaction, error)

Respond .

func (*SipStack) RespondOnRequest

func (s *SipStack) RespondOnRequest(
	request sip.Request,
	status sip.StatusCode,
	reason, body string,
	headers []sip.Header,
) (sip.ServerTransaction, error)

func (*SipStack) Send

func (s *SipStack) Send(msg sip.Message) error

Send .

func (*SipStack) Shutdown

func (s *SipStack) Shutdown()

Shutdown gracefully shutdowns SIP server

type SipStackConfig

type SipStackConfig struct {
	// Public IP address or domain name, if empty auto resolved IP will be used.
	Host string
	// Dns is an address of the public DNS server to use in SRV lookup.
	Dns               string
	Extensions        []string
	MsgMapper         sip.MessageMapper
	ServerAuthManager ServerAuthManager
	UserAgent         string
}

SipStackConfig describes available options

Jump to

Keyboard shortcuts

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