fix: return engine call IDs
This commit is contained in:
+2
-2
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user