# Giới thiệu

PSR là một module dùng cho việc stream luồng thoại từ một cuộc gọi đến một URL websocket của client.

Bạn có thể tương tác với cuộc gọi đó thông qua các action được định nghĩa hoặc phát file âm thanh thông qua kết nối websocket.

PSR còn cho phép bạn bắt đầu một cuộc gọi Click2Call hoặc BOT phát file audio tới mobile, sau khi nghe máy sẽ tiến hành kết nối tới websocket.

<img src="https://documents.tel4vn.com/assets/images/PSR-261620de6cb0d18992dcca78955afe62.png" alt="PSR" height="321" width="930">

#### Thông tin khi connect <a href="#thong-tin-khi-connect" id="thong-tin-khi-connect"></a>

Khi có cuộc gọi được tạo, PSR sẽ connect tới websocket đã được gửi, kèm với đó là các query param.

Các query params sẽ được chia thành 2 loại:

* Cố định: bao gồm 2 param là call\_id, tenant.
* Động: sẽ là các thông tin của cuộc gọi sẽ được truyền tới, đối với autocall là thông tin của KH.

**Format File:**

* 16bit
* 8000Hz

**Message Format:**

```json
{
	"timestamp": 1703825536716,
	"event": "media", // connected, closed
	"media": {
		"payload": "dGhpc2lzbWVkaWFwYXlsb2Fk......"
	},
	"data": {
		"call_id": "aaaaaaaa-1111-2222-3333-eeeeeeee", // call_id
		"channel": "stereo" // mono_a, mono_b
	}
}
```

Payload là chunk cuộc gọi được encode qua base64.


---

# 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://documents.sentechcorp.vn/psr/gioi-thieu.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.
