Skip to main content

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

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);
});



@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.


Reply