Skip to content

Instantly share code, notes, and snippets.

@dtolb
Last active December 15, 2023 10:46
Show Gist options
  • Star 24 You must be signed in to star a gist
  • Fork 16 You must be signed in to fork a gist
  • Save dtolb/79e813d45fac6488e4c67993b393ddda to your computer and use it in GitHub Desktop.
Save dtolb/79e813d45fac6488e4c67993b393ddda to your computer and use it in GitHub Desktop.
JsSip Demo

JSSIP with Catapult API

⚠️ This has been updated at JsFiddle*

Prerequisites

  • Register for a Catapult (Bandwidth Application Platform) account here
  • Register a SIP domain
  • Create an endpoint/user
  • If you want to make calls to the PSTN (normal phones) you will need a server to handler events from Catapult
  • Make phone calls ​ For a more in depth guide, view this article

Quick Start

Full docs are here ​ CDN hosted library: minified not-minifiedJSFIDDLE Demo Client

Outbound Call

var callOptions = {
  mediaConstraints: {
    audio: true, // only audio calls
    video: false
  }
};var bwPhone = new JsSIP.UA({
  'uri': 'sip:sip-user@your-domain.bwapp.bwsip.io', 
  'password': 'password', 
  'ws_servers': 'wss://webrtc.registration.bandwidth.com:10443'
});
bwPhone.start();bwPhone.on("registered", function(){
    bwPhone.call("222-333-4444", callOptions);    
});bwPhone.on("newRTCSession", function(data){
    var session = data.session; // outgoing call session here
    var dtmfSender;
    session.on("confirmed",function(){
        //the call has connected, and audio is playing
        var localStream = session.connection.getLocalStreams()[0];
        dtmfSender = session.connection.createDTMFSender(localStream.getAudioTracks()[0])
    });
    session.on("ended",function(){
        //the call has ended
    });
    session.on("failed",function(){
        // unable to establish the call
    });
    session.on('addstream', function(e){
        // set remote audio stream (to listen to remote audio)
        // remoteAudio is <audio> element on page
        remoteAudio.src = window.URL.createObjectURL(e.stream);
        remoteAudio.play();
    });
    
    //play a DTMF tone (session has method `sendDTMF` too but it doesn't work with Catapult server right)
    dtmfSender.insertDTMF("1");
    dtmfSender.insertDTMF("#");//mute call
    session.mute({audio: true});//unmute call
    session.unmute({audio: true});//to hangup the call
    session.terminate();});

Inbound Call

var callOptions = {
  mediaConstraints: {
    audio: true, // only audio calls
    video: false
  }
};var bwPhone = new JsSIP.UA({
  'uri': 'sip:sip-user@your-domain.bwapp.bwsip.io', 
  'password': 'password', 
  'ws_servers': 'wss://webrtc.registration.bandwidth.com:10443'
});
bwPhone.start();bwPhone.on("newRTCSession", function(data){
    var session = data.session; 
    
    if (session.direction === "incoming") {
        // incoming call here
        session.on("accepted",function(){
            // the call has answered
        });
        session.on("confirmed",function(){
            // this handler will be called for incoming calls too
        });
        session.on("ended",function(){
            // the call has ended
        });
        session.on("failed",function(){
            // unable to establish the call
        });
        session.on('addstream', function(e){
            // set remote audio stream (to listen to remote audio)
            // remoteAudio is <audio> element on page
            remoteAudio.src = window.URL.createObjectURL(e.stream);
            remoteAudio.play();
        });
        
        // Answer call
        session.answer(callOptions);
        
        // Reject call (or hang up it)
        session.terminate();
    }
});

Passwordless connection (via auth token)

var authToken = "1234567890"; // you can get this token by POST http request to /v1/users/<userId>/domains/<domainId>/endpoints/<endpointId>/tokensvar authHeader = "X-Callsign-Token: " + authToken;var callOptions = {
  extraHeaders: [authHeader], // set auth token here (it will be passed on making calls and answering incoming call) 
  mediaConstraints: {
    audio: true, // only audio calls
    video: false
  }
};var bwPhone = new JsSIP.UA({
  'uri': 'sip:sip-user@your-domain.bwapp.bwsip.io', 
  'ws_servers': 'wss://webrtc.registration.bandwidth.com:10443',
});
bwPhone.registrator().setExtraHeaders([authHeader]); // set auth header on registerbwPhone.on('registered', function(){
     // ready to make calls and receive incoming calls
     // making a call
     bwPhone.call("222-333-4444", callOptions);
});bwPhone.on("newRTCSession", function(data){
    var session = data.session; 
    
    if (session.direction === "incoming") {
        // answer incoming call
        session.answer(callOptions);
    }
});bwPhone.start();

​ ​

Supported Browsers

  • Firefox
  • Chrome
  • Opera ​ You can check if browser supports WebRTC by code ​
    if (!JsSIP.rtcninja.hasWebRTC()) {
        alert("WebRTC is not supported. Please use another browser.");
    }

