Search code examples
node.jsopentoktokbox

Putting a video call on hold with OpenTok


I've been researching webRTC platforms and found that OpenTok seems to provide the most customizable functionality. Before I dive nose deep into it, I wanted to make sure that it could perform one key requirement:

During a 1-1 video call between two users A and B, I want one of these users (lets go with user A) to be able to receive a call from a third party (lets call the third party user C). When A receives a call from C, while in a call with B, I want A to be able to put the call with B on hold and take the call from C. It'd be great if A could also send B a video so that B can watch something while A is talking to C.

Thanks!


Solution

  • Yes these things are possible with a little development work in your application. OpenTok calls are setup as Sessions, which are more like a conference call where everyone can see one another.

    So with this in mind the way I would implement this is to have 2 sessions. 1 for the call between user A and B and then another one for the call between A and C. As the developer of the application it will be your job to present the users with the OpenTok session ids at the time of the calls. You can do this using your own signalling logic (using eg. socket.io).

    Then to put someone on hold you can pause the audio and video on the Publisher (using publishVideo(false) and publishAudio(false)) and then the other participant will get a message saying that the audio/video has been paused (streamPropertyChanged). At this point in your application you can start to play back a video for the user that is on hold.