Click to Call API
Click-to-call allows you to create URLs that can be POSTed to with a phone number and create a phone call from the provided contact information to a destination you have pre-determined. On devices with phone capabilities, make it easy for users to directly connect with you by simply tapping a phone number, more commonly known as click to call. It converts your website's users into engaged customers by creating an easy way for your customers to contact your sales and support teams right on your website.
Parameters * compulsory field
Field | Type | Description |
---|---|---|
user_id * | integer | A valid user id |
token * | string | A valid campaign token |
from * | integer |
Example from=98765XXXXX |
to * | integer |
Example from=98765XXXXX |
Parameters Optional field
Field | Type | Default | Description |
---|---|---|---|
fromType | string | Number |
Possible Values
|
fromStrategy | string | ONE_BY_ONE |
If fromType is number or agent then from can have multiple values. In that case calling strategy can be defined. Calling strategy means how you want to call these specified numbers. Possible Values
|
toType | string | Number |
Possible Values
|
toStrategy | string | ONE_BY_ONE |
If toType is number or agent then to can have multiple values. In that case calling strategy can be defined. Calling strategy means how you want to call these specified numbers. Possible Values
|
fromRingTime | integer | 30 |
Ring duration in seconds for from number Maximum value : 50 Example fromRingTime=30 |
toRingTime | integer | 30 |
Ring duration in seconds for to number Maximum value : 50 Example toRingTime=30 |
timeLimit | integer | unlimited |
It is duration in seconds to limit the talk time between from and to Ring durations of from and to are not included in timeLimit Call will be disconnected if timeLimitHangup is true |
timeLimitHangup | boolean | true |
If timeLimit is set to more than 0 and timeLimitHangup is true then call will be disconnected after the duration mentioned in timeLimit |
timeLimtAlert | integer |
This is duration in seconds If timeLimit is set then you can play announcements at some specific time to notify the from and to numbers. This announcement will be heard by both the numbers Announcement will be played when the talk time is longer than the time mentioned in timeLimtAlert. Multiple comma separated values can be passed. Example timeLimtAlert=120,300 |
|
alertAudio | integer |
This is a valid id of announcement. You can find announcement Ids in your account under Manage->Announcement-> Id Multiple comma separated values can be passed. This announcement will be heard by both the numbers If specified, announcement will be played according to timeLimtAlert Example alertAudio=1610448601_84.wav,1610448601_85.wav You can pass only one announcement id even if you have passed multiple values in timeLimtAlert. Same id will be played for all. |
|
ringTone | string |
This is a valid id of announcement. You can find announcement Ids in your account under Manage->Announcement-> Id If passed, announcement will be heard by from number in loop while dialing to number If not passed, the original announcement (played by mobile operator) will be heard by from number. Example ringTone=1610448601_84.wav |
|
fromRetryCount | integer | 0 |
Number of retries on from number Maximum allowed value : 3 |
toRetryCount | integer | 0 |
Number of retries on to number Maximum allowed value : 3 |
fromWebLogin | string | na |
Can use when fromType is an agent or a group. Possible Values
|
fromCallLogin | string | na |
Can use when fromType is an agent or a group. Possible Values
|
toWebLogin | string | na |
Can use when toType is an agent or a group. Possible Values
|
toCallLogin | string | na |
Can use when toType is an agent or a group. Possible Values
|
fromCLI | string |
Can use Valid CLI of user. |
|
sticky | string |
Based on the value in fromType and toType, Sticky will work only if either fromType or toType has a number as value, not both. Possible Values
|
|
stickyTimeType | string | Day |
Based on the value in sticky, It will work only if sticky has yes as value. Possible Values
|
stickyTimeValue | integer | 1 | |
stickyAgentBusy | string | retrySame |
Based on the value in sticky, It will work only if sticky has yes as value. Possible Values
|
queueTimeout | integer | 60 |
Based on the value in sticky, It will work only if sticky has yes as value. It will only work if out of toType and fromType at-least one have group as value |
mode | string | Live |
This parameter is helpful at the time of API integration in your panel. Possible Values
|
Response
Success Case
{
"callid": "kn5skxr6161770885161627785",
"status": "success",
"code": "200"
}
Error Case
{
"message": "Invalid From Type",
"status": "error",
"code": "105"
}
Error Code
Response Code | Description |
---|---|
1002 |
UserId not provided |
1013 |
Invalid user id |
1014 |
Token not found |
1020 |
Invalid token |
1501 |
Connection Issue |
1502 |
fromType empty |
1503 |
fromType Invalid |
1504 |
toType empty |
1505 |
toType Invalid |
1506 |
from parameter not found |
1507 |
to parameter not found |
1508 |
invalid mobile number in from parameter |
1509 |
invalid mobile number in to parameter |
1510 |
Duplicate Mobile Number exists in from parameter |
1511 |
Duplicate Mobile Number exists in to parameter |
1512 |
Invalid Agent Id in from parameter |
1513 |
Invalid Agent Id in to parameter |
1514 |
Duplicate Agent Id Exists in from parameter |
1515 |
Duplicate Agent Id Exists in to parameter |
1516 |
Multiple Group Ids found in from parameter |
1517 |
Multiple Group Ids found in to parameter |
1518 |
Invalid Group Id in from parameter |
1519 |
Invalid Group Id in to parameter |
1520 |
Same value exists in from and to parameters |
1521 |
from and to are empty |
1522 |
fromStrategy invalid |
1523 |
toStrategy invalid |
1524 |
fromRingTime value invalid |
1525 |
negative value not allowed for fromRingTime |
1526 |
toRingTime value invalid |
1527 |
negative value not allowed for toRingTime |
1528 |
fromRetryCount value invalid |
1529 |
negative value not allowed for fromRetryCount |
1530 |
toRetryCount value invalid |
1531 |
negative value not allowed for toRetryCount |
1532 |
timeLimit empty |
1533 |
negative value not allowed for timeLimit |
1534 |
timeLimit value invalid |
1535 |
ringTone invalid announcement id |
1536 |
fromWebLogin none of the agents have this state |
1537 |
fromWebLogin none of the agents from group have this state |
1538 |
fromCallLogin none of the agents have this state |
1539 |
Invalid format |
1540 |
fromCallLogin none of the agents from group have this state |
1541 |
toWebLogin none of the agents have this state |
1542 |
toWebLogin none of the agents from group have this state |
1543 |
toCallLogin none of the agents have this state |
1544 |
toCallLogin none of the agents from group have this state |
1545 |
timeLimitAlert invalid |
1546 |
alertAudio invalid announcement id |
1547 |
timeLimitAlert must be less than from timeLimit |
1548 |
crossed maximum limit of fromRetryCount |
1549 |
crossed maximum limit of toRetryCount |
1550 |
crossed maximum limit of fromRingTime |
1551 |
crossed maximum limit of toRingTime |
1552 |
crossed maximum limit of from parameter |
1553 |
crossed maximum limit of to parameter |
1554 |
invalid CLI in fromCLI |
1555 |
invalid CLI in toCLI |
1556 |
since fromStrategy=TO_ALL, so fromCallLogin filter will not work |
1557 |
since toStrategy=TO_ALL, so toCallLogin filter will not work |
1558 |
Sticky will only work if out of toType and fromType at-least one have number as value,not both |
1559 |
invalid value of stickyTimeType |
1560 |
invalid value of stickyTimeValue. It must be an integer |
1561 |
sticky parameter must be set for stickyTimeType, stickyTimeValue and stickyAgentBusy |
1562 |
invalid value of stickyAgentBusy |
1563 |
invalid value of queueTimeout. It must be an integer |
1564 |
invalid fromWebLogin value |
1565 |
invalid fromCallLogin value |
1566 |
invalid fromWebLogin value |
1567 |
invalid toCallLogin value |
1568 |
queueTimeout will only work if out of toType and fromType at-least one have group as value |
1569 |
Value length exceed 50 characters |
1570 |
Invalid DND Filter Value, valid:from/to/both |
1571 |
Invalid From Type for DND Checking |
1572 |
Invalid To Type for DND Checking |
1573 |
DND number exists in from |
1574 |
DND number exists in to |
1575 |
connection Error in DND Api |
1576 |
Multiple values not allowed in from |
1577 |
Multiple values not allowed in to |
1578 |
From-Agent is not available |
1579 |
To-Agent is not available |
1580 |
Invalid fromType for AGENT_CLI |
1581 |
Invalid toType for AGENT_CLI |
1582 |
From-AGENT_CLI not found |
1583 |
To-AGENT_CLI not found |
1584 |
There should be at-least one agent either in TO or FROM |
1585 |
fromCLI can not be set as AGENT_CLI if toType is group |
var request = require("request");
var options = { method: 'POST',
url: 'https://s-ct3.sarv.com/v2/clickToCall/para',
qs:
{ user_id: 'USER_ID',
token: 'TOKEN',
from: 'FROM_NUMBER',
to: 'TO_NUMBER' },
headers:
{ 'cache-control': 'no-cache' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
curl -X POST \
'https://s-ct3.sarv.com/v2/clickToCall/para?user_id=USER_ID&token=TOKEN&from=FROM_NUMBER&to=TO_NUMBER' \
-H 'cache-control: no-cache'
var request = require("request");
var options = { method: 'POST',
url: 'https://s-ct3.sarv.com/v2/clickToCall/para',
qs:
{ user_id: 'USER_ID',
token: 'TOKEN',
from: 'FROM_NUMBER',
to: 'TO_NUMBER' },
headers:
{ 'cache-control': 'no-cache' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});