I have a simple app that just logs out responses from the telephony subscription. It works great in the Sandbox, but after I graduated it and use it in Production (and changing credentials), it does not create a subscription (I use this to check: https://developers.ringcentral.com/api-reference/Subscriptions/listSubscriptions). But I don't see any errors in the console.
It does print out "Ready to receive Telephony via PubNub." so it seems like it worked, but I don't see a subscription listed. Just wondering how I diagnose this further, or if I am missing something.
const RC = require('@ringcentral/sdk').SDK
const Subs = require('@ringcentral/subscriptions').Subscriptions
require('dotenv').config();
var rcsdk = new RC({
'server': process.env.RC_SERVER_URL,
'clientId': process.env.RC_CLIENT_ID,
'clientSecret': process.env.RC_CLIENT_SECRET
});
var platform = rcsdk.platform();
platform.login({
'username': process.env.RC_USERNAME,
'password': process.env.RC_PASSWORD,
'extension': process.env.RC_EXTENSION
})
var subscriptions = new Subs({ sdk: rcsdk });
var subscription = subscriptions.createSubscription({
pollInterval: 10 * 1000, renewHandicapMs: 2 * 60 * 1000
});
platform.on(platform.events.loginSuccess, () => {
subscribe_for_telephony_notification()
});
function subscribe_for_telephony_notification() {
subscription.setEventFilters(['/restapi/v1.0/account/~/telephony/sessions'])
.register()
.then(function(subscriptionResponse) {
console.log(subscriptionResponse);
console.log("Ready to receive Telephony via PubNub.")
})
.catch(function(e) {
console.error(e);
throw e;
});
}
subscription.on(subscription.events.notification, function(msg) {
console.log(msg.body);
});