Thank you

  • Thank you, @GaborTorma for updating and answering questions.
@ujin001
Copy link

ujin001 commented Nov 11, 2016

Hello!
I changed lib sipjs to jssip. I have problem on session transfer.
in sipjs this look like this
session_from.refer(session_to);

How i can do this on jssip?

@GaborTorma
Copy link

Upgraded version for JSSIP 3.4.2: https://jsfiddle.net/rge25q4s/

@radetsky
Copy link

I want to add a little note about Safari. This is code from my JsSIP experience. Take a look at the difference between stream settings. Safari does not have a 'stream' but has a 'streams' list. Also, an event is not the 'addstream' but 'track'.

// This is for Chrome,Firefox, etc. 
    session.connection.addEventListener('addstream', (e: any) => {
    console.log('Add stream on connection')
    this.audio.srcObject = e.stream
    this.audio.play()
})
// This is for Safari. 
    session.connection.addEventListener('track', (e: any) => {
    console.log('Add stream track on connection', e)
    this.audio.srcObject = e.streams[0];
    this.audio.play()
})

@JFBarsocchi
Copy link

JFBarsocchi commented Aug 30, 2023

hi and thanks for this code, it's very helpful
I can register my UA and make calls but I don't know how to hangup
I need to create a function using "terminate"but I can't find how to write it, could you help please? this function will be called by a click button in angular. maybe should I use callbacks ?
thanks

@GaborTorma
Copy link

I don't know how to hangup I need to create a function using "terminate"but I can't find how to write it, could you help please?

You can hangup call with session.terminate()

@lavkushtyagi
Copy link

call made successfully but no audio both side

@lavkushtyagi
Copy link

I don't know how to hangup I need to create a function using "terminate"but I can't find how to write it, could you help please?

You can hangup call with session.terminate()

call made but no audio on both side *help i run the jsFiddle code with my credentials.

@GaborTorma
Copy link

Generally it is codec, NAT or route problem.

@lavkushtyagi
Copy link

i use the same code can you provide me settings or any sample

@lavkushtyagi
Copy link

lavkushtyagi commented Nov 8, 2023

