Skip to content

VoIP outbound call always 422: POST /api/agents/{agent_name}/voip/call path param is 'name' not 'agent_name' #1069

Description

@vybe

Summary

The VoIP Phase 1 (VOIP-001, #1056/#1066) outbound-call trigger is 100% unusable. Every call attempt returns HTTP 422 because the POST /api/agents/{agent_name}/voip/call handler declares its path parameter as name, which does not match the route-template placeholder {agent_name}. FastAPI binds the URL segment to agent_name, leaving name unpopulated → required-path-param-missing.

This blocks both trigger paths — the REST endpoint and the call_user MCP tool (which proxies to it).

Observed on dev HEAD (eedcac84).

Symptom

{"detail":[{"type":"missing","loc":["path","name"],"msg":"Field required","input":null}]}

Both of these fail identically:

# 1) REST
curl -s -X POST -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
  http://HOST:8000/api/agents/cornelius-m/voip/call -d '{"to_number":"+15551234567"}'
# -> HTTP 422, loc: ["path","name"]

# 2) MCP tool -> "API error (422): ...loc:[\"path\",\"name\"]..."
call_user(agent_name="cornelius-m", to_number="+15551234567")

Root cause

Path-param name vs route-template placeholder mismatch. From the live OpenAPI:

Method Route template Declared path param
GET /api/agents/{agent_name}/voip {agent_name} agent_name ✅
PUT /api/agents/{agent_name}/voip {agent_name} agent_name ✅
POST /api/agents/{agent_name}/voip/call {agent_name} name ❌

The /voip/call handler's name path parameter (OpenAPI: {"name":"name","in":"path","required":true,"description":"Agent name from path"}) can never be filled, because the URL template exposes the segment as {agent_name}. No request payload can satisfy it.

Suggested fix

Rename the /voip/call handler's path parameter from name to agent_name (or Path(alias="agent_name")) so it matches the route template and the sibling GET/PUT /voip handlers. Add a regression test asserting the agent resolves from the path on POST .../voip/call.

Impact

VoIP outbound calling cannot be triggered by any means as shipped. Everything else in the path works (binding config, tunnel ingress, Twilio creds, Gemini bridge env); only this param mismatch blocks the feature.


Filed by the Trinity Ops Agent while enabling VoIP on the construct instance.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions