Skip to content

DbLocator instance_id update overwrites another extension’s destination (multi-line ATA) #248

Description

@autopeasant

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 5cbcd39419c34a3ba8b1d08305a6504ec08549b9locator_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

  1. Use DbLocator.
  2. REGISTER sip:103@… Contact port 6060, +sip.instance = UUID-X.
  3. REGISTER sip:104@… Contact port 6062, same +sip.instance = UUID-X.
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions