How to Use IraCPA with IraVoice


1. Overview

IraCPA helps identify the call outcome before starting the voice bot interaction.
It can detect events such as:

  • LV – Live Voice

  • AM – Answering Machine

  • TO – Timeout (maximum CPA duration exceeded)

  • FX – Fax

  • BP – Beep

  • SL – Silence

To enable CPA during a make_call, you must pass a pre-configured cpa_config along with optional runtime behaviors like streaming or dropping the call on specific CPA events.


2. Required Parameters

cpa_config

Specifies the predefined configuration name for IraCPA. This must match a configuration already created in the system.

stream_on_cpa_events

A list of CPA event types that should trigger audio streaming to the WebSocket.

Example:
["LV"] → Start streaming only if the CPA result is Live Voice.

drop_on_cpa_events

CPA event types that should automatically end/drop the call.

Example:
["AM", "FX"] → Drop the call if CPA detects an answering machine or fax tone.


3. Sample make_call Request

curl --location 'https://sandboxld.epicode.in/api/makecall' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer *******' \ --data '{ "campaign_name": "XYZ Campaign", "from_number": "1234567890", "to_number": "+911234567890", "cpa_config": "cpatest", "call_params": { "websocket_host": "172.18.1.18", "websocket_port": 11005, "stream_on_cpa_events": ["LV"], "drop_on_cpa_events": ["FX","AM"], "enable_vad": true, "silence_threshold": 3, "speech_threshold": 600, "stop_bot_when_user_speaks": false, "recording_dir": "xyz", "streaming_botaudio": true, "event_url": "https://hrathiktest.requestcatcher.com/test", "token": "shfbs" } }'
Note:
cpa_config should be outside of call_params drop_on_cpa_events and stream_on_cpa_events should be inside call_params

4. Behaviour of the Above Example

  • If the call is answered and CPA result = LV (Live Voice)
    → A WebSocket audio stream will be initiated.

  • If CPA detects AM (Answering Machine) or FX (Fax)
    → The call will be automatically dropped.


5. Summary

To use IraCPA effectively with IraVoice:

  1. Create and configure a cpa_config in advance.

  2. Reference it in your make_call request.

  3. Use stream_on_cpa_events to control when bot streaming should start.

  4. Use drop_on_cpa_events to automatically terminate calls for undesired CPA outcomes.