"%cJsSIP:UA %ccall()%c +31s", "color: #FF9933", "color: inherit", "color: #FF9933"
"%cJsSIP:RTCSession %cnew%c +13s", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:RTCSession %cconnect()%c +0ms", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:RTCSession %cemit &quot;peerconnection&quot;%c +1ms", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:RTCSession %cnewRTCSession()%c +0ms", "color: #99CC00", "color: inherit", "color: #99CC00"
"con", [object RTCPeerConnection] {
addEventListener: function addEventListener() { [native code] },
addIceCandidate: function addIceCandidate() { [native code] },
addStream: function addStream() { [native code] },
addTrack: function addTrack() { [native code] },
addTransceiver: function addTransceiver() { [native code] },
canTrickleIceCandidates: null,
close: function close() { [native code] },
connectionState: "new",
createAnswer: function createAnswer() { [native code] },
createDataChannel: function createDataChannel() { [native code] },
createDTMFSender: function createDTMFSender() { [native code] },
createOffer: function createOffer() { [native code] },
currentLocalDescription: null,
currentRemoteDescription: null,
dispatchEvent: function dispatchEvent() { [native code] },
getConfiguration: function getConfiguration() { [native code] },
getLocalStreams: function getLocalStreams() { [native code] },
getReceivers: function getReceivers() { [native code] },
getRemoteStreams: function getRemoteStreams() { [native code] },
getSenders: function getSenders() { [native code] },
getStats: function getStats() { [native code] },
getTransceivers: function getTransceivers() { [native code] },
iceConnectionState: "new",
iceGatheringState: "new",
localDescription: null,
onaddstream: null,
onconnectionstatechange: null,
ondatachannel: null,
onicecandidate: null,
onicecandidateerror: null,
oniceconnectionstatechange: null,
onicegatheringstatechange: null,
onnegotiationneeded: null,
onremovestream: null,
onsignalingstatechange: null,
ontrack: null,
pendingLocalDescription: null,
pendingRemoteDescription: null,
remoteDescription: null,
removeEventListener: function removeEventListener() { [native code] },
removeStream: function removeStream() { [native code] },
removeTrack: function removeTrack() { [native code] },
restartIce: function restartIce() { [native code] },
sctp: null,
setConfiguration: function setConfiguration() { [native code] },
setLocalDescription: function setLocalDescription() { [native code] },
setRemoteDescription: function setRemoteDescription() { [native code] },
signalingState: "stable"
}
"%cJsSIP:RTCSession %csession connecting%c +44ms", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:RTCSession %cemit &quot;connecting&quot;%c +0ms", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:RTCSession %ccreateLocalDescription()%c +0ms", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:RTCSession %cemit &quot;sdp&quot;%c +116ms", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:RTCSession %cemit &quot;sending&quot; [request:%o]%c +0ms", "color: #99CC00", "color: inherit", {
body: "v=0
o=- 2164683428557940697 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0
a=extmap-allow-mixed
a=msid-semantic: WMS 542c8f1c-b2e8-4b46-8503-5277b3c628c3
m=audio 62874 UDP/TLS/RTP/SAVPF 111 63 9 0 8 13 110 126
c=IN IP4 10.10.10.135
a=rtcp:9 IN IP4 0.0.0.0
a=candidate:1328652830 1 udp 2122260223 10.10.10.135 62874 typ host generation 0 network-id 1
a=candidate:2979755658 1 tcp 1518280447 10.10.10.135 9 typ host tcptype active generation 0 network-id 1
a=ice-ufrag:VY5Q
a=ice-pwd:atUYKfRy9vhp0nMT847h2Fbt
a=ice-options:trickle
a=fingerprint:sha-256 E3:0B:40:B6:8A:B1:9D:19:6C:C6:E8:1B:C0:D2:BF:11:E7:C6:BE:A2:25:D7:1E:43:34:C0:37:9D:C1:64:AF:2B
a=setup:actpass
a=mid:0
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid
a=sendrecv
a=msid:542c8f1c-b2e8-4b46-8503-5277b3c628c3 2ce77510-2ea7-46c7-9c87-a51c093f5982
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc
a=fmtp:111 minptime=10;useinbandfec=1
a=rtpmap:63 red/48000/2
a=fmtp:63 111/111
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:13 CN/8000
a=rtpmap:110 telephone-event/48000
a=rtpmap:126 telephone-event/8000
a=ssrc:531608100 cname:XCbvh2SbM0Pf6D7b
a=ssrc:531608100 msid:542c8f1c-b2e8-4b46-8503-5277b3c628c3 2ce77510-2ea7-46c7-9c87-a51c093f5982
",
call_id: "0fp8ni4redbckebe3q6j",
cseq: 6701,
extraHeaders: ["Contact: <sip:ui25l1ab@526h81p4pd99.invalid;transport=ws;ob>", "Content-Type: application/sdp", "Session-Expires: 90"],
from: {
_display_name: null,
_parameters: { ... },
_uri: { ... }
},
headers: {
Call-ID: ["0fp8ni4redbckebe3q6j"],
CSeq: ["6701 INVITE"],
From: ["<sip:x245akwD@sip01.sipprovider.com>;tag=4o2j6p6jqg"],
Max-Forwards: [69],
To: ["<sip:9026951168@sip01.sipprovider.com>"],
Via: [""]
},
method: "INVITE",
ruri: {
_headers: { ... },
_host: "sip01.sipprovider.com",
_parameters: { ... },
_port: undefined,
_scheme: "sip",
_user: "9026951168"
},
to: {
_display_name: null,
_parameters: { ... },
_uri: [circular object Object]
},
transaction: null,
ua: {
_applicants: { ... },
_cache: { ... },
_closeTimer: null,
_configuration: { ... },
_contact: { ... },
_data: { ... },
_dialogs: { ... },
_dynConfiguration: { ... },
_error: null,
_events: { ... },
_eventsCount: 2,
_maxListeners: undefined,
_registrator: { ... },
_sessions: { ... },
_status: 1,
_transactions: { ... },
_transport: { ... },
addListener: function addListener(type, listener) {
return _addListener(this, type, listener, false);
},
emit: function emit(type) {
var er, handler, len, args, i, events;
var doError = (type === 'error');

events = this._events;
if (events)
  doError = (doError && events.error == null);
else if (!doError)
  return false;

// If there is no 'error' event listener then throw.
if (doError) {
  if (arguments.length > 1)
    er = arguments[1];
  if (er instanceof Error) {
    throw er; // Unhandled 'error' event
  } else {
    // At least give some kind of context to the user
    var err = new Error('Unhandled "error" event. (' + er + ')');
    err.context = er;
    throw err;
  }
  return false;
}

handler = events[type];

if (!handler)
  return false;

var isFn = typeof handler === 'function';
len = arguments.length;
switch (len) {
    // fast cases
  case 1:
    emitNone(handler, isFn, this);
    break;
  case 2:
    emitOne(handler, isFn, this, arguments[1]);
    break;
  case 3:
    emitTwo(handler, isFn, this, arguments[1], arguments[2]);
    break;
  case 4:
    emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
    break;
    // slower
  default:
    args = new Array(len - 1);
    for (i = 1; i < len; i++)
      args[i - 1] = arguments[i];
    emitMany(handler, isFn, this, args);
}

return true;

},
eventNames: function eventNames() {
return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
},
getMaxListeners: function getMaxListeners() {
return $getMaxListeners(this);
},
listenerCount: function listenerCount(type) {
var events = this._events;

if (events) {
  var evlistener = events[type];

  if (typeof evlistener === 'function') {
    return 1;
  } else if (evlistener) {
    return evlistener.length;
  }
}

return 0;

},
listeners: function listeners(type) {
return _listeners(this, type, true);
},
on: function addListener(type, listener) {
return _addListener(this, type, listener, false);
},
once: function once(type, listener) {
if (typeof listener !== 'function')
throw new TypeError('"listener" argument must be a function');
this.on(type, _onceWrap(this, type, listener));
return this;
},
prependListener: function prependListener(type, listener) {
return _addListener(this, type, listener, true);
},
prependOnceListener: function prependOnceListener(type, listener) {
if (typeof listener !== 'function')
throw new TypeError('"listener" argument must be a function');
this.prependListener(type, _onceWrap(this, type, listener));
return this;
},
rawListeners: function rawListeners(type) {
return _listeners(this, type, false);
},
removeAllListeners: function removeAllListeners(type) {
var listeners, events, i;

    events = this._events;
    if (!events)
      return this;

    // not listening for removeListener, no need to emit
    if (!events.removeListener) {
      if (arguments.length === 0) {
        this._events = objectCreate(null);
        this._eventsCount = 0;
      } else if (events[type]) {
        if (--this._eventsCount === 0)
          this._events = objectCreate(null);
        else
          delete events[type];
      }
      return this;
    }

    // emit removeListener for all listeners on all events
    if (arguments.length === 0) {
      var keys = objectKeys(events);
      var key;
      for (i = 0; i < keys.length; ++i) {
        key = keys[i];
        if (key === 'removeListener') continue;
        this.removeAllListeners(key);
      }
      this.removeAllListeners('removeListener');
      this._events = objectCreate(null);
      this._eventsCount = 0;
      return this;
    }

    listeners = events[type];

    if (typeof listeners === 'function') {
      this.removeListener(type, listeners);
    } else if (listeners) {
      // LIFO order
      for (i = listeners.length - 1; i >= 0; i--) {
        this.removeListener(type, listeners[i]);
      }
    }

    return this;
  },
removeListener: function removeListener(type, listener) {
    var list, events, position, i, originalListener;

    if (typeof listener !== 'function')
      throw new TypeError('"listener" argument must be a function');

    events = this._events;
    if (!events)
      return this;

    list = events[type];
    if (!list)
      return this;

    if (list === listener || list.listener === listener) {
      if (--this._eventsCount === 0)
        this._events = objectCreate(null);
      else {
        delete events[type];
        if (events.removeListener)
          this.emit('removeListener', type, list.listener || listener);
      }
    } else if (typeof list !== 'function') {
      position = -1;

      for (i = list.length - 1; i >= 0; i--) {
        if (list[i] === listener || list[i].listener === listener) {
          originalListener = list[i].listener;
          position = i;
          break;
        }
      }

      if (position < 0)
        return this;

      if (position === 0)
        list.shift();
      else
        spliceOne(list, position);

      if (list.length === 1)
        events[type] = list[0];

      if (events.removeListener)
        this.emit('removeListener', type, originalListener || listener);
    }

    return this;
  },
setMaxListeners: function setMaxListeners(n) {
if (typeof n !== 'number' || n < 0 || isNaN(n))
  throw new TypeError('"n" argument must be a positive number');
this._maxListeners = n;
return this;

}
}
}, "color: #99CC00"
"%cJsSIP:Transport %csend()%c +5s", "color: #FF0066", "color: inherit", "color: #FF0066"
"%cJsSIP:Transport %csending message:

INVITE sip:9026951168@sip01.sipprovider.com SIP/2.0
Via: SIP/2.0/WSS 526h81p4pd99.invalid;branch=z9hG4bK2918698
Max-Forwards: 69
To: <sip:9026951168@sip01.sipprovider.com>
From: <sip:x245akwD@sip01.sipprovider.com>;tag=4o2j6p6jqg
Call-ID: 0fp8ni4redbckebe3q6j
CSeq: 6701 INVITE
Contact: <sip:ui25l1ab@526h81p4pd99.invalid;transport=ws;ob>
Content-Type: application/sdp
Session-Expires: 90
Allow: INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO,NOTIFY
Supported: timer,ice,replaces,outbound
User-Agent: JsSIP 3.4.2
Content-Length: 1489

v=0
o=- 2164683428557940697 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0
a=extmap-allow-mixed
a=msid-semantic: WMS 542c8f1c-b2e8-4b46-8503-5277b3c628c3
m=audio 62874 UDP/TLS/RTP/SAVPF 111 63 9 0 8 13 110 126
c=IN IP4 10.10.10.135
a=rtcp:9 IN IP4 0.0.0.0
a=candidate:1328652830 1 udp 2122260223 10.10.10.135 62874 typ host generation 0 network-id 1
a=candidate:2979755658 1 tcp 1518280447 10.10.10.135 9 typ host tcptype active generation 0 network-id 1
a=ice-ufrag:VY5Q
a=ice-pwd:atUYKfRy9vhp0nMT847h2Fbt
a=ice-options:trickle
a=fingerprint:sha-256 E3:0B:40:B6:8A:B1:9D:19:6C:C6:E8:1B:C0:D2:BF:11:E7:C6:BE:A2:25:D7:1E:43:34:C0:37:9D:C1:64:AF:2B
a=setup:actpass
a=mid:0
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid
a=sendrecv
a=msid:542c8f1c-b2e8-4b46-8503-5277b3c628c3 2ce77510-2ea7-46c7-9c87-a51c093f5982
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc
a=fmtp:111 minptime=10;useinbandfec=1
a=rtpmap:63 red/48000/2
a=fmtp:63 111/111
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:13 CN/8000
a=rtpmap:110 telephone-event/48000
a=rtpmap:126 telephone-event/8000
a=ssrc:531608100 cname:XCbvh2SbM0Pf6D7b
a=ssrc:531608100 msid:542c8f1c-b2e8-4b46-8503-5277b3c628c3 2ce77510-2ea7-46c7-9c87-a51c093f5982

