endpoint

package
v1.0.1-0...-c50d641 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2020 License: MIT Imports: 15 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 EndPoint

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

EndPoint is a SIP Client/Server

func NewEndPoint

func NewEndPoint(config *EndPointConfig, logger log.Logger) *EndPoint

NewEndPoint creates new instance of SIP server.

func (*EndPoint) AckInviteRequest

func (e *EndPoint) AckInviteRequest(request sip.Request, response sip.Response)

func (*EndPoint) CancelRequest

func (e *EndPoint) CancelRequest(request sip.Request, response sip.Response)

func (EndPoint) GetNetworkInfo

func (e EndPoint) GetNetworkInfo(protocol string) *transport.Target

func (*EndPoint) Listen

func (e *EndPoint) Listen(protocol string, listenAddr string) error

Listen ListenAndServe starts serving listeners on the provided address

func (*EndPoint) Log

func (e *EndPoint) Log() log.Logger

Log .

func (*EndPoint) OnRequest

func (e *EndPoint) OnRequest(method sip.RequestMethod, handler RequestHandler) error

OnRequest registers new request callback

func (*EndPoint) RememberInviteRequest

func (e *EndPoint) RememberInviteRequest(request sip.Request)

func (*EndPoint) Request

func (e *EndPoint) Request(req sip.Request) (sip.ClientTransaction, error)

Request Send SIP message

func (*EndPoint) RequestWithContext

func (e *EndPoint) RequestWithContext(ctx context.Context, request sip.Request, authorizer sip.Authorizer) (sip.Response, error)

RequestWithContext .

func (*EndPoint) Respond

func (e *EndPoint) Respond(res sip.Response) (sip.ServerTransaction, error)

Respond .

func (*EndPoint) RespondOnRequest

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

RespondOnRequest .

func (*EndPoint) Send

func (e *EndPoint) Send(msg sip.Message) error

Send .

func (*EndPoint) Shutdown

func (e *EndPoint) Shutdown()

Shutdown gracefully shutdowns SIP server

type EndPointConfig

type EndPointConfig 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
}

EndPointConfig describes available options

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 .

Jump to

Keyboard shortcuts

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