Spaces:
Runtime error
Runtime error
File size: 893 Bytes
46252cd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | /**
* Calls resource — incoming-call handling.
*
* Backed by `src/modules/call/call.controller.ts` (`@Controller('sessions/:sessionId/calls')`).
* @packageDocumentation
*/
import { encodeSegment } from '../http.js';
import type { OpenWAClient } from '../client.js';
import type { SuccessResult } from '../types.js';
export class CallsResource {
constructor(private readonly client: OpenWAClient) {}
/**
* Reject a ringing incoming call. The `callId` comes from the `call.received`
* webhook/socket event; the server answers 404 when the call is not found or no
* longer ringing. Requires an OPERATOR-level key.
*/
rejectCall(sessionId: string, callId: string): Promise<SuccessResult> {
return this.client.request<SuccessResult>({
method: 'POST',
path: `/api/sessions/${encodeSegment(sessionId)}/calls/${encodeSegment(callId)}/reject`,
});
}
}
|