sipjs.com 0.7.0 Make a Call #4 - Displaying the Call
by OnSIP
HTML
<script src="https://rawgit.com/onsip/SIP.js/0.13.5/dist/sip-0.13.5.js"></script>
<video id="remoteVideo"></video>
<video id="localVideo" muted="muted"></video>
<button id="endCall">End Call</button>
<!-- sip.js is included by JsFiddle as External Resources -->
CSS
video {
border: 1px solid lightgrey;
}
JavaScript
/*
* Check out the full guide at
* http://sipjs.com/guides/make-call/
*
* This sample uses
* http://sipjs.com/download/sip-0.13.5.min.js
*
* Login with your developer account to receive calls at
* http://sipjs.com/demo-phone
*/
//here you determine whether the call has video and audio
var options = {
media: {
local: {
video: document.getElementById('localVideo')
},
remote: {
video: document.getElementById('remoteVideo'),
// This is necessary to do an audio/video call as opposed to just a video call
audio: document.getElementById('remoteVideo')
}
},
ua: {}
};
var simple = new SIP.Web.Simple(options);
var endButton = document.getElementById('endCall');
endButton.addEventListener("click", function () {
simple.hangup();
alert("Call Ended");
}, false);
//makes the call
simple.call('[email protected]');