passing on dynamic variable in an inbound call
# support
n
Can you pass incoming phone number as dynamic variable? I have a tool function that requires inbound number. So it doesn’t have to run before the call starts but would be nice to have the data within first few second of the call. Or is only way to do this using a transient agent?
v
message has been deleted
You can continue this conversation by mentioning me in the message.
@NexaDev Yes, you can pass the incoming phone number as a dynamic variable to your tool function. VAPI allows you to capture the incoming caller ID and use it as a variable within your voice application. This does not necessarily require a transient agent. When a call is received, the incoming phone number can be captured and stored in a variable. You can then pass this variable to your tool function as needed. This process can be set up to occur automatically at the start of the call, ensuring that the data is available within the first few seconds. If you need assistance setting this up or have any specific requirements for your tool function, please let me know, and I can provide more detailed guidance or instructions.
s
only way is to use transient agent.
m
Can you offer details.
v
@Marcos Polanco Certainly! A transient agent in the context of voice APIs is typically a temporary service or process that handles dynamic data during a call session. If your voice application requires the use of a transient agent to capture and pass the incoming phone number as a dynamic variable, here's how it generally works: 1. **Call Initiation**: When a call is initiated, the voice API platform detects the incoming call and captures the caller ID (the incoming phone number). 2. **Transient Agent Invocation**: The voice API platform then invokes a transient agent. This agent is a short-lived process that is spun up specifically for the duration of the call or for the specific task of handling dynamic data. 3. **Data Handling**: The transient agent receives the incoming phone number and any other relevant data from the voice API platform. It can then process this data, perform any necessary logic, and pass the information to your tool function. 4. **Tool Function Execution**: With the incoming phone number now available as a dynamic variable, the transient agent can call your tool function and pass the number as a parameter. 5. **Call Handling**: Your voice application continues to handle the call as per your business logic, using the dynamic data provided by the transient agent. 6. **Session End**: Once the call is completed, or the data is no longer needed, the transient agent's job is done, and it can be terminated. Transient agents are useful for scenarios where real-time data processing is required, and they are designed to be lightweight and ephemeral, minimizing resource usage and ensuring that each call is handled independently. If you need more specific details or have questions about implementing a transient agent in your voice application, please let me know, and I'll be happy to assist further.
38 Views