Question

How to Query for Ring Out Call Duration

  • 22 May 2019
  • 3 replies
  • 1206 views

I have a requirement to record the details of calls initiated by Ring Out upon completion of the call. I'm successfully polling the Ring Out Status until the call is finished, but I can't find a way to then query for the User Call Record for the completed Ring Out. Is there a way to get the Session Id for a Ring Out call which can be used to retrieve the User Call Record and/or query for a User Call Record using a Ring Out Id? Better yet, can I create a subscription which will notify my service when a Ring Out call is completed?


3 replies

Userlevel 1
Hi Dan,

Don't poll! Use the push notifications to subscribe for the detailed extension presence event. Check the developer guide at the "Notifications and Events" section for example code in different languages. From the notification payload, you can detect when a call is ringing, connected and hangup etc. You can use the sessionId to read the record from the call log later to get more details of that call. Unfortunately, the notification payload does not contain the call type so if you are interested at only "RingOut" call, you will have to check it from the call log record.
Thanks for the quick reply! I tried following your suggestion but the subscription callback is never firing. I'm implementing this in Java so the examples are limited. Is there anything obvious I'm doing wrong?
 private void subscribeToPhoneEvents(String extensionId) {     if(extensionSubscriptions.containsKey(extensionId)) {   return;  }  String[] eventFilters = new String[]  {   String.format("/restapi/v1.0/account/%s/extension/%s/presence?detailedTelephonyState=true", ringCentralAccount, extensionId)  };  Consumer<String> callback = payload -> {    DetailedPresenceNotification notification = JSON.parseObject( payload, DetailedPresenceNotification.class);   DetailedPresenceEvent event = notification.body;   if(event.telephonyStatus.equals("NoCall") && event.terminationType.equals("final")){    for(DetailedPresenceEvent_ActiveCallInfo callInfo: event.activeCalls) {     // Record Phone call details    }   }  };  RestClient restClient = new RestClient(ringCentralClientId, ringCentralClientSecret, ringCentralServer);  try {   restClient.authorize(ringCentralAccount, extensionId, ringCentralPassword);   Subscription subscription = restClient.subscription(eventFilters, callback);   subscription.subscribe();   extensionSubscriptions.put(extensionId, subscription);  } catch (IOException | RestException e) {   LOGGER.error(e.getMessage(),e);  } } 

I believe my subscription wasn't getting triggered because I hadn't given the app enough permissions. I'm successfully receiving notifications for phone calls, how can I receive a notification when a fax is successfully sent? I see fax records in the user's call log history but I'm not receiving a presence event when the fax is successfully transmitted.

Reply