# mv.parkedCalls

> The parkedCalls methods of @morevoice/sdk: Callers on hold in your park slots, and picking them up for an agent.

Callers on hold in your park slots, and picking them up for an agent. These methods are on `mv.parkedCalls`, where `mv` is your client (see [the Node.js SDK](https://docs.morevoice.ai/sdk/node/#connect)). Each one returns the response object and throws when the API answers with an error.

## `list()`

**List parked calls.** Callers waiting on hold in your park slots, newest first: parked by agents from the app, or by desk phones. Needs a live key, call park turned on, and a key that sees all of the organization's calls.

```ts
mv.parkedCalls.list(query?: NonNullable<ParkedCallsListData["query"]>, options?: RequestOptions): PagedList<ParkedCallsListResponse["data"][number], NonNullable<ParkedCallsListData["query"]>>
```

`GET /parked_calls` · [API reference](https://docs.morevoice.ai/api/operations/parked_calls_list/)

### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `query.limit` | `integer` | no | How many objects to return, 1–100 (default 20). |
| `query.starting_after` | `string` | no | A cursor (`next_cursor`) or object ID: return the objects after it (older). |
| `query.ending_before` | `string` | no | A cursor or object ID: return the objects before it (newer). |
| `options.headers["MoreVoice-Version"]` | `string` | no | The API version to use for this request. Defaults to the version the API key is pinned to. |
| `options` | `RequestOptions` | no | `idempotencyKey`, extra `headers` and an abort `signal`: see [retries and idempotency](https://docs.morevoice.ai/sdk/typescript/retries/). |

### Returns

A [`PagedList`](https://docs.morevoice.ai/sdk/typescript/pagination/): `await` it for the first page, `for await` it for every item.

### Example

```ts
import MoreVoice from "@morevoice/sdk";

const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment

for await (const parkedCall of mv.parkedCalls.list()) {
	console.log(parkedCall);
}
```

## `pickup()`

**Pick up a parked call for an agent.** Takes the call out of its slot and rings the member you name (by `agent_id` or `extension`) with it: their app and desk phones ring as for a direct call, and their own no-answer rule applies. Only calls parked from the app (`pickup_via` = agent); a desk phone's park is picked up by dialling its slot (409). A caller who hung up meanwhile is a 404.

```ts
mv.parkedCalls.pickup(id: ParkedCallsPickupData["path"]["id"], body?: ParkedCallsPickupData["body"], options?: RequestOptions): Promise<ParkedCallsPickupResponse>
```

`POST /parked_calls/{id}/pickup` · [API reference](https://docs.morevoice.ai/api/operations/parked_calls_pickup/)

### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | A parked call ID (`park_…`). |
| `body.agent_id` | `string` | no | The member to ring with the call (their app and their desk phones, as a direct call to them). |
| `body.extension` | `string` | no | Or: the extension of the member to ring. |
| `options.headers["MoreVoice-Version"]` | `string` | no | The API version to use for this request. Defaults to the version the API key is pinned to. |
| `options.headers["Idempotency-Key"]` | `string` | no | A unique key (for example a UUID) that makes this request safe to retry: for 24 hours, a retry with the same key and parameters returns the first response instead of acting twice. |
| `options` | `RequestOptions` | no | `idempotencyKey`, extra `headers` and an abort `signal`: see [retries and idempotency](https://docs.morevoice.ai/sdk/typescript/retries/). |

### Returns

`ParkedCallPickup`:

| Field | Type | Description |
| --- | --- | --- |
| `object` | `"parked_call_pickup"` | Always `parked_call_pickup`. |
| `parked_call_id` | `string` | A parked call ID (prefix `park_`). |
| `call_id` | `string` | A call ID (prefix `call_`). |
| `slot` | `integer` | — |
| `agent_id` | `string` | The member now ringing with the call. |

### Example

```ts
import MoreVoice from "@morevoice/sdk";

const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment

const parkedCallPickup = await mv.parkedCalls.pickup("park_7Hk2Lm9Qp", {
	agent_id: "usr_4Xk9Qm2LpR7t",
});
console.log(parkedCallPickup);
```

## `retrieve()`

**Retrieve a parked call.** One parked call. A call that was picked up, rang back to the person who parked it, or whose caller hung up is gone (404).

```ts
mv.parkedCalls.retrieve(id: ParkedCallsRetrieveData["path"]["id"], options?: RequestOptions): Promise<ParkedCallsRetrieveResponse>
```

`GET /parked_calls/{id}` · [API reference](https://docs.morevoice.ai/api/operations/parked_calls_retrieve/)

### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | A parked call ID (`park_…`). |
| `options.headers["MoreVoice-Version"]` | `string` | no | The API version to use for this request. Defaults to the version the API key is pinned to. |
| `options` | `RequestOptions` | no | `idempotencyKey`, extra `headers` and an abort `signal`: see [retries and idempotency](https://docs.morevoice.ai/sdk/typescript/retries/). |

### Returns

`ParkedCall`:

| Field | Type | Description |
| --- | --- | --- |
| `object` | `"parked_call"` | Always `parked_call`. |
| `id` | `string` | A parked call ID (prefix `park_`). |
| `livemode` | `boolean` | `true` in live mode, `false` in test mode. |
| `slot` | `integer` | The park slot it waits in (701–720 by default): a desk phone picks it up by dialling this number. |
| `call_id` | `string \| null` | The call (calls parked from the app; a desk phone's park may not have one). |
| `caller` | `string` | The caller's number or extension. |
| `caller_name` | `string \| null` | — |
| `parked_from` | `"app" \| "desk_phone"` | `app`: an agent pressed Park in the app (or the agent desk). `desk_phone`: a desk phone transferred it to park. |
| `parked_by` | `object \| null` | Who parked it, when known. |
| `parked_at` | `string` | An ISO-8601 timestamp in UTC. |
| `returns_at` | `string \| null` | When it rings the person who parked it again if nobody picks it up; null: never. |
| `pickup_via` | `"agent" \| "desk_phone"` | `agent`: POST /v1/parked_calls/{id}/pickup rings an agent with it. `desk_phone`: it is held on the phone system, so it is picked up by dialling the slot on a desk phone. |

### Example

```ts
import MoreVoice from "@morevoice/sdk";

const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment

const parkedCall = await mv.parkedCalls.retrieve("park_7Hk2Lm9Qp");
console.log(parkedCall);
```
