Skip to main content

Stream Connected

Our PIOPIY platform will notify the following sample JSON live event to your web server POST method URL, when a stream is connected.

Properties

These are the list of properties and its description

PropertyTypeDescription
appidnumberYour app id
directionstringDirection of this call
fromnumberThe number who made a call
legstringDefine the leg b of the call
statusstringStatus of the stream
timenumberTimestamp of this call
cmiuuidstringA unique identifier of this call
ws_statusstringWebSocket status indicating the connection status and details

Event response

Here’s a sample JSON live event that the PIOPIY platform will send to your web server when a stream is connected:

{
appid: 2222224,
direction: 'inbound',
from: 440000000000,
leg: 'b',
status: 'stream_connected',
time: 1725975496000,
cmiuuid: 'c4ec9bd2-efad-4296-aa5b-eeafa6aeeea0',
ws_status: '{"status":"connected"}'
}

The above JSON object contains the key details about the stream connection event.

Implementation

PIOPIY webhooks implementation in different languages.

const express = require("express"),
bodyParser = require("body-parser"),
app = express();

// parse application/json
app.use(bodyParser.json());

app.post("/webhook/cdr", (req, res) => {
//Received CDR JSON Object from PIOPIY platform
var cdr = req.body;

console.log(cdr);

res.send("got it");
});

app.listen(5000);
app.run((debug = True), (port = 5000));

To know more about testing webhooks for local development purposes, go to examples.