Skip to main content
Glama

phone_cancel_call

Terminate an ongoing phone call by specifying the call ID, enabling users to stop conversations efficiently within the Asterisk S2S MCP Server environment.

Instructions

Cancelar una llamada telefónica en curso

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
callIdYesID de la llamada a cancelar

Implementation Reference

  • Core handler for cancelling phone calls: invokes the PhoneClient to cancel the call, updates local active calls state, and logs the operation with success or error handling.
    /** * Cancelar una llamada */ export async function cancelCall(callId: string): Promise<boolean> { const client = getPhoneClient(); try { const success = await client.cancelCall(callId); if (success) { // Actualizar estado local const callStatus = activeCalls.get(callId); if (callStatus) { callStatus.status = 'cancelled'; callStatus.lastUpdate = new Date().toISOString(); activeCalls.set(callId, callStatus); } // Log de cancelación const log: SystemLog = { id: generateId(), timestamp: new Date().toISOString(), level: 'info', component: 'phone', action: 'call_cancelled', details: { callId }, callId }; systemLogs.push(log); } return success; } catch (error) { const errorLog: SystemLog = { id: generateId(), timestamp: new Date().toISOString(), level: 'error', component: 'phone', action: 'cancel_call_failed', details: { error: error instanceof Error ? error.message : 'Unknown error', callId }, callId }; systemLogs.push(errorLog); throw error; } }
  • index.ts:78-95 (registration)
    Registers the MCP tool 'phone_cancel_call' with input schema (callId: string) and handler that delegates to phoneTools.cancelCall, returning formatted success/error message.
    "phone_cancel_call", "Cancelar una llamada telefónica en curso", { callId: z.string().describe("ID de la llamada a cancelar") }, async (args) => { const result = await phoneTools.cancelCall({ callId: args.callId }); return { content: [{ type: "text", text: result.success ? `✅ ${result.message}` : `❌ ${result.message}` }], }; } );
  • Helper function that wraps phoneOps.cancelCall, providing standardized {success, message} response and error handling.
    export async function cancelCall(args: { callId: string; }): Promise<{ success: boolean; message: string; }> { const { callId } = args; try { const success = await phoneOps.cancelCall(callId); return { success, message: success ? 'Llamada cancelada exitosamente' : 'No se pudo cancelar la llamada' }; } catch (error) { return { success: false, message: error instanceof Error ? error.message : 'Error desconocido al cancelar llamada' }; } }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gcorroto/mcp-s2s-asterisk'

If you have feedback or need assistance with the MCP directory API, please join our Discord server