Table of Contents
onOnlineList()
wrtc.onOnlineList() is an event function called when list of all users connected to IXNX server is received.
You can use this event to display list of all users you can call directly.
The online list contains all users currently connected to the IXNX unit you are connected to, thus users you can call directly, without connecting through SIP. It has basic status information of if user is in a call or not, but not full presence functionality.
Occurs
List of online users has changed.
The list is updated and wrtc.onOnlineList() is called every time someone connects to or disconnects from IXNX unit, or starts or ends a call.
Workgroups
Workgroups are used to limit the amount of users reported by onOnlineList(). Systems with thousands of users would otherwise be overwhelmed by reporting all users' states all the time. Systems not using workgroups should turn online list reporting off if exceeding 50 users.
Only users that are members in the same workgroups as you are reported. Eg if user is member of workgroups "foo" and "bar" all other users in those groups are listed, but not users who are members of other workgroups.
User would then get an online list there all users of workgroup foo is listed in list.workgroups["foo"].users, all users of workgroup bar is listed in list.workgroups["bar"].users, and all public users not member of any workgroups listed in list.users
Public users not member of any workgroups are always listed for all other users, regardless of their workgroups.
Arguments
wrtc.onOnlineList(list)
- list - JSON structure containing online lists: {workgroups:[…: {users:[{name:…, name_dn:…, state:…}]}], users:[{name:…, name_dn:…, state:…}]}
- workgroups: list of workgroup online lists:
- …: - name of workgroup (array index)
- users: array of online users. For each user it is listed:
- name - string containing address of user
- name_dn - string containing display name of user
- state - string containing user's state:
- "OK" - user not in call, user available for calls
- "OKaw" - user not active for a while, probably away from client but still probably available for calls (only available for clients who activated wrtc.adv.idleDetect())
- "busy" - user in call, not available for incoming calls
- "buOK" - user in call but can receive new incoming call anyway
- users: array of public users visible for everyone. name, name_dn and state is listed for each user, see above.
Return value
Ignored.
Example
An online list can look like:
{workgroups:[foo: {users: [{name:"adam@company.com", name_dn:"Adam", state:"OK"}, {name:"bertil@company.com", name_dn:"Bertil", state:"busy"}]},
bar: {users: [{name:"cesar@company.com", name_dn:"Cesar", state:"OK"}, {name:"david@company.com", name_dn:"David", state:"buOK"}]} ],
users: [{name:"erik@company.com", name_dn:"Erik", state:"OK"}, {name:"filip@company.com", name_dn:"Filip", state:"buOK"}] }
The code to progress through the list can look like:
wrtc.onOnlineList = function(list) {
// public users:
if (list.users)
list.users.forEach(function(user) {display(user.name, user.name_dn, user.state)});
// workgroup users:
if (list.workgroups) {
for (var wg in list.workgroups) {
print("Workgroup: " + wg);
list.workgroups[wg].users.forEach(function(user) {display(user.name, user.name_dn, user.state)});
}
}
}