mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage-server
synced 2026-04-12 02:18:18 +00:00
lint and format
This commit is contained in:
@@ -3,49 +3,53 @@ import { ConfigService } from '@nestjs/config';
|
||||
|
||||
@Controller('kookoo')
|
||||
export class KookooIvrController {
|
||||
private readonly logger = new Logger(KookooIvrController.name);
|
||||
private readonly sipId: string;
|
||||
private readonly callerId: string;
|
||||
private readonly logger = new Logger(KookooIvrController.name);
|
||||
private readonly sipId: string;
|
||||
private readonly callerId: string;
|
||||
|
||||
constructor(private config: ConfigService) {
|
||||
this.sipId = process.env.OZONETEL_SIP_ID ?? '523590';
|
||||
this.callerId = process.env.OZONETEL_DID ?? '918041763265';
|
||||
}
|
||||
constructor(private config: ConfigService) {
|
||||
this.sipId = process.env.OZONETEL_SIP_ID ?? '523590';
|
||||
this.callerId = process.env.OZONETEL_DID ?? '918041763265';
|
||||
}
|
||||
|
||||
@Get('ivr')
|
||||
@Header('Content-Type', 'application/xml')
|
||||
handleIvr(@Query() query: Record<string, any>): string {
|
||||
const event = query.event ?? '';
|
||||
const sid = query.sid ?? '';
|
||||
const cid = query.cid ?? '';
|
||||
const status = query.status ?? '';
|
||||
@Get('ivr')
|
||||
@Header('Content-Type', 'application/xml')
|
||||
handleIvr(@Query() query: Record<string, any>): string {
|
||||
const event = query.event ?? '';
|
||||
const sid = query.sid ?? '';
|
||||
const cid = query.cid ?? '';
|
||||
const status = query.status ?? '';
|
||||
|
||||
this.logger.log(`Kookoo IVR: event=${event} sid=${sid} cid=${cid} status=${status}`);
|
||||
this.logger.log(
|
||||
`Kookoo IVR: event=${event} sid=${sid} cid=${cid} status=${status}`,
|
||||
);
|
||||
|
||||
// New outbound call — customer answered, put them in a conference room
|
||||
// The room ID is based on the call SID so we can join from the browser
|
||||
if (event === 'NewCall') {
|
||||
this.logger.log(`Customer ${cid} answered — dialing DID ${this.callerId} to route to agent`);
|
||||
return `<?xml version="1.0" encoding="UTF-8"?>
|
||||
// New outbound call — customer answered, put them in a conference room
|
||||
// The room ID is based on the call SID so we can join from the browser
|
||||
if (event === 'NewCall') {
|
||||
this.logger.log(
|
||||
`Customer ${cid} answered — dialing DID ${this.callerId} to route to agent`,
|
||||
);
|
||||
return `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<response>
|
||||
<dial record="true" timeout="30" moh="ring">${this.callerId}</dial>
|
||||
</response>`;
|
||||
}
|
||||
}
|
||||
|
||||
// Conference event — user left with #
|
||||
if (event === 'conference' || event === 'Conference') {
|
||||
this.logger.log(`Conference event: status=${status}`);
|
||||
return `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<response>
|
||||
<hangup/>
|
||||
</response>`;
|
||||
}
|
||||
|
||||
// Dial or Disconnect
|
||||
this.logger.log(`Call ended: event=${event}`);
|
||||
return `<?xml version="1.0" encoding="UTF-8"?>
|
||||
// Conference event — user left with #
|
||||
if (event === 'conference' || event === 'Conference') {
|
||||
this.logger.log(`Conference event: status=${status}`);
|
||||
return `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<response>
|
||||
<hangup/>
|
||||
</response>`;
|
||||
}
|
||||
|
||||
// Dial or Disconnect
|
||||
this.logger.log(`Call ended: event=${event}`);
|
||||
return `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<response>
|
||||
<hangup/>
|
||||
</response>`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user