mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage-server
synced 2026-04-12 02:18:18 +00:00
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:
@@ -25,12 +25,10 @@ export class KookooIvrController {
|
||||
// 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') {
|
||||
// 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}`);
|
||||
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">${ext}</dial>
|
||||
<dial record="true" timeout="30" moh="ring">${this.callerId}</dial>
|
||||
</response>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user