Endpoint Click 2 Calls DNK
Click 2 Calls DNK
POST
http://{HOST:PORT}/v1/api/dial
Basic Authentication
Click to Call, endpoint utilizado para iniciar uma ligação no sistema de telefonia.
Json Schema (https://json-schema.org/)
Json Schema
{
"type": "object",
"title": "webhookdata",
"examples": [
{
"id": 34,
"source": "6000",
"destiny": "9999",
"event": "call.hangup",
"disposition": "ANSWERED",
"created": "2021-03-13 09:49",
"clientkey": "g58752pl-8596-8855-3654-64e8r54654q2",
"callkey": "cfbdde68b3e4b877",
"uniqueid": "1615639781.7",
"linkedid": "1615639781.7",
"eventdescription": "Ligação cncerrada",
"mp3uri": "GET http://.../api/mp3/202103/1615639781.7.mp3",
"starttime": "2021-03-13 12:49:41",
"answertime": "2021-03-13 12:49:42",
"durationtime": 11,
"billingtime": 9
}
],
"properties": {
"id": {
"type": "integer",
},
"source": {
"type": "string",
"description": "Ramal de Origem para a ligação",
"examples": [
"6000"
]
},
"destiny": {
"type": "string",
"description": "Telefone de destino",
"examples": [
"3232113211"
]
},
"event": {
"type": "string",
"examples": [
"call.dialing",
"call.answered",
"call.hangup"
]
},
"disposition": {
"type": "string",
"examples": [
"ANSWERED",
"NO ANSWER",
"BUSY",
"FAILED"
]
},
"created": {
"type": "string",
"examples": [
"2021-03-13 09:49"
]
},
"clientkey": {
"type": "string",
"description": "Chave do Client cadastrado no sistema",
"examples": [
"g58752pl-8596-8855-3654-64e8r54654q2"
]
},
"callkey": {
"description": "Chave da ligação",
"examples": [
"cfbdde68b3e4b877"
]
},
"uniqueid": {
"type": "string",
"examples": [
"1615639781.7"
]
},
"linkedid": {
"type": "string",
"examples": [
"1615639781.7"
]
},
"eventdescription": {
"type": "string",
"examples": [
"Iniciando discagem",
"Atendida pelo destino",
"Ligação cncerrada"
]
},
"mp3uri": {
"type": "string",
"description": "URI para a baixa do audio da ligação",
"examples": [
"GET http://.../api/mp3/202103/1615639781.7.mp3"
]
},
"starttime": {
"type": "string",
"description": "Disponível apenas no evento call.hangup",
"examples": [
"2021-03-13 12:49:41"
]
},
"answertime": {
"type": "string",
"description": "Disponível apenas no evento call.hangup",
"examples": [
"2021-03-13 12:49:42"
]
},
"durationtime": {
"type": "integer",
"description": "Tempo de duração da ligação em segundos.
Disponível apenas no evento call.hangup",
"examples": [
11
]
},
"billingtime": {
"type": "integer",
"description": "Tempo em segundos bilhetado para a ligação.
Disponível apenas no evento call.hangup",
"examples": [
9
]
}
},
"required": [
"id",
"source",
"destiny",
"created",
"clientkey"
],
}
Request / Response
-
{ "clientkey": "123", "source" : "7000", "destiny" : "3232323232" } -
{ "key": "e0ddd15ae2fde984", "status": "IN_PROGRESS", "created": "2021-03-03T19:24:25.432+0000", "from": "7000", "to": "3232323232", "error": null, "callId": "e0ddd15ae2fde984", "serverMessage": null, "clientKey": "123" } -
{ "timestamp": "2021-03-03T19:25:35.461+0000", "status": 400, "error": "Bad Request", "message": "", "path": "/0.1b/api/dial" } -
POST: https://api.dnk.com.br/v1/api/dial
Webhook
Ao iniciar um Click2Call o integrador receberá respostas de eventos via Webhook no endereço do backend especificado previamente com a equipe de Implantação.
Dialing
Quando a chamada entrar na fila de discagem da telefonia receberá o evento Dialing
Evento: call.dialing
Exemplo Json recebido pelo Backend do integrador:
{
id: 32,
source: '6000',
destiny: '9999',
event: 'call.dialing',
disposition: null,
created: '2021-03-13 10:25',
clientkey: '123',
callkey: '78624bbcba1c02db',
uniqueid: '1615641942.8',
linkedid: '1615641942.8',
eventdescription: 'Iniciando discagem',
mp3uri: 'GET http://.../api/mp3/202103/1615641942.8.mp3',
starttime: null,
answertime: null,
durationtime: null,
billingtime: null
}
Answering
Quando a chamada for atendida pelo Destinatário receberá o evento Answered
Evento: call.answered
Exemplo Json recebido pelo Backend do integrador:
{
id: 33,
source: '6000',
destiny: '9999',
event: 'call.answered',
disposition: 'ANSWERED',
created: '2021-03-13 09:49',
clientkey: '123',
callkey: 'cfbdde68b3e4b877',
uniqueid: '1615639781.7',
linkedid: '1615639781.7',
eventdescription: 'Atendida pelo destino',
mp3uri: 'GET http://.../api/mp3/202103/1615639781.7.mp3',
starttime: null,
answertime: null,
durationtime: null,
billingtime: null
}
Hangup
Quando a chamada for encerrada pelo Destinatário ou Agente receberá o evento Hangup
Evento: call.hangup
Exemplo Json recebido pelo Backend do integrador:
{
id: 34,
source: '6000',
destiny: '9999',
event: 'call.hangup',
disposition: 'ANSWERED',
created: '2021-03-13 09:49',
clientkey: '123',
callkey: 'cfbdde68b3e4b877',
uniqueid: '1615639781.7',
linkedid: '1615639781.7',
eventdescription: 'Ligação cncerrada',
mp3uri: 'GET http://.../api/mp3/202103/1615639781.7.mp3',
starttime: '2021-03-13 12:49:41',
answertime: '2021-03-13 12:49:42',
durationtime: '11',
billingtime: '9'
}