Skip to content

Add call.ring() to the Relay Call API - #93

Open
jakubkarolczyk wants to merge 2 commits into
mainfrom
jakub/call_accept
Open

Add call.ring() to the Relay Call API#93
jakubkarolczyk wants to merge 2 commits into
mainfrom
jakub/call_accept

Conversation

@jakubkarolczyk

@jakubkarolczyk jakubkarolczyk commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds call.ring() to the Relay Call API — send 180 Ringing on an inbound call without answering it. Signalling only: no media, no answer, no billing.

async def on_call_received(call):
    await call.ring()          # 180 Ringing to the caller
    # ...run checks, then connect/answer

Why

Related to signalwire/cloud-product#20389. When a Relay app deliberately does not answer() an inbound call (e.g. it runs authorization checks and only answers once a destination picks up), SignalWire sends the upstream carrier no provisional response; the carrier hits its post-dial-delay limit, cancels, and re-attempts. ring() lets the app send a 180 to satisfy the carrier's PDD timer without committing to an answer.

Server method: signalwire/mod_infrastructure#1846.

Behavior worth knowing

  • Ringing a call takes control of it, like answer() — it is no longer offered to other consumers and can no longer be handed off with pass.
  • Because taking control disables the inbound-offer timeout, the server bounds a rung call with its own hold timeout: if it is never answered it is hung up with SIP 480 (default 180s).
  • On WebRTC legs there is no upstream SIP carrier, so ring is a no-op that returns success without sending a provisional.

Changes

  • relay/call.pyring(**kwargs), mirroring answer (dispatches calling.ring).
  • tests/unit/relay/test_call.pytest_ring (asserts the calling.ring wire call).
  • relay/docs/call-methods.mdring under Lifecycle.
  • CHANGELOG.md[Unreleased] entry.

Note on the earlier revision

This PR originally added accept(early_media=False), sending either 180 or 183. The server-side method was subsequently cut down to a single, media-free ring that sends 180 only — the 183/early-media path is deferred to a separate preanswer method. This PR has been updated to match: the method is ring, and early_media is gone. The server's request validator is a strict allowlist, so the previous form would have been rejected with a 400.

@jakubkarolczyk jakubkarolczyk changed the title Add call.accept() to the Relay Call API Add call.ring() to the Relay Call API Aug 29, 2026
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