public void OnResponse(SipStatusLine statusLine) { if (_logger.IsDebugEnabled) { _logger.Debug("OnResponse called. StatusCode:'{0}', ReasonPhrase:'{1}'", statusLine.StatusCode, statusLine.ReasonPhrase); } _message = _messageFactory.CreateResponse(statusLine); }
private void OnFirstLine(string firstLine) { if (_logger.IsDebugEnabled) { _logger.Debug("OnFirstLine called. firstLine:'{0}'", firstLine); } if (firstLine.EndsWith(SipConstants.SipTwoZeroString)) { if (_logger.IsDebugEnabled) { _logger.Debug("Firstline is expected to be a SipRequestLine. Try parsing..."); } var requestLine = new SipRequestLineParser().Parse(firstLine); _message = _messageFactory.CreateRequest(requestLine); if (_logger.IsDebugEnabled) { _logger.Debug("RequestLine parsed. Continuing SipRequest parsing..."); } } else if (firstLine.StartsWith(SipConstants.SipTwoZeroString)) { if (_logger.IsDebugEnabled) { _logger.Debug("Firstline is expected to be a SipStatusLine. Try parsing..."); } var statusLine = new SipStatusLineParser().Parse(firstLine); _message = _messageFactory.CreateResponse(statusLine); if (_logger.IsDebugEnabled) { _logger.Debug("SipStatusLine parsed. Continuing SipResponse parsing.."); } } else { if (_logger.IsDebugEnabled) { _logger.Debug("Firstline format could not be recognized."); } throw new ParseException(ExceptionMessage.InvalidFirstLineFormat); } }