sip

package
v0.0.0-...-2406947 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2022 License: Apache-2.0 Imports: 11 Imported by: 10

Documentation

Index

Constants

View Source
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
)
View Source
const (
	EncodeUserPassword encoding = 1 + iota
	EncodeHost
	EncodeZone
	EncodeQueryComponent
)
View Source
const RFC3261BranchMagicCookie = "z9hG4bK"

Variables

This section is empty.

Functions

func AuthorizeRequest

func AuthorizeRequest(request Request, response Response, user, password MaybeString) error

func CopyHeaders

func CopyHeaders(name string, from, to Message)

Copy all headers of one type from one message to another. Appending to any headers that were already there.

func Escape

func Escape(s string, mode encoding) string

func GenerateBranch

func GenerateBranch() string

GenerateBranch returns random unique branch ID.

func MakeDialogID

func MakeDialogID(callID, innerID, externalID string) string

func MakeDialogIDFromMessage

func MakeDialogIDFromMessage(msg Message) (string, error)

func PrependCopyHeaders

func PrependCopyHeaders(name string, from, to Message)

func Unescape

func Unescape(s string, mode encoding) (string, error)

unescape unescapes a string; the mode specifies which section of the URL string is being unescaped.

Types

type Accept

type Accept string

func (*Accept) Clone

func (ct *Accept) Clone() Header

func (*Accept) Equals

func (ct *Accept) Equals(other interface{}) bool

func (*Accept) Name

func (ct *Accept) Name() string

func (*Accept) String

func (ct *Accept) String() string

func (Accept) Value

func (ct Accept) Value() string

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 NewAddressFromToHeader(to *ToHeader) *Address

func (*Address) AsContactHeader

func (addr *Address) AsContactHeader() *ContactHeader

func (*Address) AsFromHeader

func (addr *Address) AsFromHeader() *FromHeader

func (*Address) AsToHeader

func (addr *Address) AsToHeader() *ToHeader

func (*Address) Clone

func (addr *Address) Clone() *Address

func (*Address) Equals

func (addr *Address) Equals(other interface{}) bool

func (*Address) String

func (addr *Address) String() string

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 Authorizer interface {
	AuthorizeRequest(request Request, response Response) error
}

type BrokenMessageError

type BrokenMessageError struct {
	Err error
	Msg string
}

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
}

func (*CSeq) Clone

func (cseq *CSeq) Clone() Header

func (*CSeq) Equals

func (cseq *CSeq) Equals(other interface{}) bool

func (*CSeq) Name

func (cseq *CSeq) Name() string

func (*CSeq) String

func (cseq *CSeq) String() string

func (*CSeq) Value

func (cseq *CSeq) Value() string

type CallID

type CallID string

CallID - 'Call-ID' header.

func (*CallID) Clone

func (callId *CallID) Clone() Header

func (*CallID) Equals

func (callId *CallID) Equals(other interface{}) bool

func (*CallID) Name

func (callId *CallID) Name() string

func (CallID) String

func (callId CallID) String() string

func (CallID) Value

func (callId CallID) Value() string

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) Clone

func (contact *ContactHeader) Clone() Header

Copy the header.

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 Expires

type Expires uint32

func (*Expires) Clone

func (expires *Expires) Clone() Header

func (*Expires) Equals

func (expires *Expires) Equals(other interface{}) bool

func (*Expires) Name

func (expires *Expires) Name() string

func (*Expires) String

func (expires *Expires) String() string

func (Expires) Value

func (expires Expires) Value() string

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) Clone

func (from *FromHeader) Clone() Header

Copy the header.

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) Clone

func (header *GenericHeader) Clone() Header

Copy the header.

func (*GenericHeader) Equals

func (header *GenericHeader) Equals(other interface{}) bool

func (*GenericHeader) Name

func (header *GenericHeader) Name() string

Pull out the header name.

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 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

type MalformedMessageError struct {
	Err error
	Msg string
}

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

type MaybeString interface {
	String() string
	Equals(other interface{}) bool
}

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 MessageError interface {
	error
	// Malformed indicates that message is syntactically valid but has invalid headers, or
	// without required headers.
	Malformed() bool
	// Broken or incomplete message, or not a SIP message
	Broken() bool
}

type MessageID

type MessageID string

func NextMessageID

func NextMessageID() MessageID

type MessageMapper

type MessageMapper func(msg Message) Message

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.

func NewParams

func NewParams() Params

Create an empty set of parameters.

type Port

type Port uint16

Port number

func DefaultPort

func DefaultPort(protocol string) Port

DefaultPort returns protocol default port by network.

func (*Port) Clone

func (port *Port) Clone() *Port

func (*Port) Equals

func (port *Port) Equals(other interface{}) bool

func (*Port) String

