sip_parser

package module
v0.0.0-...-18a5703 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2018 License: BSD-2-Clause Imports: 4 Imported by: 0

README

About

sip_parser is a high performance parser for Session Initiated
Protocol messages.  It provides a library for use in building
SIP user agents or any program in go that needs to be able to
parse SIP messages.

Installation

The following steps assume that you have mercurial and go
installed already and that you have GOPATH set.
1. go get bitbucket.org/zagrodzki/sip_parser
2. go install bitbucket.org/zagrodzki/sip_parser
3. (optional) run tests: go test -v bitbucket.org/zagrodzki/sip_parser
4. (optional) run benchmark:
      go install bitbucket.org/zagrodzki/sip_parser/bench
      ${GOPATH}/bin/bench --ct=10000

Usage

The library has an easy to use interface.

1. call sip_parser.ParseMsg(msg string)
2. you'll get back a *SipMsg struct with the following:
    -- State is the last parsing state
    -- Error is an os.Error
    -- Msg is the raw msg
    -- CallingParty is a *CallingParty struct (see below)
    -- Body is the body of the message
    -- StartLine is the parsed StartLine (see below)
    -- Headers is a slice of *Headers (see below) and will
       only contain headers that do not get parsed
    -- Accept is a *Accept struct (see below)
    -- AlertInfo is just the string of the Alert-Info hdr
    -- Allow is a slice of strings of the methods that are
       allowed
    -- AllowEvents is a slice of strings of the supported
       event types
    -- ContentDisposition is a *ContentDisposition struct
    -- ContentLength is the value of the Content-Length hdr
    -- ContentLengthInt is the int value of the ContentLength
    -- ContentType is the header value for the Content-Type hdr
    -- From is a *From struct (see below)
    -- MaxForwards is the hdr value for the Max-Forwards hdr
    -- MaxForwardsInt is the int value of the MaxForwards field
    -- Organization is the value for the Organization hdr
    -- To is a *From struct (see below)
    -- Contact is a *From struct (see below)
       ** NOTE ** Contact is not parsed automatically.  You
       have to call *SipMsg.ParseContact() to get this value.
    -- ContactVal is the raw value of the contact hdr
    -- CallId is the call-id for the message
    -- Cseq is a *Cseq struct (see below)
    -- Rack is a *Rack struct (see below)
    -- Reason is a *Reason struct
    -- Rseq is the value of the RSeq hdr
    -- RseqInt is the int value of the Rseq
    -- RecordRoute is a slice of *URI's structs (see below)
    -- Route is a slice of *URI's structs (see below)
    -- Via is a slice of *Via structs (see below)
    -- Require is a slice of the required extensions (string
       values) from the Require hdr
    -- Supported is a slice of the supported extensions (string
       values) from the Supported hdr
    -- Privacy is the value of the Privacy hdr
    -- ProxyRequire is a slice of strings from the
       Proxy-Require hdr
    -- RemotePartyIdVal is the value from the Remote-Party-Id hdr
    -- RemotePartyId is the RemotePartyId struct
       ** NOTE ** In order to actually get this value you have to
       call *SipMsg.ParseRemotePartyId()
    -- PAssertedIdVal is the value from the P-Asserted-Identity hdr
    -- PAssertedId is the *PAssertedId struct
       ** NOTE ** In order to actually get this value you have to
       call *SipMsg.ParsePAssertedId()
    -- Unsupported is a slice of the unsupported extensions from
       the Unsupported hdr
    -- UserAgent is the value of the User-Agent hdr
    -- Server is the value of the Server hdr
    -- Subject is the value of the Subject hdr
    -- Warning is a *Warning struct (see below)

Import Types

The following types are also part of the parsed SIP message.

Accept is a struct with the following fields:
-- Val is the raw value
-- Params is a slice of AcceptParam

CallingPartyInfo is a struct of calling party information.
This is populated into the *SipMsg.CallingParty field when
the method GetCallingParty on the *SipMsg.  See below for
details of that method.
CallingPartyInfo has the following fields:
-- Name the name
-- Number the number
-- Anonymous a bool to see if this should be anonymous or not


