question

bruno-dmello15858 avatar image
bruno-dmello15858 asked bruno-dmello15858 commented

api subscription to department extension not forwarding the call to agents automatically on call arrival

steps

1. I am subscribed to all the following extensions : departments, individual extension ids

2. whenever we recieve a call and the caller types the extension id for individual agent , we recieve the agents presence in subscription properly..

3. when I select on department 's extension on call, the call is not forwarded to agent directly, and I am not receiving that notification in callback for that agent. Instead I receive notification object for department extension as :

{


"uuid": "*",

"event": "/restapi/v1.0/account/*/extension/*/presence?detailedTelephonyState=true",

"timestamp": "*",

"subscriptionId": "*",

"ownerId": "*",

"body": {


"extensionId": *,

"sequence": *,

"presenceStatus": "Offline"

}

}

4. even when the presence of agent extension is already enabled


So I am not able to figure out if this is right way to do things.

My aim is to recieve department call and get the presence of agent using subscription api to whom the call is forwarded to.


sdk
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image
Phong Vu answered
How do you implement the call forwarding? Via Active Call Control API or using preconfigured forwarding rules?

Can you explain more on this? 

3. when I select on department 's extension on call, the call is not forwarded to agent directly, and I am not receiving that notification in callback for that agent.

How do you select and how do you forward the call. Would be helpful if you provide some codes
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

bruno-dmello15858 avatar image
bruno-dmello15858 answered bruno-dmello15858 commented
I didn't configured anything or any api to control thing, I only made sure that under group section-> the list of users are active as well as call handling is set to simultaneous type.  

