Documentation
¶
Index ¶
- func ClientRequestAddRecordRoute(c *Client, r *sip.Request) error
- func ClientRequestAddVia(c *Client, r *sip.Request) error
- func ClientRequestDecreaseMaxForward(c *Client, r *sip.Request) error
- func ClientResponseRemoveVia(c *Client, r *sip.Response)
- func GenerateTLSConfig(certFile string, keyFile string, rootPems []byte) (*tls.Config, error)
- type Client
- type ClientOption
- type ClientRequestOption
- type RequestHandler
- type Server
- func (srv *Server) ListenAndServe(ctx context.Context, network string, addr string) error
- func (srv *Server) ListenAndServeTLS(ctx context.Context, network string, addr string, conf *tls.Config) error
- func (srv *Server) OnAck(handler RequestHandler)
- func (srv *Server) OnBye(handler RequestHandler)
- func (srv *Server) OnCancel(handler RequestHandler)
- func (srv *Server) OnInfo(handler RequestHandler)
- func (srv *Server) OnInvite(handler RequestHandler)
- func (srv *Server) OnMessage(handler RequestHandler)
- func (srv *Server) OnNotify(handler RequestHandler)
- func (srv *Server) OnOptions(handler RequestHandler)
- func (srv *Server) OnPrack(handler RequestHandler)
- func (srv *Server) OnPublish(handler RequestHandler)
- func (srv *Server) OnRefer(handler RequestHandler)
- func (srv *Server) OnRegister(handler RequestHandler)
- func (srv *Server) OnRequest(method sip.RequestMethod, handler RequestHandler)
- func (srv *Server) OnSubscribe(handler RequestHandler)
- func (srv *Server) OnUpdate(handler RequestHandler)
- func (srv *Server) ServeRequest(f func(r *sip.Request))
- func (srv *Server) ServeResponse(f func(m *sip.Response))
- func (srv *Server) TransportLayer() *transport.Layer
- func (srv *Server) WriteResponse(r *sip.Response) error
- type ServerDialog
- type ServerOption
- type UserAgent
- type UserAgentOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientRequestAddRecordRoute ¶
ClientRequestAddRecordRoute is option for adding record route header Based on proxy setup https://www.rfc-editor.org/rfc/rfc3261#section-16
func ClientRequestAddVia ¶
ClientRequestAddVia is option for adding via header Based on proxy setup https://www.rfc-editor.org/rfc/rfc3261.html#section-16.6
func ClientRequestDecreaseMaxForward ¶ added in v0.7.0
TODO Based on proxy setup https://www.rfc-editor.org/rfc/rfc3261#section-16
func ClientResponseRemoveVia ¶
ClientResponseRemoveVia is needed when handling client transaction response, where previously used in TransactionRequest with ClientRequestAddVia
Types ¶
type Client ¶
type Client struct {
*UserAgent
// contains filtered or unexported fields
}
func (*Client) TransactionRequest ¶
func (c *Client) TransactionRequest(req *sip.Request, options ...ClientRequestOption) (sip.ClientTransaction, error)
TransactionRequest uses transaction layer to send request
func (*Client) WriteRequest ¶
func (c *Client) WriteRequest(req *sip.Request, options ...ClientRequestOption) error
WriteRequest sends request directly to transport layer
type ClientOption ¶
type RequestHandler ¶
type RequestHandler func(req *sip.Request, tx sip.ServerTransaction)
RequestHandler is a callback that will be called on the incoming request
type Server ¶
type Server struct {
*UserAgent
// contains filtered or unexported fields
}
Server is a SIP server
func NewServer ¶
func NewServer(ua *UserAgent, options ...ServerOption) (*Server, error)
NewServer creates new instance of SIP server.
func (*Server) ListenAndServe ¶ added in v0.7.0
Serve will fire all listeners. Ctx allows canceling
func (*Server) ListenAndServeTLS ¶ added in v0.7.0
func (srv *Server) ListenAndServeTLS(ctx context.Context, network string, addr string, conf *tls.Config) error
Serve will fire all listeners that are secured. Ctx allows canceling
func (*Server) OnAck ¶
func (srv *Server) OnAck(handler RequestHandler)
OnAck registers Ack request handler
func (*Server) OnBye ¶
func (srv *Server) OnBye(handler RequestHandler)
OnBye registers Bye request handler
func (*Server) OnCancel ¶
func (srv *Server) OnCancel(handler RequestHandler)
OnCancel registers Cancel request handler
func (*Server) OnInfo ¶
func (srv *Server) OnInfo(handler RequestHandler)
OnInfo registers Info request handler
func (*Server) OnInvite ¶
func (srv *Server) OnInvite(handler RequestHandler)
OnInvite registers Invite request handler
func (*Server) OnMessage ¶
func (srv *Server) OnMessage(handler RequestHandler)
OnMessage registers Message request handler
func (*Server) OnNotify ¶
func (srv *Server) OnNotify(handler RequestHandler)
OnNotify registers Notify request handler
func (*Server) OnOptions ¶
func (srv *Server) OnOptions(handler RequestHandler)
OnOptions registers Options request handler
func (*Server) OnPrack ¶
func (srv *Server) OnPrack(handler RequestHandler)
OnPrack registers Prack request handler
func (*Server) OnPublish ¶
func (srv *Server) OnPublish(handler RequestHandler)
OnPublish registers Publish request handler
func (*Server) OnRefer ¶
func (srv *Server) OnRefer(handler RequestHandler)
OnRefer registers Refer request handler
func (*Server) OnRegister ¶
func (srv *Server) OnRegister(handler RequestHandler)
OnRegister registers Register request handler
func (*Server) OnRequest ¶
func (srv *Server) OnRequest(method sip.RequestMethod, handler RequestHandler)
OnRequest registers new request callback. Can be used as generic way to add handler
func (*Server) OnSubscribe ¶
func (srv *Server) OnSubscribe(handler RequestHandler)
OnSubscribe registers Subscribe request handler
func (*Server) OnUpdate ¶
func (srv *Server) OnUpdate(handler RequestHandler)
OnUpdate registers Update request handler
func (*Server) ServeRequest ¶
ServeRequest can be used as middleware for preprocessing message
func (*Server) ServeResponse ¶
TODO can this handled better?
func (*Server) TransportLayer ¶
Transport is function to get transport layer of server Can be used for modifying
type ServerDialog ¶
type ServerDialog struct {
Server
// contains filtered or unexported fields
}
ServerDialog is extension of Server to support Dialog handling
func NewServerDialog ¶
func NewServerDialog(ua *UserAgent, options ...ServerOption) (*ServerDialog, error)
func (*ServerDialog) OnDialog ¶
func (s *ServerDialog) OnDialog(f func(d sip.Dialog))
OnDialog allows monitoring new dialogs
func (*ServerDialog) OnDialogChan ¶
func (s *ServerDialog) OnDialogChan(ch chan sip.Dialog)
OnDialogChan same as onDialog but we channel instead callback func
type ServerOption ¶
func WithLogger ¶
func WithLogger(logger zerolog.Logger) ServerOption
func WithUDPDNSResolver ¶
func WithUDPDNSResolver(dns string) ServerOption
type UserAgent ¶
type UserAgent struct {
// contains filtered or unexported fields
}
func NewUA ¶
func NewUA(options ...UserAgentOption) (*UserAgent, error)
type UserAgentOption ¶
func WithDNSResolver ¶
func WithDNSResolver(r *net.Resolver) UserAgentOption
func WithIP ¶
func WithIP(ip string) UserAgentOption
func WithUserAgent ¶
func WithUserAgent(ua string) UserAgentOption
Directories
¶
| Path | Synopsis |
|---|---|
|
example
|
|
|
dialog
command
|
|
|
proxysip
command
|
|
|
Originaly forked from github.com/StefanKopieczek/gossip by @StefanKopieczek
|
Originaly forked from github.com/StefanKopieczek/gossip by @StefanKopieczek |
|
Originally forked from https://github.com/ghettovoice/gosip by @ghetovoice
|
Originally forked from https://github.com/ghettovoice/gosip by @ghetovoice |