# Tổng đài

## Danh sách SỐ NỘI BỘ&#x20;

<mark style="color:blue;">`GET`</mark> `[URL]/api/call_center/internal_phone/list`

\- Lấy danh sách cấu hình số nội bộ\
\- **Cấu hình** > **Tổng đài** > **Số nội bộ**<br>

#### Query Parameters

| Name    | Type   | Description                      |
| ------- | ------ | -------------------------------- |
| keyword | string | Số nội bộ, email, full\_name     |
| page    | number | Trang, bắt đầu từ 1 (Mặc định 1) |
| size    | number | Kích thước trang, mặc định là 50 |

#### Headers

| Name                                            | Type   | Description                   |
| ----------------------------------------------- | ------ | ----------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Access Token : Bearer 'token' |
| Content-type<mark style="color:red;">\*</mark>  | string | application/json              |

{% tabs %}
{% tab title="200 Lấy danh sách số nội bộ thành công" %}

```
{
    "status_code": 9999,
    "instance_id": "stg",
    "instance_name": "DESKTOP-3I0NHO0",
    "payload": {
        "items": [
            {
                "domain": "omiteam", // Domain tổng đài
                "outbound_proxy": "wss://wssvn.omicrm.com", // Outboud Proxy
                "sip_user": "147", // Số nội bộ
                "password": "XXXXXX", // Mật khẩu truy cập
                "full_name": "Đỗ Thị Hồng Vy", // Họ và tên
                "agent_id" : "xxx", // Id nhân viên
                "email": "dohongvyzyt@gmail.com", // Email
                "public_number":"84256336xxxx", // Đầu số đang sử dụng
                "last_updated_date": 1575269373331, //Cập nhật lần cuối
                "created_date": 1575251355778 // Ngày tạo
            },
            {
                "domain": "omiteam", // Domain tổng đài
                "outbound_proxy": "wss://wssvn.omicrm.com", // Outboud Proxy
                "sip_user": "145",
                "password": "kiyyzsefxx",
                "full_name": "Hồng Ngọc",
                "agent_id" : "xxx", // Id nhân viên
                "email": "vykh252tn1998@gmail.com",
                "public_number":"84256336xxxx",
                "last_updated_date": 1574999296765,
                "created_date": 1574133910912
            }
        ],
        "page_number": 1,
        "page_size": 2,
        "total_items": 30,
        "total_pages": 15,
        "has_next": true,
        "next_page": 2,
        "has_previous": false,
        "previous_page": 1
    },
    "key_enabled": false
}
```

{% endtab %}
{% endtabs %}

## Cập nhật trạng thái số máy lẻ

<mark style="color:orange;">`PUT`</mark> `[URL]/api/call_center/internal_phone/status?enabled=&sip_user=`

Thay đổi trạng thái số máy lẻ : Hoạt đồng hoặc / Ngưng hoạt động

#### Query Parameters

| Name                                        | Type   | Description                                        |
| ------------------------------------------- | ------ | -------------------------------------------------- |
| sip\_user<mark style="color:red;">\*</mark> | string | Số máy lẻ nhân viên                                |
| enabled<mark style="color:red;">\*</mark>   | string | <p>true : Hoạt động<br>false : Ngưng hoạt động</p> |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer token |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## Danh sách đầu số đang hoạt động và cho phép gọi ra

<mark style="color:blue;">`GET`</mark> `[URL]/api/call_center/hotline/list?extension=`

Lấy danh sách đầu số đang hoạt động và cho phép gọi ra của một số nội bộ

#### Query Parameters

| Name      | Type   | Description         |
| --------- | ------ | ------------------- |
| extension | string | Số máy lẻ nhân viên |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer token |

{% tabs %}
{% tab title="200 " %}

```
{
    "status_code": 9999,
    "instance_id": "stg",
    "instance_version": "1.2.163",
    "payload": [
        "024********",
        "842*********"
    ],
    "key_enabled": false
}
```

{% endtab %}
{% endtabs %}

## Danh sách số hotline

<mark style="color:green;">`GET`</mark> `[URL]/api/call_center/hotline/search`

Lấy danh sách số hotline

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Query Parameters**

| Name      | Type   | Description                                              |
| --------- | ------ | -------------------------------------------------------- |
| `page`    | number | Thứ tự phân trang, bắt đầu bằng 1                        |
| `size`    | number | Giới hạn số lượng phân tử của danh sách trả về, max = 50 |
| `keyword` | string | Số hotline, name                                         |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "instance_id": "stg",
    "payload": {
        "items": [
            {
                "number": "842871002283",
                "status": "active",
                "expire_date": 1743440340000,
                "created_date": 1730172218174,
                "last_updated_date": 1736270113875,
                "configs": {
                    "allow_call_in": true, // Cho phép gọi vào
                    "allow_call_out": true, // Cho phép gọi ra
                    "default_script": "677d6052f762e43be043ac35", // Kịch bản mặc định
                    "working_days": [
                        {
                            "weekday": 2,
                            "type": "full_day",
                            "script": "677d6052f762e43be043ac35",
                            "time_frames": [
                                {
                                    "from": "",
                                    "to": "",
                                    "script": ""
                                }
                            ]
                        },
                        {
                            "weekday": 3,
                            "type": "full_day",
                            "script": "677d6052f762e43be043ac35",
                            "time_frames": [
                                {
                                    "from": "",
                                    "to": "",
                                    "script": ""
                                }
                            ]
                        },
                        {
                            "weekday": 4,
                            "type": "full_day",
                            "script": "677d6052f762e43be043ac35",
                            "time_frames": [
                                {
                                    "from": "",
                                    "to": "",
                                    "script": ""
                                }
                            ]
                        },
                        {
                            "weekday": 5,
                            "type": "full_day",
                            "script": "677d6052f762e43be043ac35",
                            "time_frames": [
                                {
                                    "from": "",
                                    "to": "",
                                    "script": ""
                                }
                            ]
                        },
                        {
                            "weekday": 6,
                            "type": "full_day",
                            "script": "677d6052f762e43be043ac35",
                            "time_frames": [
                                {
                                    "from": "",
                                    "to": "",
                                    "script": ""
                                }
                            ]
                        },
                        {
                            "weekday": 7,
                            "type": "full_day",
                            "script": "677d6052f762e43be043ac35",
                            "time_frames": [
                                {
                                    "from": "",
                                    "to": "",
                                    "script": ""
                                }
                            ]
                        },
                        {
                            "weekday": 1,
                            "type": "full_day",
                            "script": "677d6052f762e43be043ac35",
                            "time_frames": [
                                {
                                    "from": "",
                                    "to": "",
                                    "script": ""
                                }
                            ]
                        }
                    ],
                    "special_days": [],
                    "call_configs": null
                },
                "access_type": "applies_to_all_employees",
                "number_type": "fixed",
                "accesses": [], // Phân quyền gọi ra
                "disable_by_time_frame": false,
                "outbound_config": null
            }
        ],
        "page_number": 1,
        "page_size": 50,
        "total_items": 1,
        "total_pages": 1,
        "has_next": false,
        "next_page": 1,
        "has_previous": false,
        "previous_page": 1
    },
    "instance_version": "1.2.164",
    "key_enabled": false,
    "status_code": 9999
}
```

{% endtab %}
{% endtabs %}

## Thông tin số hotline

<mark style="color:green;">`GET`</mark> `[URL]/api/call_center/hotline/by-phone`

Thông tin cấu hình của số hotline

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Query Parameters**

| Name      | Type   | Description |
| --------- | ------ | ----------- |
| `hotline` | string | Số hotline  |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "instance_id": "stg",
    "payload": {
        "number": "842871002283",
        "status": "active",
        "expire_date": 1743440340000,
        "created_date": 1730172218174,
        "last_updated_date": 1736270113875,
        "configs": {
            "allow_call_in": true, // Cho phép gọi vào
            "allow_call_out": true, // Cho phép gọi ra
            "default_script": "677d6052f762e43be043ac35", // Kịch bản mặc định
            "working_days": [
                {
                    "weekday": 2,
                    "type": "full_day",
                    "script": "677d6052f762e43be043ac35",
                    "time_frames": [
                        {
                            "from": "",
                            "to": "",
                            "script": ""
                        }
                    ]
                },
                {
                    "weekday": 3,
                    "type": "full_day",
                    "script": "677d6052f762e43be043ac35",
                    "time_frames": [
                        {
                            "from": "",
                            "to": "",
                            "script": ""
                        }
                    ]
                },
                {
                    "weekday": 4,
                    "type": "full_day",
                    "script": "677d6052f762e43be043ac35",
                    "time_frames": [
                        {
                            "from": "",
                            "to": "",
                            "script": ""
                        }
                    ]
                },
                {
                    "weekday": 5,
                    "type": "full_day",
                    "script": "677d6052f762e43be043ac35",
                    "time_frames": [
                        {
                            "from": "",
                            "to": "",
                            "script": ""
                        }
                    ]
                },
                {
                    "weekday": 6,
                    "type": "full_day",
                    "script": "677d6052f762e43be043ac35",
                    "time_frames": [
                        {
                            "from": "",
                            "to": "",
                            "script": ""
                        }
                    ]
                },
                {
                    "weekday": 7,
                    "type": "full_day",
                    "script": "677d6052f762e43be043ac35",
                    "time_frames": [
                        {
                            "from": "",
                            "to": "",
                            "script": ""
                        }
                    ]
                },
                {
                    "weekday": 1,
                    "type": "full_day",
                    "script": "677d6052f762e43be043ac35",
                    "time_frames": [
                        {
                            "from": "",
                            "to": "",
                            "script": ""
                        }
                    ]
                }
            ],
            "special_days": [],
            "call_configs": null
        },
        "access_type": "applies_to_all_employees",
        "number_type": "fixed",
        "accesses": [], // Phân quyền gọi ra
        "disable_by_time_frame": false,
        "outbound_config": null
    },
    "instance_version": "1.2.164",
    "key_enabled": false,
    "status_code": 9999
}
```

