Skip to content

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

Closed

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

  1. added
    bug
    priority-p1
    type-bug
    on Jun 4, 2026
  2. vybe commented on Jun 4, 2026

    @vybe
    ContributorAuthor

    /claim

  3. added
    status-in-progress
    on Jun 4, 2026
  4. github-actions commented on Jun 4, 2026

    @github-actions

    Claimed by @vybe. Label status-in-progress added.

    Next steps:

    1. Create branch: feature/1069-<short-slug>
    2. Implement the feature
    3. Open a PR with Fixes #1069
  5. added
    status-in-dev
    on Jun 4, 2026
  6. removed
    status-in-progress
    on Jun 4, 2026
  7. removed
    status-in-progress
    on Jun 4, 2026
  8. vybe commented on Jun 4, 2026

    @vybe
    ContributorAuthor

    Fixed in PR #1071, squash-merged to dev (commit 0f9f964c). Swapped the /voip/call handler to AuthorizedAgentByName so the dependency's Path() param matches the {agent_name} route template — no auth boundary change (the two dependency functions are byte-identical except the param name). Mutation-verified regression test added (tests/unit/test_1069_voip_call_path_param.py, 4/4). Moves to In Dev; will close on the next dev → main release cut.

  9. vybe commented on Jun 4, 2026

    @vybe
    ContributorAuthor

    Verified fixed and deployed. Pulled fd6ba602 (fix(voip): correct /voip/call path param, #1071) to the construct instance. The live OpenAPI now reports the POST /api/agents/{agent_name}/voip/call path param as agent_name (was name), and a configured agent's binding is ready to place outbound calls. Thanks for the fast turnaround — closing.

    Nice touch including the test_1069_voip_call_path_param.py regression test.

  10. removed
    status-in-dev
    on Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugpriority-p1type-bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions