Building my own WebRTC Client

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>
  <div id="page">
    <h1>SIP Web App</h1>
    <p id="callState"></p>

<script type="text/javascript" src="jssip.js"></script>
<script type="text/javascript">
var socket = new JsSIP.WebSocketInterface('wss://');
var configuration = {
  sockets  : [ socket ],
  uri      : '',
  password : 'xxxxxxxxx'
var coolPhone = new JsSIP.UA(configuration);

// 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 ='sip:800@localhost', options);
session.connection.addEventListener('addstream', function (e) {
  // set remote audio stream
  const remoteAudio = document.createElement('audio');
  remoteAudio.srcObject =;

I’m not getting any error in my browser.
Am I missing something ?
Thanks for your help

You are asking for browser configuration help on and Asterisk forum!

You need to capture the SIP and SDP exchanges in Asterisk and analyse them for correct use of, in particular, ICE, and for compatible codecs. If asking here, you also need to provide other relevant logging from Asterisk.

Also, I’m not familiar with your browser class library, but it appears to me that you are adding the addstream listener too late.

I’m not sure if Asterisk is the cause because the IP in my RTP logs are not the same if I use ctxSIP or JSSIP.
The IP is my local IP in JSSIP, and my public IP in CTXSip.
I’m sure it’s something about that.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.