1. Tasks
  2. Transfer Call

Tasks

Transfer Call

Transfers a phone call to another extension on your phone system (PBX). Useful for handing a caller over to a person, eg "press 4 to speak to an agent", or when the caller asks for a human.

Run this task on an answered phone call (see Answer Call). Stubber asks your phone system to put the caller through to the extension, the same way a desk phone does a blind transfer. The phone system rings the extension. Once the extension answers, the caller is connected to it, and the voice call with the assistant ends.

The task doesn't wait for the extension to answer: it returns transferring as soon as the phone system accepts the transfer. How it went follows later, in an _update_from_call with call_data.event set to transfer:

  • result: "transferred": the caller is through to the extension. The voice call has ended.
  • result: "failed": the transfer didn't work, eg the extension was busy or nobody answered. The caller is still on the line with the assistant.
NOTE

This moves the phone call to another extension on your phone system, eg a person's desk phone or a queue. To move a live voice call to another stub, with the caller still talking to an assistant, see Voice Session Transfer.

Basic usage

loading...

Parameters

calluuid
required
string

The id of the call, from call_data.calluuid of the incoming call event. Save it on the stub when the call comes in, so later actions can use it. The call must be answered.


extension
required
string

The extension to transfer the caller to, on the same phone system the call came in on. Digits only, eg 802. It can be anything the phone system lets an extension dial internally, eg a person's extension, a ring group or a queue. A number is accepted too.

Result

loading...

The outcome follows later, in a transfer event on _update_from_call:

        "call_data": {
  "event": "transfer",
  "calluuid": "238e63a5-e071-47d9-bac2-360b77fc5991",
  "sipconnectionuuid": "161bc664-3c90-4a1e-ba07-6d1f5438dfe4",
  "extension": "802",
  "result": "failed",
  "reason": "486 Busy Here"
}

      
result Meaning
transferred The caller is through to the extension, and the voice call has ended. reason is null
failed The caller is still with the assistant. reason is what the phone system reported, eg 486 Busy Here, or timeout when it reported nothing for 60 s

Errors

message Meaning
calluuid is required The calluuid param is missing
extension_invalid extension is missing or isn't digits
unknown_call No call with this calluuid in your organization
call_not_answered The call isn't live and answered, eg it's still ringing or has ended. error.details.status says which
transfer_in_progress A transfer of this call is already under way
transfer_rejected The phone system refused the transfer, eg transfers aren't allowed for Stubber's extension. error.details.sip_status says why

These are conceptual errors. After an error the caller is still with the assistant.

Things to know

  • Let the assistant say it first. Tell the caller they're being transferred before the task runs. Stubber lets what the assistant is saying finish playing before it transfers, but tasks run before notifications in an action, so a voice notification in the same action comes too late. Have the assistant say it and then delegate, or transfer when the caller asked by pressing a key.
  • When the voice call ends. On a successful transfer the voice call ends, and _update_from_voice reports session_ended as usual.
  • The transfer event goes to this stub, the one that ran the task, even when the call came in on another stub.
  • What the phone system reports differs. 3CX reports success once the extension answers, so a busy or unanswered extension comes back as failed. Other phone systems, eg Asterisk, may report success as soon as they've taken the call over. A busy extension then goes wherever the phone system sends it, eg voicemail, and the stub isn't told.
  • Phone system. Stubber's extension must be allowed to transfer calls, and the target extension must be reachable from it.
  • Extensions only. Calls can't be transferred to outside phone numbers.

Examples

Press 4 to speak to a person

Add a fourth option to a keypad menu (see Collect Call Digits), and transfer straight away when the caller presses it. The caller asked for it, so the assistant doesn't need to announce it. On the menu answer:

loading...

When the transfer fails

On the transfer event with result: "failed", tell the assistant, which is still on the line:

loading...

When the caller asks for a person

Tell the voice assistant, in the instructions of Start Voice Chat, to say "I'm transferring you now" and then delegate when the caller asks for a person. In the backend agent's prompt, have it call an action that runs this task when it gets that delegation. The assistant has finished speaking by then, so the caller hears the announcement before the transfer.