Merge pull request #5573 from matrix-org/dbkr/callstats
Log candidates for calls
This commit is contained in:
commit
33a86f6cbe
1 changed files with 41 additions and 0 deletions
|
@ -356,6 +356,7 @@ export default class CallHandler {
|
||||||
this.play(AudioID.Ringback);
|
this.play(AudioID.Ringback);
|
||||||
break;
|
break;
|
||||||
case CallState.Ended:
|
case CallState.Ended:
|
||||||
|
{
|
||||||
Analytics.trackEvent('voip', 'callEnded', 'hangupReason', call.hangupReason);
|
Analytics.trackEvent('voip', 'callEnded', 'hangupReason', call.hangupReason);
|
||||||
this.removeCallForRoom(mappedRoomId);
|
this.removeCallForRoom(mappedRoomId);
|
||||||
if (oldState === CallState.InviteSent && (
|
if (oldState === CallState.InviteSent && (
|
||||||
|
@ -393,6 +394,10 @@ export default class CallHandler {
|
||||||
// don't play the end-call sound for calls that never got off the ground
|
// don't play the end-call sound for calls that never got off the ground
|
||||||
this.play(AudioID.CallEnd);
|
this.play(AudioID.CallEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.logCallStats(call, mappedRoomId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
call.on(CallEvent.Replaced, (newCall: MatrixCall) => {
|
call.on(CallEvent.Replaced, (newCall: MatrixCall) => {
|
||||||
|
@ -412,6 +417,42 @@ export default class CallHandler {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async logCallStats(call: MatrixCall, mappedRoomId: string) {
|
||||||
|
const stats = await call.getCurrentCallStats();
|
||||||
|
logger.debug(
|
||||||
|
`Call completed. Call ID: ${call.callId}, virtual room ID: ${call.roomId}, ` +
|
||||||
|
`user-facing room ID: ${mappedRoomId}, direction: ${call.direction}, ` +
|
||||||
|
`our Party ID: ${call.ourPartyId}, hangup party: ${call.hangupParty}, ` +
|
||||||
|
`hangup reason: ${call.hangupReason}`,
|
||||||
|
);
|
||||||
|
logger.debug("Local candidates:");
|
||||||
|
for (const cand of stats.filter(item => item.type === 'local-candidate')) {
|
||||||
|
const address = cand.address || cand.ip; // firefox uses 'address', chrome uses 'ip'
|
||||||
|
logger.debug(
|
||||||
|
`${cand.id} - type: ${cand.candidateType}, address: ${address}, port: ${cand.port}, ` +
|
||||||
|
`protocol: ${cand.protocol}, relay protocol: ${cand.relayProtocol}, network type: ${cand.networkType}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
logger.debug("Remote candidates:");
|
||||||
|
for (const cand of stats.filter(item => item.type === 'remote-candidate')) {
|
||||||
|
const address = cand.address || cand.ip; // firefox uses 'address', chrome uses 'ip'
|
||||||
|
logger.debug(
|
||||||
|
`${cand.id} - type: ${cand.candidateType}, address: ${address}, port: ${cand.port}, ` +
|
||||||
|
`protocol: ${cand.protocol}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
logger.debug("Candidate pairs:");
|
||||||
|
for (const pair of stats.filter(item => item.type === 'candidate-pair')) {
|
||||||
|
logger.debug(
|
||||||
|
`${pair.localCandidateId} / ${pair.remoteCandidateId} - state: ${pair.state}, ` +
|
||||||
|
`nominated: ${pair.nominated}, ` +
|
||||||
|
`requests sent ${pair.requestsSent}, requests received ${pair.requestsReceived}, ` +
|
||||||
|
`responses received: ${pair.responsesReceived}, responses sent: ${pair.responsesSent}, ` +
|
||||||
|
`bytes received: ${pair.bytesReceived}, bytes sent: ${pair.bytesSent}, `,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private setCallAudioElement(call: MatrixCall) {
|
private setCallAudioElement(call: MatrixCall) {
|
||||||
const audioElement = getRemoteAudioElement();
|
const audioElement = getRemoteAudioElement();
|
||||||
if (audioElement) call.setRemoteAudioElement(audioElement);
|
if (audioElement) call.setRemoteAudioElement(audioElement);
|
||||||
|
|
Loading…
Reference in a new issue