private void WriteResponseContent(SipResponseWriter writer, List <OutContent> contents) { writer.WriteCRLF(); foreach (var c in contents) { writer.WriteBoundary(); writer.WriteContentTransferEncodingBinary(); writer.WriteContentType(new ByteArrayPart(c.OutContentType), new ByteArrayPart(c.OutContentSubtype)); writer.WriteCRLF(); writer.Write(c.GenerateToByteArray()); writer.WriteCRLF(); writer.WriteCRLF(); } writer.WriteBoundaryEnd(); writer.RewriteContentLength(); }
public void IncomingMessage(IncomingMessage message) { var result = verifier.Validate(message); if (result.Error == GeneralVerifier.Errors.None) { ProcessIncomingMessage(message); } else { var writer = new SipResponseWriter(); writer.WriteStatusLine(StatusCodes.BadRequest); writer.CopyViaToFromCallIdRecordRouteCSeq(message.Reader, StatusCodes.BadRequest); writer.WriteXErrorDetails(result.Message, result.HeaderName.ToUtf8Bytes()); writer.WriteCRLF(); SendNonTransactionMessage(message.ConnectionAddresses, writer); } }