Managing a call state
There are 2 types of calls
- An incoming call - a call that is made from some endpoint (Web SDK, a SIP phone, a PSTN network) to Voximplant Cloud.
- An outgoing call - a call that originates in the Voximplant Cloud.
Each call is represented by a Call object. Objects of this kind can't be instantiated by a developer directly. They are created automatically for incoming calls when a call arrives at Voximplant. For an outgoing call, a corresponding object is created when VoxEngine.callPSTN, VoxEngine.callUser, or VoxEngine.callSIP is called.
The following basic call operations are available:
- Answer an incoming call - using Call.answer. This normally results in dispatching a CallEvents.Connected event
- Rejecting the incoming call - using Call.reject. This causes a CallEvents.Disconnected event
- Hanging up a call - using Call.hangup. This causes a CallEvents.Disconnected or CallEvents.Failed event depending on the call state
A single session can handle multiple calls simultaneously, so Voximplant will not be able to decide itself how to send media data between the calls. There are a couple functions that tell the Cloud how to route audio and video:
- Call.sendMediaTo, Call.stopMediaTo - tell the application whether to send media from one call to another call. This doesn't affect media sent in the other direction.
- VoxEngine.sendMediaBetween, VoxEngine.stopMediaBetween - these tell the application whether to send media between 2 calls.