WebRTC client


Configure your WebRTC SIP client with the following settings.

Client settings

Parameter Value
Servers wss://voip.46elks.com/w1/websocket
Username Client number without the + sign like 4600100100.
Password The password for the number it is the value "secret" on the number object in the API.
URI The server and number in combination like 4600100100@voip.46elks.com

Outgoing phone calls

Special configuration is required to enable outgoing phone calls directly from a SIP or webRTC client. Our solution architect Ben would gladly help you get the right voice setup for your use case. You can reach him at ben@46elks.com or +46 766 866 966.

Sample code

Using SIP.js found at: https://sipjs.com/

<script src="/static/js/libs/sip-0.11.2.min.js"></script>

  // Initiate client
  var outinnumber = "+46700000000";
  var session = {"status":0};
  var userAgent = new SIP.UA({ 
    transportOptions: {
      wsServers: [
      uri: '4600100100@voip.46elks.com',
      authorizationUser: '4600100100',
      registerExpires: 60,
      sessionDescriptionHandlerFactoryOptions: {
        constraints: {
          audio: true,
          video: false

  // Initiate ring sound
  var ringAudio = new Audio('/static/sound/ring.mp3');
  ringAudio.loop = true;

  // Handle new call
    function (incomingSession) {
      // If call is ongoing terminate new call.
      if (session.status == 12) {

      // Set global call to incoming call.
      session = incomingSession;

      // Add sound to browser when call is connected.
      session.on('accepted', addsound);

      // If the call is coming from self (outgoing call)
      // make automatic pickup.
      if(session.remoteIdentity.uri.user == outinnumber){
      // In other case play ringtone.
      else {

  // Add sound from the remote caller to the browser.
  function addsound(){
    var domElement = document.getElementById('audio');
    var pc = session.sessionDescriptionHandler.peerConnection;
    var remoteStream = new MediaStream();
      function(receiver) {
        var track = receiver.track;
        if (track) {
    domElement.srcObject = remoteStream;

  // Initiate outgoing all with a request to the API for call.
  function startCall(to) {
    var domElement = document.getElementById('audio');
        voice_start: '{"connect":"'+to+'"}',
        to: "+4600100100",
        from: outinnumber,
      function(data, status) {}
<audio id="audio">
<button onclick="session.accept();">Pickup</button>
<button onclick="session.bye();">Hangup</button>
<button onclick="startCall('+4634090510')">Call</button>