Handle call trees
# support
t
HI! I'm trying to handle call trees, DTMF system and trying to use my own function like this:
Copy code
javascript
const DTMF = {
  async: true,
  type: "dtmf",
  function: {
    name: "dial-keypad-tool",
    description: "Use this function to dial a number",
    parameters: {
      type: "object",
      properties: {
        key: {
          type: "string",
          description: "The DTMF symbols to dial",
          pattern: "^[0-9*#]+$",
        },
      },
      required: ["key"],
    },
  },
}
Problem is it's seems like the system does not accept my values. Example from the call:
Copy code
{
  "role": "tool_calls",
  "time": 1726668938896,
  "message": "",
  "toolCalls": [
    {
      "id": "call_MiOXIq1q3Fbri5cnvv2IPI9n",
      "type": "function",
      "function": {
        "name": "dial-keypad-tool",
        "arguments": "{\"key\": \"4\"}"
      }
    }
  ],
  "secondsFromStart": 86.003
}
{
  "name": "dial-keypad-tool",
  "role": "tool_call_result",
  "time": 1726668938904,
  "result": "Success.",
  "toolCallId": "call_MiOXIq1q3Fbri5cnvv2IPI9n",
  "secondsFromStart": 86.011
}
What I doing wrong? Also, how to debug it proper? What kind of data vapi waits to send to the 3rd-party call system?
v
@Timur Hello! It looks like you've set up a custom function for handling DTMF (Dual-Tone Multi-Frequency) inputs within a call system. From the example you've provided, it appears that the system is accepting your values and the function call is returning a "Success." result. This indicates that the
dial-keypad-tool
function is being called correctly with the DTMF symbol "4" and is executing without errors. If you're experiencing issues despite the successful execution message, it could be due to several reasons: 1. The DTMF tones might not be reaching the third-party call system as expected. 2. There could be a mismatch between the expected input format of the third-party system and the format you're sending. 3. The third-party system might require additional information or a specific sequence of commands. To debug this properly, you can: - Check the documentation or API reference of the third-party call system to understand the expected input format and requirements for DTMF tones. - Ensure that the
dial-keypad-tool
function is correctly interfacing with the third-party system's API. - Verify that the network connection between your system and the third-party system is stable and allows for real-time communication. - If possible, log the raw input and output data between your function and the third-party system to identify any discrepancies. For the data that VAPI expects to send to the third-party call system, it typically includes the DTMF tones in a format that the system can recognize and process. This often involves sending the tones as a string of characters representing the keys pressed, which seems to be what you're doing. If you continue to face issues, please provide more details about the specific problem you're encountering, and I'll do my best to assist you further. If the problem is beyond the scope of our discussion, you may need to ask support for more info on this.
You can continue this conversation by mentioning me in the message.
Got it. Tagging @User for additional help.
t
Docs about DTMF are too poor 😦
s
@Timur can you share with call id what's not working for you?
t
f076b23b-9911-4159-9b43-4f2c8b009bf5
s
set tool async to false and try vapi prompting guide explict tool calling because your dtmf tool is not getting called.
t
thank you man
5 Views