Picture of iqbal
Registered 5 years 229 days
iqbal Wednesday, 16 June 2021, 03:26 PM
Agenda SDK Dialog: custom softphone app connection to pbx as User -> how to decrypt user password?
hi
Befor i go forward, this topic is related to thread:
https://forum.innovaphone.com/moodle2/mod/forum/discuss.php?d=26272#p73830

i am in myApps environment and on our custom Softphone trying to login to pbx as user as specified in thread.
i can connect to pbx as User but i am sending plain user Password to webservice on cpp side and generating Hash with it.
Question is how can i get Password of user in cpp code or is there other way for that?
i also tried using replicated users table but password there are encrypted. if that is solution then how could i possibly decrypt user password and which encryption key are used.

BR
Iqbal
2013
Moderator Registered 16 years 22 days
Guntram Diehl (innovaphone) Thursday, 17 June 2021, 08:43 AM
Re: Agenda SDK Dialog: custom softphone app connection to pbx as User -> how to decrypt user password?
The user passwords are stored on the PBX encrypted with the PBX key. The PBX key and the PBX pwd are stored in the _ADMIN_. PBX pwd is encrypted with PBX key and vice versa. The encypted PBX pwd and PBX key can be read by and PbxAdmin Operation.

So to decrypt a user password, you need the PBX key and for this you have to have the clear text PBX pwd to decrypt it first.

But if your App is running in the myApps environment this is not the right way to go I think. The client is already logged in to the PBX. Using this session, you should get an login to the user object.

To do this you can use the AppWebsocket lib to connect to URL wss://<PBX>/PBX0/APPS/websocket to your user. The AppWbsocket lib should obtain a login from the client.

I will try to make a small sample to verify and demonstrate this. We can have a look at it in the SDK Dialog
2013
Moderator Registered 16 years 22 days
Guntram Diehl (innovaphone) Friday, 18 June 2021, 11:03 AM in response to iqbal
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
← You can define your color theme preference here