phone_get_status
Retrieve the current status of a phone call by providing the call ID using Asterisk S2S MCP Server's functionality for automated conversational calls.
Instructions
Obtener el estado actual de una llamada telefónica
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"callId": "<callId>"
},
"name": "phone_get_status"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| callId | Yes | ID de la llamada |
Implementation Reference
- index.ts:52-74 (registration)MCP tool registration for 'phone_get_status', including input schema, description, and handler function that delegates to phoneTools.getCallStatus and formats the response.
server.tool( "phone_get_status", "Obtener el estado actual de una llamada telefónica", { callId: z.string().describe("ID de la llamada") }, async (args) => { const result = await phoneTools.getCallStatus({ callId: args.callId }); if (!result) { return { content: [{ type: "text", text: `❌ No se encontró la llamada con ID: ${args.callId}` }], }; } return { content: [{ type: "text", text: `📊 **Estado de llamada ${args.callId}**\n\n**Usuario:** ${result.usuario}\n**Teléfono:** ${result.telefono}\n**Estado:** ${result.status}\n**Propósito:** ${result.proposito}\n**Duración:** ${result.duration || 'N/A'} segundos\n**Última actualización:** ${result.lastUpdate}` }], }; } ); - index.ts:55-57 (schema)Input schema for phone_get_status tool using Zod: requires callId string.
{ callId: z.string().describe("ID de la llamada") }, - index.ts:58-73 (handler)Handler function for phone_get_status MCP tool: calls phoneTools.getCallStatus, handles null result, formats status information into MCP content response.
async (args) => { const result = await phoneTools.getCallStatus({ callId: args.callId }); if (!result) { return { content: [{ type: "text", text: `❌ No se encontró la llamada con ID: ${args.callId}` }], }; } return { content: [{ type: "text", text: `📊 **Estado de llamada ${args.callId}**\n\n**Usuario:** ${result.usuario}\n**Teléfono:** ${result.telefono}\n**Estado:** ${result.status}\n**Propósito:** ${result.proposito}\n**Duración:** ${result.duration || 'N/A'} segundos\n**Última actualización:** ${result.lastUpdate}` }], }; } - tools/realtime-assistant.ts:101-127 (helper)Helper function getCallStatus in tools layer: wraps phoneOps.getCallStatus and returns formatted status object or null.
export async function getCallStatus(args: { callId: string; }): Promise<{ status: string; duration?: number; lastUpdate: string; usuario: string; telefono: string; proposito: string; } | null> { const { callId } = args; const status = await phoneOps.getCallStatus(callId); if (!status) { return null; } return { status: status.status, duration: status.duration, lastUpdate: status.lastUpdate, usuario: status.usuario, telefono: status.telefono, proposito: status.proposito }; } - Operations layer getCallStatus: checks local activeCalls map, fetches from remote client.getCallStatus, updates local state, falls back to local on error.
export async function getCallStatus(callId: string): Promise<CallStatus | null> { // Primero verificar en el estado local const localStatus = activeCalls.get(callId); if (!localStatus) { return null; } try { // Obtener estado actualizado del asistente const client = getPhoneClient(); const remoteStatus = await client.getCallStatus(callId); // Actualizar estado local activeCalls.set(callId, remoteStatus); return remoteStatus; } catch (error) { console.warn(`No se pudo obtener estado remoto para ${callId}, usando estado local`); return localStatus; } }