feat(simulate): sip_inbound_trunk_id transport field for carrier pinning - #59
Open
azain-commits wants to merge 2 commits into
Open
feat(simulate): sip_inbound_trunk_id transport field for carrier pinning#59azain-commits wants to merge 2 commits into
azain-commits wants to merge 2 commits into
Conversation
Add TelephonyTransport.sip_inbound_trunk_id so a sip_inbound run can pin the leased carrier pool trunk (e.g. a Telnyx pool) instead of inheriting the worker's default inbound trunk. - definition.py: new optional field + validator (forbidden on sip_outbound and web transports). - engines/livekit.py: _ensure_sip_inbound_dispatch prefers the explicit trunk; when reusing a named dispatch rule it validates the rule's trunk_ids bind it; falls back to LIVEKIT_INBOUND_TRUNK_ID only when neither a rule nor a trunk id is set. - endpoints/profiles.py: require LIVEKIT_INBOUND_TRUNK_ID only when neither a dispatch rule nor an explicit inbound trunk id is present. The SDK stays carrier-blind — it receives trunk ids / E.164 / rule names, never "twilio"/"telnyx" logic.
Author
|
Telnyx provider — 3-repo PR set:
Suggested review/merge order: livekit-infra → agent-learning-kit → future-agi. |
Open
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
TelephonyTransport.sip_inbound_trunk_idso asip_inboundrun can pin the leased carrier pool trunk (e.g. a Telnyx pool) instead of inheriting the worker's defaultLIVEKIT_INBOUND_TRUNK_ID. The SDK stays carrier-blind — it receives trunk ids / E.164 / dispatch-rule names, never"twilio"/"telnyx"logic. Backward compatible: the field is optional and defaults toNone, so existing runs are unchanged. Part of a 3-repo Telnyx effort (companion PRs infuture-agiandlivekit-infra).What changed
agent/definition.py— new optionalsip_inbound_trunk_idfield onTelephonyTransport; validator forbids it onsip_outboundand web transports (webrtc/vapi_websocket/retell_webcall).simulation/engines/livekit.py—_ensure_sip_inbound_dispatchnow:transport.sip_inbound_trunk_idover theLIVEKIT_INBOUND_TRUNK_IDenv;trunk_idscontain the pinned trunk (raisessip_inbound_rule_trunk_mismatchotherwise) — so a stale/other-carrier rule of the same name can't route onto the wrong trunk;endpoints/profiles.py—LIVEKIT_INBOUND_TRUNK_IDis required only when neither a dispatch rule nor an explicit inbound trunk id is present.Why
The hosted runner leases a carrier-specific inbound pool trunk per run; without a way to pin it, a
sip_inboundrun falls back to the worker's ambient inbound trunk (one carrier). A neutral transport field keeps the SDK provider-agnostic while letting the platform select the trunk per run and supporting concurrent carriers.Tests
TelephonyTransportvalidation covered by the model validator.tests/runtime/test_livekit_engine.py+tests/test_voice_simulation.py: no new failures — the 5 failing engine tests (test_managed_case_dispatches_...,test_sip_outbound_dials_..., 3×test_web_bridge_joins_...) are pre-existing (incomplete mocks / SIP infra), confirmed identical on the branch tip with these changes stashed.Pre-existing issues (not introduced here)
test_livekit_engine.pyfailures above pre-date this PR (verified via stash-baseline).Backward compatibility
sip_inbound_trunk_idis optional (Nonedefault). With no dispatch rule and no trunk id, behaviour is exactly as before (env-driven self-provision).