What are the criteria for matching a BYE to a dialog? I know it's not call-id alone. We have situations where the BYE message R-URI does not match the initial INVITE or the R-URI changes after a re-INVITE resulting in dialog timeouts (with long duration).
According to SIP RFC3261, dialog matching is done based on CALLID hdr, FROM tag and TO tag. RURI is not relevant.