Documentation
¶
Overview ¶
Package gateway wires the pure SIP stack (stack + transaction + uas) into a ready-to-run UDP UAS with logrus logging. Pure signaling — import protocol/sipmedia separately when RTP/voice is needed.
Index ¶
- func InviteAnswer(req *stack.Message, localIP string, localRTPPort int, codec sdp.Codec, ...) (*stack.Message, *dialog.Dialog, error)
- func NewTag() string
- func PickCodec(offer *sdp.Info, prefer ...string) (sdp.Codec, bool)
- func Ringing(req *stack.Message, localTag string) (*stack.Message, error)
- func StartTCPListeners(ctx context.Context, ep *stack.Endpoint, cfg TCPListenerConfig) error
- type Endpoint
- func (e *Endpoint) Cancel(callID string) error
- func (e *Endpoint) Close() error
- func (e *Endpoint) Dial(ctx context.Context, req outbound.DialRequest) (string, error)
- func (e *Endpoint) Hangup(callID string) error
- func (e *Endpoint) LocalIP() string
- func (e *Endpoint) Open() error
- func (e *Endpoint) Outbound() *outbound.Manager
- func (e *Endpoint) Serve(ctx context.Context) error
- func (e *Endpoint) UAS() *UAS
- type EndpointConfig
- type TCPListenerConfig
- type UAS
- func (s *UAS) AttachOutbound(m *outbound.Manager)
- func (s *UAS) Close() error
- func (s *UAS) Endpoint() *stack.Endpoint
- func (s *UAS) LocalIP() string
- func (s *UAS) Manager() *transaction.Manager
- func (s *UAS) Open() error
- func (s *UAS) Send(msg *stack.Message, addr *net.UDPAddr) error
- func (s *UAS) Serve(ctx context.Context) error
- type UASConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InviteAnswer ¶
func InviteAnswer(req *stack.Message, localIP string, localRTPPort int, codec sdp.Codec, localTag string) (*stack.Message, *dialog.Dialog, error)
InviteAnswer builds a 200 OK INVITE response with an SDP answer and UAS To tag.
func PickCodec ¶
PickCodec chooses the first codec from offer matching a preferred name list. When no preference matches, the first offered codec is returned.
func StartTCPListeners ¶
StartTCPListeners starts background TCP/TLS accept loops until ctx is cancelled. Requests are dispatched via ep.DispatchRequest; responses use the same transaction handlers as UDP.
Types ¶
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
Endpoint is a bidirectional SIP signaling endpoint (UAS + UAC).
func NewEndpoint ¶
func NewEndpoint(cfg EndpointConfig) *Endpoint
NewEndpoint builds a combined signaling endpoint.
type EndpointConfig ¶
type EndpointConfig struct {
UASConfig
Outbound outbound.ManagerConfig
}
EndpointConfig combines inbound UAS and outbound UAC on one UDP socket.
type TCPListenerConfig ¶
type TCPListenerConfig struct {
// TCPAddr is host:port for plain TCP (empty = disabled).
TCPAddr string
// TLSAddr is host:port for TLS (empty = disabled).
TLSAddr string
TLSCert string
TLSKey string
}
TCPListenerConfig configures optional SIP-over-TCP / TLS listeners sharing UAS handlers.
type UAS ¶
type UAS struct {
// contains filtered or unexported fields
}
UAS is a minimal inbound SIP server on UDP.
func (*UAS) AttachOutbound ¶
AttachOutbound wires outbound response handling and shared Send on this UAS socket.
func (*UAS) Manager ¶
func (s *UAS) Manager() *transaction.Manager
Manager returns the transaction manager (for advanced wiring or tests).
type UASConfig ¶
type UASConfig struct {
Host string // listen IP, default 0.0.0.0
Port int // UDP port, default 5060
// Handlers are chained through the transaction layer (retransmissions, CANCEL, ACK).
Handlers uas.Handlers
// LocalIP is advertised in generated SDP answers when empty gateway picks the UDP bind address.
LocalIP string
}
UASConfig configures a UDP SIP user agent server.