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.