{% endtab %}
{% endtabs %}

## Cập nhật đầu số hotline

<mark style="color:green;">`POST`</mark> `[URL]/api/call_center/hotline/update`

Cập nhật thông tin cấu hình GỌI RA, GỌI VÀO cơ bản của đầu số hotline

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Body**

<table><thead><tr><th>Name</th><th width="152">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>hotline</code></td><td>string</td><td>Số hotline của doanh nghiệp</td></tr><tr><td><code>extensions</code></td><td>Array String</td><td><p><code>["101","200","301"]</code></p><p></p><p>Phân quyền được dùng đầu số để gọi ra cho những </p><p>extensions trong danh sách</p></td></tr><tr><td><code>group_ids</code></td><td>Array String</td><td><p><code>["6333d3d3f4bfc27c57841093","XXXX"]</code></p><p></p><p>Phân quyền được dùng đầu số này gọi ra theo danh sách Id nhóm nội bộ trong danh sách (Tham khảo API danh sách nhóm nội bộ)</p></td></tr><tr><td><code>call_script</code></td><td>String</td><td><p></p><p>ID Kịch bản gọi vào, tiếp nhận cuộc gọi (Tham khảo API danh sách kịch bản cuộc gọi)</p><p>Kịch bản sẽ chạy 1 kịch bản mặc định cho các ngày trong tuần</p></td></tr><tr><td><code>allow_call_in</code></td><td>String</td><td>Bật/tắt chiều gọi vào của đầu số</td></tr><tr><td><code>allow_call_out</code></td><td>String</td><td>Bật/tắt chiều gọi ra của đầu số</td></tr><tr><td><code>access_type</code></td><td>String</td><td><p>"applies_to_all_employees": Áp dụng cho toàn bộ nhân viên.<br>"applies_according_to_employee_criteria": Áp dụng theo phân quyền</p><p></p></td></tr></tbody></table>

**Response**

{% tabs %}
{% tab title="200" %}

```json

{
    "instance_id": "stg",
    "payload": true,
    "instance_version": "1.2.164",
    "key_enabled": false,
    "status_code": 9999
}
```

{% endtab %}
{% endtabs %}

## Cài đặt 1 đầu số, chỉ dùng cho 1 máy nhánh (Extension)

<mark style="color:green;">`POST`</mark> `[URL]/api/call_center/hotline/extension/update`

#### Request Body

| Name                                          | Type   | Description                                                                          |
| --------------------------------------------- | ------ | ------------------------------------------------------------------------------------ |
| hotline<mark style="color:red;">\*</mark>     | String | Số hotline                                                                           |
| user\_email<mark style="color:red;">\*</mark> | String | Email nhân viên dùng tổng đài                                                        |
| directions<mark style="color:red;">\*</mark>  | Array  | <p>outbound : Cài đặt cho chiều gọi ra</p><p>inbound : Cài đặt cho chiều gọi vào</p> |

{% tabs %}
{% tab title="200: OK " %}

{% endtab %}
{% endtabs %}

## Thông tin số nội bộ&#x20;

<mark style="color:blue;">`GET`</mark> `[URL]/api/call_center/extensions/detail?type=&keyword=`

#### Query Parameters

