Documentation
¶
Index ¶
- Variables
- type CallControlHeaders
- type CommonHeaders
- type Contact
- func (h *Contact) Init() Header
- func (h *Contact) Param(name string) string
- func (h *Contact) ParamString() (result string)
- func (h *Contact) SetParam(name, value string) Header
- func (h *Contact) SetUri(uri string) Header
- func (h *Contact) SetValue(value string) Header
- func (h *Contact) Uri() string
- func (h *Contact) Value() string
- type Header
- type Invite
- func (i *Invite) Control() *CallControlHeaders
- func (i *Invite) Headers() *CommonHeaders
- func (i *Invite) Method() string
- func (i *Invite) Parse(message string) (err error)
- func (i *Invite) Payload() []byte
- func (i *Invite) RawHeaders() string
- func (i *Invite) Render() string
- func (i *Invite) SetPayload(data []byte)
- func (i *Invite) StringPayload() string
- func (i *Invite) Uri() string
- type Message
- type Register
- func (r *Register) Control() *CallControlHeaders
- func (r *Register) Headers() *CommonHeaders
- func (r *Register) Method() string
- func (r *Register) Parse(message string) (err error)
- func (r *Register) Payload() []byte
- func (r *Register) Render() string
- func (r *Register) SetPayload(data []byte)
- func (r *Register) StringPayload() string
- func (r *Register) Uri() string
- type ToFrom
- func (t *ToFrom) Init() Header
- func (t *ToFrom) Param(name string) string
- func (t *ToFrom) ParamString() string
- func (t *ToFrom) SetParam(name, value string) Header
- func (t *ToFrom) SetUri(uri string) Header
- func (t *ToFrom) SetValue(value string) Header
- func (t *ToFrom) Uri() string
- func (t *ToFrom) Value() string
Constants ¶
This section is empty.
Variables ¶
var SupportedMethods = [5]string{
"INVITE", "REGISTER", "NOTIFY", "SUBSCRIBE", "ACK",
}
SupportedMethods is a list of all request types currently supported by Slurp
var SupportedResponses = map[int]string{
200: "OK",
100: "Trying",
180: "Ringing",
183: "Session Progress",
401: "Unauthorized",
404: "Not Found",
486: "Busy Here",
}
SupportedResponses is a mapping of support response codes and their text values
Functions ¶
This section is empty.
Types ¶
type CallControlHeaders ¶
type CallControlHeaders struct {
// A slice of Via headers
// the format is an array[2] of strings, where:
// [0] = The transport (UDP, TCP)
// [1] = The URI
Via [][2]string
// The branch of the most recent via, or ours if we added it
ViaBranch string
CallId string
Sequence int
Authenticate string
}
CallControlHeaders are common headers that are usually only set by the system, not by users
type CommonHeaders ¶
type CommonHeaders struct {
To Header
From Header
Contacts []Header
Forward int //MaxForwards
UserAgent string
ContentType string
ContentLength int
}
Contains header information common across all messages
type Header ¶
type Header interface {
Value() string
Param(string) string
Uri() string
SetValue(string) Header
SetParam(string, string) Header
SetUri(string) Header
ParamString() string
// Do we want to do Init() here or move Render() to each header impl?
Init() Header
}
Header represents "complicated" headers in the SIP RFC Not all headers are Headers. For instance, MaxForwards is fundamentally too simple to merit so much overhead
type Invite ¶
type Invite struct {
// contains filtered or unexported fields
}
func (*Invite) Control ¶
func (i *Invite) Control() *CallControlHeaders
func (*Invite) Headers ¶
func (i *Invite) Headers() *CommonHeaders
func (*Invite) Parse ¶
Parse takes a string representation of a message and unmarshalls the data into the appropriate struct fields.
func (*Invite) RawHeaders ¶
func (*Invite) SetPayload ¶
func (*Invite) StringPayload ¶
type Message ¶
type Message interface {
Render() string
// given a string representation of a message, unmarshall into Message object
Parse(string) error
// Get the method/request type of the message
Method() string
Uri() string
Headers() *CommonHeaders
RawHeaders() string
Control() *CallControlHeaders
Payload() []byte
StringPayload() string
SetPayload([]byte)
}
Message is the golang model representing an entire SIP message
type Register ¶
type Register struct {
// contains filtered or unexported fields
}
func (*Register) Control ¶
func (r *Register) Control() *CallControlHeaders
func (*Register) Headers ¶
func (r *Register) Headers() *CommonHeaders
func (*Register) Parse ¶
Parse takes a string representation of a message and unmarshalls the data into the appropriate struct fields.
func (*Register) SetPayload ¶
func (*Register) StringPayload ¶
type ToFrom ¶
type ToFrom struct {
// contains filtered or unexported fields
}
Used for both From an To headers as they have the same parameters