Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [Unreleased]

### New Features
- Relay: added `call.accept(early_media=False)` — signal a provisional (180 Ringing, or 183 Session Progress with `early_media=True`) on an inbound call without answering it. The call stays unanswered and unbilled.

## [3.2.0] - 2026-07-14

### New Features
Expand Down
10 changes: 10 additions & 0 deletions relay/docs/call-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ Answer an inbound call.
await call.answer()
```

### `accept(early_media=False, **kwargs) -> dict`

Send a provisional response (180 Ringing, or 183 Session Progress with `early_media=True`) on an inbound call without answering it. The call stays unanswered and unbilled.

<!-- snippet: no-compile await-fragment -->
```python
await call.accept()
await call.accept(early_media=True)
```

### `hangup(reason="hangup") -> dict`

End the call.
Expand Down
4 changes: 4 additions & 0 deletions signalwire/signalwire/relay/call.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,10 @@ async def answer(self, **kwargs: Any) -> dict[str, Any]:
"""Answer an inbound call."""
return await self._execute("answer", kwargs or None)

async def accept(self, early_media: bool = False, **kwargs: Any) -> dict[str, Any]:
"""Signal a provisional (180 Ringing / 183 Session Progress) on an inbound call without answering it."""
return await self._execute("accept", {"early_media": early_media, **kwargs})

async def hangup(self, reason: str = "hangup") -> dict[str, Any]:
"""End/hang up the call."""
return await self._execute("end", {"reason": reason})
Expand Down
8 changes: 8 additions & 0 deletions tests/unit/relay/test_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ async def test_answer(self, call: Call, mock_client: MagicMock) -> None:
"calling.answer", {"node_id": "node-1", "call_id": "call-1"}
)

@pytest.mark.asyncio
async def test_accept(self, call: Call, mock_client: MagicMock) -> None:
await call.accept(early_media=True)
mock_client.execute.assert_called_once_with(
"calling.accept",
{"node_id": "node-1", "call_id": "call-1", "early_media": True},
)

@pytest.mark.asyncio
async def test_hangup(self, call: Call, mock_client: MagicMock) -> None:
await call.hangup(reason="busy")
Expand Down
Loading