> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stmlink.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> 对外开放的服务端接口有两组前缀，都用同一套鉴权：`/server/v1/...`（SRTC 与 SMeeting 的主接口）和 `/stm/srvapi/v1/...`（SMeeting 的用户体系，服务端极简对接会用到）。鉴权是 app_id + nonce + timestamp + signature 四个请求头，用 app_key 做 HMAC-SHA256 签名，只能从业务方自己的后端调用。除这两组前缀外的接口均为内部接口，不要建议客户调用。 Public server APIs use two path prefixes with the same authentication: `/server/v1/...` (the main APIs of both SRTC and SMeeting) and `/stm/srvapi/v1/...` (the SMeeting user system, used by server-side low-code integration). Authenticate with four request headers, app_id + nonce + timestamp + signature, where signature is HMAC-SHA256 keyed with app_key; call these APIs only from the customer's own backend. Any other path is internal: never suggest calling it.
> app_key 是服务端密钥，绝不能出现在客户端代码、前端配置或移动 App 里。客户端加入频道用的 token 必须由业务方后端签发后下发（SRTC 走 `/server/v1/channel/grant`，SMeeting 走 `/stm/srvapi/v1/member/grant`）。 app_key is a server-side secret and must never appear in client code, frontend config, or a mobile app. The token a client uses to join must be issued by the customer's backend and passed down to the client (SRTC: `/server/v1/channel/grant`; SMeeting: `/stm/srvapi/v1/member/grant`).
> SRTC 与 SMeeting 是上下两层不同的产品，术语不通用：SRTC 是音视频底座，说「频道 channel」「加入 / 退出」；SMeeting 建在 SRTC 之上，说「房间 room」「会议 meeting」「进入 / 退出」。回答时按用户所在的层用对应术语，不要把「房间」「会议」安到 SRTC 的接口上，也不要用「频道」「加入 / 离开」描述 SMeeting 的概念（接口标识符原样保留）。 SRTC and SMeeting are two separate layers with different terminology. SRTC is the audio/video foundation: it has channels, and users join and leave a channel. SMeeting is built on top of SRTC: it has rooms and meetings, and members enter and exit a meeting. Answer in the terms of the layer the user is working with: never apply "room" or "meeting" to SRTC APIs, and never describe SMeeting concepts in prose with "channel", "join", or "leave" (API identifiers such as `force_join` keep their literal names).
> 同一能力在各端 SDK 里的包名、类名、方法名并不相同。写示例代码时请使用文档中该端自己的 API，不要把一个端的写法套到另一个端上。苹果平台每个产品都有两套 SDK（Swift 原生与 Objective-C），两套 API 不能混用。 Package, class, and method names differ between platform SDKs for the same capability. In sample code, use the API documented for that platform; never carry one platform's code over to another. On Apple platforms each product ships two SDKs (native Swift and Objective-C) whose APIs must not be mixed.

# 邀请入会与移出

> 从你的业务后端把人员（App / Web 用户）或会议室终端、监控等设备拉进会议、强制入会、移出会议，以及怎么知道邀请失败了：人员与设备两条路的接口、参数和限制对照