ContentDisposition is a struct with the following fields:
-- Val is the raw value
-- DispType is the display type
-- Params is a slice of *Param (see below)

Cseq is a struct with the following fields:
-- Val is the raw value
-- Method is the SIP method
-- Digit is the digit (although in a string format)

From is an important type that is used as a representation of
the parsed hdr values for the From, To, and Contact headers.
The From struct has the following fields:
-- Error is an os.Error
-- Val is the raw value
-- Name is the name value from the hdr
-- Tag is the value of the tag=$someval parameter
-- URI is the *URI
-- Params is a slice of *Param (see below)

Param is a struct with the following fields:
-- Param is the parameter
-- Val is the value of the parameter (if any ...)

PAssertedId is a struct with the following fields:
-- Error is an os.Error
-- Val is the raw value
-- Name is the name from the header
-- URI is the *URI
-- Params is a slice of *Param

Rack is a struct with the following fields:
-- Val is the raw value
-- RseqVal is the value of the rseq
-- CseqVal is the value of the cseq
-- CseqMethod is the value of the cseq method

Reason is a struct with the following fields:
-- Val is the raw value
-- Proto is the protocol
-- Cause is the cause code
-- Text is the text

RemotePartyId is a struct with the following fields:
-- Error is an os.Error
-- Val is the raw value of the hdr
-- Name is the name from the header
-- URI is the *URI
-- Party is the party parameter
-- Screen is the screen parameter
-- Privacy is the privacy parameeter
-- Params is a slice of *Param

StartLine is a struct with the following fields:
-- Error is an os.Error
-- Val is the raw value
-- Type is the type of startline (i.e. request or response)
-- Method is the method (if request)
-- URI is the *URI (if request)
-- Resp is the response code (i.e. 183)
-- RespText is the response text (i.e. "Session Progress")
-- Proto is the protocol (should be "SIP")
-- Version is the version (should be "2.0")

URI is an important struct that is used in many places
through a *SipMsg from the From header to the StartLine.
It has the following fields:
-- Error is an os.Error
-- Scheme is the scheme (i.e. "sip", "sips", "tel")
-- Raw is the raw value of the uri
-- UserInfo is everything before the "@" char if anything
-- User is the user (i.e. "bob")
-- UserPassword is the password (if any)
-- HostInfo is everything between the "@" char and any parameters
-- Host is the host
-- Port is the port
-- UriParams is a slice of *Param
-- Secure is a bool indicating if communication is secure

Via is an important part of the *SipMsg.  It is a fundamental
basis on which to build route-sets and do call matching.  It
has the following structs:
-- State is the parser state
-- Error is an os.Error
-- Via is the raw value
-- Proto is the protocol (i.e. "SIP")
-- Version is the version (i.e. "2.0")
-- Transport is the transport method (i.e. "UDP")
-- SentBy is a host:port combination
-- Branch is the branch parameter
-- Params is a slice of *Param

Import Methods on the *SipMsg

GetCallingParty

GetCallingParty is a method that can be called with one of
the following:
-- rpid (abbr for remote-party-id)
-- paid (abbr for party-associated-identity)
If either of the above parameters are passed to the method
then it will use one of the matching hdrs to obtain the info.
If anything else is passed then it will pull the CallingPartyInfo
from the from header.

GetRURIParamBool

GetRURIParamBool returns true or false to see if a parameter
is present in the request URI

GetRURIParamVal

GetRURIParamVal returns the actual value of the parameter if
the parameter is present in the request URI

Documentation

Index

Constants

