RestComm / jain-sip

Disclaimer: This repository is a git-svn mirror of the project found at http://java.net/projects/jsip whose original repository is developed collaboratively by the Advanced Networking Technologies Division at the National Institute of Standards and Technology (NIST) - an agency of the United States Department of Commerce and by a community of individual and enterprise contributors. TeleStax, Inc. will perform some productization work, new features experimentation branches, etc for its TelScale jSIP product that doesn't concern the community from the main repository hence this git repository.
http://www.restcomm.com/
141 stars 151 forks source link

SIPMessage hashCode implementation just takes CallID #70

Open jaimecasero opened 8 years ago

jaimecasero commented 8 years ago

This is fundametally wrong, and can potentially create incorrect logic, and make collections containing SIPMessage to perform poor. This needs to be addressed ASAP.

Proposal on new impl is to consider (CallId + topmostVia.branchId + req/res). Probably better to implement diff hashCode on req and res level

jaimecasero commented 8 years ago

Implementing using firstLine + callid + topvia.branch

jaimecasero commented 8 years ago

Specified by spec https://jsip.ci.cloudbees.com/job/jsip/javadoc/javax/sip/message/Message.html#equals(java.lang.Object)

Request/Response line, From, To, CallID, MaxForwards, CSeq and Via headers

jaimecasero commented 8 years ago

TCK collisions with SPEC requirements at https://github.com/RestComm/jain-sip/blob/master/src/test/tck/factory/MessageFactoryTest.java#L76

Setting an extension header follows with an assertion checking Reqs are different. Since no mandatory header was changed, the Reqs are equal in terms of JAIN SIP Spec, but TCK assumed deep equality.