feat(telephony/telnyx): add call transfer via conference bridge

Conference-based transfer for Telnyx with a two-step flow:
- transfer_call dials the destination with a per-transfer webhook URL.
- On call.answered, the webhook seeds a conference with the destination's
  live call_control_id and publishes DESTINATION_ANSWERED.
- TelnyxConferenceStrategy joins the caller into the conference on
  pipeline teardown (EndTaskReason.TRANSFER_CALL).
- On post-answer destination hangup, the webhook hangs up the caller —
  Telnyx's create_conference doesn't accept end_conference_on_exit on
  the seed leg, so we tear down the bridge ourselves.

TransferContext gains optional workflow_run_id (for webhook→provider
resolution in multi-config orgs) and conference_id (set on answer,
rd by the strategy).

Also fixes the transfer tool's provider lookup to go through
get_telephony_provider_for_run instead of the deprecated org-default
shim, which was returning the wrong provider in multi-config orgs.
This commit is contained in:
Sabiha Khan 2026-05-12 12:04:37 +05:30
parent 45a81c88e0
commit 700b7f1145
7 changed files with 596 additions and 7 deletions

View file

@ -68,6 +68,10 @@ class TransferContext:
original_call_sid: str
conference_name: str
initiated_at: float
# workflow_run_id: lets transfer_id-keyed webhooks resolve org/credentials.
# conference_id: set by providers that seed the conference on answer (Telnyx).
workflow_run_id: Optional[int] = None
conference_id: Optional[str] = None
def to_json(self) -> str:
"""Convert context to JSON string."""