Summary
In src/proxy/locator_db.rs, on REGISTER, when a location carries instance_id, the code finds any other row with the same instance_id (different AoR) and updates that row’s destination to the new registration’s host/port.
Grandstream HT8xx (and similar multi-line ATAs) reuse one +sip.instance / instance UUID for all lines. REGISTER for 103 (port 6060) then 104 (port 6062) causes cross-clobber:
- After 103 registers, a later 104 REGISTER updates 103’s destination to 104’s address (or vice versa).
- Observed:
104 AoR sip:104@…:6062 but destination=192.168.10.50:6060 → INVITE/BYE for 104 hit the wrong FXS port.
Affected version
commit 5cbcd39419c34a3ba8b1d08305a6504ec08549b9 — locator_db.rs register path (“If the location has an instance_id, find an existing registration with the same instance_id … update only its destination”).
Minimal reproduction
- Use DbLocator.
- REGISTER
sip:103@… Contact port 6060, +sip.instance = UUID-X.
- REGISTER
sip:104@… Contact port 6062, same +sip.instance = UUID-X.
- Read
rustpbx_locations: one of the usernames has the other’s destination port.
Expected
Instance-id based destination refresh must be scoped to the same AOR identity (at least same username, preferably same AoR key), not global across usernames. Multi-line devices sharing one instance UUID are common.
Suggested fix
Add .filter(Column::Username.eq(&username_key)) (and/or realm) to the instance_id lookup, or disable cross-AoR destination updates when the username differs.
Summary
In
src/proxy/locator_db.rs, on REGISTER, when a location carriesinstance_id, the code finds any other row with the sameinstance_id(different AoR) and updates that row’s destination to the new registration’s host/port.Grandstream HT8xx (and similar multi-line ATAs) reuse one
+sip.instance/ instance UUID for all lines. REGISTER for103(port 6060) then104(port 6062) causes cross-clobber:104AoRsip:104@…:6062butdestination=192.168.10.50:6060→ INVITE/BYE for 104 hit the wrong FXS port.Affected version
commit
5cbcd39419c34a3ba8b1d08305a6504ec08549b9—locator_db.rsregister path (“If the location has an instance_id, find an existing registration with the same instance_id … update only its destination”).Minimal reproduction
sip:103@…Contact port 6060,+sip.instance= UUID-X.sip:104@…Contact port 6062, same+sip.instance= UUID-X.rustpbx_locations: one of the usernames has the other’s destination port.Expected
Instance-id based destination refresh must be scoped to the same AOR identity (at least same username, preferably same AoR key), not global across usernames. Multi-line devices sharing one instance UUID are common.
Suggested fix
Add
.filter(Column::Username.eq(&username_key))(and/or realm) to the instance_id lookup, or disable cross-AoR destination updates when the username differs.