fix: return engine call IDs

This commit is contained in:
2026-05-08 16:24:45 +00:00
parent 980a1500f5
commit 04e706715f
4 changed files with 539 additions and 721 deletions
+7 -7
View File
@@ -13,18 +13,18 @@
"restartBackground": "pnpm run buildRust && pnpm run bundle; test -f .server.pid && kill $(cat .server.pid) 2>/dev/null; sleep 1; rm -f sip_trace.log proxy.out && nohup tsx ts/sipproxy.ts > proxy.out 2>&1 & echo $! > .server.pid; sleep 2; cat proxy.out"
},
"dependencies": {
"@design.estate/dees-catalog": "^3.77.0",
"@design.estate/dees-catalog": "^3.81.0",
"@design.estate/dees-element": "^2.2.4",
"@push.rocks/smartrust": "^1.3.2",
"@push.rocks/smartstate": "^2.3.0",
"@push.rocks/smartrust": "^1.4.0",
"@push.rocks/smartstate": "^2.3.1",
"tsx": "^4.21.0",
"ws": "^8.20.0"
},
"devDependencies": {
"@git.zone/tsbundle": "^2.10.0",
"@git.zone/tsdocker": "^2.2.4",
"@git.zone/tsrust": "^1.3.2",
"@git.zone/tswatch": "^3.3.2",
"@git.zone/tsbundle": "^2.10.1",
"@git.zone/tsdocker": "^2.2.5",
"@git.zone/tsrust": "^1.3.3",
"@git.zone/tswatch": "^3.3.3",
"@types/ws": "^8.18.1"
}
}
+521 -701
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -21,7 +21,7 @@ const CONFIG_PATH = path.join(process.cwd(), '.nogit', 'config.json');
interface IHandleRequestContext {
getStatus: () => unknown;
log: (msg: string) => void;
onStartCall: (number: string, deviceId?: string, providerId?: string) => { id: string } | null;
onStartCall: (number: string, deviceId?: string, providerId?: string) => Promise<{ id: string } | null>;
onHangupCall: (callId: string) => boolean;
onConfigSaved?: () => void | Promise<void>;
faxBoxManager?: FaxBoxManager;
@@ -129,7 +129,7 @@ async function handleRequest(
if (!number || typeof number !== 'string') {
return sendJson(res, { ok: false, error: 'missing "number" field' }, 400);
}
const call = onStartCall(number, body?.deviceId, body?.providerId);
const call = await onStartCall(number, body?.deviceId, body?.providerId);
if (call) return sendJson(res, { ok: true, callId: call.id });
return sendJson(res, { ok: false, error: 'call origination failed — provider not registered or no ports available' }, 503);
} catch (e: any) {
+7 -9
View File
@@ -159,18 +159,16 @@ initWebUi({
port: appConfig.proxy.webUiPort,
getStatus,
log,
onStartCall: (number, deviceId, providerId) => {
onStartCall: async (number, deviceId, providerId) => {
log(`[dashboard] start call: ${number} device=${deviceId || 'any'} provider=${providerId || 'auto'}`);
void makeCall(number, deviceId, providerId).then((callId) => {
if (callId) {
const callId = await makeCall(number, deviceId, providerId);
if (!callId) {
log(`[dashboard] call failed for ${number}`);
return null;
}
log(`[dashboard] call started: ${callId}`);
statusStore.noteDashboardCallStarted(callId, number, providerId);
} else {
log(`[dashboard] call failed for ${number}`);
}
});
return { id: `pending-${Date.now()}` };
return { id: callId };
},
onHangupCall: (callId) => {
void hangupCall(callId);