Picture of s.taras
Registered 5 years 24 days
s.taras Wednesday, 23 September 2020, 04:42 PM
How to get PBX connection credentials to pass to client App
Hello Innovaphone,

How can we get secured credentials for PBX connection from client side. For example, our application use PbxUserTable and PbxSignal API. But on client side we’d like to provide only PbxSignalApi for softphone regestration. If we pass credentials from Pbx application object any user can get access to admin api. Also we do not have this settings, than mean, that we need admins to dublicate them for our application.

Thank you, Taras
Picture of Matthias Schertler (innovaphone)
Moderator Registered 12 years 135 days
Matthias Schertler (innovaphone) Friday, 25 September 2020, 03:40 PM
1 of 1 users consider this post helpful
Re: How to get PBX connection credentials to pass to client App
Hi Taras,

the best way would be to forward the authentication to your app service / instance and calculate the digest there.

There is an example in the SDK docu that shows how this could be done.
Is this helpful?

Matthias
Picture of s.taras
Registered 5 years 24 days
s.taras Friday, 6 November 2020, 03:25 PM
Re: How to get PBX connection credentials to pass to client App
Hi.
It's partially helps me to solve my problem.

Can you please tell me, how can I get PBX address from MyApp or on MyAppService side.
And one more question - how can I add parameters to UserInfo response.

Thank you
Picture of Matthias Schertler (innovaphone)
Moderator Registered 12 years 135 days
Matthias Schertler (innovaphone) Monday, 9 November 2020, 12:50 PM
Re: How to get PBX connection credentials to pass to client App
Hello Taras,

one possibility would be to use the com.innovaphone.client API. The URL of the (first and only) provider is the URL of the myApps client.


Example:

https : // host/PBX0/APPCLIENT/appclient.htm

If you remove everything after PBX0/ and add /APPS/websocket you get the URL to connect to.

https : // host/PBX0/APPS/websocket

I did this before with code like that:

var clientApi = start.consumeApi("com.innovaphone.client");
clientApi.onupdate.attach(function() {
var appWebsocketUrl = clientApi.model["@client"].url.split("/APPCLIENT/")[0] + "/APPS/websocket";
console.log("url=" + appWebsocketUrl);
});



With the UserInfo and the parameters I'm not sure what message you mean. Can you please explain?

BR
Matthias
Picture of Niko 1071
Registered 11 years 359 days
Niko 1071 Tuesday, 12 January 2021, 09:01 AM
Re: How to get PBX connection credentials to pass to client App
Hi Matthias,

that works on browserbased myApps client - thx
What is the way like for myApps installer ? because our app is running in browser well but if i start this in launcher i see message WEBSOCKET ERROR

THX !
br
Niko
Picture of Niko 1071
Registered 11 years 359 days
Niko 1071 Monday, 25 January 2021, 05:33 PM
Re: How to get PBX connection credentials to pass to client App
Hi Matthias,

when can we expect a reaction here ? We are stuck and can't get any further because unsee app in launcher can't find its way to app manager (WEBSOCKET_ERROR).

In the browser everything is great.

We need urgent support please!

Danke

Niko
Picture of Daniel Deterding (innovaphone)
Moderator Registered 15 years 121 days
Daniel Deterding (innovaphone) Tuesday, 26 January 2021, 06:29 AM
Re: How to get PBX connection credentials to pass to client App
Hi Niko,

can you show how you build the websocket URL inside javascript which you pass to Appwebsocket and also post the browser console trace with the complete URL (you can rightclick inside myApps and click "investigate" to open the browser console there)?

Greetings,
Daniel
Picture of Niko 1071
Registered 11 years 359 days
Niko 1071 Tuesday, 26 January 2021, 10:08 AM
Re: How to get PBX connection credentials to pass to client App
Hi Daniel,

thx for replay.
Attached the javascript code .. i would like to send you the console log via email (support@) because there are to much information to post it public .. and if i remove them all i thik you will not be able to follow the code .. ok ?

Best Regards
Niko
myApps_WS_Config.txt
Picture of Daniel Deterding (innovaphone)
Moderator Registered 15 years 121 days
Daniel Deterding (innovaphone) Tuesday, 26 January 2021, 11:35 AM
Re: How to get PBX connection credentials to pass to client App
Hi Niko,

