Skip to content

add trunk_config to WarmTransferTask for SIP endpoint transfers#5016

Open
longcw wants to merge 3 commits intomainfrom
longc/add-trunk-config-warm-transfer
Open

add trunk_config to WarmTransferTask for SIP endpoint transfers#5016
longcw wants to merge 3 commits intomainfrom
longc/add-trunk-config-warm-transfer

Conversation

@longcw
Copy link
Contributor

@longcw longcw commented Mar 5, 2026

No description provided.

@chenghao-mou chenghao-mou requested a review from a team March 5, 2026 07:30
devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 3 additional findings in Devin Review.

Open in Devin Review

Comment on lines 112 to 115
if self._sip_trunk_id is None and self._trunk_config is None:
raise ValueError(
"`LIVEKIT_SIP_OUTBOUND_TRUNK` environment variable or `sip_trunk_id` argument must be set"
"`LIVEKIT_SIP_OUTBOUND_TRUNK` environment variable, `sip_trunk_id`, or `trunk_config` must be set"
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Validation no longer rejects empty-string sip_trunk_id, allowing invalid API calls

The old validation used if not self._sip_trunk_id: which rejected both None and empty string "". The new code at line 112 uses if self._sip_trunk_id is None and self._trunk_config is None:, which only rejects None. This means an empty-string sip_trunk_id (e.g. from LIVEKIT_SIP_OUTBOUND_TRUNK="" in the environment, or from an explicit sip_trunk_id="" argument) now passes validation and is forwarded to CreateSIPParticipantRequest at warm_transfer.py:309, where it will cause a confusing server-side error instead of the clear ValueError the old code provided.

Suggested change
if self._sip_trunk_id is None and self._trunk_config is None:
raise ValueError(
"`LIVEKIT_SIP_OUTBOUND_TRUNK` environment variable or `sip_trunk_id` argument must be set"
"`LIVEKIT_SIP_OUTBOUND_TRUNK` environment variable, `sip_trunk_id`, or `trunk_config` must be set"
)
if not self._sip_trunk_id and self._trunk_config is None:
raise ValueError(
"`LIVEKIT_SIP_OUTBOUND_TRUNK` environment variable, `sip_trunk_id`, or `trunk_config` must be set"
)
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

*,
hold_audio: NotGivenOr[AudioSource | AudioConfig | list[AudioConfig] | None] = NOT_GIVEN,
sip_trunk_id: NotGivenOr[str] = NOT_GIVEN,
trunk_config: NotGivenOr[api.SIPOutboundConfig] = NOT_GIVEN,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not the biggest fan of the trunk terminology.. because a user might just want to dial out to another sip address. we were talking about changing this in the CreateSIPParticipant API as well.

wdyt about simplifying it like the following:

  • rename sip_number to sip_user (it's the same thing, user is the more technically correct term)
  • map to deprecated sip_number field
  • allow user to pass in: sip_trunk_id or sip_connection: SIPConnection

SIPConnection would contain:

  • address
  • username
  • password
  • destination_country: str

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another idea.. thinking out loud.. this could be made even more generic.. where we could work with our Whatsapp and Twilio connectors too.. if we refactored out the dial out portion into a function.. then it could be

  • SIPDialAction(sip_user, address, username, password, destination_country)
  • SIPTrunkDialAction(sip_user, trunk_id)
  • TwilioConnectorDial(twilio_api_key, to_number, etc)
  • WhatsappConnectorDial(...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reference for the Whatsapp and Twilio connectors?

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 5 additional findings in Devin Review.

Open in Devin Review

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

Successfully merging this pull request may close these issues.

2 participants