import { CodeTabs } from '../views/docs/CodeTabs';
import { Callout, NextLink, PropTable } from '../views/docs/prose';
export const TRANSFER_SIG_PY = `call.transfer(
    destination: str,
    instructions: str | None = None,
)`;

export const TRANSFER_SIG_TS = `await call.transfer(
  destination: string,
  instructions?: string,
): Promise<void>`;

export const TRANSFER_EX_PY = `@agent.on_task_complete("collect_issue")
def on_issue_collected(call: guava.Call):
    call.transfer(
        destination="+18005550199",
        instructions="Let the caller know you're transferring them to a service representative.",
    )`;

export const TRANSFER_EX_TS = `agent.onTaskComplete("collect_issue", async (call: guava.Call) => {
  await call.transfer(
    "+18005550199",
    "Let the caller know you're transferring them to a service representative.",
  );
});`;

## transfer()

`call.transfer()` hands the active call off to another phone number or SIP address. It is a soft transfer — the agent notifies the caller before bridging, so there's no abrupt silence or dead air.

<CodeTabs
  python={{ code: TRANSFER_SIG_PY, filename: "signature" }}
  typescript={{ code: TRANSFER_SIG_TS, filename: "signature" }}
/>

<PropTable rows={[
  {
    name: "destination",
    type: "str",
    desc: "The phone number or SIP address to transfer the call to.",
  },
  {
    name: "instructions",
    type: "str | None",
    desc: 'What the agent should say before bridging. Defaults to a generic "I\'ll transfer you now" message.',
  },
]} />

### Example

<CodeTabs
  python={{ code: TRANSFER_EX_PY, filename: "example.py" }}
  typescript={{ code: TRANSFER_EX_TS, filename: "example.ts" }}
/>

<NextLink section="hangup" label="hangup()" />
