10 Key Flows (Sequence Diagrams)


10 Key Flows (Sequence Diagrams)

This chapter describes a recommended way to understand “operations + events”: after you call an operation, you receive the operation response first, then the subsequent process events.

Notes: Diagrams are written in Mermaid (some renderers require Mermaid support enabled).

1. Preview Outbound Call (previewObCall)

Involves:

  • Operation response: previewObCallResp
  • Process events: previewObCallResult / previewObCallStart / previewObCallRinging / previewObCallBridge
sequenceDiagram
    participant SDK as AgentSdk
    participant WS as WebSocket Channel
    participant SVC as Backend Service

    SDK->>WS: previewObCall(params)
    WS->>SVC: Forward previewObCall
    SVC-->>WS: previewObCallResp (response, code 0/-1)
    WS-->>SDK: previewObCallResp

    alt code=0
        SVC-->>WS: previewObCallResult (result=success/error)
        WS-->>SDK: previewObCallResult

        SVC-->>WS: previewObCallStart (start dialing customer)
        WS-->>SDK: previewObCallStart

        SVC-->>WS: previewObCallRinging (customer ringing)
        WS-->>SDK: previewObCallRinging

        SVC-->>WS: previewObCallBridge (bridged)
        WS-->>SDK: previewObCallBridge
    else code!=0
        Note right of SDK: Failed; usually no subsequent events
    end

2. Consult (startAtxfer)

Involves:

  • Operation response: startAtxferResp
  • Process events: atxferStart / atxferLink / atxferEnded / atxferError
sequenceDiagram
    participant SDK as AgentSdk
    participant WS as WebSocket Channel
    participant SVC as Backend Service

    SDK->>WS: startAtxfer(params)
    WS->>SVC: Forward startAtxfer(params)
    SVC-->>WS: startAtxferResp (response, code 0/-1)
    WS-->>SDK: startAtxferResp

    alt code=0
        SVC-->>WS: atxferStart (consult started)
        WS-->>SDK: atxferStart

        SVC-->>WS: atxferLink (consult connected)
        WS-->>SDK: atxferLink

        SVC-->>WS: atxferEnded (resume/hangup/cancel)
        WS-->>SDK: atxferEnded
    else code!=0
        Note right of SDK: Failed; usually no subsequent events
    end

    SVC-->>WS: atxferError (consult failed; may occur at any failure point)
    WS-->>SDK: atxferError

3. Consult three-way (threewayAtxfer)

Involves:

  • Operation response: threewayAtxferResp
  • Process events: threewayAtxferResult / atxferThreewayUnlink
sequenceDiagram
    participant SDK as AgentSdk
    participant WS as WebSocket Channel
    participant SVC as Backend Service

    SDK->>WS: threewayAtxfer(params)
    WS->>SVC: Forward threewayAtxfer(params)
    SVC-->>WS: threewayAtxferResp (response, code 0/-1)
    WS-->>SDK: threewayAtxferResp

    alt code=0
        SVC-->>WS: threewayAtxferResult (three-way result)
        WS-->>SDK: threewayAtxferResult

        SVC-->>WS: atxferThreewayUnlink (three-way ended)
        WS-->>SDK: atxferThreewayUnlink
    else code!=0
        Note right of SDK: Failed; usually no subsequent events
    end

4. Consult transfer (completeAtxfer)

Involves:

  • Operation response: completeAtxferResp
  • Process event: completeAtxferResult
sequenceDiagram
    participant SDK as AgentSdk
    participant WS as WebSocket Channel
    participant SVC as Backend Service

    SDK->>WS: completeAtxfer(params)
    WS->>SVC: Forward completeAtxfer(params)
    SVC-->>WS: completeAtxferResp (response, code 0/-1)
    WS-->>SDK: completeAtxferResp

    alt code=0
        SVC-->>WS: completeAtxferResult (consult transfer result)
        WS-->>SDK: completeAtxferResult
    else code!=0
        Note right of SDK: Failed; usually no subsequent events
    end