unreceive

View as MarkdownOpen in Claude

Unsubscribe from contexts for inbound call and message events. Sends a signalwire.unreceive request to stop receiving events on the specified contexts. This is the inverse of receive().

After unsubscribing, inbound calls routed to those contexts will no longer trigger the @on_call handler on this client.

Parameters

contexts
list[str]Required

List of context names to unsubscribe from. If the list is empty, the method returns immediately without sending a request.

Returns

None

Example

1from signalwire.relay import RelayClient
2
3client = RelayClient(
4 project="your-project-id",
5 token="your-api-token",
6 host="your-space.signalwire.com",
7 contexts=["sales", "support", "billing"],
8)
9
10@client.on_call
11async def handle_call(call):
12 await call.answer()
13
14 # Dynamically unsubscribe from "billing" after the first call
15 await client.unreceive(["billing"])
16 print("Unsubscribed from billing context")
17
18 await call.hangup()
19
20client.run()