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