Dynamic transfer a call to sip/asterisk
# support
a
Hi! I’m testing VAPI and need some help: • My assistant gets a sipUri from an HTTP request (e.g. sip:8880299@server.com). • The sipUri changes every time. • I’ve been looking at the docs here: https://docs.vapi.ai/calls/call-dynamic-transfers • In the Transfer Call block I can only set a fixed SIP, not a variable. If I leave it blank, I get: transfer-destination-request failed validation. No destination. Is there a way to pass the sipUri dynamically to the Transfer Call? Or do I need to handle this with another approach, NOTE: I want to do this in the GUI if posible
c
Hi axornet, Dynamic transfers in Vapi are designed to handle scenarios where destinations may vary. To achieve this with a SIP URI: 1. **Ensure Dynamic Setup**: First, ensure your transfer setup is dynamic by leaving destination fields blank in your configuration. This triggers
transfer-destination-request
. 2. **Handle Webhook Properly**: Implement a webhook handler on your server to process these requests. The webhook should receive the transfer-destination request and return the SIP URI:
Copy code
javascript
   app.post('/webhook', (req, res) => {
     const request = req.body;
     if (request.type !== 'transfer-destination-request') {
       return res.status(200).json({ received: true });
     }
     const sipUri = getSipUriFromYourSource(); // Retrieve SIP URI dynamically
     const destination = {
       type: "sip",
       uri: sipUri
     };
     res.json({ destination });
   });
3. **Server Configuration**: Make sure your server URL is configured in the Vapi dashboard to handle the webhook events properly, and verify the webhook signature as explained in [Dynamic Call Transfers](https://docs.vapi.ai/calls/call-dynamic-transfers). By ensuring your webhook dynamically provides the SIP URI and that the assistant is configured to make use of the
transfer-destination-request
, you should be able to route calls dynamically to SIP addresses.
2 Views