public void ParseOptionsBodyResponse()
{
Console.WriteLine("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name);
string sipMsg = "SIP/2.0 200 OK" + m_CRLF +
"Via: SIP/2.0/UDP 213.168.225.133:5060;branch=z9hG4bK10a1fab0" + m_CRLF +
"From: \"Unknown\" <sip:[email protected]>;tag=as18338373" + m_CRLF +
"To: <sip:[email protected]>;tag=OLg-20481" + m_CRLF +
"Call-ID: [email protected]" + m_CRLF +
"CSeq: 102 OPTIONS" + m_CRLF +
"content-type: application/sdp" + m_CRLF +
"Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, INFO, REFER, NOTIFY" + m_CRLF +
"Content-Length: 217" + m_CRLF +
m_CRLF +
"v=0" + m_CRLF +
"o=0 5972727 56415 IN IP4 0.0.0.0" + m_CRLF +
"s=SIP Call" + m_CRLF +
"c=IN IP4 0.0.0.0" + m_CRLF +
"t=0 0" + m_CRLF +
"m=audio 0 RTP/AVP 18 0 8 4 2" + m_CRLF +
"a=rtpmap:18 G729/8000" + m_CRLF +
"a=rtpmap:0 pcmu/8000" + m_CRLF +
"a=rtpmap:8 pcma/8000" + m_CRLF +
"a=rtpmap:4 g723/8000" + m_CRLF +
"a=rtpmap:2 g726/8000" + m_CRLF;
SIPMessage sipMessage = SIPMessage.ParseSIPMessage(Encoding.UTF8.GetBytes(sipMsg), null, null);
SIPResponse okResp = SIPResponse.ParseSIPResponse(sipMessage);
Assert.IsTrue(okResp.Status == SIPResponseStatusCodesEnum.Ok, "The SIP response status was not parsed correctly.");
Assert.IsTrue(okResp.Body.Length == 217, "The SIP response body length was not correct.");
Console.WriteLine("-----------------------------------------");
}