question

liu6213 avatar image
liu6213 asked bruno-dmello15858 commented

Subscription not working in dev sandbox

I have the following code to subscribe agent presence. Base on RingCentral API document, it should get notifed when there's incoming call. But I can only get notified when agent changes presence. But when there's incoming call, no notification.
  var loadAgentInfo = function (allAgents) {
    var agentIds = getAgentIds(allAgents);
    if (agentIds) {
      $scope.rcsdk.platform().get('/account/~/extension/' + agentIds, {}).then(function(agentRes) {
        var agents = agentRes.multipart();

        var subscription = $scope.rcsdk.createSubscription();
        var callLogSubscription = $scope.rcsdk.createSubscription();

        subscription.on(subscription.events.notification, function(msg) {
          $scope.loadAgentsStatus();
        });

        var callLogEvents = [];
        var presenceEvents = [];
        for (var j = 0; j < agents.length; j++) {
          var agentJson = agents[j].json();
          populateAgentInfo(agentJson);
          //presenceEvents.push('/account/~/extension/'+ agentJson.id + '/presence');
          presenceEvents.push('/account/~/extension/'+ agentJson.id + '/presence?detailedTelephonyState=true');
        }
        presenceEvents.push('/account/~/presence');
        subscription.setEventFilters(presenceEvents).register();
        $scope.$apply();
        $scope.loadAgentsStatus();

      }).catch(function(agentErr) {
        Notification.error({message: "Loading agent info failed!", positionY: 'top', positionX: 'center', delay: 10 * 1000});
      });
    }
  }
General Topic
1 |1500 characters needed characters left characters exceeded

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

ak avatar image
ak answered Phong Vu commented
Liu,

Subscription is working in Sandbox. However, I am not sure  why you are creating another subscription named 'callLogSubscription' as per the code above:

 var callLogSubscription = $scope.rcsdk.createSubscription();  
We have a demo app to showcase "Subscription-basics" in node.js . Kindly take a look at the github repo below:
https://github.com/ringcentral-tutorials/subscription-basics-nodejs-demo


4 comments
1 |1500 characters needed characters left characters exceeded

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

I removed that line of code, still not working. I run my application in browser, although the RingCentral app I created is "Server-only" type. Is this a problem?
0 Likes 0 ·

No, that should not be a problem. Can you send an email to the developer support team or submit a support ticket and we can do a screen share to get this resolved.

0 Likes 0 ·
Hello, I have some problem with registering the subscription... it says like that;
C:\Users\admin_2\Desktop\callrecording-notification-node-master>node index.js
(node:8588) UnhandledPromiseRejectionWarning: Error: Subscription is not alive
    at Subscription._subscribeAtPubnub (C:\Users\admin_2\Desktop\callrecording-notification-node-master\node_modules\ringcentral\src\subscription\Subscription.js:422:30)
    at Subscription.setSubscription (C:\Users\admin_2\Desktop\callrecording-notification-node-master\node_modules\ringcentral\src\subscription\Subscription.js:130:10)
    at Subscription.<anonymous> (C:\Users\admin_2\Desktop\callrecording-notification-node-master\node_modules\ringcentral\src\subscription\Subscription.js:207:14)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:8588) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:8588) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.



Please help me, it is urgent.

0 Likes 0 ·
Hi Anton,

First of all, this kind of question should be better asked in a new thread instead of riding on an old question and worse, as a comment in an old answer.

Back to your question, it looks like you are using the call-recording-node tutorial.

Did you follow all the steps in the tutorial to setup your environment? I am not sure about the root cause of the problem on your environment because using PubNub push notification from the JS SDK is very straightforward and I don't have any problem with it.

Did you modify the tutorial code at all? If yes, please share the new code snippets of the changes.

Can you also run the app on different network/machine etc.?

Let me know if nothing helps, and if you want to try the push notification via webhook, then I can help.

+ Phong

0 Likes 0 ·
liu6213 avatar image
liu6213 answered
This is probably because I didn't setup presence monitoring. To achieve that do I need to install softphone first?
I tried, but couldn't log in. The error I got is:

Unfortunately, application cannot be used due to the restriction on the account level. Please contact your account administrator to enable this permission.
1 |1500 characters needed characters left characters exceeded

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

ak avatar image
ak answered ak commented
Can you provide the main company number under your account please ?

