Monitor WebSocket API Events with Postman

This topic provides an example of capturing call events to demonstrate how to monitor API events of Yeastar P-Series Software Edition with Postman.

Prerequisites

Procedure

  1. Sign in to Postman.
  2. At the side-bar, click New > WebSocket to open a new request tab.

  3. Establish a WebSocket connection with Yeastar P-Series Software Edition API.

    1. In the request field, compose the WebSocket connection request.

      In this example, compose the following request:

      wss://192.168.5.150:8088/openapi/v1.0/subscribe?access_token=ah1i5B5uGYBY4W4ITiOV9lBwrDp2KPyQ
    2. Click Connect.

      The Response field returns "Connected", indicating that the WebSocket connection is successfully established.

  4. Subscribe to the desired events.

    1. Query the desired event ID in API Event Summary, and compose the event subscription message in the Message tab.

      In this example, subscribe to the events (30011) Call Status Changed and (30012) New CDR.

      {"topic_list":[30011,30012]}
    2. Click Send.

      The Response field returns "SUCCESS", indicating that the event subscription is successful.

  5. Send a heartbeat request at regular intervals to keep the connection alive.
    Note: If there is no interaction between the Postman and PBX for 60 seconds, the WebSocket connection will be automatically disconnected.

    1. In the Message tab, enter heartbeat.
    2. Click Send.

      The Response field returns a heartbeat response, indicating that the request is successful.

Result

When a subscribed event occurs, the system automatically sends the event report.

In this example, when the monitored extension receives, answers and ends a call, the system automatically sends the event report of "(30011) Call Status Changed" and "(30012) New CDR".