Documentation
¶
Index ¶
- Variables
- func DefaultHeadersParser() map[string]HeaderParser
- func ParseAddressValue(addressText string, uri *sip.Uri, headerParams sip.HeaderParams) (displayName string, err error)
- func ParseLine(startLine string) (msg sip.Message, err error)
- func ParseMessage(msgData []byte) (sip.Message, error)
- func ParseRequestLine(requestLine string, recipient *sip.Uri) (method sip.RequestMethod, sipVersion string, err error)
- func ParseStatusLine(statusLine string) (sipVersion string, statusCode sip.StatusCode, reasonPhrase string, err error)
- func ParseUri(uriStr string, uri *sip.Uri) (err error)
- func SplitByWhitespace(text string) []string
- func UnmarshalParams(s string, seperator rune, ending rune, p sip.HeaderParams) (n int, err error)
- type HeaderParser
- type Parser
- type ParserOption
Constants ¶
This section is empty.
Variables ¶
var (
ErrLineNoCRLF = errors.New("line has no CRLF")
)
Functions ¶
func DefaultHeadersParser ¶
func DefaultHeadersParser() map[string]HeaderParser
DefaultHeadersParser returns minimal version header parser. It can be extended or overwritten. Removing some defaults can break SIP functionality
NOTE this API call may change
func ParseAddressValue ¶
func ParseAddressValue(addressText string, uri *sip.Uri, headerParams sip.HeaderParams) (displayName string, err error)
ParseAddressValue parses an address - such as from a From, To, or Contact header. It returns: See RFC 3261 section 20.10 for details on parsing an address. Note that this method will not accept a comma-separated list of addresses; addresses in that form should be handled by ParseAddressValues.
func ParseRequestLine ¶
func ParseRequestLine(requestLine string, recipient *sip.Uri) ( method sip.RequestMethod, sipVersion string, err error)
Parse the first line of a SIP request, e.g:
INVITE bob@example.com SIP/2.0 REGISTER jane@telco.com SIP/1.0
func ParseStatusLine ¶
func ParseStatusLine(statusLine string) ( sipVersion string, statusCode sip.StatusCode, reasonPhrase string, err error)
Parse the first line of a SIP response, e.g:
SIP/2.0 200 OK SIP/1.0 403 Forbidden
func ParseUri ¶
ParseUri converts a string representation of a URI into a Uri object. Following https://datatracker.ietf.org/doc/html/rfc3261#section-19.1.1 sip:user:password@host:port;uri-parameters?headers
func SplitByWhitespace ¶
Splits the given string into sections, separated by one or more characters from c_ABNF_WS.
func UnmarshalParams ¶
Types ¶
type HeaderParser ¶
A HeaderParser is any function that turns raw header data into one or more Header objects.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser is implementation of sip.SIPParser It is optimized with faster header parsing
type ParserOption ¶
type ParserOption func(p *Parser)
ParserOption are addition option for NewParser. Check WithParser...
func WithHeadersParsers ¶
func WithHeadersParsers(m map[string]HeaderParser) ParserOption
WithHeadersParsers allows customizing parser headers parsers Consider performance when adding custom parser. Add only if it will appear in almost every message
Check DefaultHeadersParser as starting point
func WithParserLogger ¶
func WithParserLogger(logger zerolog.Logger) ParserOption
WithServerLogger allows customizing parser logger