View Source
const (
	// SIP request or response
	SIP_REQUEST  = "REQUEST"
	SIP_RESPONSE = "RESPONSE"
	// SIP Methods
	SIP_METHOD_INVITE    = "INVITE"
	SIP_METHOD_ACK       = "ACK"
	SIP_METHOD_OPTIONS   = "OPTIONS"
	SIP_METHOD_BYE       = "BYE"
	SIP_METHOD_CANCEL    = "CANCEL"
	SIP_METHOD_REGISTER  = "REGISTER"
	SIP_METHOD_INFO      = "INFO"
	SIP_METHOD_PRACK     = "PRACK"
	SIP_METHOD_SUBSCRIBE = "SUBSCRIBE"
	SIP_METHOD_NOTIFY    = "NOTIFY"
	SIP_METHOD_UPDATE    = "UPDATE"
	SIP_METHOD_MESSAGE   = "MESSAGE"
	SIP_METHOD_REFER     = "REFER"
	SIP_METHOD_PUBLISH   = "PUBLISH"
	// SIP Headers
	SIP_HDR_ACCEPT                        = "accept"          // RFC3261
	SIP_HDR_ACCEPT_CONTACT                = "accept-contact"  // RFC3841
	SIP_HDR_ACCEPT_CONTACT_CMP            = "a"               // RFC3841
	SIP_HDR_ACCEPT_ENCODING               = "accept-encoding" //
	SIP_HDR_ACCEPT_LANGUAGE               = "accept-language"
	SIP_HDR_ACCEPT_RESOURCE_PRIORITY      = "accept-resource-priority" // RFC4412
	SIP_HDR_ALERT_INFO                    = "alert-info"
	SIP_HDR_ALLOW                         = "allow"
	SIP_HDR_ALLOW_EVENTS                  = "allow-events"
	SIP_HDR_ALLOW_EVENTS_CMP              = "u"
	SIP_HDR_ANSWER_MODE                   = "answer-mode"
	SIP_HDR_AUTHENTICATION_INFO           = "authentication-info"
	SIP_HDR_AUTHORIZATION                 = "authorization"
	SIP_HDR_CALL_ID                       = "call-id"
	SIP_HDR_CALL_ID_CMP                   = "i"
	SIP_HDR_CALL_INFO                     = "call-info"
	SIP_HDR_CONTACT                       = "contact"
	SIP_HDR_CONTACT_CMP                   = "m"
	SIP_HDR_CONTENT_DISPOSITION           = "content-disposition"
	SIP_HDR_CONTENT_ENCODING              = "content-encoding"
	SIP_HDR_CONTENT_ENCODING_CMP          = "e"
	SIP_HDR_CONTENT_LANGUAGE              = "content-language"
	SIP_HDR_CONTENT_LENGTH                = "content-length"
	SIP_HDR_CONTENT_LENGTH_CMP            = "l"
	SIP_HDR_CONTENT_TYPE                  = "content-type"
	SIP_HDR_CONTENT_TYPE_CMP              = "c"
	SIP_HDR_CSEQ                          = "cseq"
	SIP_HDR_DATE                          = "date"
	SIP_HDR_ERROR_INFO                    = "error-info"
	SIP_HDR_EVENT                         = "event"
	SIP_HDR_EXPIRES                       = "expires"
	SIP_HDR_FLOW_TIMER                    = "flow-timer"
	SIP_HDR_FROM                          = "from"
	SIP_HDR_FROM_CMP                      = "f"
	SIP_HDR_HISTORY_INFO                  = "history-info"  // from RFC 4244
	SIP_HDR_IDENTITY                      = "identity"      // RFC 4474
	SIP_HDR_IDENTITY_CMP                  = "y"             // RFC 4474
	SIP_HDR_IDENTITY_INFO                 = "identity-info" // RFC 4474
	SIP_HDR_IDENTITY_INFO_CMP             = "n"             // RFC 4474
	SIP_HDR_IN_REPLY_TO                   = "in-reply-to"
	SIP_HDR_JOIN                          = "join" // RFC 3911
	SIP_HDR_MAX_FORWARDS                  = "max-forwards"
	SIP_HDR_MIME_VERSION                  = "mime-version"
	SIP_HDR_MIN_EXPIRES                   = "min-expires"
	SIP_HDR_MIN_SE                        = "min-se" // RFC4028
	SIP_HDR_ORGANIZATION                  = "organization"
	SIP_HDR_PATH                          = "path"               // RFC3327
	SIP_HDR_PERMISSION_MISSING            = "permission-missing" // RFC5360
	SIP_HDR_PRIORITY                      = "priority"
	SIP_HDR_PRIVACY                       = "privacy"
	SIP_HDR_PRIV_ANSWER_MODE              = "priv-answer-mode" // RFC 5373
	SIP_HDR_PROXY_AUTHENTICATE            = "proxy-authenticate"
	SIP_HDR_PROXY_AutHORIZATION           = "proxy-authorization"
	SIP_HDR_PROXY_REQUIRE                 = "proxy-require"
	SIP_HDR_RACK                          = "rack" // RFC 3262
	SIP_HDR_REASON                        = "reason"
	SIP_HDR_RECORD_ROUTE                  = "record-route"
	SIP_HDR_REFER_SUB                     = "refer-sub"                     // RFC4488
	SIP_HDR_REFER_TO                      = "refer-to"                      // RFC 3515, RFC 4508
	SIP_HDR_REFERRED_BY                   = "referred-by"                   // RFC3892
	SIP_HDR_REFERRED_BY_CMP               = "b"                             // RFC3892
	SIP_HDR_REJECT_CONTACT                = "reject-contact"                // RFC3841
	SIP_HDR_REJECT_CONTACT_CMP            = "j"                             // RFC3841
	SIP_HDR_REMOTE_PARTY_ID               = "remote-party-id"               // DRAFT
	SIP_HDR_REPLACES                      = "replaces"                      // RFC3891
	SIP_HDR_REPLY_TO                      = "reply-to"                      // RFC3261
	SIP_HDR_REQUEST_DISPOSITION           = "request-disposition"           // RFC3841
	SIP_HDR_REQUIRE                       = "require"                       // RFC3261
	SIP_HDR_RESOURCE_PRIORITY             = "resource-priority"             // RFC4412
	SIP_HDR_RETRY_AFTER                   = "retry-after"                   // RFC3261
	SIP_HDR_ROUTE                         = "route"                         // RFC3261
	SIP_HDR_RSEQ                          = "rseq"                          // RFC3262
	SIP_HDR_SECUTIRY_CLIENT               = "security-client"               // RFC3329
	SIP_HDR_SECURITY_SERVER               = "security-server"               // RFC3329
	SIP_HDR_SECURITY_VERIFY               = "security-verify"               // RFC3329
	SIP_HDR_SERVER                        = "server"                        // RFC3261
	SIP_HDR_SERVICE_ROUTE                 = "service-route"                 // RFC3608
	SIP_HDR_SESSION_EXPIRES               = "session-expires"               // RFC4028
	SIP_HDR_SESSION_EXPIRES_CMP           = "x"                             // RFC4028
	SIP_HDR_SIP_ETAG                      = "sip-etag"                      // RFC3903
	SIP_HDR_SIP_IF_MATCH                  = "sip-if-match"                  // RFC3903
	SIP_HDR_SUBJECT                       = "subject"                       // RFC3261
	SIP_HDR_SUBJECT_CMP                   = "s"                             // RFC3261
	SIP_HDR_SUBSCRIPTION_STATE            = "subscription-state"            // RFC3265
	SIP_HDR_SUPPORTED                     = "supported"                     // RFC3261
	SIP_HDR_SUPPORTED_CMP                 = "k"                             // RFC3261
	SIP_HDR_SUPPRESS_IF_MATCH             = "suppress-if-match"             // RFC5839
	SIP_HDR_TARGET_DIALOG                 = "target-dialog"                 // RFC4538
	SIP_HDR_TIMESTAMP                     = "timestamp"                     // RFC3261
	SIP_HDR_TO                            = "to"                            // RFC3261
	SIP_HDR_TO_CMP                        = "t"                             // RFC3261
	SIP_HDR_TRIGGER_CONSENT               = "trigger-consent"               // RFC5360
	SIP_HDR_UNSUPPORTED                   = "unsupported"                   // RFC3261
	SIP_HDR_USER_AGENT                    = "user-agent"                    // RFC3261
	SIP_HDR_VIA                           = "via"                           // RFC3261
	SIP_HDR_VIA_CMP                       = "v"                             // RFC3261
	SIP_HDR_WARNING                       = "warning"                       // RFC3261
	SIP_HDR_WWW_AUTHENTICATE              = "www-authenticate"              // RFC3261
	SIP_HDR_P_ACCESS_NETWORK_INFO         = "p-access-network-info"         // RFC3455
	SIP_HDR_P_ANSWER_STATE                = "p-answer-state"                // RFC3455
	SIP_HDR_P_ASSERTED_IDENTITY           = "p-asserted-identity"           // RFC3325
	SIP_HDR_P_ASSERTED_SERVICE            = "p-asserted-service"            // RFC3455
	SIP_HDR_P_ASSOCIATED_URI              = "p-associated-uri"              // RFC3455
	SIP_HDR_P_CALLED_PARTY_ID             = "p-called-party-id"             // RFC3455
	SIP_HDR_P_CHARGING_FUNCTION_ADDRESSES = "p-charging-function-addresses" // RFC3455
	SIP_HDR_P_CHARGING_VECTOR             = "p-charging-vector"             // RFC3455
	SIP_HDR_P_DCS_BILLING_INFO            = "p-dcs-billing-info"            // RFC5503
	SIP_HDR_P_DCS_LAES                    = "p-dcs-laes"                    // RFC5503
	SIP_HDR_P_DCS_OSPS                    = "p-dcs-osps"                    // RFC5503
	SIP_HDR_P_DCS_REDIRECT                = "p-dcs-redirect"                // RFC5503
	SIP_HDR_P_DCS_TRACE_PARTY_ID          = "p-dcs-trace-party-id"          // RFC5503
	SIP_HDR_P_EARLY_MEDIA                 = "p-early-media"                 // RFC5009
	SIP_HDR_P_MEDIA_AUTHORIZATION         = "p-media-authorization"         // RFC3313
	SIP_HDR_P_PREFERRED_IDENTITY          = "p-preferred-identity"          // RFC3325
	SIP_HDR_P_PREFERRED_SERVICE           = "p-preferred-service"           // RFC6050
	SIP_HDR_P_PROFILE_KEY                 = "p-profile-key"                 // RFC5002
	// P-RTP-Stat is Cisco proprietary, see http://www.cisco.com/en/US/docs/ios-xml/ios/voice/cube_sip/configuration/15-2mt/voi-report-end-cal.html
	SIP_HDR_P_RTP_STAT           = "p-rtp-stat"
	SIP_HDR_P_USER_DATABASE      = "p-user-database"      // RFC4457
	SIP_HDR_P_VISITED_NETWORK_ID = "p-visited-network-id" // RFC3455
	SIP_HDR_X_RTP_STAT           = "x-rtp-stat"           // like P-RTP-Stat, but in Libre/BareSIP
)