%c +0ms", "color: #FF0066", "color: inherit", "color: #FF0066"
"%cJsSIP:WebSocketInterface %csend()%c +5s", "color: #66CC33", "color: inherit", "color: #66CC33"
"%cJsSIP:WebSocketInterface %creceived WebSocket message%c +48ms", "color: #66CC33", "color: inherit", "color: #66CC33"
"%cJsSIP:Transport %creceived text message:

SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/WSS 526h81p4pd99.invalid;received=103.106.194.125;rport=48134;branch=z9hG4bK2918698
To: <sip:9026951168@sip01.sipprovider.com>;tag=5944.8e4b8ba743f000761380c53bf8df60de
From: <sip:x245akwD@sip01.sipprovider.com>;tag=4o2j6p6jqg
Call-ID: 0fp8ni4redbckebe3q6j
CSeq: 6701 INVITE
Proxy-Authenticate: Digest realm=&quot;sip01.sipprovider.com&quot;, nonce=&quot;71Cnw3v3ZEwaGFMYLshtwX2VmewZVuU7lhN+vVuEsPgA&quot;, qop=&quot;auth&quot;
Server: OpenSIPS (3.3.0 (x86_64/linux))
Content-Length: 0

%c +48ms", "color: #FF0066", "color: inherit", "color: #FF0066"
"%cJsSIP:Transport %csend()%c +1ms", "color: #FF0066", "color: inherit", "color: #FF0066"
"%cJsSIP:Transport %csending message:

ACK sip:9026951168@sip01.sipprovider.com SIP/2.0
Via: SIP/2.0/WSS 526h81p4pd99.invalid;branch=z9hG4bK2918698
Max-Forwards: 69
To: <sip:9026951168@sip01.sipprovider.com>;tag=5944.8e4b8ba743f000761380c53bf8df60de
From: <sip:x245akwD@sip01.sipprovider.com>;tag=4o2j6p6jqg
Call-ID: 0fp8ni4redbckebe3q6j
CSeq: 6701 ACK
Allow: INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO,NOTIFY
Supported: outbound
User-Agent: JsSIP 3.4.2
Content-Length: 0

%c +0ms", "color: #FF0066", "color: inherit", "color: #FF0066"
"%cJsSIP:WebSocketInterface %csend()%c +1ms", "color: #66CC33", "color: inherit", "color: #66CC33"
"%cJsSIP:DigestAuthentication %cauthenticate() | using qop=auth [a2:&quot;%s&quot;]%c +31s", "color: #FF9933", "color: inherit", "INVITE:sip:9026951168@sip01.sipprovider.com", "color: #FF9933"
"%cJsSIP:DigestAuthentication %cauthenticate() | response generated%c +0ms", "color: #FF9933", "color: inherit", "color: #FF9933"
"%cJsSIP:Transport %csend()%c +0ms", "color: #FF0066", "color: inherit", "color: #FF0066"
"%cJsSIP:Transport %csending message:

INVITE sip:9026951168@sip01.sipprovider.com SIP/2.0
Via: SIP/2.0/WSS 526h81p4pd99.invalid;branch=z9hG4bK5677102
Max-Forwards: 69
To: <sip:9026951168@sip01.sipprovider.com>
From: <sip:x245akwD@sip01.sipprovider.com>;tag=4o2j6p6jqg
Call-ID: 0fp8ni4redbckebe3q6j
CSeq: 6702 INVITE
Proxy-Authorization: Digest algorithm=MD5, username=&quot;x245akwD&quot;, realm=&quot;sip01.sipprovider.com&quot;, nonce=&quot;71Cnw3v3ZEwaGFMYLshtwX2VmewZVuU7lhN+vVuEsPgA&quot;, uri=&quot;sip:9026951168@sip01.sipprovider.com&quot;, response=&quot;c134a1af7854e245e5cffa497b44e049&quot;, qop=auth, cnonce=&quot;f2f2h6km1ib5&quot;, nc=00000001
Contact: <sip:ui25l1ab@526h81p4pd99.invalid;transport=ws;ob>
Content-Type: application/sdp
Session-Expires: 90
Allow: INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO,NOTIFY
Supported: timer,ice,replaces,outbound
User-Agent: JsSIP 3.4.2
Content-Length: 1489

