I have implemented Twilio Voice JS SDK to make/receive outgoing/incoming calls from within browser.
Using the status callbacks, I get to know when the call was initiated, ringing, in progress and completed.
However, I am not able to find and record which user made/answered a call (All users have different log id and different client identity id).
When the Incoming call is received, incoming event is triggered on voice client (browser), however, there is no call information availale (call SID etc) to record it.
Similarly, when an outgoing call is made, Call SID information is not available.
Code for incoming calls and to record callsid
device.on("incoming", handleIncomingCall);
function handleIncomingCall(call) {
try{
console.log(call.properties.CallSid);
}
catch (err)
{
console.log("An error occurred while retrieving callsid properties from call object.");
}
//show incoming call div
incomingCallDiv.classList.remove("d-none");
//add event listeners for Accept, Reject, and Hangup buttons
incomingCallAcceptButton.onclick = () => {
acceptIncomingCall(call);
};
incomingCallRejectButton.onclick = () => {
rejectIncomingCall(call);
};
incomingCallHangupButton.onclick = () => {
hangupIncomingCall(call);
};
}
Message that I am getting in the console
An error occurred while retrieving callsid properties from call object.