Transferring to multiple extensions with one phone...
# support
d
Is it possible to transfer a call to multiple extensions using a single phone number? For example, a caller might say they want to be transferred to any extension between 1001 and 1006. The bot should then transfer the call to the appropriate extension. In the following call IDs, the caller is requesting a transfer to extensions 1001 and 1002, but the bot is transferring the call to different extensions. 019d49ba-3347-7000-85b3-f52d0ebfc153 019d49b9-9d58-700a-b438-0f7cf7567a6b
v
Yes, you can dynamically transfer calls to specific extensions using Vapi's dynamic call transfer feature. Here’s a Node.js (Express) code snippet that extracts the requested extension and routes the call accordingly:
Copy code
js
app.post('/webhook', async (req, res) => {
  const { message } = req.body;
  const controlUrl = message?.call?.monitor?.controlUrl;
  const extension = message?.toolWithToolCallList?.[0]?.toolCall?.function?.arguments?.extension;
  if (!controlUrl || !extension) return res.status(400).json({ error: 'Missing data' });

  // Map extensions to SIP URIs
  const extensionMap = {
    '1001': 'sip:1001@yourdomain.com',
    '1002': 'sip:1002@yourdomain.com',
    // Add more as needed
  };
  const destination = { type: "sip", sipUri: extensionMap[extension] };
  await axios.post(`${controlUrl}/control`, { type: "transfer", destination });
  res.json({ success: true });
});
This approach ensures the bot transfers the call to the correct extension based on the caller’s request. For more details, see the [dynamic call transfers documentation](https://docs.vapi.ai/calls/call-dynamic-transfers). Source: - [Dynamic call transfers](https://docs.vapi.ai/calls/call-dynamic-transfers)
c
Hi, Thank you for your patience while we reviewed the transfer setup. I can see from your current configuration that the assistant is using the tool call:
transferCall({"destination": "+16143855900"})
Both of the calls reviewed are using assistant ID
4ef36549-f8a2-4c8c-8e8d-c0dc65ec423f
, and the system prompt is identical across both calls. At the moment, there does not appear to be any extension-to-phone-number mapping logic configured, which is why all transfers are going to the same base destination. To support 6 distinct extensions, we recommend configuring 6 separate transfer destinations, with each extension mapped to its corresponding phone number or SIP route. 1. Use
transferDestinations
Configure the assistant's
transferDestinations
array with 6 entries, each mapping an extension number to its SIP URI or phone number
Copy code
"transferDestinations": [
  { "type": "number", "number": "+1XXXXXXXXXX", "message": "Transferring to extension 1001", "description": "Extension 1001" },
  { "type": "number", "number": "+1XXXXXXXXXX", "message": "Transferring to extension 1002", "description": "Extension 1002" }
]
You can continue this pattern through extensions 1001–1006. 1. Restrict transfer tool destinations Alternatively, you can update the transfer tool schema so the destination parameter only allows the valid extension routes.
Copy code
{
  "destination": {
    "type": "string",
    "description": "The extension to transfer to (1001-1006)",
    "enum": [
      "+16143855900,1001",
      "+16143855900,1002"
    ]
  }
}
This ensures the assistant can only transfer to the allowed extension values. Please try either of these approaches and let us know if you run into any issues. We’ll be happy to help review the updated transfer behavior. https://cdn.discordapp.com/attachments/1488929289809432606/1489198657780846632/image.png?ex=69cf8bd3&is=69ce3a53&hm=79cfbf5ff184647e45109c5c4648ba5636b464c8a6183ab3b7dd27a72ad64225&