Skip to content

fix: apply phone alias to recipients lists - #41

Open
Arshgill01 wants to merge 1 commit into
CALLE-AI:mainfrom
Arshgill01:fix/recipients-phone-alias
Open

Arshgill01 wants to merge 1 commit into
CALLE-AI:mainfrom
Arshgill01:fix/recipients-phone-alias

Conversation

@Arshgill01

Copy link
Copy Markdown

What

Map every item in recipients= through _normalize_recipient, so recipients=[{"phone": "+14155550100"}] becomes wire [{"phones": ["+14155550100"]}], matching recipient={"phone": ...} and the TypeScript SDK.

Why

create() only normalized the singular recipient= kwarg:

"recipients": [_normalize_recipient(recipient)] if recipient is not None else recipients,

OpenAPI CallTaskRecipientRequest requires phones and sets additionalProperties: false. A TypeScript snippet ported as recipients=[{"phone": "..."}] sends an illegal phone key.

This is the one-liner alias only. Extra keys are still forwarded (existing _normalize_recipient behavior).

Evidence

Offline respx mock. No live POST /v1/calls.

uv run --locked pytest -q tests/test_calls.py
.........                                                                [100%]
9 passed in 0.10s

uv run --locked ruff check src/calle/calls.py tests/test_calls.py
All checks passed!

uv run --locked mypy src/calle
Success: no issues found in 6 source files

test_create_call_aliases_phone_on_recipients_list asserts the request body recipients are [{"phones": ["+14155550100"], "region": "US", "locale": "en-US"}].

Test

uv run --locked pytest -q tests/test_calls.py as above.

Source

From the CALL-E hackathon feedback lab: https://github.com/Arshgill01/ExactRef/blob/main/docs/feedback/lab/XR-110-python-recipients-skip-phone-alias.md

Made with Cursor

The TypeScript SDK maps phone to phones on every recipient object.
Python only did that for the singular recipient= argument.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant