question

Muhammad Shoaib avatar image
Muhammad Shoaib asked Phong Vu commented

Call events are not getting received

I've followed this ringcentral tutorial to receive call events when a call is placed but it's not firing events at all when comes in

getting started
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image
Phong Vu answered Muhammad Shoaib commented

I think it must be some thing was wrong in your environment. Can you test this simple code on your sandbox environment. You can try with and without the param "?detailedTelephonyState=true".

var SDK = require('ringcentral')

RINGCENTRAL_CLIENTID = ''
RINGCENTRAL_CLIENTSECRET = ''
RINGCENTRAL_SERVER = 'https://platform.devtest.ringcentral.com'

RINGCENTRAL_USERNAME = ''
RINGCENTRAL_PASSWORD = ''
RINGCENTRAL_EXTENSION = ''

var rcsdk = new SDK({
      server: RINGCENTRAL_SERVER,
      appKey: RINGCENTRAL_CLIENTID,
      appSecret: RINGCENTRAL_CLIENTSECRET
  });
var platform = rcsdk.platform();
var subscription = rcsdk.createSubscription();

platform.login({
      username: RINGCENTRAL_USERNAME,
      password: RINGCENTRAL_PASSWORD,
      extension: RINGCENTRAL_EXTENSION
      })
      .then(function(resp) {
          subscribe_for_presence_notification()
      });

function subscribe_for_presence_notification(){
    var eventFilters = [
      '/restapi/v1.0/account/~/presence?detailedTelephonyState=true'
    ]
    subscription.setEventFilters(eventFilters)
    .register()
    .then(function(subscriptionResponse) {
        console.log("Ready to receive all users' presence status via PubNub.")
    })
    .catch(function(e) {
        console.error(e);
        throw e;
    });
}

subscription.on(subscription.events.notification, function(msg) {
    console.log(msg.body);
});


1 comment
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Muhammad Shoaib avatar image Muhammad Shoaib commented ·

Accepted the answer since it was helpful narrowing down the issue and to close out the ticket. But I'd strongly recommend updating the tutorial as its missing a key point.

0 Likes 0 ·
Muhammad Shoaib avatar image
Muhammad Shoaib answered Phong Vu commented

@Phong Vu Thank you for the help, this piece of code wasn't working either, going through articles I suspected the permissions I had ("ReadCallLog" and "ReadAccounts" as mentioned in the tutorial) for the ringcentral app might be bit off and after I added the "Read Presence" permissions the code you sent started to work I also ran some tests to make sure this actually is the issue. If I may, I'd like to suggest updating the tutorials to dictate to also include adding the "Read Presence" permission to help first timers like myself.

1 comment
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image Phong Vu ♦♦ commented ·

Thanks for pointing out the mistake. The permissions that tutorial app needs are just the "ReadCallLog" and the "ReadPresence". I will fix the mistake in the tutorial soon.

Thanks

0 Likes 0 ·

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys