Documentation
¶
Index ¶
- Constants
- func ASCIIToLower(s string) string
- func ASCIIToLowerInPlace(s []byte)
- func CopyHeaders(name string, from, to Message)
- func CopyRoutingHeaders(newReq *Request, inviteRequest *Request, inviteResponse *Response, ...)
- func DefaultPort(transport string) int
- func DialogStateString(state int) string
- func GenerateBranch() string
- func GenerateBranchN(n int) string
- func GenerateTagN(n int) string
- func HeaderToLower(s string) string
- func MessageShortString(msg Message) string
- func NonceWrite(buf []byte)
- func ParseAddr(addr string) (host string, port int, err error)
- func ResolveSelfIP() (net.IP, error)
- type CSeqHeader
- type CallIDHeader
- type ClientTransaction
- type ContactHeader
- type ContentLengthHeader
- type ContentTypeHeader
- type CopyHeader
- type Dialog
- type ExpiresHeader
- type FromHeader
- type Header
- type HeaderKV
- type HeaderParams
- type MaxForwardsHeader
- type Message
- type MessageHandler
- type Parser
- type RecordRouteHeader
- type Request
- func NewAckRequest(inviteRequest *Request, inviteResponse *Response, body []byte) *Request
- func NewByeRequest(inviteRequest *Request, inviteResponse *Response, body []byte) *Request
- func NewCancelRequest(requestForCancel *Request) *Request
- func NewRequest(method RequestMethod, recipient Uri) *Request
- type RequestMethod
- type Response
- type RouteHeader
- type ServerTransaction
- type StatusCode
- type ToHeader
- type Transaction
- type Transport
- type Uri
- type ViaHeader
Constants ¶
const ( // Dialog received 200 response DialogStateEstablished = iota // Dialog received ACK DialogStateConfirmed // Dialog received BYE DialogStateEnded )
const ( INVITE = sipgo.INVITE ACK = sipgo.ACK CANCEL = sipgo.CANCEL BYE = sipgo.BYE REGISTER = sipgo.REGISTER OPTIONS = sipgo.OPTIONS SUBSCRIBE = sipgo.SUBSCRIBE NOTIFY = sipgo.NOTIFY REFER = sipgo.REFER INFO = sipgo.INFO MESSAGE = sipgo.MESSAGE PRACK = sipgo.PRACK UPDATE = sipgo.UPDATE PUBLISH = sipgo.PUBLISH )
method names are defined here as constants for convenience.
Variables ¶
This section is empty.
Functions ¶
func ASCIIToLower ¶
ASCIIToLower is faster than go version. It avoids one more loop
func ASCIIToLowerInPlace ¶
func ASCIIToLowerInPlace(s []byte)
func CopyHeaders ¶
Copy all headers of one type from one message to another. Appending to any headers that were already there.
func CopyRoutingHeaders ¶
func CopyRoutingHeaders(newReq *Request, inviteRequest *Request, inviteResponse *Response, isOriginalUAC bool)
inviteRequest is the original dialog-establishing INVITE request, inviteResponse is the 2xx INVITE response, which should contain a permanent routing set, if any. isOriginalUAC should be true if newReq is being generated by the UAC (og sender) to be sent to UAS (og receiver)
func DefaultPort ¶
DefaultPort returns transport default port by network.
func DialogStateString ¶
DialogStateString maps state to string
func GenerateBranchN ¶
GenerateBranchN returns random unique branch ID in format MagicCookie.<n chars>
func GenerateTagN ¶
func MessageShortString ¶
MessageShortString dumps short version of msg. Used only for logging
func NonceWrite ¶
func NonceWrite(buf []byte)
func ResolveSelfIP ¶
Forked from github.com/StefanKopieczek/gossip by @StefanKopieczek
Types ¶
type CallIDHeader ¶
type CallIDHeader = sipgo.CallIDHeader
CallIDHeader is a Call-ID header presentation
type ClientTransaction ¶
type ClientTransaction interface {
Transaction
// Responses returns channel with all responses for transaction
Responses() <-chan *Response
// Cancel sends cancel request
Cancel() error
}
type ContactHeader ¶
type ContactHeader = sipgo.ContactHeader
ContactHeader is Contact header representation
type ContentLengthHeader ¶
type ContentLengthHeader = sipgo.ContentLengthHeader
ContentLengthHeader is Content-Length header representation
type ContentTypeHeader ¶
type ContentTypeHeader = sipgo.ContentTypeHeader
ContentTypeHeader is Content-Type header representation.
type CopyHeader ¶
type CopyHeader interface {
// contains filtered or unexported methods
}
CopyHeader is internal interface for cloning headers. Maybe it will be full exposed later
type Dialog ¶
type Dialog struct {
// ID created by FROM tag, TO tag and Callid
ID string
// State of dialog. Check more for DialogState... constants
State int
}
Dialog is data structure represanting dialog
func (*Dialog) StateString ¶
StateString returns string version of state established, confirmed, ended
type ExpiresHeader ¶
type ExpiresHeader = sipgo.ExpiresHeader
ExpiresHeader is Expires header representation
type FromHeader ¶
type FromHeader = sipgo.FromHeader
type Header ¶
Header is a single SIP header.
func HeaderClone ¶
HeaderClone is generic function for cloning header
type HeaderParams ¶
type HeaderParams = sipgo.HeaderParams
HeaderParams are key value params. They do not provide order by default due to performance reasons
func NewParams ¶
func NewParams() HeaderParams
type MaxForwardsHeader ¶
type MaxForwardsHeader = sipgo.MaxForwardsHeader
MaxForwardsHeader is Max-Forwards header representation
type MessageHandler ¶
type MessageHandler func(msg Message)
type Parser ¶
The buffer size of the parser input channel. Parser is interface for decoding full message into sip message
type RecordRouteHeader ¶
type RecordRouteHeader = sipgo.RecordRouteHeader
RecordRouteHeader is Record-Route header representation.
type Request ¶
Request RFC 3261 - 7.1.
func NewAckRequest ¶
NewAckRequest creates ACK request for an INVITE response For 2xx: https://tools.ietf.org/html/rfc3261#section-13.2.2.4 For non-2xx: https://datatracker.ietf.org/doc/html/rfc3261#section-17.1.1.3
func NewByeRequest ¶
NewByeRequest creates bye request from invite TODO do some testing
func NewCancelRequest ¶
func NewRequest ¶
func NewRequest(method RequestMethod, recipient Uri) *Request
type RequestMethod ¶
type RequestMethod = sipgo.RequestMethod
type Response ¶
Response RFC 3261 - 7.2.
func CopyResponse ¶
func NewResponse ¶
func NewResponse(statusCode StatusCode, reason string) *Response
NewResponse creates base structure of response.
func NewResponseFromRequest ¶
func NewResponseFromRequest(req *Request, statusCode StatusCode, reason string, body []byte) *Response
RFC 3261 - 8.2.6
func NewSDPResponseFromRequest ¶
NewSDPResponseFromRequest is wrapper for 200 response with SDP body
type ServerTransaction ¶
type ServerTransaction interface {
Transaction
Respond(res *Response) error
Acks() <-chan *Request
Cancels() <-chan *Request
}
type StatusCode ¶
type StatusCode = int
StatusCode - response status code: 1xx - 6xx
const ( // https://datatracker.ietf.org/doc/html/rfc3261#section-21 StatusTrying StatusCode = 100 StatusRinging StatusCode = 180 StatusCallIsForwarded StatusCode = 181 StatusQueued StatusCode = 182 StatusSessionInProgress StatusCode = 183 StatusOK StatusCode = 200 StatusMovedPermanently StatusCode = 301 StatusMovedTemporarily StatusCode = 302 StatusUseProxy StatusCode = 305 StatusBadRequest StatusCode = 400 StatusPaymentRequired StatusCode = 402 StatusForbidden StatusCode = 403 StatusNotFound StatusCode = 404 StatusMethodNotAllowed StatusCode = 405 StatusNotAcceptable StatusCode = 406 StatusProxyAuthRequired StatusCode = 407 StatusRequestTimeout StatusCode = 408 StatusConflict StatusCode = 409 StatusGone StatusCode = 410 StatusRequestEntityTooLarge StatusCode = 413 StatusRequestURITooLong StatusCode = 414 StatusUnsupportedMediaType StatusCode = 415 StatusRequestedRangeNotSatisfiable StatusCode = 416 StatusBadExtension StatusCode = 420 StatusExtensionRequired StatusCode = 421 StatusIntervalToBrief StatusCode = 423 StatusCallTransactionDoesNotExists StatusCode = 481 StatusLoopDetected StatusCode = 482 StatusTooManyHops StatusCode = 483 StatusAddressIncomplete StatusCode = 484 StatusAmbiguous StatusCode = 485 StatusBusyHere StatusCode = 486 StatusRequestTerminated StatusCode = 487 StatusNotAcceptableHere StatusCode = 488 StatusInternalServerError StatusCode = 500 StatusNotImplemented StatusCode = 501 StatusBadGateway StatusCode = 502 StatusGatewayTimeout StatusCode = 504 StatusVersionNotSupported StatusCode = 505 StatusMessageTooLarge StatusCode = 513 StatusGlobalBusyEverywhere StatusCode = 600 StatusGlobalDecline StatusCode = 603 StatusGlobalDoesNotExistAnywhere StatusCode = 604 StatusGlobalNotAcceptable StatusCode = 606 )
type Transaction ¶
type Transaction interface {
// Terminate will terminate transaction
Terminate()
// Done when transaction fsm terminates. Can be called multiple times
Done() <-chan struct{}
// Last error. Useful to check when transaction terminates
Err() error
}