title: How to use a JS SIP library using a non-websockets transport?
body: <p>This question was asked by somebody on Quora <a href="https://www.quora.com/unanswered/Is-a-node-js-SIP-stack-that-will-support-UDP-and-TCP-and-not-only-WebSockets-availablend%20not%20only%20WebSockets,%20available?" rel="nofollow">here</a> but there was no answer. Is there any work around solution for this, other than changing the source code of jsSip?</p>
  
  <p>The issue is that most JS SIP libraries that work with webRTC do so through websockets (RFC 7118). ALso, Chrome now requires getUserMedia interface to be run on a https which imposes additional requirements on the SIP server side. The SIP server must also support websockets, SRTP, DTLS, etc. </p>
  
  <p>All this makes sense if the SIP calls are made through a browser, either as a signalling mechanism for webRTC or non-webRTC telephony calls through a web page. </p>
  
  <p>However, when the SIP server is on the local network and the SIP call has to be initiated from an app server, all these requirements are no longer applicable. It should be possible to make JS SIP calls over plain UDP without the need to run a http server with the SIP server as the http server in my case is integrated with the application server itself. </p>
  
  <pre><code>Scenario 1 as supported bymost JS SIP libraries:
  JSSIP (in HTML page &lt;------&gt;websockets&lt;----&gt;[http-builtin with SIP server]&lt;----&gt;PSTN
  
  Scenario 2 which applies to the question:
  JSSIP (in HTML page &lt;--https----&gt;app-server with https-server&lt;----local net---&gt;[SIP server] &lt;-----&gt; PSTN  
  </code></pre>