API CLICK2CALLEXTENSION ENGLISH
API DESCRIPTION
The CLIC2CALLEXTENSION API has 3 services which allow us to start a session, call a specific number or extension and close the session.
Alert
To use the api all browsers must have an id, you can use the following examples:
Chrome: You can Enable the “gcm” in the manifest.json to be able to get the instanceID in the JavaScript file. Example:
Manifest.json:
"permissions": ["storage", "activeTab", "scripting", "gcm"],
In the JavaScript file:
chrome.instanceID.getID(idBrowser=>{
login(idBrowser);
});
Firefox: In Firefox you can use local storage to create a random id that identifies that browser, example:
In the JavaScript file:
browser.storage.local.get('idBrowser', function(items) {
console.log("entro"+items)
var idBrowser = items.idBrowser;
console.log(items)
if (idBrowser != null) {
login(idBrowser);
} else {
idBrowser = getRandomToken();
browser.storage.local.set({idBrowser: idBrowser}, function() {
login(idBrowser);
});
}
});
function getRandomToken() {
var randomPool = new Uint8Array(32);
crypto.getRandomValues(randomPool);
var hex = '';
for (var i = 0; i < randomPool.length; ++i) {
hex += randomPool[i].toString(16);
}
return hex;
}
POSSIBLE FAULTS
Chrome: There is a possibility that Google removes instanceID from the Chrome api, this may cause a failure in the processing of the information.
API URL: https://cc7ktmsk9a.execute-api.us-east-1.amazonaws.com/master/
Login:
EndPoint:
/loginExtensionClick2Call
Método: POST
email: The email the user registered in Wekall.
password: The password of the user registered in Wekall.
idBrowser: The browser id.
{
"idBrowser":"f3PH9oP4SBA",
"email":"ejemplo@ejemplo.com",
"password":"ContraseñaEjemplo"
}
Requests:
STATUS: 200
Token: Token de sesión.
STATUS: 400
STATUS: 400
STATUS: 500
STATUS: 500
STATUS: 404
STATUS: 404
Realizar Llamada:
EndPoint:
/call/extensionClick2Call
Método: POST
destination: The destination number of the call.
idBrowser: The browser id.
HEADERS:
authorization: Session token (Token previously returned when logging in).
Requests:
STATUS: 200
STATUS: 500
STATUS: 400
STATUS: 400
STATUS: 401
STATUS: 500
Cerrar Sesión:
EndPoint:
/logout/extensionClick2Call/
Método: POST
idBrowser: The browser id
HEADERS:
authorization: Session token (Token previously returned when logging in).
Requests:
STATUS: 200
STATUS: 404
STATUS: 404
STATUS: 401
STATUS: 500
When generating a call from the plugin and not having the softphone registered to any account, the destination call is generated.
When generating a call from the plugin and the person of origin hangs up his own call, the call is still generated.