Picture of Sascha
Registered 5 years 338 days
Sascha Friday, 7 May 2021, 05:19 PM
How to login the right way to use SubscribeProfile
Hello everyone,

I have a little problem with the "SubscribeProfile" events from the "PbxApi".

I do a login to the app object over this way.
{
"mt":"AppLogin",
"app":"...",
"domain":"...",
"sip":"...",
"guid":"...",
"dn":"...",
"digest":"...",
"pbxObj":"dev:..."
}

The "..." are filled with the right Informations which are needed to create
the digest and to tell the IPVA which user should be used.

When I try to get the favorites with the "SubscribeProfile" event I get this
respone from the IPVA.
{"api":"PbxApi","mt":"SubscribeProfileResult","profiles":[]}

The user which is defined has a profile set for it's object. I will only get the profile informations when I set the profile for the app object.

Why is that is there something missing?

If you need more informations please ask me about them.

Regards,
Sascha
Picture of Sascha
Registered 5 years 338 days
Sascha Wednesday, 12 May 2021, 07:44 AM
Re: How to login the right way to use SubscribeProfile
Can anybody help here?

I have tried everything but I can't figure out how to get the right data from the ipva. I even have tried to use the softphone app from innovaphone to get the right favorites but even here I get nothing from the user object.

I have also tried to send the info object when I do the login on the websocket but even this has not helped to get the right data.

Regards,
Sascha
2013
Moderator Registered 16 years 72 days
Guntram Diehl (innovaphone) Wednesday, 12 May 2021, 08:53 AM in response to Sascha
Re: How to login the right way to use SubscribeProfile
Hi Sasha,

sorry this is the way this function is meant to work. It is a function which is not used to subscribe to any info of another object, but only the object you are logging in to. So if you login to the user directly you can use this.

Guntram
Picture of Sascha
Registered 5 years 338 days
Sascha Wednesday, 12 May 2021, 09:53 AM
Re: How to login the right way to use SubscribeProfile
Hi Guntram,

thank you.

Is there an other way to login as a user over the websocket?

I use this way at the moment to do a login to the app object with a specific user. I have added a Screenshot with the events which I send to the IPVA.


Websocket_Events.png

Picture of Sascha
Registered 5 years 338 days
Sascha Wednesday, 12 May 2021, 10:01 AM
Re: How to login the right way to use SubscribeProfile
We have also a Wireshark trace of the communication. What does the debug message other user mean?

This information is shown in the wireshark directly after the successfull app login.
wireshark.png

Picture of Sascha
Registered 5 years 338 days
Sascha Monday, 17 May 2021, 07:22 AM in response to Guntram Diehl (innovaphone)
Re: How to login the right way to use SubscribeProfile
Can you please provide me with an example how to login a user directly.
Picture of Daniel Deterding (innovaphone)
Moderator Registered 15 years 178 days
Daniel Deterding (innovaphone) Thursday, 20 May 2021, 09:28 AM
Re: How to login the right way to use SubscribeProfile
Hi Sascha,

we're currently discussing your issue and need further information:

What is your usecase to use PbxApi together with SubscribeProfile?
Is your App started within the myApps client by PBX users or is your application not running within the myApps client context?

Greetings,
Daniel

Picture of Sascha
Registered 5 years 338 days
Sascha Thursday, 20 May 2021, 11:29 AM
Re: How to login the right way to use SubscribeProfile
Hi Daniel,

we want to get and set the favorites of the user. That is the main reason why we want to use the PbxApi with the SubscribeProfile event.

We are not in the myApps environment. I have created a React App which opens a websocket connection to the PBX and sends the informations which I have shown in the screenshot in this thread. But I don't get the right informations from the websocket even if I use the same authentication which is used in your softphone in myApps.

I hope this helps. If you need more informations please ask.

Greetings,
Sascha
Picture of Sascha
Registered 5 years 338 days
Sascha Friday, 21 May 2021, 09:05 AM in response to Daniel Deterding (innovaphone)
Re: How to login the right way to use SubscribeProfile
Hi Daniel,

