Picture of Alessandro 174
Registered 13 years 97 days
Alessandro 174 Friday, 11 September 2020, 08:07 AM
Direct connection to PBX over WebSocket
Hi
I would like to connect an interface software written in C# direct to the Inno PBX by WebSocket (similar to the old SOAP API).
The purpose are:
- Add/Modify/Delete Users (old Admin)
- Start call from WQ
- Get Call Info/Update from the previous started call

My question, where I can find some documentation about direct WebSocket connection to PBX?
- How the connection URL looks like?
- How the JSON Object looks like for Add/Modify/Delete Users
- ...

Thanks and BR

Alessandro
Picture of Christoph Künkel (innovaphone)
Moderator Registered 15 years 190 days
Christoph Künkel (innovaphone) Friday, 11 September 2020, 09:50 AM
Re: Direct connection to PBX over WebSocket
Hej Alessandro,

You could have a look at the php sample in the Wiki (https://wiki.innovaphone.com/index.php?title=Reference13r1:Concept_Talking_to_the_v13_Application_Platform_using_PHP).

Regards, Chris
Picture of Alessandro 174
Registered 13 years 97 days
Alessandro 174 Friday, 11 September 2020, 02:46 PM
Re: Direct connection to PBX over WebSocket
Hi Christoph, thx for the link.

But I not understood how to proceed with my needs.
This should by the chapter that is interesting for my purpose: https://wiki.innovaphone.com/index.php?title=Reference13r1:Concept_Talking_to_the_v13_Application_Platform_using_PHP#Access_a_PBX_App_service_using_a_PBX_user_login

I have done a small c# app that acts as websocket client and connects to: "ws://pbx_ip-address/PBX0/APPS/websocket"
No error on connection, but nothing happens.
What are the next steps? I assume that I need to authenticate me, is this a basic Auth in the connection ws GET request? Or how I have to authenticate me?

To get this to work, I need to create an "App Object" with URL "http://pbx_ip-address/PBX0/APPS/websocket"? Or I miss understood this step?

And how to read/update/write objects on the pbx? https://sdk.innovaphone.com/doc/appwebsocket/PbxAdminApi.htm#UpdateObject

BR
Alessandro
Picture of Matthias Schertler (innovaphone)
Moderator Registered 12 years 193 days
Matthias Schertler (innovaphone) Friday, 11 September 2020, 03:11 PM in response to Alessandro 174
Re: Direct connection to PBX over WebSocket
Hello Alessandro,

you can also take a look at the following documentation:

Our general websocket protocol, including authentication:

PbxAdminApi to Add/Modify/Delete Users (similar to SOAP):

Call Control (similar to SOAP):

In my optinion, the most controlled way to use that protocols would be to create an App Object on the PBX (with a username and password for your application, and activate the needed APIs there). Then you can connect to that app object (wss://<pbx-host>/PBX0/APPS/websocket) and send the messages described in the documents above.

BR
Matthias

Picture of Alessandro 174
Registered 13 years 97 days
Alessandro 174 Friday, 18 September 2020, 03:24 PM
Re: Direct connection to PBX over WebSocket
Hi Matthias

Thx for you answer and links, now I have made some progress. Login ok, PbxAdmin ok, RCC -> calls not started, here my log:
------
18.09.2020 15:17:32 - Sent:
{"mt":"AppChallenge"}

18.09.2020 15:17:32 - Received:
{"mt":"AppChallengeResult","challenge":"964345d64f156b17"}

18.09.2020 15:17:32 - Sent:
{
"mt": "AppLogin",
"app": "pbxadminapi",
"digest": "54FEA32450EA00E79B63E2F4DC33CD5077E5648C1DF073AD3452B862920FC6BB",
"dn": "",
"domain": "",
"guid": "",
"sip": ""
}

18.09.2020 15:17:33 - Received:
{"mt":"AppLoginResult","ok":true}

18.09.2020 15:17:33 - Sent:
{
"mt": "Initialize",
"api": "RCC",
"src": "7e496568-5d76-4939-bdfd-5a4236c3d76c"
}

18.09.2020 15:17:33 - Received:
{"mt":"UserInfo","api":"RCC","src":"7e496568-5d76-4939-bdfd-5a4236c3d76c","guid":"973b3fd0e909d3118b990090332900bc","cn":"IP232","dn":"Angelo Marra - 1902","h323":"IP232","e164":"1902","node":"root","pbx":"TTS","regs":[{"hw":"IP232-30-00-a9"}],"state":1,"channel":0,"alert":0}

18.09.2020 15:17:33 - Received:
{"mt":"InitializeResult","api":"RCC","src":"7e496568-5d76-4939-bdfd-5a4236c3d76c"}

18.09.2020 15:17:33 - Sent:
{
"mt": "Devices",
"api": "RCC",
"cn": "IP232",
"src": "f6fc25fe-af89-435f-b82b-64776c23f306"
}

18.09.2020 15:17:33 - Received:
{"api":"RCC","src":"f6fc25fe-af89-435f-b82b-64776c23f306","mt":"DevicesResult","devices":[{"hw":"IP232-30-00-a9","text":"IP-Phone"}]}

18.09.2020 15:17:33 - Sent:
{
"mt": "UserInitialize",
"api": "RCC",
"cn": "IP232",
"src": "e36fae36-b7f3-4a69-bc13-f186bc3dcd7a",
"hw": "IP232-30-00-a9"
}

18.09.2020 15:17:33 - Received:
{"api":"RCC","src":"e36fae36-b7f3-4a69-bc13-f186bc3dcd7a","mt":"UserInitializeResult","user":1}

18.09.2020 15:17:33 - Received:
{"api":"RCC","src":"e36fae36-b7f3-4a69-bc13-f186bc3dcd7a","mt":"UserInitializeResult","user":2}

18.09.2020 15:17:33 - Sent:
{
"mt": "UserCall",
"api": "RCC",
"user": 2,
"e164": 1012,
"src": "17ddfaf5-06b9-449a-a83e-61d865100dff"
}

18.09.2020 15:17:33 - Received:
{"api":"RCC","src":"17ddfaf5-06b9-449a-a83e-61d865100dff","mt":"UserCallResult","call":3}

18.09.2020 15:17:33 - Received:
{"mt":"UserInfo","api":"RCC","src":"7e496568-5d76-4939-bdfd-5a4236c3d76c","update":"update","guid":"973b3fd0e909d3118b990090332900bc","cn":"IP232","dn":"Angelo Marra - 1902","h323":"IP232","e164":"1902","node":"root","pbx":"TTS","regs":[{"hw":"IP232-30-00-a9"}],"state":1,"channel":1,"alert":0}

18.09.2020 15:17:33 - Received:
{"mt":"CallInfo","api":"RCC","src":"e36fae36-b7f3-4a69-bc13-f186bc3dcd7a","user":1,"call":4,"state":1,"conf":"be0b5269b3645f0161690090332900bc","peer":{"e164":"","h323":""},"msg":"x-setup"}

18.09.2020 15:17:33 - Received:
{"mt":"CallInfo","api":"RCC","src":"e36fae36-b7f3-4a69-bc13-f186bc3dcd7a","user":2,"call":3,"state":1,"conf":"be0b5269b3645f0161690090332900bc","peer":{"e164":"","h323":""},"msg":"x-setup"}
-----
What I not understand is why it not works? What is wrong?
Here the syslog:
-----
20200918-151729 PBX0 9 IP232(1902:IP232) ()
20200918-151729 PBX0 11 IP232(1902:IP232) setup-> ()
----
Thanks
Picture of Daniel Deterding (innovaphone)
Moderator Registered 15 years 179 days
Daniel Deterding (innovaphone) Friday, 18 September 2020, 03:29 PM
Re: Direct connection to PBX over WebSocket
Hi Alessandro,

e164 is a string inside the UserCall message, not a number.
Try this:

{
"mt": "UserCall",
"api": "RCC",
"user": 2,
"e164": "1012",
"src": "17ddfaf5-06b9-449a-a83e-61d865100dff"
}

Greetings,
Daniel
Picture of Alessandro 174
Registered 13 years 97 days
Alessandro 174 Friday, 18 September 2020, 03:36 PM
Re: Direct connection to PBX over WebSocket
Hi Daniel

Thx for the answer, you made my day, now it works smile
One more question, why the "UserInitialize" returns me two "UserInitializeResult"? And which one "user" id should be used?
-----
18.09.2020 15:32:59 - Sent:
{
"mt": "UserInitialize",
"api": "RCC",
"cn": "IP232",
"src": "cdc75fce-19d1-4eb8-91f9-95febd1dc089",
"hw": "IP232-30-00-a9"
}

18.09.2020 15:32:59 - Received:
{"api":"RCC","src":"cdc75fce-19d1-4eb8-91f9-95febd1dc089","mt":"UserInitializeResult","user":1}

18.09.2020 15:32:59 - Received:
{"api":"RCC","src":"cdc75fce-19d1-4eb8-91f9-95febd1dc089","mt":"UserInitializeResult","user":2}
---
The User IP232 has only one registered device.

BR
Alessandro
← You can define your color theme preference here