Skip to main content

Make a Call

EnIn algunassome ocasiones,cases, esit necesariois quenecessary unfor agentean genereagent unato llamadainitiate a uncall númeroto de teléfono desde otra aplicación, como podría serphone unnumber from another application, such as a CRM. SeThis puedeAPI utilizarcan estabe API,used, yand lathe llamadacall seráwill enviadabe aldirected agente.to the agent.

UstedYou puedecan verificarcheck lathe Colección de Postman parato versee unan ejemploexample yand probartest conit suwith instancia.your instance.

TodosAll losdata datosenclosed quein esten encerrados por "{{ }}" sonare valoresvalues quethat seránwill reemplazadobe conreplaced loswith datosthe delclient's propioown clientedata y/oand/or lathe instanciacorresponding correspondiente.instance.


HTTP Request

MetodoMethod RecursoResource
POST /Integra/resources/Agents/AgentCall

Request Header

Opcion Valor
Content-Type application/x-www-form-urlencoded
Authorization Basic {{Token}}

Request Body

Parametro Tipo
Requerido Descripción
callerid Número Si DID asignadoassigned ato lathe campañacampaign porfrom lawhich cualthe secall realizaráwill labe llamada.made.
agent Texto Si AgenteAgent quewho tomaráwill latake llamada.the call.
phone
Número Si NúmeroAgent's dephone teléfono del agente.number.
tech Texto Si ProtocoloCommunication deprotocol, comunicación, agregaradd SIP.
context Texto Si NombreName delof contextothe paracontext flujosfor porflows elfrom cualwhich saldráthe lacall llamada.will Puedeexit; serit "agentes"can obe "agents"'agentes' or 'agents.'
outqueue Texto Si NombreName deof lathe campañamanual manual.campaign.
destination Número Si Nombre de

Name laof campañathe porcampaign lafor cualwhich sethe generarácall lawill llamada.be generated.


EjemplosCode de CódigoExamples

PuedeYou copiarcan loscopy siguientesthe ejemplosfollowing decode codigoexamples yand reemplazarreplace las variablesthe "{{variable}}" conwith losthe datoscorrect correctos.data.

HTTP

POST /Integra/resources/Agents/AgentCall HTTP/1.1
Host: {{instance}}.ucontactcloud.com
Authorization: Basic {{Token}}
Content-Type: application/x-www-form-urlencoded
Content-Length: 116

callerid={{callerid}}agent={{agent}}&phone={{phone}}&tech=SIP&context={{context}}&outqueue={{outqueue}}&destination={{destination}}
cURL
curl --location 'https://{{instance}}.ucontactcloud.com/Integra/resources/Agents/AgentCall' \
--header 'Authorization: Basic {{Token}}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'callerid={{callerid}}' \
--data-urlencode 'agent={{agent}}' \
--data-urlencode 'phone={{phone}}' \
--data-urlencode 'tech=SIP' \
--data-urlencode 'context={{context}}' \
--data-urlencode 'outqueue={{outqueue}}' \
--data-urlencode 'destination={{destination}}'
JavaScript
const myHeaders = new Headers();
myHeaders.append("Authorization", "Basic {{Token}}");
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");

const urlencoded = new URLSearchParams();
urlencoded.append("callerid", "{{callerid}}");
urlencoded.append("agent", "{{agent}}");
urlencoded.append("phone", "{{phone}}");
urlencoded.append("tech", "SIP");
urlencoded.append("context", "{{context}}");
urlencoded.append("outqueue", "{{outqueue}}");
urlencoded.append("destination", "{{destination}}");

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: urlencoded,
  redirect: "follow"
};

fetch("https://{{instance}}.ucontactcloud.com/Integra/resources/Agents/AgentCall", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
JQuery
var settings = {
  "url": "https://{{instance}}.ucontactcloud.com/Integra/resources/Agents/AgentCall",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Authorization": "Basic {{Token}}",
    "Content-Type": "application/x-www-form-urlencoded"
  },
  "data": {
    "callerid": "{{callerid}}",
    "agent": "{{agent}}",
    "phone": "{{phone}}",
    "tech": "SIP",
    "context": "{{context}}",
    "outqueue": "{{outqueue}}",
    "destination": "{{destination}}"
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
C#
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://{{instance}}.ucontactcloud.com/Integra/resources/Agents/AgentCall");
request.Headers.Add("Authorization", "Basic {{Token}}");
var collection = new List<KeyValuePair<string, string>>();
collection.Add(new("callerid", "{{callerid}}"));
collection.Add(new("agent", "{{agent}}"));
collection.Add(new("phone", "{{phone}}"));
collection.Add(new("tech", "SIP"));
collection.Add(new("context", "{{context}}"));
collection.Add(new("outqueue", "{{outqueue}}"));
collection.Add(new("destination", "{{destination}}"));
var content = new FormUrlEncodedContent(collection);
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Java
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "callerid={{callerid}}&agent={{agent}}&phone={{phone}}&tech=SIP&context={{context}}&outqueue={{outqueue}}&destination={{destination}}");
Request request = new Request.Builder()
  .url("https://{{instance}}.ucontactcloud.com/Integra/resources/Agents/AgentCall")
  .method("POST", body)
  .addHeader("Authorization", "Basic {{Token}}")
  .addHeader("Content-Type", "application/x-www-form-urlencoded")
  .build();
Response response = client.newCall(request).execute();
Python
import http.client

conn = http.client.HTTPSConnection("{{instance}}.ucontactcloud.com")
payload = 'callerid={{callerid}}&agent={{agent}}&phone={{phone}}&tech=SIP&context={{context}}&outqueue={{outqueue}}&destination={{destination}}'
headers = {
  'Authorization': 'Basic {{Token}}',
  'Content-Type': 'application/x-www-form-urlencoded'
}
conn.request("POST", "/Integra/resources/Agents/AgentCall", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))




HTTP Response

LasResponses respuestasin enwhich las que se obtuboan error poroccurred partedue deto losthe datosdata enviadossent porwill logenerally generalbe seránreturned entregadoswith con codigoan HTTP code 200 conand una "0"'0' enin elthe bodyresponse debody; latherefore, respuesta,caution porshould lobe tantoexercised haywhen quevalidating tenerby cuidado al validar por elthe HTTP Code Response.

LaThe respuestasuccessful exitosaresponse seráwill unbe a GUID comoas identificadorthe decall laidentifier; llamada;this condata estecan datobe seused podránfor realizarfuture futurasactions acciones mediantethrough APIs.

RespuestaSuccessful exitosaresponse.

8cf8570e-60e7-44ed-b799-3baab211b04d

RespuestaError de errorresponse.

0