constants just holds a common shared set of constants (i.e. hdr values)

View Source
const (
	CR                    = "\r"
	LF                    = "\n"
	CALLING_PARTY_DEFAULT = "default"
	CALLING_PARTY_RPID    = "rpid"
	CALLING_PARTY_PAID    = "paid"
)
View Source
const (
	RTPStatPS = "PS"
	RTPStatOS = "OS"
	RTPStatPR = "PR"
	RTPStatOR = "OR"
	RTPStatPL = "PL"
	RTPStatJI = "JI"
	RTPStatLA = "LA"
	RTPStatDU = "DU"
)
View Source
const (
	SIP_SCHEME  = "sip"
	SIPS_SCHEME = "sips"
	TEL_SCHEME  = "tel"
)

Variables

Functions

This section is empty.

Types

type Accept

type Accept struct {
	Val    string
	Params []*AcceptParam
}

Accept is a struct that holds the following: -- the raw value -- a slice of parced AcceptParam

type AcceptParam

type AcceptParam struct {
	Type string
	Val  string
}

AcceptParam is just a key:value pair of params for the accept header

type Authorization

type Authorization struct {
	Val         string
	Credentials string
	Params      []*Param
}

func (*Authorization) GetParam

func (a *Authorization) GetParam(param string) *Param

type CallingPartyInfo

type CallingPartyInfo struct {
	Name      string
	Number    string
	Anonymous bool
}

type ContentDisposition

type ContentDisposition struct {
	Val      string
	DispType string
	Params   []*Param
}

ContentDisposition is a struct that holds a parsed content-disposition hdr: -- Val is the raw value -- DispType is the display type -- Params is slice of parameters

type Cseq

type Cseq struct {
	Val    string
	Method string
	Digit  string
}

Cseq is a struct that holds the values for a cseq header:

-- Val is the raw string value of the cseq hdr
-- Method is the SIP method
-- Digit is the numeric indicator for the method

type From

type From struct {
	Error  error
	Val    string
	Name   string
	Tag    string
	URI    *URI
	Params []*Param
	// contains filtered or unexported fields
}

from holds a parsed header that has a format like: "NAME" <sip:user@hostinfo>;param=val and is used for the parsing of the from, to, and contact header in the parser program From holds the following public fields: -- Error is an error -- Val is the raw value -- Name is the name value -- Tag is the tag value -- URI is a parsed uri -- Params are for any generic params that are part of

the header
type Header struct {
	Header string
	Val    string
}

func (*Header) String

func (h *Header) String() string

type PAssertedId

type PAssertedId struct {
	Error  error
	Val    string
	Name   string
	URI    *URI
	Params []*Param
	// contains filtered or unexported fields
}