v=0
o=- 2164683428557940697 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0
a=extmap-allow-mixed
a=msid-semantic: WMS 542c8f1c-b2e8-4b46-8503-5277b3c628c3
m=audio 62874 UDP/TLS/RTP/SAVPF 111 63 9 0 8 13 110 126
c=IN IP4 10.10.10.135
a=rtcp:9 IN IP4 0.0.0.0
a=candidate:1328652830 1 udp 2122260223 10.10.10.135 62874 typ host generation 0 network-id 1
a=candidate:2979755658 1 tcp 1518280447 10.10.10.135 9 typ host tcptype active generation 0 network-id 1
a=ice-ufrag:VY5Q
a=ice-pwd:atUYKfRy9vhp0nMT847h2Fbt
a=ice-options:trickle
a=fingerprint:sha-256 E3:0B:40:B6:8A:B1:9D:19:6C:C6:E8:1B:C0:D2:BF:11:E7:C6:BE:A2:25:D7:1E:43:34:C0:37:9D:C1:64:AF:2B
a=setup:actpass
a=mid:0
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid
a=sendrecv
a=msid:542c8f1c-b2e8-4b46-8503-5277b3c628c3 2ce77510-2ea7-46c7-9c87-a51c093f5982
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc
a=fmtp:111 minptime=10;useinbandfec=1
a=rtpmap:63 red/48000/2
a=fmtp:63 111/111
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:13 CN/8000
a=rtpmap:110 telephone-event/48000
a=rtpmap:126 telephone-event/8000
a=ssrc:531608100 cname:XCbvh2SbM0Pf6D7b
a=ssrc:531608100 msid:542c8f1c-b2e8-4b46-8503-5277b3c628c3 2ce77510-2ea7-46c7-9c87-a51c093f5982

%c +0ms", "color: #FF0066", "color: inherit", "color: #FF0066"
"%cJsSIP:WebSocketInterface %csend()%c +1ms", "color: #66CC33", "color: inherit", "color: #66CC33"
"%cJsSIP:InviteClientTransaction %cTimer D expired for transaction z9hG4bK2918698%c +14s", "color: #FF3333", "color: inherit", "color: #FF3333"
"%cJsSIP:WebSocketInterface %creceived WebSocket message%c +50ms", "color: #66CC33", "color: inherit", "color: #66CC33"
"%cJsSIP:Transport %creceived text message:

SIP/2.0 100 Giving it a try
Via: SIP/2.0/WSS 526h81p4pd99.invalid;received=103.106.194.125;rport=48134;branch=z9hG4bK5677102
To: <sip:9026951168@sip01.sipprovider.com>
From: <sip:x245akwD@sip01.sipprovider.com>;tag=4o2j6p6jqg
Call-ID: 0fp8ni4redbckebe3q6j
CSeq: 6702 INVITE
Server: OpenSIPS (3.3.0 (x86_64/linux))
Content-Length: 0

%c +51ms", "color: #FF0066", "color: inherit", "color: #FF0066"
"%cJsSIP:RTCSession %creceiveInviteResponse()%c +103ms", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:WebSocketInterface %creceived WebSocket message%c +100ms", "color: #66CC33", "color: inherit", "color: #66CC33"
"%cJsSIP:Transport %creceived text message:

SIP/2.0 180 Ringing
Via: SIP/2.0/WSS 526h81p4pd99.invalid;rport=48134;received=103.106.194.125;branch=z9hG4bK5677102
Record-Route: <sip:103.163.40.230;r2=on;lr;ftag=4o2j6p6jqg;did=f87.d2e83441>
Record-Route: <sip:103.163.40.230:443;transport=wss;r2=on;lr;ftag=4o2j6p6jqg;did=f87.d2e83441>
From: <sip:x245akwD@sip01.sipprovider.com>;tag=4o2j6p6jqg
To: <sip:9026951168@sip01.sipprovider.com>;tag=as67cf82c0
Call-ID: 0fp8ni4redbckebe3q6j
CSeq: 6702 INVITE
Server: Asterisk PBX 18.6.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Session-Expires: 90;refresher=uas
Contact: <sip:9026951168@192.168.159.41:5060>
Content-Length: 0

%c +100ms", "color: #FF0066", "color: inherit", "color: #FF0066"
"%cJsSIP:RTCSession %creceiveInviteResponse()%c +100ms", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:Dialog %cnew UAC dialog created with status EARLY%c +14s", "color: #33CC33", "color: inherit", "color: #33CC33"
"%cJsSIP:RTCSession %csession progress%c +0ms", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:RTCSession %cemit &quot;progress&quot;%c +0ms", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:WebSocketInterface %creceived WebSocket message%c +711ms", "color: #66CC33", "color: inherit", "color: #66CC33"
"%cJsSIP:Transport %creceived text message:

