public void ParseCiscoOptionsResponseUnitTest()
{
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=z9hG4bK7ae332e73550dbdf2f159061651e7ed5bb88ac52, SIP/2.0/UDP 194.213.29.52:5064;branch=z9hG4bK1121681627" + m_CRLF +
"From: <sip:[email protected]:5064>;tag=8341482660" + m_CRLF +
"To: <sip:[email protected]:5060>;tag=000e38e46c60ef28651381fe-201e6ab1" + m_CRLF +
"Call-ID: [email protected]" + m_CRLF +
"Date: Wed, 29 Nov 2006 22:31:58 GMT" + m_CRLF +
"CSeq: 148 OPTIONS" + m_CRLF +
"Server: CSCO/7" + m_CRLF +
"Content-Type: application/sdp" + m_CRLF +
"Allow: OPTIONS,INVITE,BYE,CANCEL,REGISTER,ACK,NOTIFY,REFER" + m_CRLF +
"Content-Length: 193" + m_CRLF +
m_CRLF +
"v=0" + m_CRLF +
"o=Cisco-SIPUA (null) (null) IN IP4 87.198.196.121" + m_CRLF +
"s=SIP Call" + m_CRLF +
"c=IN IP4 87.198.196.121" + m_CRLF +
"t=0 0" + m_CRLF +
"m=audio 1 RTP/AVP 18 0 8" + m_CRLF +
"a=rtpmap:18 G729/8000" + m_CRLF +
"a=rtpmap:0 PCMU/8000" + m_CRLF +
"a=rtpmap:8 PCMA/8000" + m_CRLF +
m_CRLF;
SIPMessage sipMessage = SIPMessage.ParseSIPMessage(Encoding.UTF8.GetBytes(sipMsg), null, null);
SIPResponse sipResponse = SIPResponse.ParseSIPResponse(sipMessage);
Assert.IsTrue(sipMessage != null, "The SIP message not parsed correctly.");
Assert.IsTrue(sipResponse.Header.Vias.Length == 2, "The SIP reponse did not end up with the right number of Via headers.");
Console.WriteLine("-----------------------------------------");
}