I have also tried to open a connection to the appclient websocket and done an successful authentication. But I still won't get the right data from the SubscribeProfile Event. I have used these events for the login: http://sdk.innovaphone.com/doc/appwebsocket/myApps.htm

I'am at an end with the try and error tests I could do. I don't know why I won't get the informations from the user but I will still get the profile from the app object.

Is there some hidden information which is not described in your documentation? Maybe it is the info object which is send by the softphone app?

Greetings,
Sascha
Picture of Sascha
Registered 5 years 338 days
Sascha Wednesday, 2 June 2021, 07:23 AM in response to Daniel Deterding (innovaphone)
Re: How to login the right way to use SubscribeProfile
Is there an update to this available?
Do you need more informations?
Picture of Sascha
Registered 5 years 338 days
Sascha Tuesday, 8 June 2021, 07:35 AM in response to Daniel Deterding (innovaphone)
Re: How to login the right way to use SubscribeProfile
Is there any update on this?
Andreas Fink
Moderator Registered 13 years 109 days
Andreas Fink (innovaphone) Tuesday, 8 June 2021, 05:39 PM in response to Sascha
Re: How to login the right way to use SubscribeProfile
Hello Sascha,

we need to clarify in which correct context the SubscribeProfile should be used in your case.

If I understand it correctly, you have an App Service running on a server, that uses an AppLogin towards the PBX on a /PBX0/APPS/websocket connection (usually it is another way around, PBX connects to an URL of an App Service, but this way works too).

Which password is used to calculate the digest in this case?

Probably, from the view of the PBX, the context of this WebSocket connection is the App Object.

On this WebSocket you call the SubscribeProfile function, in the context of an App Service connected to the PBX.

Running SubscribeProfile requires an active myApps Login session (usually already done by the myApps client, so an App running in the context of a myApp client do not have to care about it). In your use case it would require to perform a Login on behalf of a PBX User, which is not really suitable, if you have no user credentials for this PBX User.

Probably you could get and set favourites of a PBX User just by replicating all Users via PbxTableUsers API instead? This would be more suitable, in case you are managing them from a single server application.

It would be great to have a complete overview of your scenario to understand, how to solve the issue.

Best Regards
Andreas Fink
Picture of Sascha
Registered 5 years 338 days
Sascha Wednesday, 9 June 2021, 09:31 AM
Re: How to login the right way to use SubscribeProfile
Hi Andreas,

that are questions which I can work with and not only silence wink.

Here is the description on what the app does.

We are creating an app which is not hosted on your app manager plattform it is a standalone app which will be used in Microsoft Teams. This app will also not be called in the myapps environment. This app opens all required websocket connections to the pbx and also the app manager in some cases. This application is only a client side javascript application which is written in React and Typescript. So we do not store anything in the application it self. Everything should be stored on the pbx to which we have access over the websocket connection.

For this app we have only the app object on the pbx and no extra running service on the app manager. We open a websocket connection to the url you have mentioned /PBX0/APPS/websocket. Here we do the app login with all required informations we need. You can see what I do a little bit further up in the thread.

Now the SubscribeProfile does strange things. If you have no profile configured on the app object it won't work. You will get an empty json array and you can't add something to the profile. If you have configured an profile you will get this profile. I have not checked if I can add something to the profile. But since we want to store these informations on the user object that is only an observation I had when I started to tinker around with it.

Now the really strange part. I have thought about the myapps login session and that it would be required but it won't work even if I create an myapps login session before I send the app login and then call SubscribeProfile. Since I do not know how you create the session id I had to use the login type user because I have access to these informations.

I have looked at the PbxTableUsers API but I can't see the entries for the profile in your sdk documentation. Are you sure I can use this API?

I want to use something like an on behalf of logic. I would like to make an app login with the user data attached to the login so that the app object would know that an event like SubscribeProfile should be used on behalf of the given user and not for the app object it self.

I hope this helps you.

