Document for CPaaS APIs

The CPaaS solution provides below ready to use APIs. These APIs are feature rich and have many parameters that can be passed in api call to take dynamic effect in run time.

Once you have setup the CPaaS solution on your server, you will have below two accounts already created. And below are the API credentials you can start using to test apis.

API Credentials

Account1:
account: account_1
auth: contact me

Account2:
account: account_2
auth: contact me

Click To Call

Description: This API is used for connecting 2 parties on call. Once we hit the API it generates an
outbound call to the agent number first, when the agent answers the call the second call initiated to
destination number. Now when the destination number answers the call both Agent and Destination
numbers are bridged on the call.

URL: http://localhost/api/click2call
Method: POST
Header:
Provide the keys below and its values in header.
account : Provide account_id for the API user
auth : Provide the account_auth for the API user
Body:
Provide the below json string in the body of your API request. This json string contains required and/or
optional parameters to be submitted in API requests.
{“agent_number”:”91997927XXXX”,”caller_id”:”15168148111″,”destination_number”:”91800068XXXX”,
“recording_option”:”on”,”transcript”:”on”}

Below are the descriptions for the body parameters.

Parameter NameData TypeDescription
agent_numberStringthe 10 digits agent’s mobile
number to dial
caller_idStringthe caller id which you want to
display, when agent or
destination number receives call
destination_numberStringthe 10 digits destination
number to dial
recording_optionString (Optional) Default: offHow you want to record calls,
agent side only, customer side
only or both sides. Available
options: both, agent, customer,
off
transcriptStringPossible values on, off. If on it
will generate transcription of
the call.

CURL Request:

curl --location 'http://localhost/api/click2call' \ --header 'account: YOUR_ACCOUNT_ID' \ --header 'auth: YOUR_ACCOUNT_AUTH' \ --header 'Content-Type: application/json' \ --data '{"agent_number":"91997927XXXX","caller_id":"15168148111","destination_number":"91800068XXXX", "recording_option":"on","transcript":"on"}'

Response:

{"response": {"request_id": "57362de4f0","success": "true"}}

 

Callback Request

Description: This API is used for generating callback requests of future dates and time. It automatically
generates the call between agent and customer on the defined date and time.

URL: http://localhost/api/callback
Method: POST, PATCH, DELETE (CREATE, UPDATE, DELETE operations)
Header:
Provide the keys below and its values in header.
account: Provide account_id for the API user
auth : Provide the account_auth for the API user
Body:
Provide the below json string in the body of your API request. This json string contains required and/or
optional parameters to be submitted in API requests.

Create Callback Request:

Method: POST

{“agent_number”:”91997927XXXX”,”caller_id”:”15168148111″,”destination_number”:”91800068XXXX”,
“recording_option”:”off”,”time_zone”:”Asia/Kolkata”,”scheduled_at”:”2023-08-15 12:55:00″}

Body Parameters:

Parameter NameData TypeDescription
agent_numberStringthe 10 digits agent’s mobile
number to dial
caller_idStringthe caller id which you want to
display, when agent or
destination number receives call
destination_numberStringthe 10 digits destination
number to dial
recording_optionStringPossible values: on, off
time_zoneStringProvide time zone for the
scheduled_at date, E.g.,
Asia/Kolkata, US/Eastern etc.
scheduled_atStringFuture date and time in format:
YYYY-mm-dd hh:mm:ss

CURL Request:

curl --location 'http://localhost/api/callback' --header 'account: YOUR_ACCOUNT_ID' --header 'auth: YOUR_ACCOUNT_AUTH' --header 'Content-Type: application/json' --data '{"agent_number":"91997927xxxx","caller_id":"15168148111","destination_number":"91800068xxxx","recording_option":"off","time_zone":"Asia/Kolkata","scheduled_at":"2023-11-07 19:00:00"}'

Response:

{"response": {"request_id": "fd5ff6e021","success": "true"}}

Update Callback Request:

Method: PATCH
{“request_id”:”fd5ff6e021″,”agent_number”:”91997927XXXX”,”caller_id”:”15168148111″,”destination_
number”:”91800068XXXX”,”recording_option”:”on”,”scheduled_at”:”2023-08-16 09:00:02″}Body Parameters:

Body Parameters:

Parameter NameData TypeDescription
request_idStringThe generated callback
request_id in above POST
method.
agent_numberStringthe 10 digits agent’s mobile
number to dial
caller_idStringthe caller id which you want to
display, when agent or
destination number receives call
destination_numberStringthe 10 digits destination
number to dial
recording_optionStringPossible values: on, off
scheduled_atStringFuture date and time in format:
YYYY-mm-dd hh:mm:ss

CURL Request:

curl --location --request PATCH 'http://localhost/api/callback' --header 'account: YOUR_ACCOUNT_ID' --header 'auth: YOUR_ACCOUNT_AUTH' --header 'Content-Type: application/json' --data '{"request_id":"5431b82e57","agent_number":"91997927XXXX","caller_id":"15168148111","destination_number":"91800068XXXX","recording_option":"on","scheduled_at":"2023-08-16 10:00:02"}'

Response:

{"response": {"message": "callback data modified successfully","request_id": "fd5ff6e021","success": "true"}}

Delete Callback Request:

Method: DELETE
{“request_id”:”fd5ff6e021″}

Body Parameters:

Parameter NameData TypeDescription
request_idStringThe generated callback
request_id in above POST
method, which you want to
delete.

CURL Request:

curl --location --request DELETE 'http://localhost/api/callback' --header 'account: YOUR_ACCOUNT_ID' --header 'auth: YOUR_ACCOUNT_AUTH' --header 'Content-Type: application/json' --data '{"request_id":"2de81b467d"}'

Response:

{"response": {"message": "callback request deleted successfully","request_id": "fd5ff6e021","success": "true"}}

 

One Time Password

Description: This API is used for announcing an OTP. Once we hit API it will generate an outbound call to
the given customer number and when the customer answers the call the given OTP is announced to the
customer over the phone. Announcement happens for the given number of repeat counts.

URL: http://localhost/api/outbound_call
Method: POST
Header:
Provide the keys below and its values in header.
account : Provide account_id for the API user
auth : Provide the account_auth for the API user
Body:
Provide the below json string in the body of your API request. This json string contains required and/or
optional parameters to be submitted in API requests.
{“customer_number”:”91997927XXXX”,”otp”:”1987″,”announce_template_id”:”AN2222314c96″,”repeat
“:”1″,”caller_id”:”15168148111″,”voice”:”Raveena”,”volume”:”soft”,”rate”:”slow”,”pitch”:”medium”,”la
nguage_code”:”en-US”,”tts_engine_type”:”standard”}

Below are the descriptions for the body parameters.

Parameter NameData TypeDescription
customer_numberStringthe mobile number of
customers with country code
otpStringthe one-time password which
you want to announce
announce_template_idStringThe approved otp announce
template id for the account
repeatStringnumber of times the
announcement will happen
caller_idStringthe number you want to display
as caller_id to the customer
voiceString (Optional) Default:
Joanna
male or female voice ids which
you want to use for
announcement
volumeString (Optional) Default:
medium
Provide volume value. Allowed
values: 'silent','x-
soft','soft','medium','loud','x-
loud'
rateString (Optional) Default:
medium
Provide rate of speed of
announcement. Allowed value:
'x-slow','slow','medium','fast','x-
fast'
pitchString (Optional) Default:
medium
Provide pitch type. Allowed
values: 'x-
low','low','medium','high','x-
high'
language_codeString (Optional) Default: en-USProvide language code in which
you may need to announce
tts_engine_typeString (Optional) Default:
standard
Provide engine type for TTS.
Allowed values: standard,
neural

CURL Request:

curl --location 'http://localhost/api/outbound_call' --header 'account: YOUR_ACCOUNT_ID' --header 'auth: YOUR_ACCOUNT_AUTH' --header 'Content-Type: application/json' --data '{"customer_number":"91997927XXXX","otp":"1987","announce_template_id":"AN2222314c96","repeat":"1","caller_id":"15168148111","voice":"Raveena","volume":"soft","rate":"slow","pitch":"medium"}'

Response:

