Default Tools
Adding Transfer Call, End Call, and Dial Keypad capabilities to your assistants.
Vapi voice assistants are given additional functions: transferCall
,endCall
, and dtmf
(to dial a keypad with DTMF). These functions can be used to transfer calls, hang up calls, and enter digits on the keypad.
tools
array.Transfer Call
This function is provided when transferCall
is included in the assistant’s list of available tools (see configuration options here). This function can be used to transfer the call to any of the destinations
defined in the tool configuration (see details on destination options here).
End Call
This function is provided when endCall
is included in the assistant’s list of available tools (see configuration options here). The assistant can use this function to end the call.
Send Text
This function is provided when sms
is included in the assistant’s list of available tool (see configuration options here). The assistant can use this function to send SMS messages using a configured Twilio account.
Dial Keypad (DTMF)
This function is provided when dtmf
is included in the assistant’s list of available tools (see configuration options here). The assistant will be able to enter digits on the keypad.
There are three methods for sending DTMF in a phone call:
- In-band: tones are transmitted as part of the regular audio stream. This is the simplest method, but it can suffer from quality issues if the audio stream is compressed or degraded.
- Out-of-band via RFC 2833: tones are transmitted separately from the audio stream, within RTP (Real-Time Protocol) packets. It’s typically more reliable than in-band DTMF, particularly for VoIP applications where the audio stream might be compressed. RFC 2833 is the standard that initially defined this method. It is now replaced by RFC 4733 but this method is still referred by RFC 2833.
- Out-of-band via SIP INFO messages: tones are sent as separate SIP INFO messages. While this can be more reliable than in-band DTMF, it’s not as widely supported as the RFC 2833 method.
Vapi’s DTMF tool uses in-band method. Please note that this method may not work with certain IVRs. If you are running into this issue, the recommended approach is to have your assistant say the options out loud if available. For example, when an IVR says “Press 1 or say Sales for the Sales department,” prefer having the assistant say “Sales.”
Tool Effectiveness
To evaluate this tool, we set up a Vapi assistant with the DTMF tool enabled and conducted calls to a range of IVR systems, including a Twilio IVR (configured via Studio Flows) and several third-party IVRs such as pharmacies and insurance companies.
Testing Methodology
We called and navigated through the IVRs using three different strategies:
- Direct Dialpad: calling from a personal phone and dialing options using the dialpad.
- Vapi DTMF Tool: an assistant configured with the DTMF tool.
- Manual DTMF Sound: calling from a personal phone and playing DTMF tones generated by software. (similar approach as the Vapi DTMF Tool)
Key Findings
- The assistant successfully navigated some of the third-party IVRs.
- The assistant encountered issues with Twilio IVRs, likely due to Twilio’s preference for RFC 2833.
- Observed occasional delays in DTMF tone transmission, which may affect effectiveness with IVRs that have short timeouts.
Conclusion
The tool’s effectiveness depends on the IVR system’s configuration and DTMF capturing method. We are working to improve compatibility and reduce transmission delays for broader and more reliable support.
Custom Functions: Deprecated
Custom Functions
In addition to the predefined functions, you can also define custom functions. These functions are similar to OpenAI functions and your chosen LLM will trigger them as needed based on your instructions.
The functions array in the assistant definition allows you to define custom functions that the assistant can call during a conversation. Each function is an object with the following properties:
name
: The name of the function. It must be a string containing a-z, A-Z, 0-9, underscores, or dashes, with a maximum length of 64.description
: A brief description of what the function does. This is used by the AI to decide when and how to call the function.parameters
: An object that describes the parameters the function accepts. The type property should be “object”, and the properties property should be an object where each key is a parameter name and each value is an object describing the type and purpose of the parameter.
Here’s an example of a function definition:
In this example, the bookAppointment function accepts one parameter, datetime
, which is a string representing the date and time of the appointment in ISO format.
In addition to defining custom functions, you can specify a serverUrl
where Vapi will send the function call information. This URL can be configured at the account level or at the assistant level.
At the account level, the serverUrl
is set in the Vapi Dashboard. All assistants under the account will use this URL by default for function calls.
At the assistant level, the serverUrl
can be specified in the assistant configuration when creating or updating an assistant. This allows different assistants to use different URLs for function calls. If a serverUrl
is specified at the assistant level, it will override the account-level Server URL.
If the serverUrl
is not defined either at the account level or the assistant level, the function call will simply be added to the chat history. This can be particularly useful when you want a function call to trigger an action on the frontend.
For instance, the frontend can listen for specific function calls in the chat history and respond by updating the user interface or performing other actions. This allows for a dynamic and interactive user experience, where the frontend can react to changes in the conversation in real time.