// Parse a string representation of a Call-Id header, returning a slice of at most one CallId. func parseCallId(headerName string, headerText string) ( headers []base.SipHeader, err error) { headerText = strings.TrimSpace(headerText) var callId base.CallId = base.CallId(headerText) if strings.ContainsAny(string(callId), c_ABNF_WS) { err = fmt.Errorf("unexpected whitespace in CallId header body '%s'", headerText) return } if strings.Contains(string(callId), ";") { err = fmt.Errorf("unexpected semicolon in CallId header body '%s'", headerText) return } if len(string(callId)) == 0 { err = fmt.Errorf("empty Call-Id body") return } headers = []base.SipHeader{&callId} return }
func CallId(callid string) *base.CallId { header := base.CallId(callid) return &header }