{"response": {"request_id": "ae63e9576e","success": "true"}

Campaign Manager

Create Campaign List

Description: This API creates a campaign list, this list can hold contact numbers to dial in campaign.

URL: http://localhost/api/create_campaign_list
Method: POST
Header:
Provide the keys below and its values in header.
account: Provide account_id for the API user
auth : Provide the account_auth for the API user
Body:
Provide the below json string in the body of your API request. This json string contains required and/or
optional parameters to be submitted in API requests.
{“list_name”:”my_campaign_list”}

Below are the descriptions for the body parameters.

Parameter NameData TypeDescription
list_nameStringProvide unique list_name of
your choice

CURL Request:

curl --location 'http://localhost/api/create_campaign_list' --header 'account: YOUR_ACCOUNT_ID' --header 'auth: YOUR_ACCOUNT_AUTH' --header 'Content-Type: application/json' --data '{"list_name":"my_campaign_list"}'

Response:

{"response": {"list_id": "LSdb6a12e1f1","success": "true"}}

 

Add Contacts to List

Description: This API adds the number of contacts to the created campaign list.

URL: http://localhost/api/add_contact_to_list
Method: POST
Header:
Provide the keys below and its values in header.
account: Provide account_id for the API user
auth : Provide the account_auth for the API user
Body:
Provide the below json string in the body of your API request. This json string contains required and/or
optional parameters to be submitted in API requests.
{“list_id”:”LSaa8f9db7e6″,”contacts”:[{“contact_name”:”ankit”,”contact_number”:”91997927XXXX”,”co
ntact_fields”:{“field1″:”Ankit”,”field2″:”Jayswal”,”field3″:”500″}},{“contact_name”:”abc”,”contact_numb
er”:”91800068XXXX”,”contact_fields”:{“field1″:”abc”,”field2″:”xyz”,”field3″:”100″}}]}

Below are the descriptions for the body parameters.

Parameter NameData TypeDescription
list_idStringProvide created list_id of your
account
contactsStringProvide array of contacts as per
mentioned in above body

CURL Request:

curl --location 'http://localhost/api/add_contact_to_list' --header 'account: YOUR_ACCOUNT_ID' --header 'auth: YOUR_ACCOUNT_AUTH' --header 'Content-Type: application/json' --data '{"list_id":"LSaa8f9db7e6","contacts":[{"contact_name":"ankit","contact_number":"91997927XXXX","co ntact_fields":{"field1":"Ankit","field2":"Jayswal","field3":"500"}},{"contact_name":"abc","contact_numb er":"91800068XXXX","contact_fields":{"field1":"abc","field2":"xyz","field3":"100"}}]}'

Response:

{"response": {"message": "(2) contacts imported successfully","success": "true"}}

 

Import Contacts via CSV File

Description: This API reads the provided CSV file and import contacts to the given list_id.

URL: http://localhost/api/import_broadcast_contacts_csv
Method: POST
Header:
Provide the keys below and its values in header.account: Provide account_id for the API user
auth : Provide the account_auth for the API user
Body:
Provide the below json string in the body of your API request. This json string contains required and/or
optional parameters to be submitted in API requests.
{“list_id”:”LS608c393614″,”csv_name”:”contacts_dynamic_announcement.csv”}

Below are the descriptions for the body parameters.

Parameter NameData TypeDescription
list_idStringProvide created list_id of your
account
csv_nameStringProvide CSV file name which
you uploaded to S3 bucket with
name

CURL Request:

curl --location 'http://localhost/api/import_broadcast_contacts_csv' --header 'account: YOUR_ACCOUNT_ID' --header 'auth: YOUR_ACCOUNT_AUTH' --header 'Content-Type: application/json' --data '{"list_id":"LS608c393614","csv_name":"contacts_dynamic_announcement.csv"}'

Response:

{"response": {"message": "(2) contacts imported successfully","success": "true"}}

 

Create Campaign DND List

Description: This API creates a campaign DND list, this list can hold contact numbers which we do not
require or wish to dial in campaign.

URL: http://localhost/api/create_campaign_dnd_list
Method: POST
Header:
Provide the keys below and its values in header.
account: Provide account_id for the API user
auth : Provide the account_auth for the API user
Body:
Provide the below json string in the body of your API request. This json string contains required and/or
optional parameters to be submitted in API requests.
{“dnd_list_name”:”my_first_DND_list”}

Below are the descriptions for the body parameters.

Parameter NameData TypeDescription
dnd_list_nameStringProvide unique dnd_list_name
of your choice.

CURL Request:

curl --location 'http://localhost/api/create_campaign_dnd_list' --header 'account: YOUR_ACCOUNT_ID' --header 'auth: YOUR_ACCOUNT_AUTH' --header 'Content-Type: application/json' --data '{"dnd_list_name":"my_first_DND_list"}'

Response:

{"response": {"dnd_list_id": "DNda1b361461","success": "true"}}

 

Add DND Contacts To List

Description: This API adds the number of DND contacts to the created DND list.

URL: http://localhost/api/add_dnd_contact_to_listMethod: POST
Header:
Provide the keys below and its values in header.
account: Provide account_id for the API user
auth : Provide the account_auth for the API user
Body:
Provide the below json string in the body of your API request. This json string contains required and/or
optional parameters to be submitted in API requests.
{“dnd_list_id”:”DN95716be314″,”dnd_contacts”:[{“dnd_contact_name”:”ankit”,”dnd_contact_number”:
“91997927XXXX”},{“dnd_contact_name”:”abc”,”dnd_contact_number”:”91800068XXXX”}]}

Below are the descriptions for the body parameters.

Parameter NameData TypeDescription
dnd_list_idStringProvide created dnd_list_id of
your account
dnd_contactsStringProvide array of dnd contacts as
per mentioned in above body

CURL Request:

curl --location 'http://localhost/api/add_dnd_contact_to_list' --header 'account: YOUR_ACCOUNT_ID' --header 'auth: YOUR_ACCOUNT_AUTH' --header 'Content-Type: application/json' --data '{"dnd_list_id":"DN95716be314","dnd_contacts":[{"dnd_contact_name":"ankit","dnd_contact_number":"91997927XXXX"},{"dnd_contact_name":"abc","dnd_contact_number":"91800068XXXX"}]}'

Response:

{"response": {"message": "(2) DND contacts imported successfully","success": "true"}}

 

Add DND Contacts to List via CSV File

Description: This API reads the csv file and import DND contacts to given dnd_list_id.

URL: http://localhost/api/import_dnd_contacts_csv
Method: POST
Header:
Provide the keys below and its values in header.
account: Provide account_id for the API user
auth : Provide the account_auth for the API user
Body:
Provide the below json string in the body of your API request. This json string contains required and/or
optional parameters to be submitted in API requests.
{“dnd_list_id”:”DNd2b09f8f80″,”dnd_csv_name”:”dnd_contacts.csv”}

Below are the descriptions for the body parameters.

Parameter NameData TypeDescription
dnd_list_idStringProvide created dnd_list_id of
your account
dnd_csv_nameStringProvide CSV file name for DND
contacts which you uploaded to
S3 bucket

CURL Request:

curl --location ' http://localhost/api/import_dnd_contacts_csv' --header 'account: YOUR_ACCOUNT_ID' --header 'auth: YOUR_ACCOUNT_AUTH' --header 'Content-Type: application/json' --data '{"dnd_list_id":"DNd2b09f8f80","dnd_csv_name":"dnd_contacts.csv"}'

Response:

{"response": {"message": "(2) DND contacts imported successfully","success": "true"}}

 

Create Campaign

Description: This API creates campaigns for the given list_id and dnd_list_id. There are two types of campaign. First one is broadcast the dynamic or prerecorded file message. Second one is to connect with IVR, VoiceBot, VoiceMail.

URL: http://localhost/api/create_campaign
Method: POST
Header:
Provide the keys below and its values in header.
account: Provide account_id for the API user
auth : Provide the account_auth for the API user
Body:
Provide the below json string in the body of your API request. This json string contains required and/or
optional parameters to be submitted in API requests.

CAMPAIGN TYPE 0 (ANNOUNCEMENT ONLY):

Option 1: For Dynamic announcement
{“list_id”:”LS608c393614″,”dnd_list_id”:”DNd2b09f8f80″,”campaign_name”:”test_broadcast_campaign
_test_volume”,”campaign_type”:”0″,”campaign_caller_id”:”15168148111″,”dynamic_announcement”:”
1″,”recorded_filename”:””,”announcement_text”:”Dear, {field1} , {field2}, Your due balance is,, {field3},,
INR only”,”campaign_start_date”:”2023-09-25 14:05:00″,”campaign_end_date”:”2023-09-26
20:00:00″,”time_zone”:”Asia/Kolkata”,”repeat”:”2″,”max_retries”:”1″,”retry_time”:”60″,”calls_per_min
ute”:”10″,”voice”:”Matthew”,”volume”:”soft”,”rate”:”slow”,”pitch”:”medium”,”language_code”:”en-
US”,”tts_engine_type”:”standard”}

Option 2: For Prerecorded file announcement
{“list_id”:”LS5ac4d9833c”,”dnd_list_id”:”DN4746f26296″,”campaign_name”:”test_broadcast_campaign
_new1″,”campaign_type”:”0″,”campaign_caller_id”:”15168148111″,”dynamic_announcement”:”0″,”rec
orded_filename”:”quality_training-8khz.wav”,”announcement_text”:””,”campaign_start_date”:”2023-
07-17 09:00:00″,”campaign_end_date”:”2023-07-18
20:00:00″,”time_zone”:”Asia/Kolkata”,”repeat”:”3″,”max_retries”:”1″,”retry_time”:”60″,”calls_per_min
ute”:”10″}

CAMPAIGN TYPE 1 (CONNECT TO IVR):

{“list_id”:”LS18ac9f0cb0″,”dnd_list_id”:”DNbc4f9d9b5f”,”campaign_name”:”campaign_type_new_one_
new1″,”campaign_type”:”1″,”campaign_caller_id”:”15168148111″,”dynamic_announcement”:”1″,”reco
rded_filename”:””,”announcement_text”:”abc”,”campaign_start_date”:”2023-12-1810:00:00″,”campaign_end_date”:”2023-12-18
20:00:00″,”time_zone”:”Asia/Kolkata”,”repeat”:”1″,”max_retries”:”1″,”retry_time”:”60″,”calls_per_min
ute”:”10″}

Below are the descriptions for the body parameters.

Parameter NameData TypeDescription
list_idStringProvide created list_id of your
account
dnd_list_idStringProvide created dnd_list_id of
your account
campaign_nameStringProvide unique campaign name
of your choice
campaign_typeString0=only announce, 1=Survey
campaign_caller_idStringThe caller_id which you want to
display while dialing contacts in
the campaign.
dynamic_announcementString0=pre-recorded file play, 1=play
dynamic given text with
variables provided
recorded_filenameStringThe pre uploaded wav filename
which we want to play when
contact answers the call in the
campaign
announcement_textStringThe dynamic text with variables
which we want to announce to
every contact in the campaign
retry_attemptsStringNumber of times to retry when
contact does not answer the call
retry_on_statusesStringOn which status you need to re-
dial the contact. E.g., NOANSER,
BUSY etc.
repeat_countStringNumber of times the
announcement should happen
max_retriesStringMax number of retries to dial
contact number if call fails
retry_timeStringAfter how much seconds retry
should happen
calls_per_minuteStringNumber of calls to dial per
minute for the campaign
voiceString (Optional) Default:
Joanna
male or female voice ids which
you want to use for
announcement
volumeString (Optional) Default:
medium
Provide volume value. Allowed
values: 'silent','x-
soft','soft','medium','loud','x-
loud'
rateString (Optional) Default:
medium
Provide rate of speed of
announcement. Allowed value:
'x-slow','slow','medium','fast','x-
fast'
pitchString (Optional) Default:
medium
Provide pitch type. Allowed
values: 'x-
low','low','medium','high','x-
high'
campaign_start_dateStringThe date and time when the
campaign should start
campaign_end_dateStringThe date and time when the
campaign should end
time_zoneString (Optional)Provide campaign time zones
for the start and end date, E.g.,
Asia/Kolkata, US/Eastern etc.
Default: UTC
language_codeString (Optional) Default: en-USProvide language code in which
you may need to announce
tts_engine_typeString (Optional) Default:
standard
Provide engine type for TTS.
Allowed values: standard,
neural

CURL Request:

curl --location 'http://localhost/api/create_campaign' --header 'account: YOUR_ACCOUNT_ID' --header 'auth: YOUR_ACCOUNT_AUTH' --header 'Content-Type: application/json' --data '{"list_id":"LS608c393614","dnd_list_id":"DNd2b09f8f80","campaign_name":"test_broadcast_campaign _test_volume","campaign_type":"0","campaign_caller_id":"15168148111","dynamic_announcement":"1","recorded_filename":"","announcement_text":"Dear, {field1} , {field2}, Your due balance is,, {field3},,INR only","campaign_start_date":"2023-09-25 14:05:00","campaign_end_date":"2023-09-26 20:00:00","time_zone":"Asia/Kolkata","repeat":"2","max_retries":"1","retry_time":"60","calls_per_min ute":"10","voice":"Matthew","volume":"soft","rate":"slow","pitch":"medium"}'

Response:

{"response": {"campaign_id": "CMcc0cb33a01","success": "true"}}

 

Stop Campaign

Description: This API stops a campaign.

URL: http://localhost/stop_campaign
Method: POST
Header:
Provide the keys below and its values in header.
account: Provide account_id for the API user
auth : Provide the account_auth for the API user
Body:
Provide the below json string in the body of your API request. This json string contains required and/or
optional parameters to be submitted in API requests.
{“campaign_id”:” CM7b1b0f4c2f “}

Below are the descriptions for the body parameters.

Parameter NameData TypeDescription
campaign_idStringProvide campaign_id which you
want to stop

CURL Request:

curl --location 'http://localhost/api/stop_campaign' --header 'account: YOUR_ACCOUNT_ID' --header 'auth: YOUR_ACCOUNT_AUTH' --header 'Content-Type: application/json' --data '{"campaign_id":"CM7b1b0f4c2f"}'

Response:

{"response": {"message": " campaign stopped successfully","success": "true"}}

 

Get Campaign Details

Description: This API provides details about the created campaigns.

URL: http://localhost/api/get_campaign_details
Method: GET
Header:
Provide the keys below and its values in header.
account: Provide account_id for the API user
auth : Provide the account_auth for the API user

CURL Request:

curl --location 'http://localhost/api/get_campaign_details' --header 'account: YOUR_ACCOUNT_ID' --header 'auth: YOUR_ACCOUNT_AUTH' --header 'Content-Type: application/json'

Response:

{"response":{"message":"campaign found","result":[{"calls_per_minute":"10","campaign_caller_id":"15168148111","campaign_end_date":"Wed, 12 Jul 2023 20:00:00 GMT","campaign_id":"CMf32a68bc63","campaign_name":"test_broadcast_campaign_max","campaign_start_date":"Tue, 11 Jul 2023 09:00:00 GMT","campaign_status":"3","campaign_type":"0","max_retries":"1","repeat_announcement_count":"3","retry_time":"60"}],"success":"true"}}

 

CDR API REQUESTS

Get CDR By Date

Description: This API provides call detail records for the given start and end date range.

URL: http://localhost/api/get_cdr_by_date
Method: POST
Header:
Provide the keys below and its values in header.
account : Provide account_id for the API user
auth : Provide the account_auth for the API user
Body:
Provide the below json string in the body of your API request. This json string contains required and/or
optional parameters to be submitted in API requests.
{“start_call_date”:”2023-06-13″,”end_call_date”:”2023-06-17″,”record_count”:”5″,”offset”:”1″}

Below are the descriptions for the body parameters.

Parameter NameData TypeDescription
start_call_dateStringCDR start from this date or
greater than this date
end_call_dateStringCDR end from this date or less
than this date
record_countString (Optional) Default: 1000Number of CDR records you
want in response
offsetString (Optional) Default: 0Offset value to skip some
records. E.g., If given 5 then it
will skip initial 5 records

CURL Request:

curl --location 'http://localhost/api/get_cdr_by_date' --header 'account: YOUR_ACCOUNT_ID' --header 'auth: YOUR_ACCOUNT_AUTH' --header 'Content-Type: application/json' --data '{"start_call_date":"2023-06-13","end_call_date":"2023-06-17","record_count":"5","offset":"1"}'

Response:

{"response":{"message":"cdr found","result":[{"account_id":"ACvjfnvjnfs","agent_number":"","answer":"Fri, 07 Jul 2023 06:08:09 GMT","billsec":7.26955,"call_date":"Fri, 07 Jul 2023 06:08:16 GMT","call_direction":"outbound-api","call_duration":17.0311,"call_status":"ANSWERED","caller_id":"15168148111","customer_number":"91997927XXXX","destination_context":"local_call","dial_status":"ANSWER","dialed_number":"91997927XXXX","dtmf_inputs":"","end":"Fri, 07 Jul 2023 06:08:16 GMT","id":352,"recording_name":"","request_id":"b5e66bf36f","uniqueid":"1688710079.868"}],"success":"true"}}

 

Get CDR By Request ID

Description: This API provides call detail records for the given request id.

URL: http://localhost/api/get_cdr_by_request_id
Method: POST
Header:
Provide the keys below and its values in header.
account: Provide account_id for the API user
auth : Provide the account_auth for the API user
Body:
Provide the below json string in the body of your API request. This json string contains required and/or
optional parameters to be submitted in API requests.
{“request_id”:”91da7c083f”}

Below are the descriptions for the body parameters.

Parameter NameData TypeDescription
request_idStringThe request_id generated from
API request like outbound_call,
click2call

CURL Request:

curl --location 'http://localhost/api/get_cdr_by_request_id' --header 'account: YOUR_ACCOUNT_ID' --header 'auth: YOUR_ACCOUNT_AUTH' --header 'Content-Type: application/json' --data '{"request_id":"91da7c083f"}'

Response:

{"response":{"message":"cdr found","result":[{"account_id":"ACvjfnvjnfs","agent_number":"91800068XXXX","answer":"Tue, 04 Jul 2023 05:31:42 GMT","billsec":8.55722,"call_date":"Tue, 04 Jul 2023 05:31:51 GMT","call_direction":"outbound-api","call_duration":15.1364,"call_status":"ANSWERED","caller_id":"15168148111","customer_number":"91997927XXXX","destination_context":"click2call","dial_status":"ANSWER","dialed_number":"91997927XXXX","dtmf_inputs":"","end":"Tue, 04 Jul 2023 05:31:51 GMT","id":328,"recording_name":"","request_id":"91da7c083f","uniqueid":"1688448695.804"}],"success":"true"}}

 

Get CDR By Campaign ID

Description: This API provides call detail records for the given campaign id.

URL: http://localhost/api/get_cdr_by_campaign_id
Method: POST
Header:
Provide the keys below and its values in header.
account: Provide account_id for the API user
auth : Provide the account_auth for the API user
Body:
Provide the below json string in the body of your API request. This json string contains required and/or
optional parameters to be submitted in API requests.
{“campaign_id”:”CM39139118b8″}

Below are the descriptions for the body parameters.

Parameter NameData TypeDescription
campaign_idStringThe campaign_id generated
while creating campaign (from
create_campaign API)

CURL Request:

curl --location 'http://localhost/api/get_cdr_by_campaign_id' --header 'account: YOUR_ACCOUNT_ID' --header 'auth: YOUR_ACCOUNT_AUTH' --header 'Content-Type: application/json' --data '{"campaign_id":"CM39139118b8"}'

Response:

{"response":{"message":"cdr found","result":[{"account_id":"ACvjfnvjnfs","agent_number":"","answer":"Thu, 01 Jan 1970 00:00:00 GMT","billsec":null,"call_date":"Tue, 18 Jul 2023 06:11:10 GMT","call_direction":"outbound-campaign","call_duration":null,"call_status":null,"caller_id":"15168148720","customer_number":"","destination_context":"local_call_campaign_type_0","dial_status":"DND","dialed_number":"91800068XXXX","dtmf_inputs":"","end":"Thu, 01 Jan 1970 00:00:00 GMT","id":444,"is_dnd":"1","list_id":"LS50f6ec70b7","recording_name":"","request_id":"","uniqueid":""},{"account_id":"ACvjfnvjnfs","agent_number":"","answer":"Tue, 18 Jul 2023 06:11:19 GMT","billsec":11.2202,"call_date":"Tue, 18 Jul 2023 06:11:30 GMT","call_direction":"outbound-campaign","call_duration":19.8233,"call_status":"ANSWERED","caller_id":"15168148720","customer_number":"","destination_context":"local_call_campaign_type_0","dial_status":"ANSWER","dialed_number":"91997927XXXX","dtmf_inputs":"","end":"Tue, 18 Jul 2023 06:11:30 GMT","id":445,"is_dnd":"0","list_id":"LS50f6ec70b7","recording_name":"","request_id":"","uniqueid":"1689660670.1179"}],"success":"true"}}

 

Get CDR Statistics

Description: This API provides count of answer calls, busy calls, cancel calls, channel unavailable calls,
congestion calls, no-answer calls, total calls.

URL: http://localhost/api/get_cdr_statistics
Method: GET
Header:
Provide the keys below and its values in header.
account: Provide account_id for the API user
auth: Provide the account_auth for the API user

CURL Request:

curl --location 'http://localhost/api/get_cdr_statistics' \ --header 'account: YOUR_ACCOUNT_ID' \ --header 'auth: YOUR_ACCOUNT_AUTH' \

Response:

{"response":{"result":{"answer_calls":[248],"busy_calls":[0],"cancel_calls":[13],"chanunavail_calls":[35],"congestion_calls":[0],"noanswer_calls":[13],"total_calls":[434]},"success":"true"}}

 

Get Live Calls Statistics

Description: This API provides count of click2call calls, otp calls.

URL: http://localhost/api/get_live_call_statistics
Method: GET
Header:
Provide the keys below and its values in header.
account: Provide account_id for the API user
auth : Provide the account_auth for the API user

CURL Request:

curl --location 'http://localhost/api/get_live_call_statistics' \ --header 'account: YOUR_ACCOUNT_ID' \ --header 'auth: YOUR_ACCOUNT_AUTH' \

Response:

{"response":{"result":{"live_calls_c2c":0,"live_calls_campaign":0,"live_calls_inbound":0,"live_calls_otp":0},"success":"true"}}

 

Get Campaign CDR Statistics

Description: This API provides the number of answered calls, busy calls, DND calls etc.

URL: http://localhost/api/get_campaign_cdr_statistics
Method: POST
Header:
Provide the keys below and its values in header.
account: Provide account_id for the API user
auth : Provide the account_auth for the API user
Body:
Provide the below json string in the body of your API request. This json string contains required and/or
optional parameters to be submitted in API requests.
{“campaign_id”:” CM7b1b0f4c2f “}

Below are the descriptions for the body parameters.

Parameter NameData TypeDescription
campaign_idStringProvide campaign_id for which
you want to see CDR statistics

CURL Request:

curl --location 'http://localhost/api/get_campaign_cdr_statistics' \ --header 'account: YOUR_ACCOUNT_ID' \ --header 'auth: YOUR_ACCOUNT_AUTH' \ --header 'Content-Type: application/json' \ --data '{"campaign_id":"CM7b1b0f4c2f"}'

Response:

{"response":{"result":{"answer_calls":[5],"busy_calls":[0],"cancel_calls":[0],"chanunavail_calls":[0],"congestion_calls":[0],"dnd_calls":[4],"noanswer_calls":[0],"total_calls":[9]},"success":"true"}}

 

Modify Live Call

Description: This API used for call transfer (blind or attended transfer) and hangup the call

URL: http://localhost/api/modify_callMethod: POST
Header:
Provide the keys below and its values in header.
account: Provide account_id for the API user
auth : Provide the account_auth for the API user
Body:
Provide the below json string in the body of your API request. This json string contains required and/or
optional parameters to be submitted in API requests.

Transfer to SIP Agent:
{“channel”:” PJSIP/101-0000023c”,”modify_type”:”0″,”transfer_to”:”102″}
Transfer to External Number:
{“channel”:” PJSIP/tatatrunk-ACvjfnvjnfs-0000023d”,”modify_type”:”0″,”transfer_to”:”919976XXXXXX”}

Below are the descriptions for the body parameters.

Parameter NameData TypeDescription
channelStringFor Blind Transfer: provide
transferer channel. Whoever
wants to transfer just provide
his channel only.
For Attended Transfer: provide
customer channel
modify_typeString0=blind transfer, 1=attended
transfer, 2=hangup, 3=start
recording
transfer_toStringSIP Agent extension or External
number with country code

CURL Request:

curl --location 'http://localhost/api/modify_call' \ --header 'account: YOUR_ACCOUNT_ID' \ --header 'auth: YOUR_ACCOUNT_AUTH' \ --header 'Content-Type: application/json' \ --data '{"channel":"","modify_type":"0","transfer_to":"102"}'

Response:

{"response":{"message":"blind transferred successfully","success":"true"}}

 

———————————————–x———————————–x——————————————————