2 comments
1 |1500 characters needed characters left characters exceeded

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

(267) 863-4786
0 Likes 0 ·
Liu,

To login into the Softphone using your Sandbox Credentials, you would first need to point the softphone to the ' Sandbox Environment' :
  • Launch the downloaded application.

  • When the login screen is displayed press Cntrl+F2 (for Mac Fn+Command+F2).

  • Press 'Sandbox' in the pop-up menu and sign in with your sandbox account credentials.
You can find this information here :  https://developer.ringcentral.com/library/getting-started.html under the section ' Your Softphone'

**make sure you have the latest version of Softphone from our App Gallery.
0 Likes 0 ·
liu6213 avatar image
liu6213 answered
One more question, how can I monitor incoming calls to call queue? Currently I can monitor calls for all agents of a call queue. But the problem is if all agents are busy, then one more incoming call to the call queue I won't be able to get notified by monitoring all agents. Any solutions?
1 |1500 characters needed characters left characters exceeded

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

ak avatar image
ak answered bruno-dmello15858 commented
Hi LIU,

Here's my two cents on ' How can I monitor incoming calls to call queue?'


A call queue would have Call Handling Rules which can be set either via Service Web or via API's. Per which the calls would be processed in same accordance on all the agents inside of the queue.

Lets say there is an agent named A inside the call queue and when A is already on a call, you would receive a notification as below:  ( just the active calls object of the Push notification ) 

 "activeCalls": [
      {
        "id": "8a5f8b7e9d5845b480ae6716c5041fba",
        "direction": "Inbound",
        "fromName": "Bla Bla",
        "from": "+Customer 1 Number ",
        "toName": "RingCentral Developers",
        "to": "+RingCentral Number Agent A",
        "telephonyStatus": "CallConnected",
        "sessionId": "160241057020",
        "startTime": "2017-07-31T21:04:27.300Z"
      }
    ]

Now, if the call queue receives another call , and lets assume agent A is the first one in either of the below handling rules :

1.) Rotating
2.) Simultaneous
3.) In fixed Order

Agent A would receive a Push notification just as we did early but with a second leg which provides information about the incoming call: ( just the active calls object of the Push notification )
    "activeCalls": [
      {
        "id": "bebfd12e5a884f0c84ca934408ba608a",
        "direction": "Inbound",
        "fromName": "Customer 2 Peter",
        "from": "+Customer 2 Number",
        "toName": "RingCentral Developers",
        "to": "+RingCentral Number Agent A",
        "telephonyStatus": "Ringing",
        "sessionId": "160241208020",
        "startTime": "2017-07-31T21:04:51.579Z"
      },
      {
        "id": "8a5f8b7e9d5845b480ae6716c5041fba",
        "direction": "Inbound",
        "fromName": "RAY D COMPANY",
        "from": "+Customer 1 Number",
        "toName": "RingCentral Developers",
        "to": "+ RingCentral Number Agent A",
        "telephonyStatus": "CallConnected",
        "sessionId": "160241057020",
        "startTime": "2017-07-31T21:04:27.300Z"
      }
    ],
This could notify that there is an inbound call on the Call Queue ( which in-turn is being routed to the agents in the order specified under the call handling rules )

Hope this helps !














5 comments
1 |1500 characters needed characters left characters exceeded

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

I have tried this. I had only 1 agent on my call queue. I set the "Call Handling" to "In Fixed Order". Made 1 phone call to call queue and had the agent connected the phone call. Then Made another phone call to the call queue. I didn't get any notification.
0 Likes 0 ·
Just to be sure, you are Subscribed to the agent right ? 
0 Likes 0 ·
Yes, I subscribed to the agent.
0 Likes 0 ·
Did you get this figured out LIU? I am working on a similar problem.
0 Likes 0 ·
I am working on same..
I am subscribed to individual agents extension ids, as well as department ids, and receive notification. when I select on department 's extension on call, the call is not forwarded to agent, and I am not receiving that notification in callback for that agent. Instead I receive notification object for department extension as :
{
  "uuid": "*",
  "event": "/restapi/v1.0/account/*/extension/*/presence?detailedTelephonyState=true",
  "timestamp": "*",
  "subscriptionId": "*",
  "ownerId": "*",
  "body": {
    "extensionId": *,
    "sequence": *,
    "presenceStatus": "Offline"
  }
}
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