> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# execute

> Send a raw JSON-RPC request to RELAY.

[dial]: /docs/server-sdks/reference/python/relay/client/dial

[send-message]: /docs/server-sdks/reference/python/relay/client/send-message

[call]: /docs/server-sdks/reference/python/relay/call

Send a raw JSON-RPC 2.0 request to the RELAY server and return the parsed
response. This is the low-level RPC method that all other client and call
control methods are built on.

If the client is not currently connected (e.g., during a reconnect cycle),
the request is automatically queued and sent after re-authentication completes.

This method has a default timeout of 10 seconds. If no response is received
within that window, it raises `RelayError` and forces a reconnection attempt,
as the timeout may indicate a half-open WebSocket connection.

Most developers should use the higher-level methods like
[`dial()`][dial],
[`send_message()`][send-message],
and the [`Call`][call] control methods
instead of calling `execute()` directly. Use `execute()` only for custom
or unsupported RPC methods.

## **Parameters**

Full JSON-RPC method name (e.g., `"calling.answer"`, `"calling.play"`,
`"messaging.send"`). The method name must include the namespace prefix.

Parameters for the RPC call. Typically includes `node_id` and `call_id`
for calling methods, along with method-specific parameters.

## **Returns**

`dict` -- The `result` object from the JSON-RPC response. Structure depends on the method called.

## **Example**

```python {13}
from signalwire.relay import RelayClient

client = RelayClient(
    project="your-project-id",
    token="your-api-token",
    host="your-space.signalwire.com",
    contexts=["default"],
)

@client.on_call
async def handle_call(call):
    # Send a custom RPC request using the call's identifiers
    result = await client.execute("calling.answer", {
        "node_id": call.node_id,
        "call_id": call.call_id,
    })
    print(f"Answer result: {result}")

client.run()
```