Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion apps/meteor/server/services/omnichannel-voip/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,16 @@ export class OmnichannelVoipService extends ServiceClassInternal implements IOmn
*/

// Use latest queue caller join event
const numericPhone = guest?.phone?.[0]?.phoneNumber.replace(/\D/g, '');
const callStartPbxEvent = await PbxEvents.findOne(
{
phone: guest?.phone?.[0]?.phoneNumber,
$or: [
{
phone: numericPhone, // Incoming calls will have phone number (connectedlinenum) without any symbol
},
{ phone: `*${numericPhone}` }, // Outgoing calls will have phone number (connectedlinenum) with * prefix
{ phone: `+${numericPhone}` }, // Just in case
],
event: {
$in: ['QueueCallerJoin', 'DialEnd', 'DialState'],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export class ContinuousMonitor extends Command {
return;
}

if (event.dialstatus.toLowerCase() !== 'answer' && event.dialstatus.toLowerCase() !== 'ringing') {
if (!['answer', 'ringing'].includes(event.dialstatus.toLowerCase())) {
this.logger.warn(`Received unexpected event ${event.event} dialstatus = ${event.dialstatus}`);
return;
}
Expand All @@ -283,7 +283,7 @@ export class ContinuousMonitor extends Command {
uniqueId: `${event.event}-${event.calleridnum}-${event.channel}-${event.destchannel}-${event.uniqueid}`,
event: event.event,
ts: new Date(),
phone: event?.connectedlinenum,
phone: event?.connectedlinenum.replace(/\D/g, ''), // Remove all non-numeric characters
callUniqueId: event.uniqueid,
callUniqueIdFallback: event.linkedid,
agentExtension: event.calleridnum,
Expand Down