News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Subscription not working in dev sandbox
Tags: subscription, developer sandbox
Jul 28, 2017 at 11:16am   •   5 replies  •  0 likes
liu

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

});

}

}

5 Answers
answered on Jul 31, 2017 at 2:21pm  
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 !















 1
answered on Jul 31, 2017 at 10:14am  
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?

 0
answered on Jul 28, 2017 at 1:36pm  
Can you provide the main company number under your account please ?


 0
answered on Jul 28, 2017 at 1:21pm  
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.

 0
answered on Jul 28, 2017 at 12:23pm  
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



 0



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us