Skip to content

Commit fd478a7

Browse files
fix: voip call history doesn't always log the correct call information (#35006)
1 parent ba0cbd3 commit fd478a7

File tree

61 files changed

+9218
-811
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+9218
-811
lines changed

.changeset/shy-colts-appear.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
'@rocket.chat/model-typings': patch
3+
'@rocket.chat/core-typings': patch
4+
'@rocket.chat/freeswitch': patch
5+
'@rocket.chat/ui-voip': patch
6+
'@rocket.chat/models': patch
7+
'@rocket.chat/tools': patch
8+
'@rocket.chat/meteor': patch
9+
---
10+
11+
Fixes the parsing of FreeSwitch events to properly generate a history of calls on Rocket.Chat

apps/meteor/app/statistics/server/lib/getVoIPStatistics.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { log } from 'console';
22

33
import type { IStats, IVoIPPeriodStats } from '@rocket.chat/core-typings';
4-
import { FreeSwitchCall } from '@rocket.chat/models';
4+
import { FreeSwitchChannel } from '@rocket.chat/models';
55
import { MongoInternals } from 'meteor/mongo';
66

77
import { readSecondaryPreferred } from '../../../../server/database/readSecondaryPreferred';
@@ -30,35 +30,37 @@ async function getVoIPStatisticsForPeriod(days?: number): Promise<IVoIPPeriodSta
3030
const statistics: IVoIPPeriodStats = {};
3131

3232
promises.push(
33-
FreeSwitchCall.countCallsByDirection('internal', minDate, options).then((count) => {
33+
FreeSwitchChannel.countChannelsByKind('internal', minDate, options).then((count) => {
3434
statistics.internalCalls = count;
3535
}),
3636
);
37+
3738
promises.push(
38-
FreeSwitchCall.countCallsByDirection('external_inbound', minDate, options).then((count) => {
39+
FreeSwitchChannel.countChannelsByKindAndDirection('external', 'inbound', minDate, options).then((count) => {
3940
statistics.externalInboundCalls = count;
4041
}),
4142
);
43+
4244
promises.push(
43-
FreeSwitchCall.countCallsByDirection('external_outbound', minDate, options).then((count) => {
45+
FreeSwitchChannel.countChannelsByKindAndDirection('external', 'outbound', minDate, options).then((count) => {
4446
statistics.externalOutboundCalls = count;
4547
}),
4648
);
4749

4850
promises.push(
49-
FreeSwitchCall.sumCallsDuration(minDate, options).then((callsDuration) => {
51+
FreeSwitchChannel.sumChannelsDurationByKind('internal', minDate, options).then((callsDuration) => {
5052
statistics.callsDuration = callsDuration;
5153
}),
5254
);
5355

5456
promises.push(
55-
FreeSwitchCall.countCallsBySuccessState(true, minDate, options).then((count) => {
57+
FreeSwitchChannel.countChannelsByKindAndSuccessState('internal', true, minDate, options).then((count) => {
5658
statistics.successfulCalls = count;
5759
}),
5860
);
5961

6062
promises.push(
61-
FreeSwitchCall.countCallsBySuccessState(false, minDate, options).then((count) => {
63+
FreeSwitchChannel.countChannelsByKindAndSuccessState('internal', false, minDate, options).then((count) => {
6264
statistics.failedCalls = count;
6365
}),
6466
);

apps/meteor/client/hooks/useVoipClient.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ export const useVoipClient = (): UseVoipClientResult => {
8585
iceServers,
8686
connectionRetryCount: Number(voipRetryCount),
8787
enableKeepAliveUsingOptionsForUnstableNetworks: Boolean(enableKeepAlive),
88+
userId: uid || '',
89+
siteUrl: '',
8890
};
8991

9092
client = await (isEE ? EEVoipClient.create(config) : VoIPUser.create(config));

0 commit comments

Comments
 (0)