Versions in this module Expand all Collapse all v0 v0.22.3 Sep 2, 2024 Changes in this version + var ErrDialogCanceled = errors.New("Dialog canceled") + var ErrDialogDoesNotExists = errors.New("Dialog Does Not Exist") + var ErrDialogInviteNoContact = errors.New("No Contact header") + var ErrDialogOutsideDialog = errors.New("Call/Transaction outside dialog") + var ListenReadyCtxKey = "ListenReadyCtxKey" + func ClientRequestAddRecordRoute(c *Client, r *sip.Request) error + func ClientRequestAddVia(c *Client, r *sip.Request) error + func ClientRequestBuild(c *Client, r *sip.Request) error + func ClientRequestDecreaseMaxForward(c *Client, r *sip.Request) error + func GenerateTLSConfig(certFile string, keyFile string, rootPems []byte) (*tls.Config, error) + func Init() + type AnswerOptions struct + OnResponse func(res *sip.Response) + Password string + Username string + type Client struct + func NewClient(ua *UserAgent, options ...ClientOption) (*Client, error) + func (c *Client) Close() error + func (c *Client) DoDigestAuth(ctx context.Context, req *sip.Request, res *sip.Response, auth DigestAuth) (sip.ClientTransaction, error) + func (c *Client) GetHostname() string + func (c *Client) TransactionRequest(ctx context.Context, req *sip.Request, options ...ClientRequestOption) (sip.ClientTransaction, error) + func (c *Client) WriteRequest(req *sip.Request, options ...ClientRequestOption) error + type ClientOption func(c *Client) error + func WithClientAddr(addr string) ClientOption + func WithClientHostname(hostname string) ClientOption + func WithClientLogger(logger zerolog.Logger) ClientOption + func WithClientNAT() ClientOption + func WithClientPort(port int) ClientOption + type ClientRequestOption func(c *Client, req *sip.Request) error + type Dialog struct + ID string + InviteRequest *sip.Request + InviteResponse *sip.Response + func (d *Dialog) Body() []byte + func (d *Dialog) Context() context.Context + func (d *Dialog) Done() <-chan struct{} + func (d *Dialog) State() <-chan sip.DialogState + type DialogClient struct + func NewDialogClient(client *Client, contactHDR sip.ContactHeader) *DialogClient + func (c *DialogClient) Invite(ctx context.Context, recipient sip.Uri, body []byte, headers ...sip.Header) (*DialogClientSession, error) + func (c *DialogClient) ReadBye(req *sip.Request, tx sip.ServerTransaction) error + func (c *DialogClient) ReadRefer(req *sip.Request, tx sip.ServerTransaction, referUri *sip.Uri) (*DialogClientSession, error) + func (c *DialogClient) WriteInvite(ctx context.Context, inviteRequest *sip.Request) (*DialogClientSession, error) + type DialogClientSession struct + func (s *DialogClientSession) Ack(ctx context.Context) error + func (s *DialogClientSession) Bye(ctx context.Context) error + func (s *DialogClientSession) Close() error + func (s *DialogClientSession) TransactionRequest(ctx context.Context, req *sip.Request) (sip.ClientTransaction, error) + func (s *DialogClientSession) WaitAnswer(ctx context.Context, opts AnswerOptions) error + func (s *DialogClientSession) WriteAck(ctx context.Context, ack *sip.Request) error + func (s *DialogClientSession) WriteBye(ctx context.Context, bye *sip.Request) error + func (s *DialogClientSession) WriteRequest(req *sip.Request) error + type DialogServer struct + func NewDialogServer(client *Client, contactHDR sip.ContactHeader) *DialogServer + func (s *DialogServer) ReadAck(req *sip.Request, tx sip.ServerTransaction) error + func (s *DialogServer) ReadBye(req *sip.Request, tx sip.ServerTransaction) error + func (s *DialogServer) ReadInvite(req *sip.Request, tx sip.ServerTransaction) (*DialogServerSession, error) + type DialogServerSession struct + func (s *DialogServerSession) Bye(ctx context.Context) error + func (s *DialogServerSession) Close() error + func (s *DialogServerSession) Respond(statusCode sip.StatusCode, reason string, body []byte, headers ...sip.Header) error + func (s *DialogServerSession) RespondSDP(sdp []byte) error + func (s *DialogServerSession) TransactionRequest(ctx context.Context, req *sip.Request) (sip.ClientTransaction, error) + func (s *DialogServerSession) WriteRequest(req *sip.Request) error + func (s *DialogServerSession) WriteResponse(res *sip.Response) error + type DigestAuth struct + Password string + Username string + type ErrDialogResponse struct + Res *sip.Response + func (e ErrDialogResponse) Error() string + type ListenReadyCtxValue chan struct + type RequestHandler func(req *sip.Request, tx sip.ServerTransaction) + type Server struct + func NewServer(ua *UserAgent, options ...ServerOption) (*Server, error) + func (srv *Server) Close() error + 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) OnNoRoute(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) RegisteredMethods() []string + func (srv *Server) ServeRequest(f func(r *sip.Request)) + func (srv *Server) ServeTCP(l net.Listener) error + func (srv *Server) ServeTLS(l net.Listener) error + func (srv *Server) ServeUDP(l net.PacketConn) error + func (srv *Server) ServeWS(l net.Listener) error + func (srv *Server) ServeWSS(l net.Listener) error + func (srv *Server) TransportLayer() *sip.TransportLayer + func (srv *Server) WriteResponse(r *sip.Response) error + type ServerOption func(s *Server) error + func WithServerLogger(logger zerolog.Logger) ServerOption + type UserAgent struct + func NewUA(options ...UserAgentOption) (*UserAgent, error) + func (ua *UserAgent) Close() error + func (ua *UserAgent) GetIP() net.IP + func (ua *UserAgent) Name() string + func (ua *UserAgent) TransactionLayer() *sip.TransactionLayer + func (ua *UserAgent) TransportLayer() *sip.TransportLayer + type UserAgentOption func(s *UserAgent) error + func WithUserAgenTLSConfig(c *tls.Config) UserAgentOption + func WithUserAgent(ua string) UserAgentOption + func WithUserAgentDNSResolver(r *net.Resolver) UserAgentOption + func WithUserAgentHostname(hostname string) UserAgentOption + func WithUserAgentParser(p *sip.Parser) UserAgentOption