Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/warm-transfer/warm_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
# ensure the following variables/env vars are set
SIP_TRUNK_ID = os.getenv("LIVEKIT_SIP_OUTBOUND_TRUNK") # "ST_abcxyz"
SUPERVISOR_PHONE_NUMBER = os.getenv("LIVEKIT_SUPERVISOR_PHONE_NUMBER") # "+12003004000"
SIP_NUMBER = os.getenv("LIVEKIT_SIP_NUMBER") # "+15005006000" - caller ID shown to supervisor


class SupportAgent(Agent):
Expand Down Expand Up @@ -60,6 +61,7 @@ async def transfer_to_human(self) -> None:
result = await WarmTransferTask(
target_phone_number=SUPERVISOR_PHONE_NUMBER,
sip_trunk_id=SIP_TRUNK_ID,
sip_number=SIP_NUMBER,
chat_ctx=self.chat_ctx,
# add extra instructions for summarization
# you can also customize the entire instructions by overriding the `get_instructions` method
Expand Down
6 changes: 6 additions & 0 deletions livekit-agents/livekit/agents/beta/workflows/warm_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def __init__(
*,
hold_audio: NotGivenOr[AudioSource | AudioConfig | list[AudioConfig] | None] = NOT_GIVEN,
sip_trunk_id: NotGivenOr[str] = NOT_GIVEN,
sip_number: NotGivenOr[str] = NOT_GIVEN,
extra_instructions: str = "",
chat_ctx: NotGivenOr[llm.ChatContext] = NOT_GIVEN,
turn_detection: NotGivenOr[TurnDetectionMode | None] = NOT_GIVEN,
Expand Down Expand Up @@ -108,6 +109,10 @@ def __init__(
"`LIVEKIT_SIP_OUTBOUND_TRUNK` environment variable or `sip_trunk_id` argument must be set"
)

self._sip_number = (
sip_number if is_given(sip_number) else os.getenv("LIVEKIT_SIP_NUMBER", "")
)

# background audio and io
self._background_audio = BackgroundAudioPlayer()
self._hold_audio_handle: PlayHandle | None = None
Expand Down Expand Up @@ -302,6 +307,7 @@ async def _dial_human_agent(self) -> AgentSession:
room_name=human_agent_room_name,
participant_identity=self._human_agent_identity,
wait_until_answered=True,
sip_number=self._sip_number or None,
)
)

Expand Down
Loading