Picture of Sascha
Registered 5 years 339 days
Sascha Wednesday, 18 March 2020, 09:56 AM
Read all User Objects
Hello everyone,

I'am searching for the possibility to get all user objects from an ipva with a v13 app. I have looked in the SDK documentation but I have found no event or something similar to the old soap way with findUser.

Regards,
Sascha
Picture of Matthias Schertler (innovaphone)
Moderator Registered 12 years 193 days
Matthias Schertler (innovaphone) Friday, 27 March 2020, 12:05 PM
Re: Read all User Objects
Hello Sascha,

the best replacement for the findUser method of SOAP is the SearchUsers message of the PbxAdminApi.

See: http://sdk.innovaphone.com/doc/appwebsocket/PbxAdminApi.htm#SearchUsers

For enumerating all user objects start with
  • {"api":"PbxAdminApi","mt":"SearchUsers","cn":""}
You will get back an array with up to 20 objects, for example
  • {"api":"PbxAdminApi","mt":"SearchUsersResult","user":[{"cn":"Atlantis","guid":"60bab4d7bc7d5e01ef3d009033410fcc","h323":"atlantis"},{"cn":"Endeavour","guid":"7b38f2d7bc7d5e01ee3d009033410fcc","h323":"endeavour"},{"cn":"User1","guid":"699f08fdc97d5e013636009033410fcc","h323":"user1"},{"cn":"User10","guid":"61698150ca7d5e013f36009033410fcc","h323":"user10"},{"cn":"User11","guid":"2389ba5aca7d5e014036009033410fcc","h323":"user11"},{"cn":"User12","guid":"a929cc63ca7d5e014136009033410fcc","h323":"user12"},{"cn":"User13","guid":"fdb0f469ca7d5e014236009033410fcc","h323":"user13"},{"cn":"User14","guid":"abe67d6fca7d5e014336009033410fcc","h323":"user14"},{"cn":"User15","guid":"12e6c778ca7d5e014436009033410fcc","h323":"User15"},{"cn":"User16","guid":"ed6d9580ca7d5e014536009033410fcc","h323":"user16"},{"cn":"User17","guid":"77dd8988ca7d5e014636009033410fcc","h323":"user17"},{"cn":"User18","guid":"3aade38fca7d5e014736009033410fcc","h323":"user18"},{"cn":"User19","guid":"f834e696ca7d5e014836009033410fcc","h323":"user19"},{"cn":"User2","guid":"7fd02404ca7d5e013736009033410fcc","h323":"user2"},{"cn":"User20","guid":"c7f367a4ca7d5e014936009033410fcc","h323":"user20"},{"cn":"User3","guid":"fb413e0cca7d5e013836009033410fcc","h323":"user3"},{"cn":"User4","guid":"dbc8ab17ca7d5e013936009033410fcc","h323":"user4"},{"cn":"User5","guid":"73935322ca7d5e013a36009033410fcc","h323":"user5"},{"cn":"User6","guid":"d866e22bca7d5e013b36009033410fcc","h323":"user6"},{"cn":"User7","guid":"efb15932ca7d5e013c36009033410fcc","h323":"user7"}]}
Contiue with searches for the cn of the last object in the array, until you don't get more results.
  • {"api":"PbxAdminApi","mt":"SearchUsers","cn":"User7"}
  • {"api":"PbxAdminApi","mt":"SearchUsersResult","user":[{"cn":"User8","guid":"7679293fca7d5e013d36009033410fcc","h323":"user8"},{"cn":"User9","guid":"d8eaa547ca7d5e013e36009033410fcc","h323":"user9"}]}
  • {"api":"PbxAdminApi","mt":"SearchUsers","cn":"User9"}
    {"api":"PbxAdminApi","mt":"SearchUsersResult"}
For reading the full details of the objects you can use the GetObject message afterwards.
  • {"api":"PbxAdminApi","mt":"GetObject","guid":"60bab4d7bc7d5e01ef3d009033410fcc"}
  • {"api":"PbxAdminApi","mt":"GetObjectResult","guid":"60bab4d7bc7d5e01ef3d009033410fcc","cn":"Atlantis","h323":"atlantis","e164":"201","loc":"master","node":"root","apps":"phone","hide":false,"no-dev":false,"mypbx":true,"devices":[{"hw":"atlantis","text":"atlantis","app":"phone"}]}
Hoping this was helpful.

I attached a small sample code in JavaScript for demonstration. It requires an app object "testapp" with password "pwd" and the "admin" checkmark actiavted on the PBX.

BR
Matthias
pbx-api-test.zip
Picture of Matthias Schertler (innovaphone)
Moderator Registered 12 years 193 days
Matthias Schertler (innovaphone) Friday, 27 March 2020, 02:04 PM
Re: Read all User Objects
Hi Sascha,

there is a second option to read the user objects that might also interesting - especially if you are interested in getting live updates as user objects change.

You can replicate the objects using the API "PbxTableUsers". The documentation can be found here: http://sdk.innovaphone.com/doc/appwebsocket/Replication.htm

Again I tried to build a small sample in JavaScript for demonstration of the API. It needs an app object called "testapp" with password "pwd" and "TableUsers" checked.
  • It first starts a replication of the PBX users specifying what fields are interesting for the app - in this case I chose guid, cn, h323 and e164.
    • {"api":"PbxTableUsers","mt":"ReplicateStart","columns":{"guid":{},"h323":{},"e164":{},"cn":{}},"pseudo":[""]}
    • {"mt":"ReplicateStartResult","api":"PbxTableUsers","columns":{"guid":{},"h323":{},"e164":{},"cn":{}}}
  • Then it sends ReplicateNext until no more objects are returned.
    • {"api":"PbxTableUsers","mt":"ReplicateNext"}
    • {"mt":"ReplicateNextResult","api":"PbxTableUsers","columns":{"guid":"7b38f2d7bc7d5e01ee3d009033410fcc","h323":"endeavour","e164":"200","cn":"Endeavour"}}
    • {"api":"PbxTableUsers","mt":"ReplicateNext"}
    • ...
    • {"mt":"ReplicateNextResult","api":"PbxTableUsers"}
  • If you are interested in live upates, just leave the connection open and wait for incoming ReplicateUpdate messages.
    • {"mt":"ReplicateUpdate","api":"PbxTableUsers","columns":{"guid":"7b38f2d7bc7d5e01ee3d009033410fcc","cn":"Endeavour Changed","h323":"endeavour","e164":"200"}}
Hoping this was helpful.

BR
Matthias
tableusers-test.zip
Picture of s.taras
Registered 5 years 82 days
s.taras Wednesday, 15 April 2020, 11:33 AM
Re: Read all User Objects
Hello,

How can I use "PbxTableUsers" api on Service(C++) side?

Thank you,Taras
Picture of Sascha
Registered 5 years 339 days
Sascha Monday, 30 March 2020, 09:16 AM in response to Matthias Schertler (innovaphone)
Re: Read all User Objects
Hi Matthias,

thank you for the examples. But I think this approach will generate to much load on the ipva. For example if I have 1000 or more obejcts I have to call this 50 times to get all users.

Is it possible to get more than 20 objects from this api?

Regards,
Sascha
2013
Moderator Registered 16 years 72 days
Guntram Diehl (innovaphone) Monday, 30 March 2020, 09:21 AM
Re: Read all User Objects
Hi Sascha,

this approach reduces the peak load and the overhead of the additional messages is not that high. So we think this is better compare to deliver many users in one big message.

Guntram
← You can define your color theme preference here