Regards,
Sascha
Andreas Fink
Moderator Registered 13 years 109 days
Andreas Fink (innovaphone) Wednesday, 9 June 2021, 01:05 PM
Re: How to login the right way to use SubscribeProfile
Hello Sascha,

as I have expected, you are rebuilding a myApps App, but without myApps environment, so you try to talk to the PBX in the manner of an App Service.

This approach is not supported by design. This is the reason for all the strange things you describe.

You have to recreate complete myApps logic:
  • Login on behalf of a PBX User (using user object credentials and maintaining a session, you have to store it in the clients local DOM storage for example)
  • AppLogin on behalf of a PBX User (easy part, you will get a list of Apps accessible by the User, after successful Login)
  • Using PbxApi on a WebSocket connection to the PBX, where Login was made
You have to study and reimplement/integrate JavaScript libraries for Apps, especially lib1 and appwebsocket ( https://sdk.innovaphone.com/13r1/doc/reference.htm#JS_library ) and take myApps behaviour as example in this matter (monitor WebSocket messages, their payload AND! destination).

Also following sample code uses the user centric approach to connect to Devices App, so you can take the implementation logic from here (ignore the added complexity by the "The Asynchronous Programming Model" chapter, as it is required for PHP environment, but is already provided by JS):

http://wiki.innovaphone.com/index.php?title=Reference13r1:Concept_Talking_to_the_v13_Application_Platform_using_PHP

> it won't work even if I create an myapps login session
> before I send the app login

Could you post complete communication of this attempt? Which credentials are used to calculate digest?

Best Regards
Andreas
Picture of Sascha
Registered 5 years 338 days
Sascha Wednesday, 9 June 2021, 01:11 PM
Re: How to login the right way to use SubscribeProfile
I have to recreate this and send you an image of the messages which I got. I post again as soon as I have it.
Picture of Sascha
Registered 5 years 338 days
Sascha Wednesday, 9 June 2021, 02:54 PM in response to Andreas Fink (innovaphone)
Re: How to login the right way to use SubscribeProfile
I have now the myapps login. You can see the communication in the screenshot.

I open a websocket connection to the pbx with this endpoint /PBX0/APPCLIENT/websocket

To create the digest I have used these values like it is described in the documentation for the myapps login.

["innovaphoneAppClient", "user", "byon-int-v13.de", "Sascha Waitz", "password of the extension", "d5250d1a1e66a553", "2f61fcf22f61fccb"]

I can also call AppGetLogin and I will get an reply but I can't use these informations for an successful login at the app it self.

But how do I get this point working?
>Using PbxApi on a WebSocket connection to the PBX, where Login was made

If I understand it correctly I have to send PbxApi events on this websocket: /PBX0/APPCLIENT/websocket. When I do that I will not get a response form the websocket.

Is there a hidden field which is not mentioned in the documentation?
emulated_myapps_login.png

Picture of Sascha
Registered 5 years 338 days
Sascha Thursday, 10 June 2021, 09:55 AM in response to Andreas Fink (innovaphone)
Re: How to login the right way to use SubscribeProfile
I have now changed my login process.

1) I open a connection to /PBX0/APPCLIENT/websocket. I do a login like I have shown you in the screenshot.
2) Then I open a connection to /PBX0/APPS/{appName}/websocket. On this websocket I send the AppChallenge event and with it's result I send a AppGetLogin on the myApps websocket.
3) With the AppGetLoginResult I send the login data I get from this event and so that I have a correct app login like it is done in the myapps client.

AS you can see in the screenshot with the messages of the pbx websocket I still get the from profile.
pbx_app_login.png

Andreas Fink
Moderator Registered 13 years 109 days
Andreas Fink (innovaphone) Thursday, 10 June 2021, 04:34 PM
Re: How to login the right way to use SubscribeProfile
Hello Sascha,

I'm sorry for the delay. This implementation seems to be correct, in the matter of WebSockets and overall flow.