SIP/2.0 180 Ringing
Via: SIP/2.0/WSS 526h81p4pd99.invalid;rport=48134;received=103.106.194.125;branch=z9hG4bK5677102
Record-Route: <sip:103.163.40.230;r2=on;lr;ftag=4o2j6p6jqg;did=f87.d2e83441>
Record-Route: <sip:103.163.40.230:443;transport=wss;r2=on;lr;ftag=4o2j6p6jqg;did=f87.d2e83441>
From: <sip:x245akwD@sip01.sipprovider.com>;tag=4o2j6p6jqg
To: <sip:9026951168@sip01.sipprovider.com>;tag=as67cf82c0
Call-ID: 0fp8ni4redbckebe3q6j
CSeq: 6702 INVITE
Server: Asterisk PBX 18.6.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Session-Expires: 90;refresher=uas
Contact: <sip:9026951168@192.168.159.41:5060>
Content-Length: 0

%c +712ms", "color: #FF0066", "color: inherit", "color: #FF0066"
"%cJsSIP:RTCSession %creceiveInviteResponse()%c +711ms", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:RTCSession %csession progress%c +0ms", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:RTCSession %cemit &quot;progress&quot;%c +0ms", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:WebSocketInterface %creceived WebSocket message%c +792ms", "color: #66CC33", "color: inherit", "color: #66CC33"
"%cJsSIP:Transport %creceived text message:

SIP/2.0 183 Session Progress
Via: SIP/2.0/WSS 526h81p4pd99.invalid;rport=48134;received=103.106.194.125;branch=z9hG4bK5677102
Record-Route: <sip:103.163.40.230;r2=on;lr;ftag=4o2j6p6jqg;did=f87.d2e83441>
Record-Route: <sip:103.163.40.230:443;transport=wss;r2=on;lr;ftag=4o2j6p6jqg;did=f87.d2e83441>
From: <sip:x245akwD@sip01.sipprovider.com>;tag=4o2j6p6jqg
To: <sip:9026951168@sip01.sipprovider.com>;tag=as67cf82c0
Call-ID: 0fp8ni4redbckebe3q6j
CSeq: 6702 INVITE
Server: Asterisk PBX 18.6.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Session-Expires: 90;refresher=uas
Contact: <sip:9026951168@192.168.159.41:5060>
Content-Type: application/sdp
Require: timer
Content-Length: 693

v=0
o=root 64994987 64994987 IN IP4 103.163.40.241
s=Asterisk PBX 18.6.0
c=IN IP4 103.163.40.241
t=0 0
m=audio 13584 UDP/TLS/RTP/SAVPF 111 0 8 126
a=maxptime:20
a=mid:0
a=rtpmap:111 opus/48000/2
a=fmtp:111 useinbandfec=1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:126 telephone-event/8000
a=fmtp:126 0-16
a=sendrecv
a=rtcp:13584
a=rtcp-mux
a=setup:active
a=fingerprint:sha-256 01:F4:35:DC:48:F7:89:D3:A0:48:31:41:56:A0:67:8C:74:47:FC:97:B2:8A:A3:D1:D0:15:1E:ED:1B:36:14:33
a=ptime:20
a=ice-ufrag:ZScToNgg
a=ice-pwd:tGC7ADo18G2WBrgq2ksSpX8ne7
a=ice-options:trickle
a=candidate:jI2oon5gu1OTmegP 1 UDP 2130706431 103.163.40.241 13584 typ host
a=end-of-candidates

%c +791ms", "color: #FF0066", "color: inherit", "color: #FF0066"
"%cJsSIP:RTCSession %creceiveInviteResponse()%c +792ms", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:RTCSession %csession progress%c +0ms", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:RTCSession %cemit &quot;progress&quot;%c +0ms", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:RTCSession %cemit &quot;sdp&quot;%c +0ms", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:WebSocketInterface %creceived WebSocket message%c +11s", "color: #66CC33", "color: inherit", "color: #66CC33"
"%cJsSIP:Transport %creceived text message:

SIP/2.0 200 OK
Via: SIP/2.0/WSS 526h81p4pd99.invalid;rport=48134;received=103.106.194.125;branch=z9hG4bK5677102
Record-Route: <sip:103.163.40.230;r2=on;lr;ftag=4o2j6p6jqg;did=f87.d2e83441>
Record-Route: <sip:103.163.40.230:443;transport=wss;r2=on;lr;ftag=4o2j6p6jqg;did=f87.d2e83441>
From: <sip:x245akwD@sip01.sipprovider.com>;tag=4o2j6p6jqg
To: <sip:9026951168@sip01.sipprovider.com>;tag=as67cf82c0
Call-ID: 0fp8ni4redbckebe3q6j
CSeq: 6702 INVITE
Server: Asterisk PBX 18.6.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Session-Expires: 90;refresher=uas
Contact: <sip:9026951168@192.168.159.41:5060>
Content-Type: application/sdp
Require: timer
Content-Length: 693

v=0
o=root 64994987 64994987 IN IP4 103.163.40.241
s=Asterisk PBX 18.6.0
c=IN IP4 103.163.40.241
t=0 0
m=audio 13584 UDP/TLS/RTP/SAVPF 111 0 8 126
a=maxptime:20
a=mid:0
a=rtpmap:111 opus/48000/2
a=fmtp:111 useinbandfec=1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:126 telephone-event/8000
a=fmtp:126 0-16
a=sendrecv
a=rtcp:13584
a=rtcp-mux
a=setup:active
a=fingerprint:sha-256 01:F4:35:DC:48:F7:89:D3:A0:48:31:41:56:A0:67:8C:74:47:FC:97:B2:8A:A3:D1:D0:15:1E:ED:1B:36:14:33
a=ptime:20
a=ice-ufrag:ZScToNgg
a=ice-pwd:tGC7ADo18G2WBrgq2ksSpX8ne7
a=ice-options:trickle
a=candidate:jI2oon5gu1OTmegP 1 UDP 2130706431 103.163.40.241 13584 typ host
a=end-of-candidates

%c +11s", "color: #FF0066", "color: inherit", "color: #FF0066"
"%cJsSIP:RTCSession %creceiveInviteResponse()%c +11s", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:Dialog %cdialog 0fp8ni4redbckebe3q6j4o2j6p6jqgas67cf82c0 changed to CONFIRMED state%c +13s", "color: #33CC33", "color: inherit", "color: #33CC33"
"%cJsSIP:RTCSession %cemit &quot;sdp&quot;%c +1ms", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:RTCSession %csession accepted%c +2ms", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:RTCSession %cemit &quot;accepted&quot;%c +1ms", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:RTCSession %csendRequest()%c +0ms", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:Transport %csend()%c +6ms", "color: #FF0066", "color: inherit", "color: #FF0066"
"%cJsSIP:Transport %csending message:

ACK sip:9026951168@192.168.159.41:5060 SIP/2.0
Route: <sip:103.163.40.230:443;transport=wss;r2=on;lr;ftag=4o2j6p6jqg;did=f87.d2e83441>
Route: <sip:103.163.40.230;r2=on;lr;ftag=4o2j6p6jqg;did=f87.d2e83441>
Via: SIP/2.0/WSS 526h81p4pd99.invalid;branch=z9hG4bK1933423
Max-Forwards: 69
To: <sip:9026951168@sip01.sipprovider.com>;tag=as67cf82c0
From: <sip:x245akwD@sip01.sipprovider.com>;tag=4o2j6p6jqg
Call-ID: 0fp8ni4redbckebe3q6j
CSeq: 6702 ACK
Allow: INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO,NOTIFY
Supported: outbound
User-Agent: JsSIP 3.4.2
Content-Length: 0

%c +0ms", "color: #FF0066", "color: inherit", "color: #FF0066"
"%cJsSIP:WebSocketInterface %csend()%c +6ms", "color: #66CC33", "color: inherit", "color: #66CC33"
"%cJsSIP:RTCSession %csession confirmed%c +1ms", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:RTCSession %cemit &quot;confirmed&quot;%c +0ms", "color: #99CC00", "color: inherit", "color: #99CC00"
"%cJsSIP:WebSocketInterface %creceived WebSocket message%c +12s", "color: #66CC33", "color: inherit", "color: #66CC33"
"%cJsSIP:Transport %creceived text message:

OPTIONS sip:ui25l1ab@526h81p4pd99.invalid;transport=ws SIP/2.0
Via: SIP/2.0/WSS 103.163.40.230:443;branch=z9hG4bK572.edb8810000003501
From: sip:pinger@192.168.159.230;tag=07b883d3
To: sip:ui25l1ab@526h81p4pd99.invalid;transport=ws
Call-ID: 3e11b965-0504838-6f1262@103.163.40.230
CSeq: 1 OPTIONS
Max-Forwards: 70
Content-Length: 0

%c +12s", "color: #FF0066", "color: inherit", "color: #FF0066"
"%cJsSIP:Transport %csend()%c +1ms", "color: #FF0066", "color: inherit", "color: #FF0066"
"%cJsSIP:Transport %csending message:

SIP/2.0 200 OK
Via: SIP/2.0/WSS 103.163.40.230:443;branch=z9hG4bK572.edb8810000003501
To: sip:ui25l1ab@526h81p4pd99.invalid;transport=ws;tag=nsfmc92lc3
From: sip:pinger@192.168.159.230;tag=07b883d3
Call-ID: 3e11b965-0504838-6f1262@103.163.40.230
CSeq: 1 OPTIONS
Allow: INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO,NOTIFY
Accept: application/sdp, application/dtmf-relay
Supported: outbound
Content-Length: 0

%c +0ms", "color: #FF0066", "color: inherit", "color: #FF0066"
"%cJsSIP:WebSocketInterface %csend()%c +1ms", "color: #66CC33", "color: inherit", "color: #66CC33"
"%cJsSIP:NonInviteServerTransaction %cTimer J expired for transaction z9hG4bK572.edb8810000003501%c +30s", "color: #6633CC", "color: inherit", "color: #6633CC"

the attached log after call pickup successfully

@lavkushtyagi
Copy link

Generally it is codec, NAT or route problem.

I want to made audio call
the attached log after successfully call made and pickup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment