Re: Agenda SDK Dialog: custom softphone app connection to pbx as User -> how to decrypt user password?
As follow up from the SDK dialog, I want to sum up what is needed to connect as a device App to a user device as for example a custom softphone:
- App Object with URL to the AppService
- Set Websocket checkmark. so that the App object connects to the AppService and is sending the AppInfo request. You should respond to the with AppInfoResult which should include a deviceapp:"softphone" property. This is done within the AppWebsocketAppInfo(const char * app, class json_io & msg, word base) function call on a App Service on our AP
- Set App Object to hidden, so that the App does not appear, when the App Service is not available
- Grant access to PbxSignal in the App object
- Configure a device for the user, with unique hw-id, name which is displayed and app which refers to the App Object
The you should be able to register to the device with the following JS code:
function SoftphoneLogin(start) {
class Elm extends HTMLElement {
constructor(content) {
super();
this.setAttribute("style", "display:block");
if (content) this.innerText = content;
}
}
customElements.define("innovaphone-elm", Elm);
var app = new innovaphone.appwebsocket.Connection("wss://172.16.64.50/PBX0/APPS/websocket", start.name);
document.body.appendChild(new Elm("started"));
app.Xonconnected= function () {
document.body.appendChild(new Elm("connected"));
var hw = app.obj();
if (hw.startsWith("dev:")) hw = hw.substring(4);
app.send({ mt: "Register", api: "PbxSignal", hw: hw });
}
app.Xonmessage= function (obj) {
if (obj.mt == "RegisterResult") document.body.appendChild(new Elm("registered " + obj.addr));
}
}
find attached the PBX config used for this sample as XML export. There is a little bit more configured then needed for this sample
pbx.xml