| Name                                      | Type   | Description                                                                                                                                                                                                                              |
| ----------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| type<mark style="color:red;">\*</mark>    | String | <p>Gồm các giá trị sau tương ứng với keyword được search </p><p><strong>usr\_uuid</strong> : Username từ bên thứ 3</p><p><strong>sip\_user</strong> : Số máy lẻ tổng đài </p><p><strong>user\_email</strong>: Email nhân viên</p><p></p> |
| keyword<mark style="color:red;">\*</mark> | String | Giá trị tìm kiếm tương ứng với type ở trên                                                                                                                                                                                               |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "instance_id": "stg",
    "payload": {
        "extension": "6349",
        "full_name": "Nguyen Tien",
        "mail": "contact18_usr_1685433772610@omicallpbx.com",
        "pbx_account": {
            "display_name": "6349",
            "sip_user": "6349",
            "sip_password": "rvld582289",
            "sip_web_socket_server": "wss://vh.omicrm.com:7443",
            "sip_realm": "contact18",
            "sip_proxy": "<sip:171.244.138.14;transport=udp>",
            "sip_proxy_port": "",
            "stun_servers": [],
            "transport": [
                "tcp",
                "udp",
                "ws",
                "wss"
            ],
            "use_opus": true,
            "opus_quality": 1
        },
        "uuid": "tientv11"
    },
    "instance_version": "1.2.164",
    "key_enabled": false,
    "status_code": 9999
}
```

{% endtab %}
{% endtabs %}

## Cập nhật thông tin số nội bộ

<mark style="color:blue;">`POST`</mark> `[URL]/api/call_center/internal_phone/update`

#### Headers

| Name          | Value             |
| ------------- | ----------------- |
| Authorization | `Bearer <token>`  |
| Content-Type  | `application/jso` |

#### Request Body

| Name                                        | Type   | Description                                              |
| ------------------------------------------- | ------ | -------------------------------------------------------- |
| sip\_user<mark style="color:red;">\*</mark> | String | Số máy lẻ nhân viên                                      |
| password                                    | String | Mật khẩu số máy lẻ nhân viên                             |
| call\_timeout                               | String | Thời gian chờ của nhân viên khi cuộc gọi chuyển tiếp tới |

{% tabs %}
{% tab title="200: OK" %}

```
{
   
}
```

{% endtab %}
{% endtabs %}

## Làm mới số nội bộ

<mark style="color:blue;">`GET`</mark> `[URL]/api/call_center/internal_phone/refresh`

Cho phép thu hồi lại các cấu hình tổng đài đã cài đặt cho user.  Đưa User trở lại trạng thái như lúc ban đầu tạo mới

#### Query Parameters

| Name         | Type   | Description         |
| ------------ | ------ | ------------------- |
| sip\_user \* | String | Số máy lẻ nhân viên |

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | String | Bearer Token |

{% tabs %}
{% tab title="200: OK" %}

```
{

}
```

{% endtab %}
{% endtabs %}

## Danh sách nhóm nội bộ

<mark style="color:blue;">`GET`</mark> `[URL]/api/call_center/internal_group/list`

#### Query Parameters

| Name    | Type    | Description                         |
| ------- | ------- | ----------------------------------- |
| keyword | String  | Từ khoá tìm kiếm                    |
| page    | Integer | Trang (Bắt đầu từ 1). Mặc định là 1 |
| size    | Integer | Kích thước trang (mặc định là 10)   |

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | String | Bearer Token |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "status_code": 9999,
    "instance_id": "stg",
    "instance_version": "1.2.163",
    "payload": {
        "items": [
            {
                "_id": "62ff11b208d4bf3ea694a6f3",
                "tenant_id": "6209c98461c1cb163ded25f7",
                "group_name": "Nhóm Tech",
                "group_name_unsigned": "Nhom Tech",
                "group_number": "38011",
                "created_date": 1660883378087,
                "last_updated_date": 1661221667904,
                "create_by": {
                    "id": "6209c98561c1cb163ded25fa",
                    "name": "OMI Hotline"
                },
                "last_update_by": {
                    "id": "6209c98561c1cb163ded25fa",
                    "name": "OMI Hotline"
                },
                "is_deleted": false,
                "note": null,
                "members": [
                    {
                        "agent_id": "62d563113127de2eac6b8cbf",
                        "contact_id": "62d563113127de2eac6b8cbe",
                        "order": 0,
                        "view": null,
                        "timeout": 30,
                        "sip_user": null,
                        "hold_music_id": null
                    },
                    {
                        "agent_id": "6209c98561c1cb163ded25fa",
                        "contact_id": "6209c98c067f745da47367d1",
                        "order": 0,
                        "view": null,
                        "timeout": 30,
                        "sip_user": null,
                        "hold_music_id": null
                    }
                ],
                "is_forward_to_user_owner": null,
                "is_forward_to_outer_group": false,
                "outer_group_id": null,
                "strategy": "enterprise",
                "ring_back_id": "",
                "ring_back_name": null,
                "is_answer": "false",
                "target_timeout_type": "",
                "target_timeout": "",
                "target_timeout_name": null,
                "ring_group_type": 0,
                "ring_group_wait_time": 0,
                "ring_group_wait_time_sequence": 2,
                "ring_group_type_result": null,
                "enable_criteria": false,
                "criterias": []
            },
            {
                "_id": "62ff11a208d4bf3ea694a539",
                "tenant_id": "6209c98461c1cb163ded25f7",
                "group_name": "Nhóm Sales",
                "group_name_unsigned": "Nhom Sales",
                "group_number": "62714",
                "created_date": 1660883362155,
                "last_updated_date": 1667615822209,
                "create_by": {
                    "id": "6209c98561c1cb163ded25fa",
                    "name": "OMI Hotline"
                },
                "last_update_by": {
                    "id": "6209c98561c1cb163ded25fa",
                    "name": "OMI Hotline"
                },
                "is_deleted": false,
                "note": null,
                "members": [
                    {
                        "agent_id": "62d563113127de2eac6b8cbf",
                        "contact_id": "62d563113127de2eac6b8cbe",
                        "order": 0,
                        "view": null,
                        "timeout": 30,
                        "sip_user": null,
                        "hold_music_id": null
                    },
                    {
                        "agent_id": "6209c98561c1cb163ded25fa",
                        "contact_id": "6209c98c067f745da47367d1",
                        "order": 0,
                        "view": null,
                        "timeout": 30,
                        "sip_user": null,
                        "hold_music_id": null
                    }
                ],
                "is_forward_to_user_owner": null,
                "is_forward_to_outer_group": false,
                "outer_group_id": null,
                "strategy": "enterprise",
                "ring_back_id": "",
                "ring_back_name": null,
                "is_answer": "false",
                "target_timeout_type": "",
                "target_timeout": "",
                "target_timeout_name": null,
                "ring_group_type": 0,
                "ring_group_wait_time": 0,
                "ring_group_wait_time_sequence": 0,
                "ring_group_type_result": null,
                "enable_criteria": false,
                "criterias": []
            },
            {
                "_id": "62ff119508d4bf3ea694a44a",
                "tenant_id": "6209c98461c1cb163ded25f7",
                "group_name": "Nhóm CSKH",
                "group_name_unsigned": "Nhom CSKH",
                "group_number": "54807",
                "created_date": 1660883349783,
                "last_updated_date": 1660883349783,
                "create_by": {
                    "id": "6209c98561c1cb163ded25fa",
                    "name": "OMI Hotline"
                },
                "last_update_by": null,
                "is_deleted": false,
                "note": null,
                "members": [
                    {
                        "agent_id": "6209c98561c1cb163ded25fa",
                        "contact_id": "6209c98c067f745da47367d1",
                        "order": 0,
                        "view": null,
                        "timeout": 30,
                        "sip_user": null,
                        "hold_music_id": null
                    }
                ],
                "is_forward_to_user_owner": null,
                "is_forward_to_outer_group": false,
                "outer_group_id": null,
                "strategy": "enterprise",
                "ring_back_id": "",
                "ring_back_name": null,
                "is_answer": "false",
                "target_timeout_type": "",
                "target_timeout": "",
                "target_timeout_name": null,
                "ring_group_type": 0,
                "ring_group_wait_time": 0,
                "ring_group_wait_time_sequence": 2,
                "ring_group_type_result": null,
                "enable_criteria": false,
                "criterias": []
            },
            {
                "_id": "6209c99b067f745da47367f4",
                "tenant_id": "6209c98461c1cb163ded25f7",
                "group_name": "Nhóm nhân viên mặc định",
                "group_name_unsigned": "Nhom nhan vien mac dinh",
                "group_number": "54919",
                "created_date": 1644808603212,
                "last_updated_date": 1662705652281,
                "create_by": {
                    "id": "6209c98561c1cb163ded25fa",
                    "name": "OMI Hotline"
                },
                "last_update_by": {
                    "id": "6209c98561c1cb163ded25fa",
                    "name": "OMI Hotline"
                },
                "is_deleted": false,
                "note": null,
                "members": [
                    {
                        "agent_id": "6209c98561c1cb163ded25fa",
                        "contact_id": "6209c98c067f745da47367d1",
                        "order": 0,
                        "view": null,
                        "timeout": 30,
                        "sip_user": null,
                        "hold_music_id": null
                    }
                ],
                "is_forward_to_user_owner": null,
                "is_forward_to_outer_group": false,
                "outer_group_id": null,
                "strategy": "enterprise",
                "ring_back_id": "",
                "ring_back_name": null,
                "is_answer": "false",
                "target_timeout_type": "Voice_mail",
                "target_timeout": "62da34652a310904dfbbf13b",
                "target_timeout_name": null,
                "ring_group_type": 0,
                "ring_group_wait_time": 0,
                "ring_group_wait_time_sequence": 0,
                "ring_group_type_result": null,
                "enable_criteria": false,
                "criterias": []
            }
        ],
        "page_number": 1,
        "page_size": 10,
        "total_items": 4,
        "total_pages": 1,
        "has_next": false,
        "next_page": 1,
        "has_previous": false,
        "previous_page": 1,
        "extension": null
    },
    "key_enabled": false
}
```

