2

I have successfully tested the vline-node example locally but when i uploaded my code into server and my user is able to call the other person but at the other end user is unable to receive any call because there is no call to receive. i am using this script which i downloaded from GitHub. The link used in vline examples

https://github.com/vline/vline-php-example

Help me out of it if you used this. thanks

  var client, vlinesession,
    authToken = '<?php echo $vline->getJWT() ?>',
    serviceId = '<?php echo $vline->getServiceID() ?>',
    profile = {"displayName": '<?php echo $vline->getUserDisplayName() ?>', "id": '<?php echo $vline->getUserID() ?>'};

  // Create vLine client  
  window.vlineClient = client = vline.Client.create({"serviceId": serviceId, "ui": true});
  // Add login event handler
  client.on('login', onLogin);
  // Do login


  client.login(serviceId, profile, authToken);


  function onLogin(event) {
    vlinesession = event.target;
    // Find and init call buttons and init them
    $(".callbutton").each(function(index, element) {
       initCallButton($(this)); 
    });
  }

  // add event handlers for call button
  function initCallButton(button) {
    var userId = button.attr('data-userid');

    // fetch person object associated with username
    vlinesession.getPerson(userId).done(function(person) {
      // update button state with presence
      function onPresenceChange() {
        if(person.getPresenceState() == 'online'){
            button.removeClass().addClass('active');
        }else{
            button.removeClass().addClass('disabled');
        }
        button.attr('data-presence', person.getPresenceState());
      }

      // set current presence
      onPresenceChange();

      // handle presence changes
      person.on('change:presenceState', onPresenceChange);

      // start a call when button is clicked
      button.click(function() {
              if (person.getId() == vlinesession.getLocalPersonId()) {
            alert('You cannot call yourself. Login as another user in an incognito window');
            return;
              }
          if(button.hasClass('active'))
            person.startMedia();
      });
    });

  }

  return client;
})();

$(window).unload(function() {
  vlineClient.logout();
});
</script>`

0 Answers0