PAssertedId is a struct that holds: -- Error is just an os.Error -- Val is the raw value -- Name is the name value from the p-asserted-id hdr -- URI is the parsed uri from the p-asserted-id hdr -- Params is a slice of the *Params from the p-asserted-id hdr

type Param

type Param struct {
	Param string
	Val   string
}

Param is just a struct that holds a parameter and a value As an example of this would be something like user=phone

type RTPStat

type RTPStat struct {
	Val    string
	Params []*Param

	PS, OS, PR, OR, PL, JI, DU uint32
	LA                         int32
	Errors                     []error
	// contains filtered or unexported fields
}

RTPStat is a struct that holds a parsed [PX]-RTP-Stat hdr Fields are as follows: -- Val is the raw value -- Params has individual fields -- Has is a map of stat types to bool, Has[s] is true if header includes stat s. -- PS is the number of packets sent -- OS is the number of octets sent -- PR is the number of packets received -- OR is the number of octets received -- PL is the number of packets lost -- JI is the jitter -- LA is the round-trip delay -- DU is call duration -- Errors is a list of errors encountered when parsing individual fields

func (*RTPStat) Has

func (r *RTPStat) Has(f RTPStatField) bool

Has returns true if the RTPStat includes stat f.

type RTPStatField

type RTPStatField string

type Rack

type Rack struct {
	Val        string
	RseqVal    string
	CseqVal    string
	CseqMethod string
}

Rack is a struct that holds the parsed rack hdr The fields are as follows: -- Val is the raw value -- RseqVal is the rseq value from the rack hdr -- CseqVal is the cseq value from the rack hdr -- CseqMethod is the method from the cseq hdr

type Reason

type Reason struct {
	Val   string
	Proto string
	Cause string
	Text  string
}

Reason is a struct that holds a parsed reason hdr Fields are as follows: -- Val is the raw value -- Proto is the protocol (i.e. SIP) -- Cause is the cause code (i.e. 41) -- Text is the actual text response

type RemotePartyId

type RemotePartyId struct {
	Error   error
	Val     string
	Name    string
	URI     *URI
	Party   string
	Screen  string
	Privacy string
	Params  []*Param
}

type SipMsg

