====== Switch client ====== If you have created a simple wrtc_kit client that can only handle single calls it automatically connects audio-only to the group call if it happens to be invited into a group call. As an alternative solution you can switch to a different, group-call-capable client instead in such situations. If your client's [[ixnx:wrtc:js:api:wrtc:maxnrcalls|wrtc.maxNrCalls]] is set to 1 it indicates to the system it is only capable of making single calls. If such a client gets invited into a group call it will automatically end the current call and connect to the voice bridge at IXNX to establish an audio-only connection with the group call. Then you will be able to hear everyone in the group and talk to them, but not see them. If you are satisfied with that solution you don't need to do anything, wrtc_kit will take care of everything. If you however have two different clients, one single-call-only and one group-call-capable then it might be a good idea for the single-call-only client to automatically switch to the group-call-capable one when it receives an invite to group calls. Then you will be able to both hear and see everyone in the group. If a single-call-only client receives a joingroup it first reports [[ixnx:wrtc:js:api:wrtc:onerror|error 115]] before ending current call and connecting to voice bridge instead. You can use that error 115 to launch the group-call-capable client instead. ===== code ===== wrtc.onError = function(obj, err) { if ((err.errorCode) && (err.errorCode == 115)) { obj.hangup(); window.location.href = "«url»/?Iam=" + wrtc.addressName + "&call=" + err.msg.bridge_addr + ";gc_gid=" + wrtc.i.hashCode(err.msg.gid) + ";gid=" + err.msg.gid; } } In the [[ixnx:wrtc:js:api:wrtc:onerror|onError]] function we first check if errorCode is 115. Then we hang up current call and instead set window.location.href to the «url» of the group-call-capable client. You add the following tags to the URL: * Iam - makes the new client use same [[ixnx:wrtc:js:api:wrtc:addressname|addressName]] as current (optional but recommended) * call - makes new client call (using [[ixnx:wrtc:js:api:wrtc:geturlvars|wrtc.getURLvars]]) the group * gc_gid and gid are the identifiers of what group call to connect to err.msg contains the received joingroup message so that the correct voice bridge can be called with the appropriate group ID. By adding these lines to your simple client it will switch to your fully-capable client if someone tries to add it to a group call. Without these lines your simple client will still do the best it can, establish an audio-only connection to the group.