Documentation ¶
Index ¶
- Constants
- func CanonicalHeaderKey(s string) string
- func NewRequest(method, requestURI string, body io.Reader) *request
- func NewResponse(statusCode int, reasonPhrase string, body io.Reader) *response
- func ParseSIPVersion(vers string) (major, minor int, ok bool)
- func ParseTime(text string) (t time.Time, err error)
- type ClientTransaction
- type Dialog
- type DialogState
- type Header
- type Listener
- type Message
- type Provider
- type Request
- type RequestEvent
- type Response
- type ResponseEvent
- type ServerTransaction
- type Stack
- type StartLineWriter
- type Timeout
- type TimeoutEvent
- type Tracer
- type Transaction
- type TransactionState
- type Transport
Constants ¶
const ( ACK = "ACK" BYE = "BYE" CANCEL = "CANCEL" INVITE = "INVITE" OPTIONS = "OPTIONS" REGISTER = "REGISTER" NOTIFY = "NOTIFY" SUBSCRIBE = "SUBSCRIBE" MESSAGE = "MESSAGE" REFER = "REFER" INFO = "INFO" PRACK = "PRACK" UPDATE = "UPDATE" )
const ( TRYING = 100 RINGING = 180 CALL_IS_BEING_FORWARDED = 181 QUEUED = 182 SESSION_PROGRESS = 183 OK = 200 ACCEPTED = 202 MULTIPLE_CHOICES = 300 MOVED_PERMANENTLY = 301 MOVED_TEMPORARILY = 302 USE_PROXY = 305 ALTERNATIVE_SERVICE = 380 BAD_REQUEST = 400 UNAUTHORIZED = 401 PAYMENT_REQUIRED = 402 FORBIDDEN = 403 NOT_FOUND = 404 METHOD_NOT_ALLOWED = 405 NOT_ACCEPTABLE = 406 PROXY_AUTHENTICATION_REQUIRED = 407 REQUEST_TIMEOUT = 408 GONE = 410 REQUEST_ENTITY_TOO_LARGE = 413 REQUEST_URI_TOO_LONG = 414 UNSUPPORTED_MEDIA_TYPE = 415 UNSUPPORTED_URI_SCHEME = 416 BAD_EXTENSION = 420 EXTENSION_REQUIRED = 421 INTERVAL_TOO_BRIEF = 423 TEMPORARILY_UNAVAILABLE = 480 CALL_OR_TRANSACTION_DOES_NOT_EXIST = 481 LOOP_DETECTED = 482 TOO_MANY_HOPS = 483 ADDRESS_INCOMPLETE = 484 AMBIGUOUS = 485 BUSY_HERE = 486 REQUEST_TERMINATED = 487 NOT_ACCEPTABLE_HERE = 488 BAD_EVENT = 489 REQUEST_PENDING = 491 UNDECIPHERABLE = 493 SERVER_INTERNAL_ERROR = 500 NOT_IMPLEMENTED = 501 BAD_GATEWAY = 502 SERVICE_UNAVAILABLE = 503 SERVER_TIMEOUT = 504 VERSION_NOT_SUPPORTED = 505 MESSAGE_TOO_LARGE = 513 BUSY_EVERYWHERE = 600 DECLINE = 603 DOES_NOT_EXIST_ANYWHERE = 604 SESSION_NOT_ACCEPTABLE = 606 )
const ( TIMEOUT_RETRANSMIT = iota //0 TIMEOUT_TRANSACTION //1 )
const ( UDP = "udp" TCP = "tcp" TLS = "tls" SCTP = "sctp" )
const TimeFormat = "Mon, 02 Jan 2006 15:04:05 GMT"
TimeFormat is the time format to use with time.Parse and time.Time.Format when parsing or generating times in HTTP headers. It is like time.RFC1123 but hard codes GMT as the time zone.
Variables ¶
This section is empty.
Functions ¶
func CanonicalHeaderKey ¶
CanonicalHeaderKey returns the canonical format of the header key s. The canonicalization converts the first letter and any letter following a hyphen to upper case; the rest are converted to lowercase. For example, the canonical key for "accept-encoding" is "Accept-Encoding". If s contains a space or invalid header field bytes, it is returned without modifications.
func NewRequest ¶
func ParseSIPVersion ¶
ParseSIPVersion parses a SIP version string. "SIP/2.0" returns (2, 0, true).
Types ¶
type ClientTransaction ¶
type Dialog ¶
type Dialog interface { GetLocalParty() string GetRemoteParty() string GetRemoteTarget() string GetDialogId() string GetCallId() string GetLocalSequenceNumber() int GetRemoteSequenceNumber() int GetRouteSet() []string IsSecure() bool IsServer() bool IncrementLocalSequenceNumber() CreateRequest(method string) (Request, error) SendRequest(ct ClientTransaction) error SendAck(ack Request) error GetState() DialogState Close() GetFirstTransaction() Transaction GetLocalTag() string GetRemoteTag() string SetApplicationData(applicationData interface{}) GetApplicationData() interface{} }
type DialogState ¶
type DialogState int
const ( DIALOGSTATE_EARLY DialogState = iota //0 DIALOGSTATE_CONFIRMED //1 DIALOGSTATE_COMPLETED //2 DIALOGSTATE_TERMINATED //3 )
type Header ¶
A Header represents the key-value pairs in an HTTP header.
func (Header) Add ¶
Add adds the key, value pair to the header. It appends to any existing values associated with key.
func (Header) Get ¶
Get gets the first value associated with the given key. If there are no values associated with the key, Get returns "". To access multiple values of a key, access the map directly with CanonicalHeaderKey.
func (Header) Set ¶
Set sets the header entries associated with key to the single element value. It replaces any existing values associated with key.
type Listener ¶
type Listener interface { ProcessRequest(requestEvent RequestEvent) ProcessResponse(responseEvent ResponseEvent) ProcessTimeout(timeoutEvent TimeoutEvent) }
type Message ¶
type Provider ¶
type Provider interface { AddTransport(Transport) RemoveTransport(Transport) AddListener(Listener) RemoveListener(Listener) GetNewCallId() string GetNewClientTransaction(Request) ClientTransaction GetNewServerTransaction(Request) ServerTransaction SendRequest(Request) error SendResponse(Response) error }
type RequestEvent ¶
type RequestEvent struct {
// contains filtered or unexported fields
}
func NewRequestEvent ¶
func NewRequestEvent(serverTransaction ServerTransaction, request Request) *RequestEvent
func (*RequestEvent) GetRequest ¶
func (this *RequestEvent) GetRequest() Request
func (*RequestEvent) GetServerTransaction ¶
func (this *RequestEvent) GetServerTransaction() ServerTransaction
type ResponseEvent ¶
type ResponseEvent struct {
// contains filtered or unexported fields
}
func NewResponseEvent ¶
func NewResponseEvent(clientTransaction ClientTransaction, response Response) *ResponseEvent
func (*ResponseEvent) GetClientTransaction ¶
func (this *ResponseEvent) GetClientTransaction() ClientTransaction
func (*ResponseEvent) GetResponse ¶
func (this *ResponseEvent) GetResponse() Response
type ServerTransaction ¶
type ServerTransaction interface { Transaction SendResponse(Response) error }
type Stack ¶
type StartLineWriter ¶
type TimeoutEvent ¶
type TimeoutEvent struct {
// contains filtered or unexported fields
}
func NewTimeoutEvent ¶
func NewTimeoutEvent(transaction Transaction, timeout Timeout) *TimeoutEvent
func (*TimeoutEvent) GetTimeout ¶
func (this *TimeoutEvent) GetTimeout() Timeout
func (*TimeoutEvent) GetTransaction ¶
func (this *TimeoutEvent) GetTransaction() Transaction
func (*TimeoutEvent) IsServerTransaction ¶
func (this *TimeoutEvent) IsServerTransaction() bool
type Transaction ¶
type TransactionState ¶
type TransactionState int
const ( TRANSACTIONSTATE_CALLING TransactionState = iota //0 TRANSACTIONSTATE_TRYING //1 TRANSACTIONSTATE_PROCEEDING //2 TRANSACTIONSTATE_COMPLETED //3 TRANSACTIONSTATE_CONFIRMED //4 TRANSACTIONSTATE_TERMINATED //5 )