lint and format

This commit is contained in:
Kartik Datrika
2026-03-23 15:46:32 +05:30
parent 30a4cda178
commit a1157ab4c1
48 changed files with 10980 additions and 2810 deletions

View File

@@ -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>`;
}
}