gosip

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: BSD-2-Clause Imports: 12 Imported by: 0

README

gosip

SIP stack in Go (RFC 3261)

Build Status Coverage Status

PROJECT IS UNDER DEVELOPMENT

Inspired by:

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "0.0.0"

Version is the current gosip package version

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 RequestWithContextOption

type RequestWithContextOption interface {
	ApplyRequestWithContext(options *RequestWithContextOptions)
}

func WithAuthorizer

func WithAuthorizer(authorizer sip.Authorizer) RequestWithContextOption

func WithResponseHandler

func WithResponseHandler(handler func(res sip.Response, request sip.Request)) RequestWithContextOption

type RequestWithContextOptions

type RequestWithContextOptions struct {
	ResponseHandler func(res sip.Response, request sip.Request)
	Authorizer      sip.Authorizer
}

type Server

type Server interface {
	Shutdown()

	Listen(network, addr string, options ...transport.ListenOption) error
	Send(msg sip.Message) error

	Request(req sip.Request) (sip.ClientTransaction, error)
	RequestWithContext(
		ctx context.Context,
		request sip.Request,
		options ...RequestWithContextOption,
	) (sip.Response, error)
	OnRequest(method sip.RequestMethod, handler RequestHandler) error

	Respond(res sip.Response) (sip.ServerTransaction, error)
	RespondOnRequest(
		request sip.Request,
		status sip.StatusCode,
		reason, body string,
		headers []sip.Header,
	) (sip.ServerTransaction, error)
}

func NewServer

func NewServer(
	config ServerConfig,
	tpFactory TransportLayerFactory,
	txFactory TransactionLayerFactory,
	logger log.Logger,
) Server

NewServer creates new instance of SIP server.

type ServerConfig

type ServerConfig 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
	UserAgent  string
}

ServerConfig describes available options

type TransactionLayerFactory

type TransactionLayerFactory func(tpl sip.Transport, logger log.Logger) transaction.Layer

type TransportLayerFactory

type TransportLayerFactory func(
	ip net.IP,
	dnsResolver *net.Resolver,
	msgMapper sip.MessageMapper,
	logger log.Logger,
) transport.Layer

Directories

Path Synopsis
examples
sip
parser
Forked from github.com/StefanKopieczek/gossip by @StefanKopieczek
Forked from github.com/StefanKopieczek/gossip by @StefanKopieczek
Forked from github.com/StefanKopieczek/gossip by @StefanKopieczek
Forked from github.com/StefanKopieczek/gossip by @StefanKopieczek
transaction package implements SIP Transaction Layer
transaction package implements SIP Transaction Layer
transport package implements SIP transport layer.
transport package implements SIP transport layer.
Forked from github.com/StefanKopieczek/gossip by @StefanKopieczek
Forked from github.com/StefanKopieczek/gossip by @StefanKopieczek

Jump to

Keyboard shortcuts

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