Picture of Wim 4127
Registered 6 years 309 days
Wim 4127 Tuesday, 2 November 2021, 07:48 PM
How to handle authentication for HTTP cmd requests to the PBX from within C++ app
Hi,

we are writing a C++ app that must set the recall timeout and response timeout that is configured in the PBX (the values you can find on the old UI when you go to the PBX/Config tab/general page).

As far as I know, there is no V13 API available to set/get these values in C++. Is this correct? Of there is an API available, please let me know the API and maybe provide an example.

Assuming there isn't a V13 API available, these values can be set using the HTTP cmd interface of the PBX. This would make it possible to use the http_client library in C++ to set these values. However, this brings another problem into the game: how to authenticate in this case. If we use a tool like postman, we use digest authentication with username and password. However, in our C++ app we do not have these values available as far as I know. So how doe we authenticate then? Do we have to store username and password in the config of the application, or, is there a better way to authenticate these HTTP requests so the PBX accepts them? Please advise on how to achieve this from within the C++ app.
Andreas Fink
Moderator Registered 13 years 109 days
Andreas Fink (innovaphone) Wednesday, 3 November 2021, 06:40 PM
Re: How to handle authentication for HTTP cmd requests to the PBX from within C++ app
Hello Wim,

better approach for this would be usage of the Devices API.

The Devices App service maintains a WebSocket Sysclient connection from a Gateway running PBX.You can use this connection to send commands to the specific Gateways.

Please take a look on the chapter "Communication with connected Sysclients" in the /sdk/13r2/doc/service/Devices.htm document (located in he folder with innovaphone SDK on your developer PC).

Not all messages are documented, so you have to reverse engineer required messages from Devices App (see chapter "FurtherMessages").

In case you still miss some API info required for your solution, feel free to ask here.

Best Regards
Andreas Fink
Picture of Wim 4127
Registered 6 years 309 days
Wim 4127 Wednesday, 3 November 2021, 07:34 PM
Re: How to handle authentication for HTTP cmd requests to the PBX from within C++ app
With all do respect, but, the documentation doesn't help me, or probably I didn't understand it. I don't understand how the documentation of the devices.htm will help me to authenticate when calling the PBX HTTP cmd ... so please provide more information where and how this can be done, or maybe a useful, working and complete example of how this should be done then, with the documentation that a developer might expect from a development platform. The goal of an API and documentation is that we can develop applications on your platform and spent time on implementing business logic that brings value to the customer (for which he pays), not for trying to figure out and reverse engineer your platform
Picture of Wim 4127
Registered 6 years 309 days
Wim 4127 Wednesday, 3 November 2021, 07:34 PM in response to Andreas Fink (innovaphone)
Re: How to handle authentication for HTTP cmd requests to the PBX from within C++ app
With all do respect, but, the documentation doesn't help me, or probably I didn't understand it. I don't understand how the documentation of the devices.htm will help me to authenticate when calling the PBX HTTP cmd ... so please provide more information where and how this can be done, or maybe a useful, working and complete example of how this should be done then, with the documentation that a developer might expect from a development platform. The goal of an API and documentation is that we can develop applications on your platform and spent time on implementing business logic that brings value to the customer (for which he pays), not for trying to figure out and reverse engineer your platform
Picture of Daniel Deterding (innovaphone)
Moderator Registered 15 years 178 days
Daniel Deterding (innovaphone) Thursday, 4 November 2021, 08:28 AM
Re: How to handle authentication for HTTP cmd requests to the PBX from within C++ app
Hi Wim,
  • all your devices should be connected to your Devices App and these are so called "sysclients"
  • you can now use the com.innovaphone.devices API to retrieve connected devices and build HTTP URLs to send commands: https://sdk.innovaphone.com/13r2/doc/service/Devices.htm
  • these commands do not need to be authenticated anymore, as you use a unique key inside the request which belongs to your websocket connection, see https://sdk.innovaphone.com/13r2/doc/service/Devices.htm#SysclientComm
  • to use the API you must use the services mechanism, which is described here: https://sdk.innovaphone.com/13r2/doc/appwebsocket/Services.htm
I extended the documentation with the GetDomains, GetDevices and GetFilteredDevices requests so that you are able to search e.g. all Gateways|VAs with an active PBX inside a domain.

Greetings,
Daniel
Picture of Wim 4127
Registered 6 years 309 days
Wim 4127 Friday, 5 November 2021, 12:16 PM
Re: How to handle authentication for HTTP cmd requests to the PBX from within C++ app
Is it possible to get a simple sample application for an app v13r2 that performs all of the above that you mention and that executes one http cmd sent (e.g. show all users) to the PBX when I click a button in UI of that application. I guess for you that is very simple, and, many people can learn from it. It would certainly clarify a lot of the APIs for all the developers that work with the V13 platform, so it's definitely a good investment of your time I think (and saves all the others some time in figuring this out)
Andreas Fink
Moderator Registered 13 years 109 days
Andreas Fink (innovaphone) Friday, 5 November 2021, 01:36 PM
Re: How to handle authentication for HTTP cmd requests to the PBX from within C++ app
I will create a tutorial for the scenario with access to services, which should cover your questions. This could take few weeks, for JS and C++.

I can share samples here, prior releasing it in the SDK documentation.

Best Regards
Andreas Fink

Picture of Wim 4127
Registered 6 years 309 days
Wim 4127 Friday, 5 November 2021, 02:19 PM
Re: How to handle authentication for HTTP cmd requests to the PBX from within C++ app
Please share them here or just send them to my email address wim.van.houts at xqting.be if that would be more suitable...
← You can define your color theme preference here