client.inbound_routes
How inbound calls to your numbers are routed. These methods are on client.inbound_routes, where client is a MoreVoice client (see the Python SDK). On AsyncMoreVoice the same methods are awaited. Each one returns the response object and raises an exception when the API answers with an error.
create()
Section titled “create()”Create an inbound route. Adds a rule that answers inbound calls. target is required: an assistant, a published flow, a queue, a person or a conference room. The other fields default: enabled, priority 100, any connection, any dialled number and any caller. match_did and match_caller take an exact number, a prefix ending in *, or nothing for any. The next call uses the new rule.
def create(self, body: _m.InboundRouteCreateParamsInput | Mapping[str, Any], *, more_voice_version: str | Unset = UNSET, idempotency_key: str | Unset = UNSET) -> _m.InboundRouteclient.inbound_routes.create() · await async_client.inbound_routes.create() · POST /inbound_routes · API reference
Request body
Section titled “Request body”| Field | Type | Required | Description |
|---|---|---|---|
target |
RouteTargetParamsInput |
yes | Where a matching call goes: type, and the ID in <type>_id. |
assistant_request_timeout_ms |
integer |
no | 200–5000 ms (default 1500): after this, the route’s own target answers. |
assistant_request_url |
string | null |
no | A public https URL asked which assistant answers each matching call (see the assistant-request guide); null turns it off. |
connection_id |
string | null |
no | conn_… ID. |
enabled |
boolean |
no | — |
fallback_assistant_id |
string | null |
no | asst_… ID. |
match_caller |
string |
no | The caller’s number: exact, a prefix ending in *, or empty for any. |
match_did |
string |
no | The dialled number: exact, a prefix ending in *, or empty for any. |
name |
string |
no | — |
priority |
integer |
no | — |
Returns
Section titled “Returns”InboundRoute:
| Field | Type | Description |
|---|---|---|
id |
string |
The route’s ID. |
object |
"inbound_route" |
Always inbound_route. |
livemode |
boolean |
true in live mode, false in test mode. |
name |
string |
— |
enabled |
boolean |
— |
priority |
integer |
Lower runs first; the first matching route wins. |
connection_id |
string | null |
conn_… ID. |
match_did |
string |
The dialled number: exact, a prefix ending in *, or empty for any. |
match_caller |
string |
The caller’s number: exact, a prefix ending in *, or empty for any. |
target |
RouteTarget | null |
Where matching calls go (null: the connection’s inbound assistant answers). |
fallback_assistant_id |
string | null |
asst_… ID. |
assistant_request_url |
string | null |
When set, this URL is asked (a signed POST, assistant.request) which assistant, flow or queue answers each matching call, and with which variables; the route’s own target answers when it does not reply in time. Null: off. |
assistant_request_timeout_ms |
integer |
How long the assistant request may take (200–5000 ms) before the route’s own target answers. |
created |
string |
An ISO-8601 timestamp in UTC. |
Example
Section titled “Example”from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
inbound_route = client.inbound_routes.create({ "fallback_assistant_id": "asst_3cYbE6uYvGkH8w4ZK1rTqd", "match_did": "+97231234567", "name": "Sales line", "target": { "queue_id": "q_4Gk2LmN9pQ4rS6tV8wX0yZ", "type": "queue", },})print(inbound_route)delete()
Section titled “delete()”Delete an inbound route. Deletes an inbound route. Calls already in progress are not affected; the next call is routed by the remaining rules.
def delete(self, id: str, *, more_voice_version: str | Unset = UNSET, idempotency_key: str | Unset = UNSET) -> _m.DeletedInboundRouteclient.inbound_routes.delete() · await async_client.inbound_routes.delete() · DELETE /inbound_routes/{id} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
str |
yes | A inbound route ID (rte_…). |
Returns
Section titled “Returns”DeletedInboundRoute:
| Field | Type | Description |
|---|---|---|
id |
string |
A inbound route ID (prefix rte_). |
object |
"inbound_route" |
Always inbound_route. |
deleted |
true |
— |
Example
Section titled “Example”from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
deleted_inbound_route = client.inbound_routes.delete("rte_7Hk2Lm9Qp")print(deleted_inbound_route)list()
Section titled “list()”List inbound routes. Your routes in evaluation order: priority, then age. The first enabled route that matches a call wins.
def list(self, *, limit: int | Unset = 20, starting_after: str | Unset = UNSET, ending_before: str | Unset = UNSET, more_voice_version: str | Unset = UNSET) -> AsyncPage[_m.InboundRoute]client.inbound_routes.list() · await async_client.inbound_routes.list() · GET /inbound_routes · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
limit |
integer |
no | How many objects to return, 1–100 (default 20). |
starting_after |
string |
no | A cursor (next_cursor) or object ID: return the objects after it (older). |
ending_before |
string |
no | A cursor or object ID: return the objects before it (newer). |
Returns
Section titled “Returns”A page of results (InboundRouteList): data, has_more and next_cursor.
Example
Section titled “Example”from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
for inbound_route in client.inbound_routes.list(): print(inbound_route)retrieve()
Section titled “retrieve()”Retrieve an inbound route. Returns an inbound route: what it matches (connection_id, match_did, match_caller), its priority, whether it is enabled, and its target.
def retrieve(self, id: str, *, more_voice_version: str | Unset = UNSET) -> _m.InboundRouteclient.inbound_routes.retrieve() · await async_client.inbound_routes.retrieve() · GET /inbound_routes/{id} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
str |
yes | A inbound route ID (rte_…). |
Returns
Section titled “Returns”InboundRoute:
| Field | Type | Description |
|---|---|---|
id |
string |
The route’s ID. |
object |
"inbound_route" |
Always inbound_route. |
livemode |
boolean |
true in live mode, false in test mode. |
name |
string |
— |
enabled |
boolean |
— |
priority |
integer |
Lower runs first; the first matching route wins. |
connection_id |
string | null |
conn_… ID. |
match_did |
string |
The dialled number: exact, a prefix ending in *, or empty for any. |
match_caller |
string |
The caller’s number: exact, a prefix ending in *, or empty for any. |
target |
RouteTarget | null |
Where matching calls go (null: the connection’s inbound assistant answers). |
fallback_assistant_id |
string | null |
asst_… ID. |
assistant_request_url |
string | null |
When set, this URL is asked (a signed POST, assistant.request) which assistant, flow or queue answers each matching call, and with which variables; the route’s own target answers when it does not reply in time. Null: off. |
assistant_request_timeout_ms |
integer |
How long the assistant request may take (200–5000 ms) before the route’s own target answers. |
created |
string |
An ISO-8601 timestamp in UTC. |
Example
Section titled “Example”from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
inbound_route = client.inbound_routes.retrieve("rte_7Hk2Lm9Qp")print(inbound_route)update()
Section titled “update()”Update an inbound route. Changes the fields you send. A new target replaces the old one (and drops fallback_assistant_id when the new target is an assistant).
def update(self, id: str, body: _m.InboundRouteUpdateParamsInput | Mapping[str, Any] | Unset = UNSET, *, more_voice_version: str | Unset = UNSET) -> _m.InboundRouteclient.inbound_routes.update() · await async_client.inbound_routes.update() · PATCH /inbound_routes/{id} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
str |
yes | A inbound route ID (rte_…). |
Request body
Section titled “Request body”| Field | Type | Required | Description |
|---|---|---|---|
assistant_request_timeout_ms |
integer |
no | 200–5000 ms (default 1500): after this, the route’s own target answers. |
assistant_request_url |
string | null |
no | A public https URL asked which assistant answers each matching call (see the assistant-request guide); null turns it off. |
connection_id |
string | null |
no | conn_… ID. |
enabled |
boolean |
no | — |
fallback_assistant_id |
string | null |
no | asst_… ID. |
match_caller |
string |
no | The caller’s number: exact, a prefix ending in *, or empty for any. |
match_did |
string |
no | The dialled number: exact, a prefix ending in *, or empty for any. |
name |
string |
no | — |
priority |
integer |
no | — |
target |
RouteTargetParamsInput |
no | Where a matching call goes: type, and the ID in <type>_id. |
Returns
Section titled “Returns”InboundRoute:
| Field | Type | Description |
|---|---|---|
id |
string |
The route’s ID. |
object |
"inbound_route" |
Always inbound_route. |
livemode |
boolean |
true in live mode, false in test mode. |
name |
string |
— |
enabled |
boolean |
— |
priority |
integer |
Lower runs first; the first matching route wins. |
connection_id |
string | null |
conn_… ID. |
match_did |
string |
The dialled number: exact, a prefix ending in *, or empty for any. |
match_caller |
string |
The caller’s number: exact, a prefix ending in *, or empty for any. |
target |
RouteTarget | null |
Where matching calls go (null: the connection’s inbound assistant answers). |
fallback_assistant_id |
string | null |
asst_… ID. |
assistant_request_url |
string | null |
When set, this URL is asked (a signed POST, assistant.request) which assistant, flow or queue answers each matching call, and with which variables; the route’s own target answers when it does not reply in time. Null: off. |
assistant_request_timeout_ms |
integer |
How long the assistant request may take (200–5000 ms) before the route’s own target answers. |
created |
string |
An ISO-8601 timestamp in UTC. |
Example
Section titled “Example”from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
inbound_route = client.inbound_routes.update("rte_7Hk2Lm9Qp", { "enabled": False,})print(inbound_route)