Skip to main content

I am trying to pull the phone number of an Inbound active phone number routed through a call Queue for an user. I am currently using Get User Active Call to try and pull that number. It seems to work for direct calls to and from User to Client and in call Queues if the inbound phone call is ignored by users. the issue is that if a user is busy and the systems moves to the next person or if a user declines a call, the User Active Call record changes to an outbound phone call and does not have the needed phone number anymore. How can I get the external phone number that I need when the record changed from Inbound to Outbound. The phone number I am trying to get is +12222222222
What I expect:

type: Voice
internalType: LocalNumber
direction: Inbound
action: Phone Call
result: In Progress
to: {
name: Test Queue
phoneNumber: +1111111111
location: Abbyville , KS},
from: {
name: Test Queue - Sam Smith
phoneNumber: +1222222222
location: Town, St},


What I am getting:

internalType: Sip
direction: Outbound
action: VoIP
Call result: In Progress
to: {
"phoneNumber" : "+19998887777",
"extensionNumber" : "1111",
"location" : ", KS" },
from: {
"name" : "Sam Smith",
"extensionNumber" : "1111",


The user active calls list also internal calls via a call queue and that is why you see the Outbound call also. I can't explain why and what those internal calls are for but as you can see, they all has different session id and telephony session id.

In this case, I recommend you to use the /presence?detailedTelephonyState=true to read active calls and detect the 'from' phone number. See sample code and result.

async function getUserTelephonyStatus(
try {
var endpoint = `/restapi/v1.0/account/~/extension/~/presence?detailedTelephonyState=true`
var res = await platform.get(endpoint)
var jsonObj = await res.json()
if (jsonObj.hasOwnProperty('activeCalls')){
for (var record of jsonObj.activeCalls){
console.log(record)
}
}
}catch(e) {
console.log(e.message)
}
}
// example result
{
id: 's-a0d...',
direction: 'Inbound',
fromName: 'Demo queue - WIRELESS CALLER',
from: '+1650224xxxx',
toName: 'Demo queue',
to: '+1209248xxxx',
telephonyStatus: 'Ringing',
sessionId: '961173946016',
startTime: '2022-12-05T20:56:59.822Z',
partyId: 'p-a0d...',
telephonySessionId: 's-a0d...',
callInfo: {
primary: { type: 'QueueName', value: 'Demo queue' },
additional: { type: 'CallerIdName', value: 'WIRELESS CALLER' }
},
queueCall: true
}

Reply