Call Transfer
Call Transfer lets your AI Agent move an ongoing SIP call to another phone number without ending the current session. Instead of making the caller hang up and dial a new number, the agent can automatically route the call.
How Call Transfer Works
- The agent evaluates the user’s intent to determine when a call transfer is required and then triggers the function tool.
- When the function tool is triggered, it tells the system to move the call to another phone number.
- The ongoing SIP call is forwarded to the new number instantly, without disconnecting or redialing.
Trigger Call Transfer
To set up incoming call handling, outbound calling, and routing rules, check out the Quick Start Example.
main.py
from videosdk.agents import Agent, function_tool,
class CallTransferAgent(Agent):
def __init__(self):
super().__init__(
instructions="You are the Call Transfer Agent Which Help and provide to transfer on going call to new number. use transfer_call tool to transfer the call to new number.",
)
async def on_enter(self) -> None:
await self.session.say("Hello Buddy, How can I help you today?")
async def on_exit(self) -> None:
await self.session.say("Goodbye Buddy, Thank you for calling!")
@function_tool
async def transfer_call(self) -> None:
"""Transfer the call to Provided number"""
token = os.getenv("VIDEOSDK_AUTH_TOKEN")
transfer_to = os.getenv("CALL_TRANSFER_TO")
return await self.session.call_transfer(token,transfer_to)
Example - Try It Yourself
Got a Question? Ask us on discord