平台侧把人拉进会议有两条路：**人员**（登录了 App / Web 的用户）用会议层的
[会议时呼叫人员入会](https://docs.stmlink.com/zh/meeting/server-api/meet-admin.md#会议时呼叫人员入会)（`call-users`），
**设备**（SIP / H.323 终端、国标监控、RTSP 等）用经 SMeeting 转发的
[邀请设备入会](https://docs.stmlink.com/zh/rtc/server-api/agent.md#邀请设备入会)（`agent/invite`）。移出则两者共用一个接口。

## 对照表

| | 人员 | 设备 |
| - | - | - |
| 邀请接口 | `POST /server/v1/meet-admin/call-users` | `POST /server/v1/agent/invite` |
| 会议怎么填 | `room_no` 或 `meeting_id` 二选一 | `no` 填会议房间号 `room_no`（不是 `meeting_id`） |
| 对方要不要确认 | 要：被叫人的各端弹出来电，接听后入会 | 不用：设备网关直接呼叫或拉流。SIP / H.323 终端是否自动应答，看终端自己的设置 |
| 强制入会 | 传 `force_join=true`：不弹来电，直接入会；正在别的会里会先退出再进 | 总是强制：设备已在别的会里会直接切到这场，终端不挂断 |
| 能进的受限会议 | 见下文「能进哪些受限会议」 | 见下文「能进哪些受限会议」 |
| 移出 | [主持人踢人](https://docs.stmlink.com/zh/meeting/server-api/meet-admin.md#主持人踢人)（`kickout-user`），`target_id` 填用户 ID | 同一个接口，`target_id` 填设备的会中 ID（带 `_agent_` 前缀） |
| 失败怎么知道 | 返回值 `offline_user_ids` 列出不在线的人；没接、拒接用「60 秒内没收到 `user_enter` 回调」判断 | [`device_invite_failed` 回调](https://docs.stmlink.com/zh/meeting/server-api/guides/callbacks#device_invite_failed-—-设备邀请失败) |

## 邀请人员：call-users

```json theme={null}
{
  "room_no": "021890611",
  "conferee_details": [{ "user_id": "1001" }, { "user_id": "1002" }],
  "is_additional": true,
  "force_join": true
}
```

* 被叫人会被同步进参会人员（白名单），并收到一条呼叫；`is_additional=true` 表示追加，不覆盖原有的参会人员
* 被叫人要**登录着**某一端 App / Web（即时通讯在线）才收得到呼叫
* 返回 `data.offline_user_ids`：呼叫当时即时通讯不在线、一定收不到这次呼叫的人。都在线时为空数组；
  在线状态暂时查不到时按在线处理，不会误报

```json theme={null}
{ "code": 0, "data": { "offline_user_ids": ["1002"] } }
```

### 强制入会（force\_join）

`force_join=true` 时，我们的 App（STM Link 等）收到呼叫后：

* 不弹来电页，提示一句后直接入会；入会时的昵称、摄像头 / 麦克风开关沿用 App 的入会设置
* 正在别的会议里（含等候室、正在入会）：先离开当前会议再进这场。离开只退出自己，即使是主持人也不结束会议，也不弹确认框
* 已经在这场会议里：忽略
* 入会失败（如会议已结束）按普通入会失败提示，不重试

不传或传 `false` 时，保持普通的来电页（接听 / 拒绝，60 秒超时）。

## 邀请设备：agent/invite

设备邀请经 SMeeting 原样转发到 SRTC，参数与签名的填法见[设备接入与 IM](https://docs.stmlink.com/zh/meeting/server-api/guides/agent-and-im.md#设备入会时目标房间填什么)，
字段说明见 SRTC 的[邀请设备入会](https://docs.stmlink.com/zh/rtc/server-api/agent.md#邀请设备入会)。

```json theme={null}
{
  "agents": [{ "type": 2, "contact": "192.168.0.18:5060" }],
  "no": "021890611"
}
```

* 设备不用确认。设备网关呼叫 SIP / H.323 终端，终端配置了自动应答就直接入会，否则要有人在终端上接听；国标、RTSP 等拉流设备直接拉流入会
* 设备已经在别的会议里时，会直接切到这场会议，通话不中断、终端不挂断
* 接口返回成功只代表邀请已下发给设备网关，**不代表设备已入会**。入会成功看 `user_enter` 回调，失败看 `device_invite_failed` 回调

## 能进哪些受限会议

邀请会放过会议的部分入会限制，被邀请方不用输密码、不会卡在等候室：

| 入会限制 | 设备（平台邀请） | 人员，`force_join=true` | 人员，普通呼叫 |
| - | - | - | - |
| 会议密码 | 放过 | 放过 | 放过 |
| 参会人员白名单 | 放过 | 放过（呼叫时已加入白名单） | 放过（呼叫时已加入白名单） |
| 会议锁定 | 放过 | 放过 | 照常拦截 |
| 等候室 | 放过（直接进会） | 放过（直接进会） | 照常进等候室 |
| 主持人入会前不允许他人加入 | 放过 | 放过 | 照常拦截 |

* 人员的放行**有效期 30 分钟**：要凭这次呼叫在 30 分钟内入会，超时后按普通入会处理；同一人被再次呼叫时以最新一次为准
* **设备自己呼入**（终端拨会议号进来）不算平台邀请，仍走正常的入会校验
* 会议已结束、被拉黑（踢人时带了 `join_disabled`）等其它规则不受影响

## 移出：kickout-user

人员和设备都用[主持人踢人](https://docs.stmlink.com/zh/meeting/server-api/meet-admin.md#主持人踢人)：

```json theme={null}
{
  "room_no": "021890611",
  "target_id": "_agent_co63jg6g54hu3b0xhtie",
  "join_disabled": true
}
```

* `target_id`：人员填用户 ID；设备填它在会中的用户 ID，以 `_agent_` 开头，从[会中人员列表](https://docs.stmlink.com/zh/meeting/server-api/meet.md#查询会中人员列表)或 `user_enter` 回调拿
* `join_disabled=true`：拉黑，本场会议不能再进；`remove_conferee=true`：同时从参会人员里移除
* 目标已不在会中时直接返回成功

## 邀请失败怎么知道

### 人员

| 情况 | 怎么判断 |
| - | - |
| 不在线，收不到呼叫 | `call-users` 返回的 `offline_user_ids` |
| 收到了但没接、拒接，或强制入会失败 | 呼叫后 **60 秒内没收到该用户的 `user_enter` 回调** |

### 设备

订阅 [`device_invite_failed` 回调](https://docs.stmlink.com/zh/meeting/server-api/guides/callbacks#device_invite_failed-—-设备邀请失败)：终端忙、拒接、无应答、呼不通、拉流失败、入会被拒时推送，
带失败原因 `reason` 与原始说明 `msg`。

> [!WARNING]
>
> 这个回调需要两方面都就位才会推送：
>
> * **设备网关新版本**：老版本的设备网关不上报邀请失败
> * **你订阅**：[设置事件通知](https://docs.stmlink.com/zh/meeting/server-api/meet.md#设置事件通知)时 `events` 里带上 `device_invite_failed`，服务端会自动开启所需的底层事件
>
> SMeeting 服务端 v1.8.0 之前的版本，还需要部署方在服务端配置的 `rtc.callback_events` 里追加 `agent_invite_failed`。
>
> 只对平台邀请的设备推送，设备自己呼入失败不推。

## 限制

* **App 不在线拉不进来**：人员必须登录着某一端（即时通讯在线）才能收到呼叫，强制入会也一样；不在线的人列在 `offline_user_ids` 里
* **手机 App 在后台时**：系统允许时直接拉到前台入会；不允许时只能先弹本地通知，用户 60 秒内点通知或回到前台才入会，超过 60 秒丢弃这次呼叫
* **自己用 SDK 做界面的**：上面「强制入会」的行为是我们 App 的处理，SDK 只把标记带给你。要在收到呼叫事件时自行读取 `force_join`，
  按上面的方式处理（不弹来电、先退出当前会议再入会）；不处理的话，强制呼叫在你的 App 里就和普通呼叫一样。各端从以下版本起能拿到这个字段：

| 端 | 版本 | 字段 |
| - | - | - |
| Web | 0.2.0 起 | `call_calling` 事件的 `content.force_join`，见[事件](https://docs.stmlink.com/zh/meeting/web/events.md#会外消息事件) |
| Android | 2.0.37 起 | `ImContent.CallingMsg.forceJoin`，见[类型](https://docs.stmlink.com/zh/meeting/android/types.md#imcontent-callingmsg) |
| iOS（Objective-C） | 2.5.0 起 | `onCallReceived:nickname:roomNo:title:meetingId:forceJoin:`，见[MeetingKitIMDelegate](https://docs.stmlink.com/zh/meeting/ios/api-reference/MeetingKitIMDelegate.md#oncallreceivednicknameroomnotitlemeetingidforcejoin) |
| Swift | 1.13.0 起 | `ImCallContent.forceJoin`，见[会议外消息](https://docs.stmlink.com/zh/meeting/swift/advanced/im.md#有人呼叫你) |
| 鸿蒙 | 1.9.0 起 | `ImCallContent.forceJoin`，见[IM 与呼叫](https://docs.stmlink.com/zh/meeting/harmony/advanced/im.md#被呼叫入会) |
| Windows | 暂不支持 | — |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.