you have a bit too much logic in creating the URL.
Basically you must simply replace the APPCLIENT with APPS/websocket, so that your URL (in the myApps windows client) looks e.g. like this:
wss://localhost:10008/appproxy/ext/your-pbx-dns/PBX0/APPS/websocket

In the browser it should be like this:
wss://your-pbx-dns/PBX0/APPS/websocket

There is no need to identify the localhost case in your javascript (btw. this could be also 127.0.0.1 on some systems ...) as the websocket request should be tunneled through the appproxy running in the client (certificate stuff etc.).

Greetings,
Daniel
Picture of Niko 1071
Registered 11 years 359 days
Niko 1071 Wednesday, 27 January 2021, 04:00 PM
Re: How to get PBX connection credentials to pass to client App
Hi Daniel,

thanks for the hint
our solution now looks like this:

Byon.clientApi = start.consumeApi("com.innovaphone.client");
Byon.pbxUrl = Byon.pbxUrl || null;
Byon.app = Byon.app || _app;
Byon.connectionInfo = Byon.connectionInfo || _connectionInfo;
Byon.clientApi.onupdate.attach(function () {
var url = Byon.clientApi.model["@client"].url;
Byon.pbxUrl = "wss://" + new URL(url).host;
if (url.indexOf('localhost') > -1 || url.indexOf('127.0.0.1') > -1) {
var appUrl = url.split("/PBX0/")[0];
const urlObject = new URL(appUrl);
const wsUrl = "ws://" + urlObject.host + urlObject.pathname;
Byon.pbxUrl = wsUrl;
}
doStart();
});


What Do you think, meaningful ?

Best Regards
Niko

Picture of Daniel Deterding (innovaphone)
Moderator Registered 15 years 121 days
Daniel Deterding (innovaphone) Thursday, 28 January 2021, 07:39 AM
Re: How to get PBX connection credentials to pass to client App
Hi Niko,

why do you still parse for localhost? It should be much easier and independent where your app actually runs:

var url = Byon.clientApi.model["@client"].url;
url = url.split("/APPCLIENT/")[0] + "/APPS/websocket";
url = "ws" + url.substring(4); // as url must always start with http and like this, you'll use either ws or wss

That's all for all usecases if I do not oversee something.

Greetings,
Daniel
Picture of Niko 1071
Registered 11 years 359 days
Niko 1071 Friday, 29 January 2021, 05:51 PM
Re: How to get PBX connection credentials to pass to client App

Hi Daniel,

greate that works, thx !

Next Problem ist now apps runs not on smartphone (iOS) is there something different in connection ?


Greetings,
niko
Picture of Matthias Schertler (innovaphone)
Moderator Registered 12 years 135 days
Matthias Schertler (innovaphone) Monday, 1 February 2021, 09:00 AM
Re: How to get PBX connection credentials to pass to client App
In general it should be the same on iOS. But sometimes there are slight differences between browsers.

I'd recommend to open your app in the Safari Browser and use the Developer Tools of Safari to find out what is going wrong.

BR
Matthias
Picture of Niko 1071
Registered 11 years 359 days
Niko 1071 Wednesday, 3 February 2021, 09:29 AM
Re: How to get PBX connection credentials to pass to client App
Hi Matthias,

in Safari Browser on same iOS device it works, in myApps on this device not ?!
How i can debugg what happens in myApps on iOS Smartphone ?

BR
Niko
Picture of Niko 1071
Registered 11 years 359 days
Niko 1071 Thursday, 11 February 2021, 02:13 PM
Re: How to get PBX connection credentials to pass to client App
Hallo,

wie können wir hier weiter machen ?!?

Danke
Viele Grüße
Niko
Picture of Matthias Schertler (innovaphone)
Moderator Registered 12 years 135 days
Matthias Schertler (innovaphone) Monday, 22 March 2021, 11:13 PM
Re: How to get PBX connection credentials to pass to client App
You could activate browser traces in myApps iOS and download the trace.
Maybe it shows the problem.

BR
Matthias
Picture of Niko 1071
Registered 11 years 359 days
Niko 1071 Friday, 26 March 2021, 04:43 PM
Re: How to get PBX connection credentials to pass to client App
Hi Matthias,

do we need only "browser" traces ?
i have tried it but didn't see any error Messages
what i have exactly to look for ?

BR
Niko
← You can define your color theme preference here