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
Rest API - how to get notified when there's incoming call
Tags: rest api
Jul 10, 2017 at 10:28am   •   5 replies  •  0 likes
liu

I'm creating a browser app to use rest APIs. One critical feature is to show waiting calls. I tried to use subscription to get notified when there's new incoming call. But subscription seems not working for either active-calls or call-logs API. I got invalid event filter error.

So subscription doesn't support call logs?

5 Answers
answered on Jul 31, 2017 at 9:56am  
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
answered on Jul 29, 2017 at 7:31am  
Hi Liu,

Yes, you need to login your SoftPhone with the extension phone number which you want to monitor an incoming call. You have to switch your SoftPhone to sandbox mode before you can login with sandbox account. In Windows PC, press Ctrl + F2 and in MacOS, press Fn+Command+F2 simultaneously and select sandbox mode.

+ Paco

 0
answered on Jul 28, 2017 at 11:22am  
Thanks everybody for reply. I tried agent presence subscription. But I only got notified when agent changes presence, but when there's incoming call, no notification. Is it because I don't have softphone connected? Problem is I couldn't login to softphone, it's testing environment.
The following is my code:
  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});
      });
    }
  }

 0
answered on Jul 10, 2017 at 5:34pm  
Probably you should use detailed presence with active calls information - see https://developer.ringcentral.com/api-docs/latest/index.html#!#RefGetDetailedExtensionPresenceEvent. It is not a direct alternative for active-calls but the best we have today. We are working on extending the event payload to contain more details about a call to eliminate a need of calling active-calls API after a call is finished.

 0
answered on Jul 10, 2017 at 4:45pm  
Hi Liu,

First of all, there is no event filter for call-log event. You said you got invalid event filter error, was that for what you tried with call-logs?

I am not sure what you meant "active-calls" while your question was about to get notified when there's new incoming call (new coming call is not an active-call yet). To get notified when there is an incoming call, you can simply subscribe to the account presence event with this event type "/restapi/v1.0/account/~/presence". Then when there is an incoming call, you should receive this "telephonyStatus":"Ringing" inside the body of the notification payload.

If this is not what you wanted, please clarify more your question and post the event filter your tried and the error message you got.

Kind regards,
Paco

 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