{% endtab %}
{% endtabs %}

## Tạo nhóm nội bộ

<mark style="color:green;">`POST`</mark> `[URL]/api/call_center/internal_group/add`

#### Request Body

<table><thead><tr><th width="205">Name</th><th width="133">Type</th><th>Description</th></tr></thead><tbody><tr><td>group_name<mark style="color:red;">*</mark></td><td>String</td><td>Tên nhóm</td></tr><tr><td>strategy<mark style="color:red;">*</mark></td><td>String</td><td><p>Hình thức đổ chuông của nhóm, Một trong các giá trị dưới</p><p><strong>enterprise</strong> : Đồng thời </p><p><strong>rollover</strong> : Tuần tự</p><p><strong>random</strong> : Ngẫu nhiên</p></td></tr><tr><td>sip_members<mark style="color:red;">*</mark></td><td>Array</td><td>Danh sách số máy lẻ nhân viên cần thêm vào nhóm</td></tr><tr><td>timeout<mark style="color:red;">*</mark></td><td>Integer</td><td>Thời gian chờ từng nhân viên</td></tr><tr><td>ring_group_type</td><td>Integer</td><td><p>Loại tiêu chí trong nhóm, áp dụng cho kịch bản tuần tự</p><p>1: Ưu tiên NV rảnh cao nhất</p><p>4: Ưu tiên nhân viên có tổng cuộc gọi trả lời trong ngày ít nhất</p><p>0: Không tiêu chí</p></td></tr><tr><td>target_timeout_type</td><td>String</td><td><p>Loại kịch bản sẽ chuyển tiếp khi kết thúc nhóm </p><p><strong>Recording</strong> : Lời chào</p><p><strong>Ivr_menu</strong> : Tương tác phím</p><p><strong>Ring_group</strong> : Nhóm</p></td></tr><tr><td>target_timeout</td><td>String</td><td>Id theo từng loại dữ liệu của <strong>target_timeout_type</strong></td></tr><tr><td>call_queue_config</td><td>Object</td><td>Cấu hình hàng đợi<br>{<br> "enable": true, //Bật tắt chức năng<br> "is_in_call": true, //Nhân viên bận<br> "is_offline": true, //Nhân viên không trực tuyến<br> "waiting_time": 90 //Thời gian chờ(s)<br> }</td></tr></tbody></table>

{% tabs %}
{% tab title="200: OK " %}

```json
{
  "status_code": 9999,
  "instance_id": "stg",
  "instance_version": "1.2.163",
  "payload": {
    "_id": "6391f5be232ce4664531e0cc",
    "tenant_id": "6209c98461c1cb163ded25f7",
    "group_name": "tientv11",
    "group_name_unsigned": "tientv11",
    "group_number": "22412",
    "created_date": 1670510011881,
    "last_updated_date": 1670510011881,
    "create_by": {
      "id": "6209c98561c1cb163ded25fa",
      "name": "OMI Hotline"
    },
    "last_update_by": null,
    "is_deleted": false,
    "note": null,
    "members": [
      {
        "agent_id": "6209c98561c1cb163ded25fa",
        "contact_id": "6209c98c067f745da47367d1",
        "order": 0,
        "view": null,
        "timeout": 30,
        "sip_user": null,
        "hold_music_id": null
      }
    ],
    "is_forward_to_user_owner": null,
    "is_forward_to_outer_group": false,
    "outer_group_id": null,
    "strategy": "random",
    "ring_back_id": null,
    "ring_back_name": null,
    "is_answer": null,
    "target_timeout_type": null,
    "target_timeout": null,
    "target_timeout_name": null,
    "ring_group_type": null,
    "ring_group_wait_time": 30,
    "ring_group_wait_time_sequence": 30,
    "ring_group_type_result": null,
    "enable_criteria": null,
    "criterias": null,
    "sip_members": [
      "100"
    ],
    "timeout": 30,
    "call_queue_config": {
      "enable": true,
      "is_in_call": true,
      "is_offline": true,
      "waiting_time": 90
    }
  },
  "key_enabled": false
}
```

{% endtab %}
{% endtabs %}

## Cập nhật nhóm nội bộ

<mark style="color:green;">`POST`</mark> `[URL]/api/call_center/internal_group/update/:id`

#### Path Parameters

| Name                                 | Type   | Description        |
| ------------------------------------ | ------ | ------------------ |
| id<mark style="color:red;">\*</mark> | String | Id của NHÓM NỘI BỘ |

#### Request Body

<table><thead><tr><th width="220">Name</th><th width="127">Type</th><th>Description</th></tr></thead><tbody><tr><td>group_name<mark style="color:red;">*</mark></td><td>String</td><td>Tên nhóm</td></tr><tr><td>strategy<mark style="color:red;">*</mark></td><td>String</td><td><p>Hình thức đổ chuông của nhóm, Một trong các giá trị dưới</p><p><strong>enterprise</strong> : Đồng thời </p><p><strong>rollover</strong> : Tuần tự</p><p><strong>random</strong> : Ngẫu nhiên</p></td></tr><tr><td>sip_members<mark style="color:red;">*</mark></td><td>String</td><td>Danh sách số máy lẻ nhân viên cần thêm vào nhóm</td></tr><tr><td>timeout<mark style="color:red;">*</mark></td><td>Integer</td><td>Thời gian chờ từng nhân viên</td></tr><tr><td>target_timeout_type</td><td>String</td><td><p>Loại kịch bản sẽ chuyển tiếp khi kết thúc nhóm </p><p><strong>Recording</strong> : Lời chào</p><p><strong>Ivr_menu</strong> : Tương tác phím</p><p><strong>Ring_group</strong> : Nhóm</p></td></tr><tr><td>target_timeout</td><td>String</td><td>Id theo từng loại dữ liệu của <strong>target_timeout_type</strong></td></tr><tr><td>ring_group_type</td><td>Integer</td><td><p>Loại tiêu chí trong nhóm, áp dụng cho kịch bản tuần tự</p><p>1: Ưu tiên NV rảnh cao nhất</p><p>4: Ưu tiên nhân viên có tổng cuộc gọi trả lời trong ngày ít nhất</p><p>0: Không tiêu chí</p></td></tr><tr><td>call_queue_config</td><td>Object</td><td>Cấu hình hàng đợi<br>{<br> "enable": true, //Bật tắt chức năng<br> "is_in_call": true, //Nhân viên bận<br> "is_offline": true, //Nhân viên không trực tuyến<br> "waiting_time": 90 //Thời gian chờ(s)<br> }</td></tr></tbody></table>

{% tabs %}
{% tab title="200: OK " %}

```json
{
  "status_code": 9999,
  "instance_id": "stg",
  "instance_version": "1.2.163",
  "payload": {
    "_id": "6391f5be232ce4664531e0cc",
    "tenant_id": "6209c98461c1cb163ded25f7",
    "group_name": "tientv11",
    "group_name_unsigned": "tientv11",
    "group_number": "22412",
    "created_date": 1670510011881,
    "last_updated_date": 1670510011881,
    "create_by": {
      "id": "6209c98561c1cb163ded25fa",
      "name": "OMI Hotline"
    },
    "last_update_by": null,
    "is_deleted": false,
    "note": null,
    "members": [
      {
        "agent_id": "6209c98561c1cb163ded25fa",
        "contact_id": "6209c98c067f745da47367d1",
        "order": 0,
        "view": null,
        "timeout": 30,
        "sip_user": null,
        "hold_music_id": null
      }
    ],
    "is_forward_to_user_owner": null,
    "is_forward_to_outer_group": false,
    "outer_group_id": null,
    "strategy": "random",
    "ring_back_id": null,
    "ring_back_name": null,
    "is_answer": null,
    "target_timeout_type": null,
    "target_timeout": null,
    "target_timeout_name": null,
    "ring_group_type": null,
    "ring_group_wait_time": 30,
    "ring_group_wait_time_sequence": 30,
    "ring_group_type_result": null,
    "enable_criteria": null,
    "criterias": null,
    "sip_members": [
      "100"
    ],
    "timeout": 30,
    "call_queue_config": {
      "enable": true,
      "is_in_call": true,
      "is_offline": true,
      "waiting_time": 90
    }
  },
  "key_enabled": false
}
```

{% endtab %}
{% endtabs %}

## Thêm nhân viên vào nhóm nội bộ

<mark style="color:green;">`POST`</mark> `[URL]/api/call_center/internal_group/add-members`

#### Request Body

| Name                                         | Type   | Description                             |
| -------------------------------------------- | ------ | --------------------------------------- |
| group\_id<mark style="color:red;">\*</mark>  | String | Id của nhóm nội bộ                      |
| sip\_users<mark style="color:red;">\*</mark> | Array  | Danh sách các số máy lẻ , thêm vào nhóm |

## Xoá nhân viên khỏi nhóm nội bộ

<mark style="color:green;">`POST`</mark> `[URL]/api/call_center/internal_group/remove-members`

#### Request Body

| Name                                         | Type   | Description                           |
| -------------------------------------------- | ------ | ------------------------------------- |
| group\_id<mark style="color:red;">\*</mark>  | String | Id của nhóm nội bộ                    |
| sip\_users<mark style="color:red;">\*</mark> | Array  | Danh sách số máy lẻ nhân viên cần xoá |

## Xoá nhóm nội bộ

<mark style="color:red;">`DELETE`</mark> `[URL]/api/call_center/internal_group/delete/:id`

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | String | Id của nhóm |

## Danh sách kịch bản bấm phím

<mark style="color:blue;">`GET`</mark> `[URL]/api/call_center/key-interaction/list`

#### Query Parameters

| Name                                   | Type    | Description      |
| -------------------------------------- | ------- | ---------------- |
| keyword                                | String  | Từ khoá tìm kiếm |
| page<mark style="color:red;">\*</mark> | Integer | Trang            |
| size<mark style="color:red;">\*</mark> | Integer | Kích thước trang |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
   "status_code":9999,
   "instance_id":"stg",
   "instance_version":"1.2.163",
   "payload":{
      "items":[
         {
            "_id":"632969ce7534d97b0933d51d",
            "tenant_id":"6209c98461c1cb163ded25f7",
            "script_name":"KỊCH BẢN BẤM PHÍM",
            "script_name_unsigned":"KICH BAN BAM PHIM",
            "script_number":"166780",
            "greeting_id":"6209c99b067f745da47367f3",
            "greeting_name":null,
            "greeting_short_id":"",
            "greeting_short_name":null,
            "note":null,
            "created_date":1663658446348,
            "created_by":{
               "id":"6209c98561c1cb163ded25fa",
               "name":"OMI Hotline"
            },
            "last_updated_date":1663658542212,
            "last_updated_by":{
               "id":"6209c98561c1cb163ded25fa",
               "name":"OMI Hotline"
            },
            "is_deleted":false,
            "scripts":[
               {
                  "key":null,
                  "action_type":"Ring_group",
                  "action":"62ff119508d4bf3ea694a44a",
                  "action_name":null,
                  "ivr":"1"
               },
               {
                  "key":null,
                  "action_type":"Ring_group",
                  "action":"62ff119508d4bf3ea694a44a",
                  "action_name":null,
                  "ivr":"2"
               },
               {
                  "key":null,
                  "action_type":"",
                  "action":"",
                  "action_name":null,
                  "ivr":"3"
               },
               {
                  "key":null,
                  "action_type":"",
                  "action":"",
                  "action_name":null,
                  "ivr":"4"
               },
               {
                  "key":null,
                  "action_type":"",
                  "action":"",
                  "action_name":null,
                  "ivr":"5"
               }
            ],
            "time_out":3,
            "action_type":"",
            "action":"",
            "action_name":null,
            "invalid_sound_id":"",
            "invalid_sound_name":null,
            "max_failure":1,
            "ivr_direct_menu_dial":null
         }
      ],
      "page_number":1,
      "page_size":10,
      "total_items":1,
      "total_pages":1,
      "has_next":false,
      "next_page":1,
      "has_previous":false,
      "previous_page":1,
      "extension":null
   },
   "key_enabled":false
}
```

{% endtab %}
{% endtabs %}

## Tạo mới kịch bản bấm phím

<mark style="color:green;">`POST`</mark> `[URL]/api/call_center/key-interaction/add`

#### Request Body

| Name                                           | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| script\_name<mark style="color:red;">\*</mark> | String  | Tên kịch bản bấm phím (Chú ý không được trùng)                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| max\_failure<mark style="color:red;">\*</mark> | Integer | Số lần nhấn sai phím                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| time\_out<mark style="color:red;">\*</mark>    | Integer | Thời gian chờ KH bấm phím,  hoặc Khi  kết thúc file ghi âm                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| scripts<mark style="color:red;">\*</mark>      | Array   | <p>Danh sách mảng đối tượng phím</p><p>Cách loại kịch bản đi kèm với phím bấm.<br><strong>Thành phần là nhóm nội bộ</strong></p><p>{</p><p>   "ivr" : "", //Tên phím 1,2,3..</p><p>    "action": "xxxxxxxx" // Id của nhóm nội bộ</p><p>  "action\_type":"<em>Ring\_group</em>"</p><p>}</p><p><strong>Thành phần là kịch bản bấm phím</strong> </p><p>{</p><p>   "ivr" : "", //Tên phím 1,2,3..</p><p>    "action": "xxxxxxxx" // Id Kịch bản bấm phím.</p><p>  "action\_type":"<em>Ivr\_menu</em>"</p><p>}</p><p></p> |
| greeting\_id<mark style="color:red;">\*</mark> | String  | Id của file ghi âm (API upload file ghi âm)                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| greeting\_short\_id                            | String  | Id của file ghi âm( Nhạc chờ khi trở lại tương tác bấm phím)                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| invalid\_sound\_id                             | String  | Id của file ghi âm (Nhạc chờ khi nhấn sai phím)                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| action                                         | String  | Id của hành động action\_type theo các loại tương ứng                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| action\_type                                   | String  | <p>Loại hành động khi không nhấn phím, hoặc nhấn sai phím quá số lần cho phép</p><p>Ring\_group : Nhóm nội bộ</p><p>Ivr\_menu : Kịch bản bấm phím </p><p>Recording : Lời chào</p>                                                                                                                                                                                                                                                                                                                                      |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
   "status_code":9999,
   "instance_id":"stg",
   "instance_version":"1.2.163",
   "payload":{
      "_id":"632969ce7534d97b0933d51d",
      "tenant_id":"6209c98461c1cb163ded25f7",
      "script_name":"KỊCH BẢN BẤM PHÍM",
      "script_name_unsigned":"KICH BAN BAM PHIM",
      "script_number":"166780",
      "greeting_id":"62da34652a310904dfbbf13b",
      "greeting_name":null,
      "greeting_short_id":"",
      "greeting_short_name":null,
      "note":null,
      "created_date":1663658446348,
      "created_by":{
         "id":"6209c98561c1cb163ded25fa",
         "name":"OMI Hotline"
      },
      "last_updated_date":1670644627322,
      "last_updated_by":{
         "id":"6209c98561c1cb163ded25fa",
         "name":"OMI Hotline"
      },
      "is_deleted":false,
      "scripts":[
         {
            "key":null,
            "action_type":"Ivr_menu",
            "action":"6391fa5f44b0fb4429b580c0",
            "action_name":null,
            "ivr":"1"
         },
         {
            "key":null,
            "action_type":"",
            "action":"",
            "action_name":null,
            "ivr":"5"
         }
      ],
      "time_out":3,
      "action_type":"",
      "action":"",
      "action_name":null,
      "invalid_sound_id":"6209c99b067f745da47367f3",
      "invalid_sound_name":null,
      "max_failure":1,
      "ivr_direct_menu_dial":"false"
   },
   "key_enabled":false
}
```

{% endtab %}
{% endtabs %}

## Cập nhật kịch bản bấm phím

<mark style="color:green;">`POST`</mark> `[URL]/api/call_center/key-interaction/update/:id`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | String | Id kịch bản |

#### Request Body

| Name                                           | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| script\_name<mark style="color:red;">\*</mark> | String  | Tên kịch bản bấm phím                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| greeting\_id<mark style="color:red;">\*</mark> | String  | Id file ghi âm                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| max\_failure<mark style="color:red;">\*</mark> | Integer | Số lần nhấn sai phím                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| time\_out<mark style="color:red;">\*</mark>    | Integer | Thời gian chờ KH nhấn phím hoặc lời chào kết thúc                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| scripts<mark style="color:red;">\*</mark>      | Array   | <p>Danh sách mảng đối tượng phím</p><p>Cách loại kịch bản đi kèm với phím bấm.<br><strong>Thành phần là nhóm nội bộ</strong></p><p>{</p><p>   "ivr" : "", //Tên phím 1,2,3..</p><p>    "action": "xxxxxxxx" // Id của nhóm nội bộ</p><p>  "action\_type":"<em>Ring\_group</em>"</p><p>}</p><p><strong>Thành phần là kịch bản bấm phím</strong> </p><p>{</p><p>   "ivr" : "", //Tên phím 1,2,3..</p><p>    "action": "xxxxxxxx" // Id Kịch bản bấm phím.</p><p>  "action\_type":"<em>Ivr\_menu</em>"</p><p>}</p><p></p> |
| action\_type                                   | String  | <p>Loại hành động khi không nhấn phím, hoặc nhấn sai phím quá số lần cho phép</p><p>Ring\_group : Nhóm nội bộ</p><p>Ivr\_menu : Kịch bản bấm phím </p><p>Recording : Lời chào</p><p></p><p></p>                                                                                                                                                                                                                                                                                                                        |
| action                                         | String  | Id của hành động action\_type theo các loại tương ứng                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| invalid\_sound\_id                             | String  | Id của file ghi âm (Nhạc chờ khi nhấn sai phím)                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| greeting\_short\_id                            | String  | Id của file ghi âm( Nhạc chờ khi trở lại tương tác bấm phím)                                                                                                                                                                                                                                                                                                                                                                                                                                                           |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
   "status_code":9999,
   "instance_id":"stg",
   "instance_version":"1.2.163",
   "payload":{
      "_id":"632969ce7534d97b0933d51d",
      "tenant_id":"6209c98461c1cb163ded25f7",
      "script_name":"KỊCH BẢN BẤM PHÍM",
      "script_name_unsigned":"KICH BAN BAM PHIM",
      "script_number":"166780",
      "greeting_id":"62da34652a310904dfbbf13b",
      "greeting_name":null,
      "greeting_short_id":"",
      "greeting_short_name":null,
      "note":null,
      "created_date":1663658446348,
      "created_by":{
         "id":"6209c98561c1cb163ded25fa",
         "name":"OMI Hotline"
      },
      "last_updated_date":1670644627322,
      "last_updated_by":{
         "id":"6209c98561c1cb163ded25fa",
         "name":"OMI Hotline"
      },
      "is_deleted":false,
      "scripts":[
         {
            "key":null,
            "action_type":"Ivr_menu",
            "action":"6391fa5f44b0fb4429b580c0",
            "action_name":null,
            "ivr":"1"
         },
         {
            "key":null,
            "action_type":"",
            "action":"",
            "action_name":null,
            "ivr":"5"
         }
      ],
      "time_out":3,
      "action_type":"",
      "action":"",
      "action_name":null,
      "invalid_sound_id":"6209c99b067f745da47367f3",
      "invalid_sound_name":null,
      "max_failure":1,
      "ivr_direct_menu_dial":"false"
   },
   "key_enabled":false
}
```

{% endtab %}
{% endtabs %}

## XOÁ kịch bản bấm phím

<mark style="color:red;">`DELETE`</mark> `[URL]/api/call_center/key-interaction/delete/:id`

#### Path Parameters

| Name                                 | Type   | Description     |
| ------------------------------------ | ------ | --------------- |
| id<mark style="color:red;">\*</mark> | String | Id của kịch bản |

## Danh sách file ghi âm

<mark style="color:blue;">`GET`</mark> `[URL]/api/call_center/greeting/list`

#### Query Parameters

| Name                                   | Type    | Description                    |
| -------------------------------------- | ------- | ------------------------------ |
| page<mark style="color:red;">\*</mark> | Integer | Trang (bắt đầu từ 1)           |
| size<mark style="color:red;">\*</mark> | Integer | Kích thước trang (mặc định 10) |

{% tabs %}
{% tab title="200: OK " %}

````javascript

{
    "status_code": 9999,
    "instance_id": "stg",
    "instance_version": "1.2.163",
    "payload": {
        "items": [
            {
                "_id": "6391f975b4c5c92743725fa3",
                "created_date": 1670510965969,
                "last_updated_date": 1670510965977,
                "create_by": null,
                "last_update_by": null,
                "tenant_id": "6209c98461c1cb163ded25f7",
                "greeting_name": "Name 1",
                "greeting_name_unsigned": "name 1",
                "formality": "Robot đọc",
                "recording_file": "6c0d4c55-d837-4ae5-835e-c16180b09e51.mp3",
                "content": "Name 1",
                "voice": "banmai",
                "speed": 0,
                "is_deleted": false,
                "is_hidden_in_list": null
            },
            {
                "_id": "634944c8df71333e7787e03d",
                "created_date": 1665746120033,
                "last_updated_date": 1665746120033,
                "create_by": null,
                "last_update_by": null,
                "tenant_id": "6209c98461c1cb163ded25f7",
                "greeting_name": "Thêm mới thành công",
                "greeting_name_unsigned": "them moi thanh cong",
                "formality": "Robot đọc",
                "recording_file": "d1969275-e403-438f-935c-6425d1550692.mp3",
                "content": "Thêm mới thành công",
                "voice": "banmai",
                "speed": 0,
                "is_deleted": false,
                "is_hidden_in_list": null
            },
            {
                "_id": "634944a5823f5332401ec9c3",
                "created_date": 1665746085884,
                "last_updated_date": 1665746085884,
                "create_by": null,
                "last_update_by": null,
                "tenant_id": "6209c98461c1cb163ded25f7",
                "greeting_name": "Thêm mới",
                "greeting_name_unsigned": "them moi",
                "formality": "Robot đọc",
                "recording_file": "d8bc922b-cabf-4e28-8198-6021f5b82c14.mp3",
                "content": "Thêm mới thành công hay thất bại",
                "voice": "banmai",
                "speed": 0,
                "is_deleted": false,
                "is_hidden_in_list": null
            }
        ],
        "page_number": 1,
        "page_size": 3,
        "total_items": 13,
        "total_pages": 5,
        "has_next": true,
        "next_page": 2,
        "has_previous": false,
        "previous_page": 1,
        "extension": null
    },
    "key_enabled": false
}
```
````

{% endtab %}
{% endtabs %}

## Upload file ghi âm

<mark style="color:green;">`POST`</mark> `[URL]/api/call_center/greeting/upload`

Chú ý : **Request là form-data và chỉ hỗ trợ mp3**

#### Query Parameters

| Name           | Type   | Description |
| -------------- | ------ | ----------- |
| greeting\_name | String | Tên file    |

#### Request Body

| Name                                   | Type   | Description      |
| -------------------------------------- | ------ | ---------------- |
| file<mark style="color:red;">\*</mark> | Binary | Dữ liệu của file |

## Upload file ghi âm : Robot đọc (Text To Speech)

<mark style="color:green;">`POST`</mark> `[URL]/api/call_center/greeting/upload-text-to-speech`

#### Query Parameters

| Name                                             | Type   | Description     |
| ------------------------------------------------ | ------ | --------------- |
| greeting\_name<mark style="color:red;">\*</mark> | String | Tên file ghi âm |

#### Request Body

| Name                                    | Type   | Description                                                                                                                                                                           |
| --------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| text<mark style="color:red;">\*</mark>  | String | Nội dung cần đọc **< 300 ký tự**                                                                                                                                                      |
| speed<mark style="color:red;">\*</mark> | String | <p>Tốc độ đọc, Giá trị từ  -3 - 3<br>- 3 : Cực kì chậm<br>-2 : Rất chậm<br>-1 : Chậm<br>0 : Bình thường<br>1 : Nhanh<br>...</p><p></p>                                                |
| voice<mark style="color:red;">\*</mark> | String | ID giọng đọc mặc định là 'northern\_female\_ngocanh'. Danh sách ID các giọng đọc: northern\_female\_ngocanh southern\_male\_tienhuy northern\_male\_anhkiet southern\_female\_khangan |

{% tabs %}
{% tab title="200: OK " %}

````javascript
{
    "status_code": 9999,
    "instance_id": "stg",
    "instance_version": "1.2.163",
    "payload": {
        "file": {
            "_id": "639981151ee2ed6f5bbeea90",
            "created_date": 1671004437213,
            "last_updated_date": 1671004437213,
            "create_by": null,
            "last_update_by": null,
            "tenant_id": "6209c98461c1cb163ded25f7",
            "greeting_name": "Nhắc lịch đào tạo",
            "greeting_name_unsigned": "Nhac lich dao tao",
            "formality": "Robot đọc",
            "recording_file": "a6c2edd9-9af1-4e71-98a7-657c3c1e0466.mp3",
            "content": "Bạn có một lịch họp sắp đến giờ, bạn vui lòng chú ý thời gian để đến đúng giờ",
            "voice": "banmai",
            "speed": 0,
            "is_deleted": false,
            "is_hidden_in_list": null
        }
    },
    "key_enabled": false
}
```
````

{% endtab %}
{% endtabs %}

## Xoá file ghi âm

<mark style="color:red;">`DELETE`</mark> `[URL]/api/call_center/greeting/delete/:id`

#### Path Parameters

| Name                                 | Type   | Description    |
| ------------------------------------ | ------ | -------------- |
| id<mark style="color:red;">\*</mark> | String | Id file ghi âm |

## Danh sách kịch bản

<mark style="color:green;">`GET`</mark> `[URL]/api/call_center/call_script/list?page=&size=`

Danh sách kịch bản cuộc gọi

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Request Params**

| Name | Type    | Description      |
| ---- | ------- | ---------------- |
| page | Integer | Trang            |
| size | Integer | Kích thước trang |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "instance_id": "stg",
    "payload": {
        "items": [
            {
                "_id": "6333d3d3f4bfc27c57841093",
                "extension": "3638325",
                "created_date": 1664340947781,
                "last_updated_date": 1736159391976,
                "create_by": {
                    "id": "6209c98561c1cb163ded25fa",
                    "name": "Trần Văn Tiến"
                },
                "last_update_by": {
                    "id": "6209c98561c1cb163ded25fa",
                    "name": "Trần Văn Tiến"
                },
                "tenant_id": "6209c98461c1cb163ded25f7",
                "script_name": "Nhóm CSKH",
                "script_name_unsigned": "Nhom CSKH",
                "note": "",
                "is_deleted": false,
                "callscript_type": 0,
                "callscript_wait_time": 5,
                "scripts": [
                    {
                        "action_type": "Ring_group",
                        "action_id": "62ff119508d4bf3ea694a44a",
                        "order": 0,
                        "action_name": null,
                        "voice": null,
                        "callbot_script_uuid": null
                    }
                ],
                "enable_criteria": true,
                "criterias": [
                    {
                        "type": "2",
                        "wait_time": "10",
                        "timeout_time": "10"
                    }
                ]
            }
        ],
        "page_number": 1,
        "page_size": 10,
        "total_items": 1,
        "total_pages": 1,
        "has_next": false,
        "next_page": 1,
        "has_previous": false,
        "previous_page": 1,
        "extension": null
    },
    "instance_version": "1.2.164",
    "key_enabled": false,
    "status_code": 9999
}
```

{% endtab %}
{% endtabs %}

## Tạo mới kịch bản cuộc gọi

<mark style="color:green;">`POST`</mark> `[URL]/api/call_center/call_script/add`

Tạo mới kịch bản cuộc gọi

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Body**

<table><thead><tr><th width="155">Name</th><th width="132">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>script_name *</code></td><td>string</td><td>Tên kịch bản</td></tr><tr><td><code>note</code></td><td>string</td><td>Mô tả về kịch bản</td></tr><tr><td>scripts *</td><td>Array Object</td><td><pre><code><strong>[{
</strong>    "action_id":"",
    "action_type":""
 }]
</code></pre><p>Là thành phần bên trong kịch bản. Ví dụ khi cần chuyển tiếp tới nhân viên, nhóm , hoặc tương tác phím. Chúng được quy định bởi : </p><p><strong>action_id : Là id của thành phần</strong> </p><p><strong>action_type : Là loại thành phần :</strong> </p><pre class="language-json"><code class="lang-json">Extension : Tới nhân viên
Ivr_menu : Tương tác phím
Ring_group : Nhóm nội bộ
Recording : Lời chào
</code></pre></td></tr><tr><td><p></p><p>criterias</p></td><td>Array Object</td><td>[<br>{<br>"type": "2",<br>"timeout_time": "10",<br>"wait_time": "10"<br>},<br>{<br>"type": "3",<br>"timeout_time": "10",<br>"wait_time": "10"<br>},<br>{<br>"type": "4",<br>"timeout_time": "10",<br>"wait_time": "10"<br>}<br>]<br>Là tiêu chí kịch bản.<br>"type" : "2" là tiêu chí nhân viên quản lý khách hàng<br>"type" : "3" là tiêu chí nhân viên từng gọi điện cho khách hàng đó<br>"type" : "4" là tiêu chí nhân viên có cuộc gọi nhỡ với khách hàng đó<br>"timeout_time" là thời gian chờ của nhân viên (s)<br>"wait_time" là thời gian chờ khi không trực tuyến (s)<br></td></tr></tbody></table>

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "instance_id": "stg",
    "payload": {
        "_id": "677cc34c7af28d0abf247aff",
        "extension": "4187167",
        "created_date": 1736229708336,
        "last_updated_date": 1736229708336,
        "create_by": {
            "id": "6209c98561c1cb163ded25fa",
            "name": "Trần Văn Tiến"
        },
        "last_update_by": null,
        "tenant_id": "6209c98461c1cb163ded25f7",
        "script_name": "KB demo Api",
        "script_name_unsigned": "KB demo Api",
        "note": "",
        "is_deleted": false,
        "callscript_type": 0,
        "callscript_wait_time": 5,
        "scripts": [
            {
                "action_type": "Ring_group",
                "action_id": "62ff119508d4bf3ea694a44a",
                "order": 0,
                "action_name": null,
                "voice": null,
                "callbot_script_uuid": null
            }
        ],
        "enable_criteria": false,
        "criterias": []
    },
    "instance_version": "1.2.164",
    "key_enabled": false,
    "status_code": 9999
}
```

{% endtab %}
{% endtabs %}

## Cập nhật kịch bản

<mark style="color:green;">`PUT`</mark> `[URL]/api/call_center/call_script/update/:id`

\<Description of the endpoint>

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Path Parameters**

|    |        |                              |
| -- | ------ | ---------------------------- |
| id | string | Id của kịch bản cần cập nhật |

**Body**

<table><thead><tr><th width="166">Name</th><th width="137">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>name *</code></td><td>string</td><td>Tên kịch bản</td></tr><tr><td><code>note</code></td><td>string</td><td>Ghi chú về kịch bản</td></tr><tr><td>scripts *</td><td>Array Object</td><td><p></p><pre><code><strong>[{
</strong>    "action_id":"",
    "action_type":""
 }]
</code></pre><p>Là thành phần bên trong kịch bản. Ví dụ khi cần chuyển tiếp tới nhân viên, nhóm , hoặc tương tác phím. Chúng được quy định bởi : </p><p><strong>action_id : Là id của thành phần</strong> </p><p><strong>action_type : Là loại thành phần :</strong> </p><pre class="language-json"><code class="lang-json">Extension : Tới nhân viên
Ivr_menu : Tương tác phím
Ring_group : Nhóm nội bộ
Recording : Lời chào
</code></pre></td></tr><tr><td>criterias</td><td>Array Object</td><td>[<br>{<br>"type": "2",<br>"timeout_time": "10",<br>"wait_time": "10"<br>},<br>{<br>"type": "3",<br>"timeout_time": "10",<br>"wait_time": "10"<br>},<br>{<br>"type": "4",<br>"timeout_time": "10",<br>"wait_time": "10"<br>}<br>]<br>Là tiêu chí kịch bản.<br>"type" : "2" là tiêu chí nhân viên quản lý khách hàng<br>"type" : "3" là tiêu chí nhân viên từng gọi điện cho khách hàng đó<br>"type" : "4" là tiêu chí nhân viên có cuộc gọi nhỡ với khách hàng đó<br>"timeout_time" là thời gian chờ của nhân viên (s)<br>"wait_time" là thời gian chờ khi không trực tuyến (s)</td></tr></tbody></table>

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "instance_id": "stg",
    "payload": {
        "_id": "677cc34c7af28d0abf247aff",
        "extension": "4187167",
        "created_date": 1736229708336,
        "last_updated_date": 1736229708336,
        "create_by": {
            "id": "6209c98561c1cb163ded25fa",
            "name": "Trần Văn Tiến"
        },
        "last_update_by": null,
        "tenant_id": "6209c98461c1cb163ded25f7",
        "script_name": "KB demo Api",
        "script_name_unsigned": "KB demo Api",
        "note": "",
        "is_deleted": false,
        "callscript_type": 0,
        "callscript_wait_time": 5,
        "scripts": [
            {
                "action_type": "Ring_group",
                "action_id": "62ff119508d4bf3ea694a44a",
                "order": 0,
                "action_name": null,
                "voice": null,
                "callbot_script_uuid": null
            }
        ],
        "enable_criteria": false,
        "criterias": []
    },
    "instance_version": "1.2.164",
    "key_enabled": false,
    "status_code": 9999
}
```

{% endtab %}
{% endtabs %}

## Xoá kịch bản cuộc gọi

<mark style="color:green;">`DELETE`</mark> `[URL]/api/call_center/call_script/delete/:id`

Xoá kịch bản cuộc gọi

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Path Parameters**

| Name | Type   | Description      |
| ---- | ------ | ---------------- |
| `id` | string | Name of the user |

**Response**

{% tabs %}
{% tab title="200" %}

```json

{
    "instance_id": "stg",
    "payload": true,
    "instance_version": "1.2.164",
    "key_enabled": false,
    "status_code": 9999
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api.omicall.com/omicall-api/call-center.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
