stephenlb / webrtc-sdk

WebRTC Simple Calling API + Mobile SDK - A simplified approach to RTCPeerConnection for mobile and web video calling apps.
https://stephenlb.github.io/webrtc-sdk/
MIT License
853 stars 278 forks source link

Add Access Manager for Security #53

Open sagar-spkt opened 6 years ago

sagar-spkt commented 6 years ago

Allow only some users for call.

stephenlb commented 5 years ago

That is a really cool feature!

crookedbard commented 5 years ago

Is there any milestone for this new feature?

stephenlb commented 5 years ago

You can add a "Accept Call" phase before the parties video/audio starts. This isn't planned at this time. You can add this feature here near this function: https://github.com/stephenlb/webrtc-sdk/blob/master/index.html#L196-L208

I'll walk you through this:

Before the Sending the Video/Audio Stream, send a signal to ask for call permission:

let user_number = "1235445"; // my friends number
phone.send( { "accept" : "Would you like to accept this call?" }, user_number );

Like this:

function call_request(number) {
    phone.send( { "accept" : "Would you like to accept this call?" }, user_number );
}
function call_accepted() {
    // start voice/video session
    phone.dial(user_number);
}
function call_rejected() {
    // show call rejected screen
}
stephenlb commented 5 years ago

Added: https://github.com/stephenlb/webrtc-sdk/blob/master/readme.md#webrtc-session-call-rejection-and-accept-permissions