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
854 stars 279 forks source link

reject the call #22

Closed d-knafo closed 6 years ago

d-knafo commented 8 years ago

hi @stephenlb , I want to know if it is possible to reject a call ? (a confirmation to enter in conversation)

stephenlb commented 8 years ago

Yes but you have to add this yourself. There is no "ringer" or "calling" state. Only an instant "connecting" state.

Hamadme50 commented 6 years ago

stephenlb can you guide us how we can do it?

stephenlb commented 6 years ago

You can do this. Here is an example.

// When Call Comes In or is to be Connected
phone.receive(function(session){
    session.ended(function(session){
        sounds.play('sound/goodbye');
        console.log("Bye!");
    });

    // immediately reject the call.   <-------------- rejected 🙅‍♂️
    if (true) session.hangup();

});