# Click To Call

API dùng để thực hiện **click-to-call**.

Sau khi thực hiện click-to-call, hệ thống sẽ gọi vào số extension của domain, sau khi extension pickup cuộc gọi thì có một cuộc gọi đẩy ra số mobile dựa vào parameter của API.

## Click To Call

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

#### Headers

| Name          | Type   | Description           |
| ------------- | ------ | --------------------- |
| Authorization | string | Bearer 'Access Token' |

#### Request Body

| Name          | Type   | Description                            |
| ------------- | ------ | -------------------------------------- |
| extension     | string | Số máy lẻ nhân viên thực hiện cuộc gọi |
| hotline       | string | Số Hotline (hay số SIP)                |
| phone\_number | string | Số điện thoại gọi tới                  |

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

```json
{
    "status_code": 9999,
    "instance_id": "stg",
    "instance_version": "1.2.163",
    "payload": {
        "call_uuid": "b4dae7fe-9d09-4491-918f-2b391fd5feef" // id cuộc gọi
    },
    "key_enabled": false
}
```

{% endtab %}

{% tab title="Error" %}

```json
{
	"status_code": -9999,
	"instance_id": "stg",
	"instance_version": "1.2.163",
	"payload": {
		"status": "fail",
		"error": "data_is_required",
		"message": "Please check your input param"
	},
	"key_enabled": false
}
```

{% endtab %}
{% endtabs %}

Mô tả mã lỗi trong trường hợp gọi API không thành công

| <p>ERROR CODE</p><p>(payload.error)</p> | <p>MESAGE</p><p>(payload.message)</p>                       | DESCRIPTION                                                                  |
| --------------------------------------- | ----------------------------------------------------------- | ---------------------------------------------------------------------------- |
| *data\_is\_required*                    | Please check your input param                               | Dữ liệu là bắt buộc                                                          |
| *tenant\_invalid*                       | Your tenant not found                                       | Doanh nghiệp không hợp lệ                                                    |
| *user\_not\_registered*                 | User not registered extension with Softphone, IP Phone, Web | Số máy lẻ không được ghi danh tổng đài                                       |
| *number\_call\_out\_invalid*            | Your hotline invalid                                        | Số hotline gọi ra không hợp lệ hoặc không có                                 |
| *extension\_invalid*                    | Extension not found or disabled                             | Số máy lẻ không hợp lệ                                                       |
| user\_busy                              | User busy                                                   | Số điện thoại gọi tới bận                                                    |
| do\_not\_call                           | Do not call                                                 | Số điện thoại gọi tới đăng ký donotcall (đăng ký không làm phiền ở nhà mạng) |
|                                         | Unknown                                                     | Lỗi khác                                                                     |


---

# 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/click-to-call.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.
