public static bool AreEqual(SIPContactHeader contact1, SIPContactHeader contact2)
{
if (!SIPURI.AreEqual(contact1.ContactURI, contact2.ContactURI))
{
return false;
}
else
{
// Compare invaraiant parameters.
string[] contact1Keys = contact1.ContactParameters.GetKeys();
if (contact1Keys != null && contact1Keys.Length > 0)
{
foreach (string key in contact1Keys)
{
if (key == EXPIRES_PARAMETER_KEY || key == QVALUE_PARAMETER_KEY)
{
continue;
}
else if (contact1.ContactParameters.Get(key) != contact2.ContactParameters.Get(key))
{
return false;
}
}
}
// Need to do the reverse as well
string[] contact2Keys = contact2.ContactParameters.GetKeys();
if (contact2Keys != null && contact2Keys.Length > 0)
{
foreach (string key in contact2Keys)
{
if (key == EXPIRES_PARAMETER_KEY || key == QVALUE_PARAMETER_KEY)
{
continue;
}
else if (contact2.ContactParameters.Get(key) != contact1.ContactParameters.Get(key))
{
return false;
}
}
}
}
return true;
}