Documentation ¶
Index ¶
- Constants
- func Phrase(status int) string
- type Addr
- func (addr *Addr) Append(b *bytes.Buffer)
- func (addr *Addr) CompareHostPort(other *Addr) bool
- func (addr *Addr) Copy() *Addr
- func (addr *Addr) Last() *Addr
- func (addr *Addr) Len() int
- func (addr *Addr) Or(other *Addr) *Addr
- func (addr *Addr) Reversed() *Addr
- func (addr *Addr) String() string
- func (addr *Addr) Tag() *Addr
- type MiscPayload
- type Msg
- type MsgIncompleteError
- type MsgParseError
- type Param
- type Payload
- type ResponseError
- type URI
- type URIHeader
- type URIParam
- type Via
- type XHeader
Constants ¶
View Source
const ( MethodInvite = "INVITE" // Indicates a client is being invited to participate in a call session. MethodAck = "ACK" // Confirms that the client has received a final response to an INVITE request. MethodBye = "BYE" // Terminates a call and can be sent by either the caller or the callee. MethodCancel = "CANCEL" // Cancels any pending request. MethodOptions = "OPTIONS" // Queries the capabilities of servers. MethodRegister = "REGISTER" // Registers the address listed in the To header field with a SIP server. MethodPrack = "PRACK" // Provisional acknowledgement. MethodSubscribe = "SUBSCRIBE" // Subscribes for an Event of Notification from the Notifier. MethodNotify = "NOTIFY" // Notify the subscriber of a new Event. MethodPublish = "PUBLISH" // Publishes an event to the Server. MethodInfo = "INFO" // Sends mid-session information that does not modify the session state. MethodRefer = "REFER" // Asks recipient to issue SIP request (call transfer.) MethodMessage = "MESSAGE" // Transports instant messages using SIP. MethodUpdate = "UPDATE" // Modifies the state of a session without changing the state of the dialog. )
View Source
const ( // 1xx: Provisional -- request received, continuing to process the request. StatusTrying = 100 // Indicates server is not totally pwnd. StatusRinging = 180 // Remote phone is definitely ringing. StatusCallIsBeingForwarded = 181 StatusQueued = 182 StatusSessionProgress = 183 // Establish early media (PSTN ringback) // 2xx: Success -- the action was successfully received, understood, // and accepted; StatusOK = 200 // Call is answered StatusAccepted = 202 // [RFC3265] StatusNoNotification = 204 // [RFC5839] // 3xx: Redirection -- further action needs to be taken in order to // complete the request; StatusMultipleChoices = 300 StatusMovedPermanently = 301 StatusMovedTemporarily = 302 // Send your call there instead kthx. StatusUseProxy = 305 // You fool! Send your call there instead. StatusAlternativeService = 380 // 4xx: Client Error -- the request contains bad syntax or cannot be // fulfilled at this server; StatusBadRequest = 400 // Missing headers, bad format, etc. StatusPaymentRequired = 402 // I am greedy. StatusForbidden = 403 // gtfo StatusNotFound = 404 // wat? StatusMethodNotAllowed = 405 // I don't support that type of request. StatusNotAcceptable = 406 StatusProxyAuthenticationRequired = 407 StatusRequestTimeout = 408 StatusConflict = 409 StatusGone = 410 // Shaniqua don't live here no more. StatusLengthRequired = 411 StatusConditionalRequestFailed = 412 // [RFC3903] StatusRequestEntityTooLarge = 413 StatusRequestURITooLong = 414 StatusUnsupportedMediaType = 415 StatusUnsupportedURIScheme = 416 StatusUnknownResourcePriority = 417 StatusBadExtension = 420 StatusExtensionRequired = 421 StatusSessionIntervalTooSmall = 422 // [RFC4028] StatusIntervalTooBrief = 423 StatusUseIdentityHeader = 428 // [RFC4474] StatusProvideReferrerIdentity = 429 // [RFC3892] StatusFlowFailed = 430 // [RFC5626] StatusAnonymityDisallowed = 433 // [RFC5079] StatusBadIdentityInfo = 436 // [RFC4474] StatusUnsupportedCertificate = 437 // [RFC4474] StatusInvalidIdentityHeader = 438 // [RFC4474] StatusFirstHopLacksOutboundSupport = 439 // [RFC5626] StatusMaxBreadthExceeded = 440 // [RFC5393] StatusConsentNeeded = 470 // [RFC5360] StatusCallTransactionDoesNotExist = 481 // Bad news StatusLoopDetected = 482 // Froot looping StatusTooManyHops = 483 // Froot looping StatusAddressIncomplete = 484 StatusAmbiguous = 485 StatusBusyHere = 486 StatusRequestTerminated = 487 StatusNotAcceptableHere = 488 StatusBadEvent = 489 // [RFC3265] StatusRequestPending = 491 StatusUndecipherable = 493 StatusSecurityAgreementRequired = 494 // [RFC3329] // 5xx: Server Error -- the server failed to fulfill an apparently // valid request; StatusInternalServerError = 500 StatusNotImplemented = 501 StatusBadGateway = 502 StatusGatewayTimeout = 504 StatusVersionNotSupported = 505 StatusMessageTooLarge = 513 StatusPreconditionFailure = 580 // [RFC3312] // 6xx: Global Failure -- the request cannot be fulfilled at any // server. StatusBusyEverywhere = 600 StatusDecline = 603 StatusDoesNotExistAnywhere = 604 StatusNotAcceptable606 = 606 StatusDialogTerminated = 687 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Addr ¶
type Addr struct { Uri *URI // never nil Display string // blank if not specified Param *Param // these look like ;key=lol;rport;key=wut Next *Addr // for comma separated lists of addresses }
Represents a SIP Address Linked List
func (*Addr) CompareHostPort ¶
type MiscPayload ¶
func (*MiscPayload) ContentType ¶
func (p *MiscPayload) ContentType() string
func (*MiscPayload) Data ¶
func (p *MiscPayload) Data() []byte
type Msg ¶
type Msg struct { // Fields that aren't headers. VersionMajor uint8 VersionMinor uint8 Method string // Indicates type of request (if request) Request *URI // dest URI (nil if response) Status int // Indicates happiness of response (if response) Phrase string // Explains happiness of response (if response) Payload Payload // Stuff that comes after two line breaks // Special non-SIP fields. SourceAddr *net.UDPAddr // Set by transport layer as received address. // Important headers should be further up in the struct. From *Addr // Logical sender of message To *Addr // Logical destination of message Via *Via // Linked list of agents traversed (must have one) Route *Addr // Used for goose routing and loose routing RecordRoute *Addr // Used for loose routing Contact *Addr // Where we send response packets or nil CallID string // Identifies call from invite to bye CSeq int // Counter for network packet ordering CSeqMethod string // Helps with matching to orig message MaxForwards int // 0 has context specific meaning UserAgent string // All the other RFC 3261 headers in plus some extras. Accept string AcceptContact string AcceptEncoding string AcceptLanguage string AlertInfo string Allow string AllowEvents string AuthenticationInfo string Authorization string CallInfo string ContentDisposition string ContentEncoding string ContentLanguage string Date string ErrorInfo string Event string Expires int // Seconds registration should expire. InReplyTo string MIMEVersion string MinExpires int // Registrars need this when responding Organization string PAssertedIdentity *Addr // P-Asserted-Identity or nil (used for PSTN ANI) Priority string ProxyAuthenticate string ProxyAuthorization string ProxyRequire string ReferTo string ReferredBy string RemotePartyID *Addr // Evil twin of P-Asserted-Identity. ReplyTo string Require string RetryAfter string Server string Subject string Supported string Timestamp string Unsupported string WWWAuthenticate string Warning string // Extension headers. XHeader *XHeader }
Msg represents a SIP message. This can either be a request or a response. These fields are never nil unless otherwise specified.
func (*Msg) IsResponse ¶
type MsgIncompleteError ¶
type MsgIncompleteError struct {
Msg []byte
}
func (MsgIncompleteError) Error ¶
func (err MsgIncompleteError) Error() string
type MsgParseError ¶
func (MsgParseError) Error ¶
func (err MsgParseError) Error() string
type Param ¶
Param is a linked list of ;key="values" for Addr/Via parameters.
type ResponseError ¶
type ResponseError struct {
Msg *Msg
}
ResponseError encapsulates an unhandled >=400 SIP error response.
func (*ResponseError) Error ¶
func (err *ResponseError) Error() string
type URI ¶
type URI struct { Scheme string // e.g. sip, sips, tel, etc. User string // e.g. sip:USER@host Pass string // e.g. sip:user:PASS@host Host string // e.g. example.com, 1.2.3.4, etc. Port uint16 // e.g. 5060, 80, etc. Param *URIParam // e.g. ;isup-oli=00;day=tuesday Header *URIHeader // e.g. ?subject=project%20x&lol=cat }
func (*URI) CompareHostPort ¶
type URIHeader ¶
URIHeader is a linked list of ?key=values for URI headers.
type URIParam ¶
URIParam is a linked list of ;key=values for URI parameters.
type Via ¶
type Via struct { Protocol string // should be "SIP" Version string // protocol version e.g. "2.0" Transport string // transport type "UDP" Host string // name or ip of egress interface Port uint16 // network port number Param *Param // param like branch, received, rport, etc. Next *Via // pointer to next via header if any }
Example: SIP/2.0/UDP 1.2.3.4:5060;branch=z9hG4bK556f77e6.
func (*Via) CompareBranch ¶
func (*Via) CompareHostPort ¶
Click to show internal directories.
Click to hide internal directories.