Hello,
I’m trying to make a call with the JSSIP library, in order to build a WebRTC client.
If I use an existing WebRTC client (ctxSIP), there is no problem, calls are working.
When I try to use JSSIP, the call is ringing fine, but there is no sound from both ways.
Here is my JSSIP code :
<!DOCTYPE html>
<html>
<body>
<div id="page">
<h1>SIP Web App</h1>
<p id="callState"></p>
</div>
</body>
</html>
<script type="text/javascript" src="jssip.js"></script>
<script type="text/javascript">
var socket = new JsSIP.WebSocketInterface('wss://mydomain.fr:8089/ws');
var configuration = {
sockets : [ socket ],
uri : 'sip:myuser@mydomain.fr',
password : 'xxxxxxxxx'
};
var coolPhone = new JsSIP.UA(configuration);
coolPhone.start();
// Register callbacks to desired call events
var eventHandlers = {
'progress': function(e) {
callState.innerHTML='call is in progress';
},
'failed': function(e) {
callState.innerHTML='call failed : '+ e.cause;
},
'ended': function(e) {
callState.innerHTML='call ended :' + e.cause;
},
'confirmed': function(e) {
callState.innerHTML='call confirmed';
}
};
var options = {
'eventHandlers' : eventHandlers,
'mediaConstraints' : { 'audio': true, 'video': false }
};
var session = coolPhone.call('sip:800@localhost', options);
session.connection.addEventListener('addstream', function (e) {
// set remote audio stream
const remoteAudio = document.createElement('audio');
remoteAudio.srcObject = e.stream;
page.appendChild(remoteAudio);
remoteAudio.play();
});
</script>
I’m not getting any error in my browser.
Am I missing something ?
Thanks for your help