type SipMsg struct {
	State              string
	Error              error
	Msg                string
	CallingParty       *CallingPartyInfo
	Body               string
	StartLine          *StartLine
	Headers            []*Header
	Accept             *Accept
	AlertInfo          string
	Allow              []string
	AllowEvents        []string
	Authorization      *Authorization
	ContentDisposition *ContentDisposition
	ContentLength      string
	ContentLengthInt   int
	ContentType        string
	From               *From
	MaxForwards        string
	MaxForwardsInt     int
	Organization       string
	To                 *From
	Contact            *From
	ContactVal         string
	CallId             string
	Cseq               *Cseq
	Rack               *Rack
	Reason             *Reason
	Rseq               string
	RseqInt            int
	RecordRoute        []*URI
	RTPStat            *RTPStat
	Route              []*URI
	Via                []*Via
	Require            []string
	Supported          []string
	Privacy            string
	ProxyAuthenticate  *Authorization
	ProxyRequire       []string
	RemotePartyIdVal   string
	RemotePartyId      *RemotePartyId
	PAssertedIdVal     string
	PAssertedId        *PAssertedId
	Unsupported        []string
	UserAgent          string
	Server             string
	Subject            string
	Warning            *Warning
	WWWAuthenticate    *Authorization
	// contains filtered or unexported fields
}

func ParseMsg

func ParseMsg(str string) (s *SipMsg)

func (*SipMsg) GetCallingParty

func (s *SipMsg) GetCallingParty(str string) error

func (*SipMsg) GetRURIParamBool

func (s *SipMsg) GetRURIParamBool(str string) bool

func (*SipMsg) GetRURIParamVal

func (s *SipMsg) GetRURIParamVal(str string) string

func (*SipMsg) ParseContact

func (s *SipMsg) ParseContact(str string)

func (*SipMsg) ParsePAssertedId

func (s *SipMsg) ParsePAssertedId(str string)

func (*SipMsg) ParseRemotePartyId

func (s *SipMsg) ParseRemotePartyId(str string)

type StartLine

type StartLine struct {
	Error    error
	Val      string
	Type     string
	Method   string
	URI      *URI
	Resp     string
	RespText string
	Proto    string
	Version  string
}

func ParseStartLine

func ParseStartLine(str string) *StartLine

type URI

type URI struct {
	Error        error  // error if any
	Scheme       string // scheme .. i.e. tel, sip, sips,etc.
	Raw          string // this is the actual raw uri unparsed
	UserInfo     string // this is everything before the "@"
	User         string // this is the actual called party
	UserPassword string // this is the password (i.e. alice:[email protected])
	HostInfo     string // this is everything after the @ or the entire uri
	Host         string // the host in the uri
	Port         string // the port
	UriParams    []*Param
	Secure       bool // Indicates SIP-URI or SIPS-URI (true for SIPS-URI)
	// contains filtered or unexported fields
}

URI is a struct that holds an error (hopefully nil), the raw value, and the parsed uri. Fields are as follows: -- Error is the error (or nil) -- Scheme is the scheme (i.e. sip) -- Raw is the raw value of the uri -- UserInfo is the user:password;userparams=foo; -- User is the user (i.e. the phone number) -- UserPassword is the user password -- HostInfo is the host:port combination -- Host is the host -- Port is the port (if any) -- UriParams are the uri's parameters -- Secure is if the scheme is "sips" -- atPos is just used by the parser to identify where the

"@" char is in the .Raw field (or 0 if not present)

func NewURI

func NewURI(s string) *URI

NewURI is a convenience function that creates a *URI for you

func ParseURI

func ParseURI(s string) *URI

ParseURI is NewURI ... but also parses it

func (*URI) Parse

func (u *URI) Parse()

Parse parses the .Raw field

type Via

type Via struct {
	State     string
	Error     error
	Via       string
	Proto     string
	Version   string
	Transport string
	SentBy    string
	Branch    string
	Received  string
	RPort     string
	Params    []*Param
	// contains filtered or unexported fields
}

func (*Via) AddReceived

func (v *Via) AddReceived(s string)

type Warning

type Warning struct {
	Val     string
	Code    string
	CodeInt int
	Agent   string
	Text    string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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