Rate this page:

How to make peer-to-peer calls

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.

To call a user directly, we’ll need the callUserDirect method of the Voximplant API. The JavaScript scenario that uses this method and the callee should be both associated with the same Voximplant application.


  • 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:

P2P calling

P2P calling

Please note

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.

P2P video

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.