Documentation
¶
Index ¶
- Constants
- func AuthorizeRequest(request Request, response Response, user, password MaybeString) error
- func CopyHeaders(name string, from, to Message)
- func Escape(s string, mode encoding) string
- func GenerateBranch() string
- func MakeDialogID(callID, innerID, externalID string) string
- func MakeDialogIDFromMessage(msg Message) (string, error)
- func PrependCopyHeaders(name string, from, to Message)
- func Unescape(s string, mode encoding) (string, error)
- type Accept
- type Address
- type AllowHeader
- type Authorization
- func (auth *Authorization) Algorithm() string
- func (auth *Authorization) CNonce() string
- func (auth *Authorization) CalcResponse() string
- func (auth *Authorization) Nc() string
- func (auth *Authorization) Nonce() string
- func (auth *Authorization) Qop() string
- func (auth *Authorization) Realm() string
- func (auth *Authorization) Response() string
- func (auth *Authorization) SetCNonce(cnonce string)
- func (auth *Authorization) SetMethod(method string) *Authorization
- func (auth *Authorization) SetNc(nc string)
- func (auth *Authorization) SetPassword(password string) *Authorization
- func (auth *Authorization) SetQop(qop string)
- func (auth *Authorization) SetResponse(response string)
- func (auth *Authorization) SetUri(uri string) *Authorization
- func (auth *Authorization) SetUsername(username string) *Authorization
- func (auth *Authorization) String() string
- func (auth *Authorization) Uri() string
- func (auth *Authorization) Username() string
- type Authorizer
- type BrokenMessageError
- type CSeq
- type CallID
- type CancelError
- type ClientTransaction
- type ContactHeader
- type ContactUri
- type ContentLength
- type ContentType
- type DefaultAuthorizer
- type EscapeError
- type ExpireError
- type Expires
- type FromHeader
- type GenericHeader
- type Header
- type InvalidHostError
- type MalformedMessageError
- type MaxForwards
- type MaybeString
- type Message
- type MessageError
- type MessageID
- type MessageMapper
- type Params
- type Port
- type ProxyRequireHeader
- type RecordRouteHeader
- type Request
- func CopyRequest(req Request) Request
- func NewAckRequest(ackID MessageID, inviteRequest Request, inviteResponse Response, body string, ...) Request
- func NewCancelRequest(cancelID MessageID, requestForCancel Request, fields log.Fields) Request
- func NewRequest(messID MessageID, method RequestMethod, recipient Uri, sipVersion string, ...) Request
- type RequestBuilder
- func (rb *RequestBuilder) AddHeader(header Header) *RequestBuilder
- func (rb *RequestBuilder) AddVia(via *ViaHop) *RequestBuilder
- func (rb *RequestBuilder) Build() (Request, error)
- func (rb *RequestBuilder) RemoveHeader(headerName string) *RequestBuilder
- func (rb *RequestBuilder) SetAccept(accept *Accept) *RequestBuilder
- func (rb *RequestBuilder) SetAllow(methods []RequestMethod) *RequestBuilder
- func (rb *RequestBuilder) SetBody(body string) *RequestBuilder
- func (rb *RequestBuilder) SetCallID(callID *CallID) *RequestBuilder
- func (rb *RequestBuilder) SetContact(address *Address) *RequestBuilder
- func (rb *RequestBuilder) SetContentType(contentType *ContentType) *RequestBuilder
- func (rb *RequestBuilder) SetExpires(expires *Expires) *RequestBuilder
- func (rb *RequestBuilder) SetFrom(address *Address) *RequestBuilder
- func (rb *RequestBuilder) SetHost(host string) *RequestBuilder
- func (rb *RequestBuilder) SetMaxForwards(maxForwards *MaxForwards) *RequestBuilder
- func (rb *RequestBuilder) SetMethod(method RequestMethod) *RequestBuilder
- func (rb *RequestBuilder) SetRecipient(uri Uri) *RequestBuilder
- func (rb *RequestBuilder) SetRequire(options []string) *RequestBuilder
- func (rb *RequestBuilder) SetRoutes(routes []Uri) *RequestBuilder
- func (rb *RequestBuilder) SetSeqNo(seqNo uint) *RequestBuilder
- func (rb *RequestBuilder) SetSupported(options []string) *RequestBuilder
- func (rb *RequestBuilder) SetTo(address *Address) *RequestBuilder
- func (rb *RequestBuilder) SetTransport(transport string) *RequestBuilder
- func (rb *RequestBuilder) SetUserAgent(userAgent *UserAgentHeader) *RequestBuilder
- type RequestError
- type RequestMethod
- type RequireHeader
- type Response
- type RouteHeader
- type ServerTransaction
- type SipUri
- func (uri *SipUri) Clone() Uri
- func (uri *SipUri) Equals(val interface{}) bool
- func (uri *SipUri) Headers() Params
- func (uri *SipUri) Host() string
- func (uri *SipUri) IsEncrypted() bool
- func (uri *SipUri) IsTelNum() bool
- func (uri *SipUri) IsWildcard() bool
- func (uri *SipUri) Password() MaybeString
- func (uri *SipUri) Port() *Port
- func (uri *SipUri) SetEncrypted(flag bool)
- func (uri *SipUri) SetHeaders(params Params)
- func (uri *SipUri) SetHost(host string)
- func (uri *SipUri) SetPassword(pass MaybeString)
- func (uri *SipUri) SetPort(port *Port)
- func (uri *SipUri) SetTelFlag(flag bool)
- func (uri *SipUri) SetUriParams(params Params)
- func (uri *SipUri) SetUser(user MaybeString)
- func (uri *SipUri) String() string
- func (uri *SipUri) UriParams() Params
- func (uri *SipUri) User() MaybeString
- type StatusCode
- type String
- type SupportedHeader
- type ToHeader
- type Transaction
- type TransactionKey
- type Transport
- type UnexpectedMessageError
- type UnsupportedHeader
- type UnsupportedMessageError
- type Uri
- type UserAgentHeader
- type ViaHeader
- type ViaHop
- type WildcardUri
- func (uri WildcardUri) Clone() Uri
- func (uri WildcardUri) Equals(other interface{}) bool
- func (uri WildcardUri) Headers() Params
- func (uri WildcardUri) Host() string
- func (uri WildcardUri) IsEncrypted() bool
- func (uri WildcardUri) IsWildcard() bool
- func (uri WildcardUri) Password() MaybeString
- func (uri WildcardUri) Port() *Port
- func (uri WildcardUri) SetEncrypted(flag bool)
- func (uri WildcardUri) SetHeaders(params Params)
- func (uri WildcardUri) SetHost(host string)
- func (uri WildcardUri) SetPassword(pass MaybeString)
- func (uri WildcardUri) SetPort(port *Port)
- func (uri WildcardUri) SetUriParams(params Params)
- func (uri WildcardUri) SetUser(user MaybeString)
- func (uri WildcardUri) String() string
- func (uri WildcardUri) UriParams() Params
- func (uri WildcardUri) User() MaybeString
Constants ¶
const ( MTU uint = 1500 DefaultHost = "127.0.0.1" DefaultProtocol = "UDP" DefaultUdpPort Port = 5060 DefaultTcpPort Port = 5060 DefaultTlsPort Port = 5061 DefaultWsPort Port = 80 DefaultWssPort Port = 443 )
const ( EncodeUserPassword encoding = 1 + iota EncodeHost EncodeZone EncodeQueryComponent )
const RFC3261BranchMagicCookie = "z9hG4bK"
Variables ¶
This section is empty.
Functions ¶
func AuthorizeRequest ¶
func AuthorizeRequest(request Request, response Response, user, password MaybeString) error
func CopyHeaders ¶
Copy all headers of one type from one message to another. Appending to any headers that were already there.
func MakeDialogID ¶
func MakeDialogIDFromMessage ¶
func PrependCopyHeaders ¶
Types ¶
type Address ¶
type Address struct {
DisplayName MaybeString
Uri Uri
Params Params
}
func NewAddressFromContactHeader ¶
func NewAddressFromContactHeader(cnt *ContactHeader) *Address
func NewAddressFromFromHeader ¶
func NewAddressFromFromHeader(from *FromHeader) *Address
func NewAddressFromToHeader ¶
func (*Address) AsContactHeader ¶
func (addr *Address) AsContactHeader() *ContactHeader
func (*Address) AsFromHeader ¶
func (addr *Address) AsFromHeader() *FromHeader
func (*Address) AsToHeader ¶
type AllowHeader ¶
type AllowHeader []RequestMethod
func (AllowHeader) Clone ¶
func (allow AllowHeader) Clone() Header
func (AllowHeader) Equals ¶
func (allow AllowHeader) Equals(other interface{}) bool
func (AllowHeader) Name ¶
func (allow AllowHeader) Name() string
func (AllowHeader) String ¶
func (allow AllowHeader) String() string
func (AllowHeader) Value ¶
func (allow AllowHeader) Value() string
type Authorization ¶
type Authorization struct {
// contains filtered or unexported fields
}
currently only Digest and MD5
func AuthFromValue ¶
func AuthFromValue(value string) *Authorization
func (*Authorization) Algorithm ¶
func (auth *Authorization) Algorithm() string
func (*Authorization) CNonce ¶
func (auth *Authorization) CNonce() string
func (*Authorization) CalcResponse ¶
func (auth *Authorization) CalcResponse() string
func (*Authorization) Nc ¶
func (auth *Authorization) Nc() string
func (*Authorization) Nonce ¶
func (auth *Authorization) Nonce() string
func (*Authorization) Qop ¶
func (auth *Authorization) Qop() string
func (*Authorization) Realm ¶
func (auth *Authorization) Realm() string
func (*Authorization) Response ¶
func (auth *Authorization) Response() string
func (*Authorization) SetCNonce ¶
func (auth *Authorization) SetCNonce(cnonce string)
func (*Authorization) SetMethod ¶
func (auth *Authorization) SetMethod(method string) *Authorization
func (*Authorization) SetNc ¶
func (auth *Authorization) SetNc(nc string)
func (*Authorization) SetPassword ¶
func (auth *Authorization) SetPassword(password string) *Authorization
func (*Authorization) SetQop ¶
func (auth *Authorization) SetQop(qop string)
func (*Authorization) SetResponse ¶
func (auth *Authorization) SetResponse(response string)
func (*Authorization) SetUri ¶
func (auth *Authorization) SetUri(uri string) *Authorization
func (*Authorization) SetUsername ¶
func (auth *Authorization) SetUsername(username string) *Authorization
func (*Authorization) String ¶
func (auth *Authorization) String() string
func (*Authorization) Uri ¶
func (auth *Authorization) Uri() string
func (*Authorization) Username ¶
func (auth *Authorization) Username() string
type Authorizer ¶
type BrokenMessageError ¶
Broken or incomplete messages, or not a SIP message.
func (*BrokenMessageError) Broken ¶
func (err *BrokenMessageError) Broken() bool
func (*BrokenMessageError) Error ¶
func (err *BrokenMessageError) Error() string
func (*BrokenMessageError) Malformed ¶
func (err *BrokenMessageError) Malformed() bool
type CSeq ¶
type CSeq struct {
SeqNo uint32
MethodName RequestMethod
}
type CancelError ¶
type CancelError interface {
Canceled() bool
}
type ClientTransaction ¶
type ClientTransaction interface {
Transaction
Responses() <-chan Response
Cancel() error
}
type ContactHeader ¶
type ContactHeader struct {
// The display name from the header, may be omitted.
DisplayName MaybeString
Address ContactUri
// Any parameters present in the header.
Params Params
}
func (*ContactHeader) Equals ¶
func (contact *ContactHeader) Equals(other interface{}) bool
func (*ContactHeader) Name ¶
func (contact *ContactHeader) Name() string
func (*ContactHeader) String ¶
func (contact *ContactHeader) String() string
func (*ContactHeader) Value ¶
func (contact *ContactHeader) Value() string
type ContactUri ¶
type ContactUri interface {
Uri
}
A URI from a schema suitable for inclusion in a Contact: header. The only such URIs are sip/sips URIs and the special wildcard URI '*'. hold this interface to not break other code
type ContentLength ¶
type ContentLength uint32
func (*ContentLength) Clone ¶
func (contentLength *ContentLength) Clone() Header
func (*ContentLength) Equals ¶
func (contentLength *ContentLength) Equals(other interface{}) bool
func (*ContentLength) Name ¶
func (contentLength *ContentLength) Name() string
func (ContentLength) String ¶
func (contentLength ContentLength) String() string
func (ContentLength) Value ¶
func (contentLength ContentLength) Value() string
type ContentType ¶
type ContentType string
func (*ContentType) Clone ¶
func (ct *ContentType) Clone() Header
func (*ContentType) Equals ¶
func (ct *ContentType) Equals(other interface{}) bool
func (*ContentType) Name ¶
func (ct *ContentType) Name() string
func (*ContentType) String ¶
func (ct *ContentType) String() string
func (ContentType) Value ¶
func (ct ContentType) Value() string
type DefaultAuthorizer ¶
type DefaultAuthorizer struct {
User MaybeString
Password MaybeString
}
func (*DefaultAuthorizer) AuthorizeRequest ¶
func (auth *DefaultAuthorizer) AuthorizeRequest(request Request, response Response) error
type EscapeError ¶
type EscapeError string
func (EscapeError) Error ¶
func (e EscapeError) Error() string
type ExpireError ¶
type ExpireError interface {
Expired() bool
}
type FromHeader ¶
type FromHeader struct {
// The display name from the header, may be omitted.
DisplayName MaybeString
Address Uri
// Any parameters present in the header.
Params Params
}
func (*FromHeader) Equals ¶
func (from *FromHeader) Equals(other interface{}) bool
func (*FromHeader) Name ¶
func (from *FromHeader) Name() string
func (*FromHeader) String ¶
func (from *FromHeader) String() string
func (*FromHeader) Value ¶
func (from *FromHeader) Value() string
type GenericHeader ¶
type GenericHeader struct {
// The name of the header.
HeaderName string
// The contents of the header, including any parameters.
// This is transparent data that is not natively understood by gossip.
Contents string
}
Encapsulates a header that gossip does not natively support. This allows header data that is not understood to be parsed by gossip and relayed to the parent application.
func (*GenericHeader) Equals ¶
func (header *GenericHeader) Equals(other interface{}) bool
func (*GenericHeader) String ¶
func (header *GenericHeader) String() string
Convert the header to a flat string representation.
func (*GenericHeader) Value ¶
func (header *GenericHeader) Value() string
type Header ¶
type Header interface {
// Name returns header name.
Name() string
Value() string
// Clone returns copy of header struct.
Clone() Header
String() string
Equals(other interface{}) bool
}
Header is a single SIP header.
type InvalidHostError ¶
type InvalidHostError string
func (InvalidHostError) Error ¶
func (e InvalidHostError) Error() string
type MalformedMessageError ¶
syntactically valid but logically invalid message
func (*MalformedMessageError) Broken ¶
func (err *MalformedMessageError) Broken() bool
func (*MalformedMessageError) Error ¶
func (err *MalformedMessageError) Error() string
func (*MalformedMessageError) Malformed ¶
func (err *MalformedMessageError) Malformed() bool
type MaxForwards ¶
type MaxForwards uint32
func (*MaxForwards) Clone ¶
func (maxForwards *MaxForwards) Clone() Header
func (*MaxForwards) Equals ¶
func (maxForwards *MaxForwards) Equals(other interface{}) bool
func (*MaxForwards) Name ¶
func (maxForwards *MaxForwards) Name() string
func (MaxForwards) String ¶
func (maxForwards MaxForwards) String() string
func (MaxForwards) Value ¶
func (maxForwards MaxForwards) Value() string
type MaybeString ¶
String wrapper
type Message ¶
type Message interface {
MessageID() MessageID
Clone() Message
// Start line returns message start line.
StartLine() string
// String returns string representation of SIP message in RFC 3261 form.
String() string
// Short returns short string info about message.
Short() string
// SipVersion returns SIP protocol version.
SipVersion() string
// SetSipVersion sets SIP protocol version.
SetSipVersion(version string)
// Headers returns all message headers.
Headers() []Header
// GetHeaders returns slice of headers of the given type.
GetHeaders(name string) []Header
// AppendHeader appends header to message.
AppendHeader(header Header)
// PrependHeader prepends header to message.
PrependHeader(header Header)
PrependHeaderAfter(header Header, afterName string)
// RemoveHeader removes header from message.
RemoveHeader(name string)
ReplaceHeaders(name string, headers []Header)
// Body returns message body.
Body() string
// SetBody sets message body.
SetBody(body string, setContentLength bool)
/* Helper getters for common headers */
// CallID returns 'Call-ID' header.
CallID() (*CallID, bool)
// Via returns the top 'Via' header field.
Via() (ViaHeader, bool)
// ViaHop returns the first segment of the top 'Via' header.
ViaHop() (*ViaHop, bool)
// From returns 'From' header field.
From() (*FromHeader, bool)
// To returns 'To' header field.
To() (*ToHeader, bool)
// CSeq returns 'CSeq' header field.
CSeq() (*CSeq, bool)
ContentLength() (*ContentLength, bool)
ContentType() (*ContentType, bool)
Contact() (*ContactHeader, bool)
Transport() string
SetTransport(tp string)
Source() string
SetSource(src string)
Destination() string
SetDestination(dest string)
IsCancel() bool
IsAck() bool
Fields() log.Fields
WithFields(fields log.Fields) Message
}
Message introduces common SIP message RFC 3261 - 7.
type MessageError ¶
type MessageMapper ¶
type Params ¶
type Params interface {
Get(key string) (MaybeString, bool)
Add(key string, val MaybeString) Params
Remove(key string) Params
Clone() Params
Equals(params interface{}) bool
ToString(sep uint8) string
String() string
Length() int
Items() map[string]MaybeString
Keys() []string
Has(key string) bool
}
Generic list of parameters on a header.
type Port ¶
type Port uint16
Port number
func DefaultPort ¶
DefaultPort returns protocol default port by network.
type ProxyRequireHeader ¶
type ProxyRequireHeader struct {
Options []string
}
func (*ProxyRequireHeader) Clone ¶
func (proxyRequire *ProxyRequireHeader) Clone() Header
func (*ProxyRequireHeader) Equals ¶
func (proxyRequire *ProxyRequireHeader) Equals(other interface{}) bool
func (*ProxyRequireHeader) Name ¶
func (proxyRequire *ProxyRequireHeader) Name() string
func (*ProxyRequireHeader) String ¶
func (proxyRequire *ProxyRequireHeader) String() string
func (*ProxyRequireHeader) Value ¶
func (proxyRequire *ProxyRequireHeader) Value() string
type RecordRouteHeader ¶
type RecordRouteHeader struct {
Addresses []Uri
}
func (*RecordRouteHeader) Clone ¶
func (route *RecordRouteHeader) Clone() Header
func (*RecordRouteHeader) Equals ¶
func (route *RecordRouteHeader) Equals(other interface{}) bool
func (*RecordRouteHeader) Name ¶
func (route *RecordRouteHeader) Name() string
func (*RecordRouteHeader) String ¶
func (route *RecordRouteHeader) String() string
func (*RecordRouteHeader) Value ¶
func (route *RecordRouteHeader) Value() string
type Request ¶
type Request interface {
Message
Method() RequestMethod
SetMethod(method RequestMethod)
Recipient() Uri
SetRecipient(recipient Uri)
/* Common Helpers */
IsInvite() bool
}
Request RFC 3261 - 7.1.
func CopyRequest ¶
func NewAckRequest ¶
func NewAckRequest(ackID MessageID, inviteRequest Request, inviteResponse Response, body string, fields log.Fields) Request
NewAckRequest creates ACK request for 2xx INVITE https://tools.ietf.org/html/rfc3261#section-13.2.2.4
func NewCancelRequest ¶
type RequestBuilder ¶
type RequestBuilder struct {
// contains filtered or unexported fields
}
func NewRequestBuilder ¶
func NewRequestBuilder() *RequestBuilder
func (*RequestBuilder) AddHeader ¶
func (rb *RequestBuilder) AddHeader(header Header) *RequestBuilder
func (*RequestBuilder) AddVia ¶
func (rb *RequestBuilder) AddVia(via *ViaHop) *RequestBuilder
func (*RequestBuilder) Build ¶
func (rb *RequestBuilder) Build() (Request, error)
func (*RequestBuilder) RemoveHeader ¶
func (rb *RequestBuilder) RemoveHeader(headerName string) *RequestBuilder
func (*RequestBuilder) SetAccept ¶
func (rb *RequestBuilder) SetAccept(accept *Accept) *RequestBuilder
func (*RequestBuilder) SetAllow ¶
func (rb *RequestBuilder) SetAllow(methods []RequestMethod) *RequestBuilder
func (*RequestBuilder) SetBody ¶
func (rb *RequestBuilder) SetBody(body string) *RequestBuilder
func (*RequestBuilder) SetCallID ¶
func (rb *RequestBuilder) SetCallID(callID *CallID) *RequestBuilder
func (*RequestBuilder) SetContact ¶
func (rb *RequestBuilder) SetContact(address *Address) *RequestBuilder
func (*RequestBuilder) SetContentType ¶
func (rb *RequestBuilder) SetContentType(contentType *ContentType) *RequestBuilder
func (*RequestBuilder) SetExpires ¶
func (rb *RequestBuilder) SetExpires(expires *Expires) *RequestBuilder
func (*RequestBuilder) SetFrom ¶
func (rb *RequestBuilder) SetFrom(address *Address) *RequestBuilder
func (*RequestBuilder) SetHost ¶
func (rb *RequestBuilder) SetHost(host string) *RequestBuilder
func (*RequestBuilder) SetMaxForwards ¶
func (rb *RequestBuilder) SetMaxForwards(maxForwards *MaxForwards) *RequestBuilder
func (*RequestBuilder) SetMethod ¶
func (rb *RequestBuilder) SetMethod(method RequestMethod) *RequestBuilder
func (*RequestBuilder) SetRecipient ¶
func (rb *RequestBuilder) SetRecipient(uri Uri) *RequestBuilder
func (*RequestBuilder) SetRequire ¶
func (rb *RequestBuilder) SetRequire(options []string) *RequestBuilder
func (*RequestBuilder) SetRoutes ¶
func (rb *RequestBuilder) SetRoutes(routes []Uri) *RequestBuilder
func (*RequestBuilder) SetSeqNo ¶
func (rb *RequestBuilder) SetSeqNo(seqNo uint) *RequestBuilder
func (*RequestBuilder) SetSupported ¶
func (rb *RequestBuilder) SetSupported(options []string) *RequestBuilder
func (*RequestBuilder) SetTo ¶
func (rb *RequestBuilder) SetTo(address *Address) *RequestBuilder
func (*RequestBuilder) SetTransport ¶
func (rb *RequestBuilder) SetTransport(transport string) *RequestBuilder
func (*RequestBuilder) SetUserAgent ¶
func (rb *RequestBuilder) SetUserAgent(userAgent *UserAgentHeader) *RequestBuilder
type RequestError ¶
func NewRequestError ¶
func NewRequestError(code uint, reason string, request Request, response Response) *RequestError
func (*RequestError) Error ¶
func (err *RequestError) Error() string
type RequestMethod ¶
type RequestMethod string
A representation of a SIP method. This is syntactic sugar around the string type, so make sure to use the Equals method rather than built-in equality, or you'll fall foul of case differences. If you're defining your own Method, uppercase is preferred but not compulsory.
const ( INVITE RequestMethod = "INVITE" ACK RequestMethod = "ACK" CANCEL RequestMethod = "CANCEL" BYE RequestMethod = "BYE" REGISTER RequestMethod = "REGISTER" OPTIONS RequestMethod = "OPTIONS" SUBSCRIBE RequestMethod = "SUBSCRIBE" NOTIFY RequestMethod = "NOTIFY" REFER RequestMethod = "REFER" INFO RequestMethod = "INFO" MESSAGE RequestMethod = "MESSAGE" PRACK RequestMethod = "PRACK" UPDATE RequestMethod = "UPDATE" PUBLISH RequestMethod = "PUBLISH" )
It's nicer to avoid using raw strings to represent methods, so the following standard method names are defined here as constants for convenience.
func (*RequestMethod) Equals ¶
func (method *RequestMethod) Equals(other *RequestMethod) bool
Determine if the given method equals some other given method. This is syntactic sugar for case insensitive equality checking.
type RequireHeader ¶
type RequireHeader struct {
Options []string
}
func (*RequireHeader) Clone ¶
func (require *RequireHeader) Clone() Header
func (*RequireHeader) Equals ¶
func (require *RequireHeader) Equals(other interface{}) bool
func (*RequireHeader) Name ¶
func (require *RequireHeader) Name() string
func (*RequireHeader) String ¶
func (require *RequireHeader) String() string
func (*RequireHeader) Value ¶
func (require *RequireHeader) Value() string
type Response ¶
type Response interface {
Message
StatusCode() StatusCode
SetStatusCode(code StatusCode)
Reason() string
SetReason(reason string)
// Previous returns previous provisional responses
Previous() []Response
SetPrevious(responses []Response)
/* Common helpers */
IsProvisional() bool
IsSuccess() bool
IsRedirection() bool
IsClientError() bool
IsServerError() bool
IsGlobalError() bool
}
Response RFC 3261 - 7.2.
func CopyResponse ¶
func NewResponse ¶
func NewResponseFromRequest ¶
func NewResponseFromRequest( resID MessageID, req Request, statusCode StatusCode, reason string, body string, ) Response
RFC 3261 - 8.2.6
type RouteHeader ¶
type RouteHeader struct {
Addresses []Uri
}
func (*RouteHeader) Clone ¶
func (route *RouteHeader) Clone() Header
func (*RouteHeader) Equals ¶
func (route *RouteHeader) Equals(other interface{}) bool
func (*RouteHeader) Name ¶
func (route *RouteHeader) Name() string
func (*RouteHeader) String ¶
func (route *RouteHeader) String() string
func (*RouteHeader) Value ¶
func (route *RouteHeader) Value() string
type ServerTransaction ¶
type ServerTransaction interface {
Transaction
Respond(res Response) error
Acks() <-chan Request
Cancels() <-chan Request
}
type SipUri ¶
type SipUri struct {
// True if and only if the URI is a SIPS URI.
FIsEncrypted bool
// The user part of the URI: the 'joe' in sip:joe@bloggs.com
// This is a pointer, so that URIs without a user part can have 'nil'.
FUser MaybeString
FIsTel bool
// The password field of the URI. This is represented in the URI as joe:hunter2@bloggs.com.
// Note that if a URI has a password field, it *must* have a user field as well.
// This is a pointer, so that URIs without a password field can have 'nil'.
// Note that RFC 3261 strongly recommends against the use of password fields in SIP URIs,
// as they are fundamentally insecure.
FPassword MaybeString
// The host part of the URI. This can be a domain, or a string representation of an IP address.
FHost string
// The port part of the URI. This is optional, and so is represented here as a pointer type.
FPort *Port
// Any parameters associated with the URI.
// These are used to provide information about requests that may be constructed from the URI.
// (For more details, see RFC 3261 section 19.1.1).
// These appear as a semicolon-separated list of key=value pairs following the host[:port] part.
FUriParams Params
// Any headers to be included on requests constructed from this URI.
// These appear as a '&'-separated list at the end of the URI, introduced by '?'.
// Although the values of the map are MaybeStrings, they will never be NoString in practice as the parser
// guarantees to not return blank values for header elements in SIP URIs.
// You should not set the values of headers to NoString.
FHeaders Params
}
SipUri A SIP or SIPS URI, including all params and URI header params. noinspection GoNameStartsWithPackageName
func (*SipUri) Equals ¶
Determine if the SIP URI is equal to the specified URI according to the rules laid down in RFC 3261 s. 19.1.4. TODO: The Equals method is not currently RFC-compliant; fix this!
func (*SipUri) IsEncrypted ¶
func (*SipUri) IsWildcard ¶
func (*SipUri) Password ¶
func (uri *SipUri) Password() MaybeString
func (*SipUri) SetEncrypted ¶
func (*SipUri) SetHeaders ¶
func (*SipUri) SetPassword ¶
func (uri *SipUri) SetPassword(pass MaybeString)
func (*SipUri) SetTelFlag ¶
func (*SipUri) SetUriParams ¶
func (*SipUri) SetUser ¶
func (uri *SipUri) SetUser(user MaybeString)
func (*SipUri) User ¶
func (uri *SipUri) User() MaybeString
type SupportedHeader ¶
type SupportedHeader struct {
Options []string
}
func (*SupportedHeader) Clone ¶
func (support *SupportedHeader) Clone() Header
func (*SupportedHeader) Equals ¶
func (support *SupportedHeader) Equals(other interface{}) bool
func (*SupportedHeader) Name ¶
func (support *SupportedHeader) Name() string
func (*SupportedHeader) String ¶
func (support *SupportedHeader) String() string
func (*SupportedHeader) Value ¶
func (support *SupportedHeader) Value() string
type ToHeader ¶
type ToHeader struct {
// The display name from the header, may be omitted.
DisplayName MaybeString
Address Uri
// Any parameters present in the header.
Params Params
}
ToHeader introduces SIP 'To' header
type Transaction ¶
type Transaction interface {
Origin() Request
Key() TransactionKey
String() string
Errors() <-chan error
Done() <-chan bool
}
type TransactionKey ¶
type TransactionKey string
func (TransactionKey) String ¶
func (key TransactionKey) String() string
type UnexpectedMessageError ¶
func (*UnexpectedMessageError) Broken ¶
func (err *UnexpectedMessageError) Broken() bool
func (*UnexpectedMessageError) Error ¶
func (err *UnexpectedMessageError) Error() string
func (*UnexpectedMessageError) Malformed ¶
func (err *UnexpectedMessageError) Malformed() bool
type UnsupportedHeader ¶
type UnsupportedHeader struct {
Options []string
}
'Unsupported:' is a SIP header type - this doesn't indicate that the header itself is not supported by gossip!
func (*UnsupportedHeader) Clone ¶
func (unsupported *UnsupportedHeader) Clone() Header
func (*UnsupportedHeader) Equals ¶
func (unsupported *UnsupportedHeader) Equals(other interface{}) bool
func (*UnsupportedHeader) Name ¶
func (unsupported *UnsupportedHeader) Name() string
func (*UnsupportedHeader) String ¶
func (unsupported *UnsupportedHeader) String() string
func (*UnsupportedHeader) Value ¶
func (unsupported *UnsupportedHeader) Value() string
type UnsupportedMessageError ¶
func (*UnsupportedMessageError) Broken ¶
func (err *UnsupportedMessageError) Broken() bool
func (*UnsupportedMessageError) Error ¶
func (err *UnsupportedMessageError) Error() string
func (*UnsupportedMessageError) Malformed ¶
func (err *UnsupportedMessageError) Malformed() bool
type Uri ¶
type Uri interface {
// Determine if the two URIs are equal according to the rules in RFC 3261 s. 19.1.4.
Equals(other interface{}) bool
String() string
Clone() Uri
IsEncrypted() bool
SetEncrypted(flag bool)
User() MaybeString
SetUser(user MaybeString)
Password() MaybeString
SetPassword(pass MaybeString)
Host() string
SetHost(host string)
Port() *Port
SetPort(port *Port)
UriParams() Params
SetUriParams(params Params)
Headers() Params
SetHeaders(params Params)
// Return true if and only if the URI is the special wildcard URI '*'; that is, if it is
// a WildcardUri struct.
IsWildcard() bool
}
A URI from any schema (e.g. sip:, tel:, callto:)
type UserAgentHeader ¶
type UserAgentHeader string
func (*UserAgentHeader) Clone ¶
func (ua *UserAgentHeader) Clone() Header
func (*UserAgentHeader) Equals ¶
func (ua *UserAgentHeader) Equals(other interface{}) bool
func (*UserAgentHeader) Name ¶
func (ua *UserAgentHeader) Name() string
func (*UserAgentHeader) String ¶
func (ua *UserAgentHeader) String() string
func (UserAgentHeader) Value ¶
func (ua UserAgentHeader) Value() string
type ViaHop ¶
type ViaHop struct {
// E.g. 'SIP'.
ProtocolName string
// E.g. '2.0'.
ProtocolVersion string
Transport string
Host string
// The port for this via hop. This is stored as a pointer type, since it is an optional field.
Port *Port
Params Params
}
A single component in a Via header. Via headers are composed of several segments of the same structure, added by successive nodes in a routing chain.
type WildcardUri ¶
type WildcardUri struct{}
The special wildcard URI used in Contact: headers in REGISTER requests when expiring all registrations.
func (WildcardUri) Equals ¶
func (uri WildcardUri) Equals(other interface{}) bool
Determines if this wildcard URI equals the specified other URI. This is true if and only if the other URI is also a wildcard URI.
func (WildcardUri) Headers ¶
func (uri WildcardUri) Headers() Params
func (WildcardUri) Host ¶
func (uri WildcardUri) Host() string
func (WildcardUri) IsEncrypted ¶
func (uri WildcardUri) IsEncrypted() bool
func (WildcardUri) Password ¶
func (uri WildcardUri) Password() MaybeString
func (WildcardUri) Port ¶
func (uri WildcardUri) Port() *Port
func (WildcardUri) SetEncrypted ¶
func (uri WildcardUri) SetEncrypted(flag bool)
func (WildcardUri) SetHeaders ¶
func (uri WildcardUri) SetHeaders(params Params)
func (WildcardUri) SetHost ¶
func (uri WildcardUri) SetHost(host string)
func (WildcardUri) SetPassword ¶
func (uri WildcardUri) SetPassword(pass MaybeString)
func (WildcardUri) SetPort ¶
func (uri WildcardUri) SetPort(port *Port)
func (WildcardUri) SetUriParams ¶
func (uri WildcardUri) SetUriParams(params Params)
func (WildcardUri) SetUser ¶
func (uri WildcardUri) SetUser(user MaybeString)
func (WildcardUri) String ¶
func (uri WildcardUri) String() string
Always returns '*' - the representation of a wildcard URI in a SIP message.
func (WildcardUri) UriParams ¶
func (uri WildcardUri) UriParams() Params
func (WildcardUri) User ¶
func (uri WildcardUri) User() MaybeString