关键流程(时序图)


sequenceDiagram
    participant A
    participant B
    A->>B: ping
    B-->>A: pong

本章介绍一种理解“操作 + 事件”的推荐方式:调用某个操作后,你会先收到该操作的响应,然后再收到后续的流程事件。

注意:图表使用 Mermaid 编写(某些渲染器需要启用 Mermaid 支持)。

1. 预览外呼(previewObCall

包含:

  • 操作响应:previewObCallResp
  • 流程事件:previewObCallResult / previewObCallStart / previewObCallRinging / previewObCallBridge
sequenceDiagram
    participant SDK
    participant WS
    participant SVC
    SVC-->>WS: completeAtxferResult 咨询转接结果
    WS-->>SDK: completeAtxferResult
    SDK->>WS: previewObCall(params)
    WS->>SVC: 转发 previewObCall
    SVC-->>WS: previewObCallResp 响应码
    WS-->>SDK: previewObCallResp

    SVC-->>WS: previewObCallResult 结果
    WS-->>SDK: previewObCallResult
    SVC-->>WS: previewObCallStart 开始呼叫客户
    WS-->>SDK: previewObCallStart
    SVC-->>WS: previewObCallRinging 客户振铃
    WS-->>SDK: previewObCallRinging
    SVC-->>WS: previewObCallBridge 已接通
    WS-->>SDK: previewObCallBridge


## 2. 咨询(`startAtxfer`)

包含:

* 操作响应:`startAtxferResp`
* 流程事件:`atxferStart / atxferLink / atxferEnded / atxferError`

```mermaid
sequenceDiagram
    participant SDK
    participant WS
    participant SVC
    SDK->>WS: startAtxfer(params)
    WS->>SVC: 转发 startAtxfer(params)
    SVC-->>WS: startAtxferResp 响应码
    WS-->>SDK: startAtxferResp
    SVC-->>WS: atxferStart 咨询开始
    WS-->>SDK: atxferStart
    SVC-->>WS: atxferLink 咨询已接通
    WS-->>SDK: atxferLink
    SVC-->>WS: atxferEnded 咨询结束
    WS-->>SDK: atxferEnded
    SVC-->>WS: atxferError 咨询失败
    WS-->>SDK: atxferError

    WS-->>SDK: atxferError

3. 咨询三方通话(threewayAtxfer

包含:

  • 操作响应:threewayAtxferResp
  • 流程事件:threewayAtxferResult / atxferThreewayUnlink
sequenceDiagram
    participant SDK
    participant WS
    participant SVC
    SDK->>WS: threewayAtxfer(params)
    WS->>SVC: 转发 threewayAtxfer(params)
    SVC-->>WS: threewayAtxferResp 响应码
    WS-->>SDK: threewayAtxferResp
    SVC-->>WS: threewayAtxferResult 三方结果
    WS-->>SDK: threewayAtxferResult
    SVC-->>WS: atxferThreewayUnlink 三方结束
    WS-->>SDK: atxferThreewayUnlink

    WS-->>SDK: atxferThreewayUnlink

4. 咨询转接(completeAtxfer

包含:

  • 操作响应:completeAtxferResp
  • 流程事件:completeAtxferResult
sequenceDiagram
    participant SDK
    participant WS
    participant SVC
    SDK->>WS: completeAtxfer(params)
    WS->>SVC: 转发 completeAtxfer(params)
    SVC-->>WS: completeAtxferResp 响应码
    WS-->>SDK: completeAtxferResp


    SVC-->>WS: completeAtxferResult consult transfer result
    WS-->>SDK: completeAtxferResult