For some reason you are using as pbxObj "byon_softphone_widget" now (in your first example it was the name of a WebRTC endpoint). This is probably the reason, the PBX handles the API requests on this WebSocket in context of the App Object, and not of the User Object.

EDIT: please try to omit the pbxObj parameter completely

EDIT2: for sip parameter it is better to use something like a user part of an emal address (no spaces and special characters)

Best Regards
Andreas Fink

Picture of Sascha
Registered 5 years 338 days
Sascha Friday, 11 June 2021, 07:09 AM
Re: How to login the right way to use SubscribeProfile
Hi Andreas,

sorry for the confusion I have tried so many thing till now that I myself don't know anymore where I send what to the pbx. thoughtful

I will do another try without the pbxObj.

The SIP parameter is exactly what I get from the AppGetLoginResult is there a possibilty that I can also omit this parameter or is it needed?

Regards,
Sascha
Picture of Sascha
Registered 5 years 338 days
Sascha Friday, 11 June 2021, 07:23 AM in response to Andreas Fink (innovaphone)
Re: How to login the right way to use SubscribeProfile
Hi Andreas,

I have for this test changed the login to an email which will be send as the SIP parameter and I have also omited the pbxObj but I still get the wrong informations.

Regards,
Sascha
without_pbxobj_and_sip_as_email.png

2013
Moderator Registered 16 years 72 days
Guntram Diehl (innovaphone) Friday, 11 June 2021, 07:18 AM in response to Sascha
Re: How to login the right way to use SubscribeProfile
Yes if you have the "app" property in the login, this takes precedence and the login is to the App Object, so you don't get the profile of the user.

If you just use "sip", it will work, but you need the credentials of the user, what you, I guess, not want?

I assume, what you would like to do is to login with the credentials of the App Object and do SubscribeProfile for a number of users?

This does not work at the moment, as I have already posted earlier.

We could think about a solution for this in 13r2. For this it would be good, if you could describe the complete idea, what you want to achieve.
Picture of Sascha
Registered 5 years 338 days
Sascha Friday, 11 June 2021, 07:30 AM
Re: How to login the right way to use SubscribeProfile
Hi Guntram,

I can show you the idea we have. I can do that at the community day you have today.

>If you just use "sip", it will work, but you need the credentials of the user,
>what you, I guess, not want?

Normally I would like to prevent that but I have now a service from our portal which gives me these informations. So I can do the login with a user and it's password.

>I assume, what you would like to do is to login with the credentials of the App
>Object and do SubscribeProfile for a number of users?

That is exactly what we want to do. I thought it would work already because you can send the user informations in the applogin. For example it works for the applogin on the app manager. I have used that for the reporting for example and I will get here the call data of the given user.

Regards,
Sascha
Picture of Sascha
Registered 5 years 338 days
Sascha Friday, 11 June 2021, 11:21 AM in response to Guntram Diehl (innovaphone)
Re: How to login the right way to use SubscribeProfile
This method is working I get the right informations now. I have to test if the rest is also working correctly but it seems that this was the solution. I also do not need to ask the user for the password I will create everything in the backend so I don't need to send the password of the user to the frontend. working_app_login.png

2013
Moderator Registered 16 years 72 days
Guntram Diehl (innovaphone) Saturday, 12 June 2021, 12:09 PM in response to Sascha
Re: How to login the right way to use SubscribeProfile
We added a new API PbxImpersonation to address this problem. I will be available in 13r2 beta4. The idea is, that you can log in with your App Service account and then access PbxApi on behalf of a given user. Detailed description will be found in the SDK documentation
2013
Moderator Registered 16 years 72 days
Guntram Diehl (innovaphone) Friday, 18 June 2021, 11:06 AM
Re: How to login the right way to use SubscribeProfile
As discussed in the SDK Dialog, we check if we can merge this back to 13r1
2013
Moderator Registered 16 years 72 days
Guntram Diehl (innovaphone) Friday, 18 June 2021, 01:51 PM
Re: How to login the right way to use SubscribeProfile
Done!
← You can define your color theme preference here