Picture of Anton
Registered 5 years 174 days
Anton Monday, 8 June 2020, 01:49 PM
Programmatically detection of connected PBX
Hello, Is there a way to get the connected PBX IP-Address for a websocket connection? Right now I'm giving the user the oppertunity to set the PBX IP himself. A way of automatic detection or drop-down list of available PBX, which the user could choose from, would be more elegant. Regards, Anton
Picture of Marc Schodermayr (innovaphone)
Moderator Registered 9 years 259 days
Marc Schodermayr (innovaphone) Monday, 8 June 2020, 02:13 PM
Re: Programmatically detection of connected PBX
May I ask for what scenario you will need that? Because generally the PBX will connect to your service and there you can use the name of the PBX to accept the connection only for the desiered one. For that case there is no need to know the IP address. The name is something you need to define in the settings of your app. The calendar is an example of how that works. There you can give the name of the master PBX the calendar will accept connections from. All other PBX connections will be denied.

You can check that in the AppWebsocketMessage() function. When connected, you will get an PbxInfo message. The JSON for that message will have a "pbx" property which holds the name of the PBX connected. If the name is the same as the configured one, everything is fine. If not, close the connection by calling AppWebsocketClose(). (This are functions from the AppWebsocket class).
Picture of Anton
Registered 5 years 174 days
Anton Monday, 8 June 2020, 03:17 PM
Re: Programmatically detection of connected PBX
Hi Marc,

I have build an App, which is using the PbxAdminApi.
It's just an early sampleapp to get into the SDK functionallities.

Basically what the App is doing.
-Connecting with the PBX via wss (hardcoded IP in the code)
-retrieving all userObjects // mt: "SearchUsers"
-setting a diversion for a selected user by inputing a number

I'm well aware, that this is already available. Like I said the main purpose is to get familiar with the SDK and V13 Apps in general.

So is there another way to connect with the PBX which I havent found?
Picture of Marc Schodermayr (innovaphone)
Moderator Registered 9 years 259 days
Marc Schodermayr (innovaphone) Monday, 8 June 2020, 03:50 PM
Re: Programmatically detection of connected PBX
Well, depends on. Do you want to connect to the PBX via your AppService (C++ side) oder via the browser (JavaScript side)?
Picture of Anton
Registered 5 years 174 days
Anton Monday, 8 June 2020, 04:01 PM
Re: Programmatically detection of connected PBX
At first I thought it would be simpler via the browser.

But do you maybe have an example of how to connect with the PBX (PbxAdminApi) via the C++?

With which way is it possible without hardcoding or asking for the IP?
Picture of Marc Schodermayr (innovaphone)
Moderator Registered 9 years 259 days
Marc Schodermayr (innovaphone) Monday, 8 June 2020, 05:34 PM
Re: Programmatically detection of connected PBX
Well, for the C++ side, you have two options: using the IWebsocketClient interface to open a websocket connection or using the existing AppWebsocket connection you get when the PBX connected to your app.

If you want to let the user configure the PBX to connect to (by giving the IP address or the name of the PBX), you can use the config class together with the config JavaScript "class". So on the C++ side, you make a ConfigContext instance and add ConfigItems to it. The JavaScript side will automatically mirrow the names of the config fields so that you can ask the user in your JavaScript UI for the IP address or the name of the PBX and write it to the config. You than can use the value the user has given on the C++ side. It will also be stored to the database of your service, too. However, for a configuration like this it is recommended to create a PBX manager plugin (because there you can let the user create a PBX object for the app as well as offer a configuration UI like our apps do).
Picture of Anton
Registered 5 years 174 days
Anton Tuesday, 9 June 2020, 07:49 AM
Re: Programmatically detection of connected PBX
Thank you very much, I will try this out.
Andreas Fink
Moderator Registered 13 years 110 days
Andreas Fink (innovaphone) Tuesday, 9 June 2020, 04:44 PM in response to Anton
Re: Programmatically detection of connected PBX
> With which way is it possible without hardcoding or asking for the IP?

It seems like you are looking for the way to perform a discovery in a local network, to find a PBX?
Picture of Anton
Registered 5 years 174 days
Anton Wednesday, 10 June 2020, 08:28 AM
Re: Programmatically detection of connected PBX
Primarily I want to get a connection to the PBX on which the app is running without setting the IP by hand. I think in most cases this would be the PBX where all the userobjects are stored.

But a discovery of all available PBX in the local network would be interesting, too. Is there something in the SDK documentation, which I haven't found or do you maybe have an example for that?
← You can define your color theme preference here