func (port *Port) String() string

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 CopyRequest(req Request) Request

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

func NewCancelRequest(cancelID MessageID, requestForCancel Request, fields log.Fields) Request

func NewRequest

func NewRequest(
	messID MessageID,
	method RequestMethod,
	recipient Uri,
	sipVersion string,
	hdrs []Header,
	body string,
	fields log.Fields,
) Request

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

type RequestError struct {
	Request  Request
	Response Response
	Code     uint
	Reason   string
}

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 CopyResponse(res Response) Response

func NewResponse

func NewResponse(
	messID MessageID,
	sipVersion string,
	statusCode StatusCode,
	reason string,
	hdrs []Header,
	body string,
	fields log.Fields,
) Response

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) Clone

func (uri *SipUri) Clone() Uri

Clone the Sip URI.

func (*SipUri) Equals

func (uri *SipUri) Equals(val interface{}) bool

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) Headers

func (uri *SipUri) Headers() Params

func (*SipUri) Host

func (uri *SipUri) Host() string

func (*SipUri) IsEncrypted

func (uri *SipUri) IsEncrypted() bool

func (*SipUri) IsTelNum

func (uri *SipUri) IsTelNum() bool

func (*SipUri) IsWildcard

func (uri *SipUri) IsWildcard() bool

func (*SipUri) Password

func (uri *SipUri) Password() MaybeString

func (*SipUri) Port

func (uri *SipUri) Port() *Port

func (*SipUri) SetEncrypted

func (uri *SipUri) SetEncrypted(flag bool)

func (*SipUri) SetHeaders

func (uri *SipUri) SetHeaders(params Params)

func (*SipUri) SetHost

func (uri *SipUri) SetHost(host string)

func (*SipUri) SetPassword

func (uri *SipUri) SetPassword(pass MaybeString)

func (*SipUri) SetPort

func (uri *SipUri) SetPort(port *Port)

func (*SipUri) SetTelFlag

func (uri *SipUri) SetTelFlag(flag bool)

func (*SipUri) SetUriParams

func (uri *SipUri) SetUriParams(params Params)

func (*SipUri) SetUser

func (uri *SipUri) SetUser(user MaybeString)

func (*SipUri) String

func (uri *SipUri) String() string

Generates the string representation of a SipUri struct.

func (*SipUri) UriParams

func (uri *SipUri) UriParams() Params

func (*SipUri) User

func (uri *SipUri) User() MaybeString

type StatusCode

type StatusCode uint16

StatusCode - response status code: 1xx - 6xx

type String

type String struct {
	Str string
}

func (String) Equals

func (str String) Equals(other interface{}) bool

func (String) String

func (str String) String() string

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

func (*ToHeader) Clone

func (to *ToHeader) Clone() Header

Copy the header.

func (*ToHeader) Equals

func (to *ToHeader) Equals(other interface{}) bool

func (*ToHeader) Name

func (to *ToHeader) Name() string

func (*ToHeader) String

func (to *ToHeader) String() string

func (*ToHeader) Value

func (to *ToHeader) Value() string

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 Transport

type Transport interface {
	Messages() <-chan Message
	Send(msg Message) error
	IsReliable(network string) bool
	IsStreamed(network string) bool
}

type UnexpectedMessageError

type UnexpectedMessageError struct {
	Err error
	Msg string
}

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

type UnsupportedMessageError struct {
	Err error
	Msg string
}

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 ViaHeader

type ViaHeader []*ViaHop

func (ViaHeader) Clone

func (via ViaHeader) Clone() Header

func (ViaHeader) Equals

func (via ViaHeader) Equals(other interface{}) bool

func (ViaHeader) Name

func (via ViaHeader) Name() string

func (ViaHeader) String

func (via ViaHeader) String() string

func (ViaHeader) Value

func (via ViaHeader) 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.

func (*ViaHop) Clone

func (hop *ViaHop) Clone() *ViaHop

Return an exact copy of this ViaHop.

func (*ViaHop) Equals

func (hop *ViaHop) Equals(other interface{}) bool

func (*ViaHop) SentBy

func (hop *ViaHop) SentBy() string

func (*ViaHop) String

func (hop *ViaHop) String() string

type WildcardUri

type WildcardUri struct{}

The special wildcard URI used in Contact: headers in REGISTER requests when expiring all registrations.

func (WildcardUri) Clone

func (uri WildcardUri) Clone() Uri

Copy the wildcard URI. Not hard!

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) IsWildcard

func (uri WildcardUri) IsWildcard() bool

Always returns 'true'.

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

Directories

Path Synopsis
Forked from github.com/StefanKopieczek/gossip by @StefanKopieczek
Forked from github.com/StefanKopieczek/gossip by @StefanKopieczek

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL