Skip to content

Flood calls are creating new Room/Job when Dispatch is Any but TrunkID is empty #326

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mercuryyy opened this issue Mar 30, 2025 · 4 comments
Assignees

Comments

@mercuryyy
Copy link

When using

│ SipDispatchRuleID │ Name │ SipTrunks │ Type                │ RoomName              │ Pin │ Attributes │ Agents    │
├───────────────────┼──────┼───────────┼─────────────────────┼───────────────────────┼─────┼────────────┼───────────┤
│ SDR_***  │      │ <any>     │ Individual (Caller) │ in-_<caller>_<random> │     │ map[]      │ *****-agent │

its causing requests like

{'event': 'participant_joined', 'room': {'sid': 'RM_DwDHCXtC8dun', 'name': 'in-_*_uD3hEq6noPra', 'emptyTimeout': 300, 'departureTimeout': 20, 'creationTime': '1743339898', 'creationTimeMs': '1743339898086', 'turnPassword': 'Axk62TYJp6fy35z6MJfO2At5Udb6WNL6zOtuhG7GT7b', 'enabledCodecs': [{'mime': 'audio/opus'}, {'mime': 'audio/red'}, {'mime': 'video/VP8'}, {'mime': 'video/H264'}, {'mime': 'video/VP9'}, {'mime': 'video/AV1'}, {'mime': 'video/rtx'}]}, 'participant': {'sid': 'PA_Ga72ZChbseAS', 'identity': 'sip_*', 'state': 'ACTIVE', 'joinedAt': '1743339898', 'joinedAtMs': '1743339898091', 'name': 'Phone *', 'version': 2, 'permission': {'canSubscribe': True, 'canPublish': True, 'canPublishData': True, 'canUpdateMetadata': True}, 'kind': 'SIP', 'attributes': {'sip.callID': 'SCL_kGJ9p5GgAnaa', 'sip.phoneNumber': '*', 'sip.ruleID': 'SDR_***', 'sip.trunkID': '', 'sip.trunkPhoneNumber': '11**15042301205'}}, 'id': 'EV_WFLZQd9TYfwS', 'createdAt': '1743339899'}

To Get pushed in and open a room

We added

async def entrypoint(ctx: JobContext):
....
            participant_attributes = participant.attributes
            trunkID = participant_attributes.get("sip.trunkID", "Unknown")
            if trunkID == 'Unknown':
                logger.info(f"Shutting down Agent this is SPAM")
                return

But shouldn't we want to have inbound requests with sip.trunkID not open a new livekt room and init a Job by default ?

@dennwc
Copy link
Contributor

dennwc commented Mar 30, 2025

Are you self-hosting SIP? If so, just create a new Trunk and bind a dispatch rule to it instead.

@dennwc dennwc self-assigned this Mar 30, 2025
@mercuryyy
Copy link
Author

mercuryyy commented Mar 30, 2025

Yes Self hosting, we plan to have 100's/1000's of inbound trunks created that is why we reverted to try and use Dispatch any.

Blocking these requests at the SIP server or at the point where it decide if to open a Room/job would probably be the expected behavior when no trunkid i would assume

@dennwc
Copy link
Contributor

dennwc commented Mar 31, 2025

There are a few options here. SIP now supports update APIs, so you could update old trunks instead of creating new ones.

But in other cases, this behaviour would need to be configured in the main LiveKit server. We could enforce the same policy as Cloud does, that is - reject calls that match no trunks. We cannot enable it by default, since some users already rely on this behaviour.

@mercuryyy
Copy link
Author

Yeah we build our own logic to edit redis and we were updating the "Dispatch" trunk_ids dynamically but i figured having 1 dispatch with vs 1000's is more ideal

I would suggest maybe putting it on the roadmap? If trunkid is empty there is no logic in opening a new Room/Job its will probably improve/save on the main LiveKit Cloud servers :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants