Vapi-IraVoice Integration
Overview
IraVoice can integrate with Vapi using Vapi's WebSocket transport mechanism. This integration allows IraVoice to connect live PSTN calls to a Vapi voicebot over a secure WebSocket (WSS) connection.
When a call is answered, IraVoice requests a dynamically generated WebSocket URL from your application. Your application is responsible for creating a Vapi WebSocket session and returning the corresponding WSS URL to IraVoice.
Integration Flow
- An inbound or outbound call is established through IraVoice.
- Once the call is answered, IraVoice sends an HTTP POST request to your configured endpoint.
- Your application creates a new Vapi WebSocket transport session.
- Vapi returns a dynamic WebSocket URL.
- Your application returns this WSS URL in the HTTP response.
- IraVoice connects to the returned WebSocket endpoint and begins streaming audio between the caller and the Vapi voicebot.
Creating a Vapi WebSocket Session
Your application must create a WebSocket session using the Vapi Call API.
Sample Request
Code
The response contains a dynamically generated WebSocket URL that can be used to connect the call audio stream to the Vapi assistant.
Endpoint Requirements
You must expose an HTTP endpoint that IraVoice can invoke when a call is answered.
Sample Endpoint
Code
Request from IraVoice
IraVoice sends a POST request to your endpoint after the call has been answered.
Example:
Code
The exact payload may vary depending on your implementation requirements.
Expected Response
Example Response:
Code
Important Considerations
- A new WebSocket URL should be generated for every call.
- The returned URL must be valid and immediately accessible by IraVoice.
- The voicebot application must stream audio to IraVoice over WebSocket in the following format:
- PCM (signed 16-bit)
- Sampling rate: 8 kHz or 16 kHz
- Ensure that your endpoint responds quickly to avoid delays in call setup.
- Any authentication required for invoking your endpoint should be coordinated during the integration process.

