feat: webhook field fixes, Force Ready endpoint, improved error logging

- Fix Call record field names (recording, callerNumber, durationSec)
- Add POST /api/ozonetel/agent-ready using logout+login for Force Ready
- Add callerNumber to kookoo callback
- Better error logging with response body

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-20 20:22:47 +05:30
parent 8c6cd2c156
commit 58225b7943
4 changed files with 49 additions and 22 deletions

View File

@@ -53,6 +53,29 @@ export class OzonetelAgentController {
}
}
@Post('agent-ready')
async agentReady() {
this.logger.log(`Force ready: logging out and back in agent ${this.defaultAgentId}`);
try {
await this.ozonetelAgent.logoutAgent({
agentId: this.defaultAgentId,
password: this.defaultAgentPassword,
});
const result = await this.ozonetelAgent.loginAgent({
agentId: this.defaultAgentId,
password: this.defaultAgentPassword,
phoneNumber: this.defaultSipId,
mode: 'blended',
});
return result;
} catch (error: any) {
const message = error.response?.data?.message ?? error.message ?? 'Force ready failed';
this.logger.error(`Force ready failed: ${message}`);
throw new HttpException(message, error.response?.status ?? 502);
}
}
@Post('dispose')
async dispose(
@Body() body: {