diff --git a/src/ozonetel/kookoo-ivr.controller.ts b/src/ozonetel/kookoo-ivr.controller.ts
index e5c4a1b..9c2e542 100644
--- a/src/ozonetel/kookoo-ivr.controller.ts
+++ b/src/ozonetel/kookoo-ivr.controller.ts
@@ -5,9 +5,11 @@ import { ConfigService } from '@nestjs/config';
export class KookooIvrController {
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';
}
@Get('ivr')
@@ -16,30 +18,32 @@ export class KookooIvrController {
const event = query.event ?? '';
const sid = query.sid ?? '';
const cid = query.cid ?? '';
- const data = query.data ?? '';
const status = query.status ?? '';
this.logger.log(`Kookoo IVR: event=${event} sid=${sid} cid=${cid} status=${status}`);
- // New outbound call — customer answered, connect to agent's SIP
+ // 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(`Connecting customer ${cid} to agent SIP ${this.sipId}`);
+ // Try dialing the SIP extension with 0 prefix (internal routing)
+ const ext = query.ext ?? `0${this.sipId}`;
+ this.logger.log(`Customer ${cid} answered — dialing agent at ${ext}`);
return `
-${this.sipId}
+${ext}
`;
}
- // Dial event — call to agent finished
- if (event === 'Dial') {
- this.logger.log(`Dial completed: status=${status} data=${data}`);
+ // Conference event — user left with #
+ if (event === 'conference' || event === 'Conference') {
+ this.logger.log(`Conference event: status=${status}`);
return `
`;
}
- // Hangup or any other event
+ // Dial or Disconnect
this.logger.log(`Call ended: event=${event}`);
return `