Documentation
¶
Index ¶
- Constants
- func GetSIPHeaderVal(header string, data string) (val string)
- type Accept
- type AcceptParam
- type Authorization
- type CallingPartyInfo
- type ContentDisposition
- type Cseq
- type Diversion
- type From
- type Header
- type PAssertedId
- type Param
- type Rack
- type Reason
- type RemotePartyId
- type SipMsg
- type StartLine
- type URI
- type Via
- type Warning
Constants ¶
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" // 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_DIVERSION = "diversion" // RFC3261 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 // X-RTP-Stat is AVM proprietary, see https://avm.de/fileadmin/user_upload/Global/Service/Schnittstellen/xrtpv32.pdf SIP_HDR_X_RTP_STAT = "x-rtp-stat" SIP_HDR_X_RTP_STAT_ADD = "x-rtp-stat-add" )
constants just holds a common shared set of constants (i.e. hdr values)
const ( CR = "\r" LF = "\n" CALLING_PARTY_DEFAULT = "default" CALLING_PARTY_RPID = "rpid" CALLING_PARTY_PAID = "paid" )
const ( SIP_SCHEME = "sip" SIPS_SCHEME = "sips" TEL_SCHEME = "tel" )
Variables ¶
This section is empty.
Functions ¶
func GetSIPHeaderVal ¶
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 ¶
AcceptParam is just a key:value pair of params for the accept header
type Authorization ¶
type CallingPartyInfo ¶
type ContentDisposition ¶
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 ¶
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 // 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 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 ¶
Param is just a struct that holds a parameter and a value As an example of this would be something like user=phone
type Rack ¶
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 ¶
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 SipMsg ¶
type SipMsg struct { State string Error error Msg string CallingParty *CallingPartyInfo Body string Authorization *Authorization AuthVal string AuthUser string ContentLength string ContentType string From *From FromUser string FromHost string FromTag string MaxForwards string Organization string To *From ToUser string ToHost string ToTag string Expires string Contact *From ContactVal string ContactUser string ContactHost string ContactPort int CallID string XCallID string XHeader []string CHeader []string CustomHeader map[string]string Cseq *Cseq CseqMethod string CseqVal string ReasonVal string RTPStatVal string ViaOne string ViaOneBranch string Privacy string RemotePartyIdVal string DiversionVal string RemotePartyId *RemotePartyId PAssertedIdVal string PaiUser string PaiHost string PAssertedId *PAssertedId UserAgent string Server string URIHost string URIRaw string URIUser string FirstMethod string FirstResp string FirstRespText string Profile string // contains filtered or unexported fields }
func (*SipMsg) GetCallingParty ¶
func (*SipMsg) ParseContact ¶
func (*SipMsg) ParsePAssertedId ¶
func (*SipMsg) ParseRemotePartyId ¶
type StartLine ¶
type StartLine struct { Error error //internal error condition Val string //StartLine as a String Type string //one of SIP_REQUEST or SIP_RESPONSE Method string //INV, ACK, BYE etc URI *URI //Request URI; sip:alice@chicago.com Resp string //Response code: e.g. 200, 400 RespText string //Response String e.g. "Trying" Proto string //e.g. "SIP" in the string "SIP/2.0" Version string //e.g. "2.0" in the string "SIP/2.0" }
func ParseStartLine ¶
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 HostInfo string // this is everything after the @ or the entire uri Host string // the host in the uri Port string // the port PortInt int //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) -- 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)