the overall procedure coded is a follows: 
1. get the list of extensions by department :
/account/~/extension?type=Department
2. then I loop over its data to get members of all department
getCallMembersExtensions = (allExtensions) => {
                 
return (extensionResults)=>{
let extensionDetails = extensionResults.json();
let memberList = extensionDetails.records.map(({id}) => {
allExtensions.push(this.getPresenceLink(id))
return platform.get('/account/~/department/${id}/members')
})
return Promise.all(memberList)
}
}
4. prepare the presence links  
getMemberPresence = (allExtensions) => {
                 
return (memberDetails) => {
console.log("memberDetails", memberDetails);
memberDetails.map((memberDatum) => {
let memberJson = memberDatum.json();
return memberJson.records.map((r) => {
allExtensions.push(this.getPresenceLink(r.id))
})
})
5. set the presence

subscription
.setEventFilters([...allExtensions, '/account/~/presence'])
.register().then(function (response) {
console.log('Success: Subscription is listening');
}).catch(function(e) {
console.log('Subscription Error: ', e);
});
5. listen to the events,
const subscription = getRcsdk().createSubscription();
subscription.on(subscription.events.notification, function(accountPresence) {
  console.log("accountPresence", accountPresence)
});
here I receive notifications for both direct agent extension on call or call queue extensions. but in case of call queue extension  , I receive this data
{
                 
  "uuid": "*",
  "event": "/restapi/v1.0/account/*/extension/*/presence?detailedTelephonyState=true",
  "timestamp": "*",
  "subscriptionId": "*",
  "ownerId": "*",
  "body": {
    "extensionId": *,
    "sequence": *,
    "presenceStatus": "Offline"
  }
no caller info, nothing else.. moreover I was expecting that it forwards the call to particular agent(as the agent's ext id is also being listened, I may recieve a notification in callback for same, but this is not happening).
please let me know if I am missing something



8 comments
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image Phong Vu ♦♦ commented ·
There are a few strange things here:

You set the presence filter at the account level 
subscription.setEventFilters([...allExtensions, '/account/~/presence']) 
This means that you will get presence status notification of all the extensions under the same account and provided that you login the app with the admin user.

However, the notification data you received came with the telephony status:
"event": "/restapi/v1.0/account/*/extension/*/presence?detailedTelephonyState=true",
I guess that you replace the tilde, the subscriptionId with the * symbol. Can you double check the subscriptionId returned after you subscribe for the event and the one in the notification payload to see if they match.

Can you try to subscribe for the presence with telephony status event at the extension level for each of the extension you want to monitor. Iterate thru the list of extensions, get the extension id then add to the filter array as shown below
'/restapi/v1.0/account/~/extension/[EXTENSION_ID]/presence?detailedTelephonyState=true'

You wrote ".. moreover I was expecting that it forwards the call to particular agent(as the agent's ext id is also being listened". I think your code has nothing to do with forwarding the call to an agent. So if you defined the forwarding with the forwarding rule, just check that part to see if it was preconfigured properly.

I will try to double check if the notification data for a call in the call queue would contain call information and let you know later. This could take some time for me to test so please be patience.
0 Likes 0 ·
bruno-dmello15858 avatar image bruno-dmello15858 commented ·
In above code I have collection all the extensions links to be subscribed in an array. the name of array is  
allExtensions
you can check in part 2, 4.
yes I have replace tilde and data with '*', just to hide the data.. if required I can definitely share it..


"Can you try to subscribe for the presence with telephony status event at the extension level for each of the extension you want to monitor. Iterate thru the list of extensions, get the extension id then add to the filter array as shown below"
 ->so in 2,4 step I have collection the extension with method

getPresenceLink(id) {
return '/restapi/v1.0/account/~/extension/${id}/presence?detailedTelephonyState=true'
}

that creates the subscription links, and then on step 5 registered all the links in array, so that I may listen to all the extensions, as well as any notification that I may miss on account level.

 hope this is all a expected.

I do get notification for all the extensions subscribed

So I guess, the only issue is the response event structure I received when called a call queue extension. let me know once you verify about this.

Forwarding    
I don't want to actually forward the call to agent number explicitly using any rule. but by default when we call the call queue extension and we get notification about it on api, in background I am sure we handle the call to particular agent, that 's what we configure in call handling and member section under group tab(which I had configured as 'simultaneous'). 


Thanks for help please let me know if anything else is required from my side 

0 Likes 0 ·
bruno-dmello15858 avatar image bruno-dmello15858 commented ·
Hello Phong Vu, 
please let me know once you receive any updates on this.
0 Likes 0 ·
Phong Vu avatar image Phong Vu ♦♦ commented ·
Hi Bruno,

I just got some time to test the queue and presence notification and here is the outcomes:

If I have no "Agent" available (meaning that none of the users added to the queue extension is logged in) then the notification body will be just as what you got. i.e. 

{"extensionId":xxxxxxxx,"sequence":22,"presenceStatus":"Offline"} ...

But if I login with one of the user (in my test, the extension 101) using the soft phone (so at least one is available/online) then I get a detailed call info from the notification body:

{"extensionId":xxxxxxxxx,"telephonyStatus":"NoCall","activeCalls":[{"id":"Y3MxNjk2MTIzOTczNTE2MjAzNjE5QDEwLjI4LjIwLjEwOQ","direction":"Inbound","from":"+1650224XXXX","toName":"Sales team","to":"+1438800XXXX","telephonyStatus":"NoCall","sessionId":"20915514004","terminationType":"final","startTime":"2019-05-07T18:23:29.883Z","partyId":"cs1696123973516203619-3","telephonySessionId":"Y3MxNjk2MTIzOTczNTE2MjAzNjE5QDEwLjI4LjIwLjEwOQ"}],"sequence":373,"presenceStatus":"Available","userStatus":"Available","dndStatus":"TakeAllCalls","message":"I am free","allowSeeMyPresence":true,"ringOnMonitoredCall":false,"pickUpCallsOnHold":false,"totalActiveCalls":1}

I am sure that if I also login with other users on added to the queue extension, then I would receive more notification for that user.

Is this what you are looking for? Please try as I did and let me know.
0 Likes 0 ·
bruno-dmello15858 avatar image bruno-dmello15858 commented ·
Thanks for your feedback. so this are the steps implemented : 
1. performed login in ringcentral integrated app with admin account.
2. logged in with call queue member account in different browser
3. made a call to company number and typed the extension for call queue in which the member is present.
4. in the integrated app, receiving the presence notification that still shows the same offline response and not the active call with callers info response

please let me know if I am missing something or what can be done about it
0 Likes 0 ·
Show more comments

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys