A direct (peer-to-peer) connection may fail at some point because of network quality issues or the ISP, firewall, or browser extension blocking WebRTC. In this case, we switch to a TURN server. During these periods of time, the SDK call is no longer free.
Peer-to-peer calls are made directly between two people, instead of being routed through Voximplant servers. These types of calls are used to make the connection secure and improve the quality of audio and video signal on-call.
- incomingCall is the call that needs to be forwarded.
- Username is the name of the Voximplant user to call.
- Callerid is the callerID of the calling user that will be displayed to the caller. Normally it's some phone number that can be used for callback (real numbers only, no whitespaces).
- displayName is the name of the caller to be displayed to the callee.
- extraHeaders (optional custom parameters).
Let's see how it all works. Go to the Users tab in your application and create a user there:
Now you can call this user in the scenario:
Calling the callUserDirect method makes it impossible to use non-P2P mode for a new call and the specified incomingCall. So, the following methods can't be used: Call.say, Call.sendDigits, Call.sendMediaTo, Call.stopMediaTo. Audio playback and recording won’t work in P2P mode either. P2P mode is available only for calls between SDKs.
Peer-to-peer data transfer capabilities available in WebRTC-enabled browsers (Chrome/Firefox/Opera/other) help with the quality of communication (low latency) and scalability. And if you want to make a peer-to-peer video call, please read this article.