Here is a page with some graphs showing how the alarm process works . Essentially, first you install some elements of the client side:
- PeerConnectionFactory; to generate PeerConnections,
- PeerConnection; one for each connection to another peer you want (usually 1),
- MediaStream to connect audio and video from your client device.
Then you create an SDP offer
peerConnection.createOffer();
on the calling party side and send it to the called party. The caller sets up this offer
peerConnection.setRemoteDescription(insert-the-offer-here);
and generates SDP answer
peerConnection.createAnswer();
and send it back to the caller. The subscriber receives this answer and installs it.
peerConnection.setRemoteDescription(insert-the-answer-here);
Both the caller and the callee will invoke the call
onAddStream() {...}
The call when the calling offer set, and the calling when the answer configured. This callback signals the start of a connection.
You can also use ICE ( STUN / TURN ) to avoid problems with firewall and NAT , but this is optional. Although in production code, you probably want to implement it.
Note. The Webrtc documentation is sparse and subject to change, take everything you read about webrtc (at least anything written at the moment) with a grain of salt ...
source share