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
Property | Type | Description |
---|---|---|
appid | number | Your app id |
direction | string | Direction of this call |
from | number | The number who made a call |
leg | string | Define the leg b of the call |
status | string | Status of the stream |
time | number | Timestamp of this call |
cmiuuid | string | A unique identifier of this call |
ws_status | string | WebSocket 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.
- Node.js
- Python
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.
from flask import Flask,request
app = Flask(__name__)
# Receive webhooks from PIOPIY platform when call receive or make
@app.route("/webhook/cdr",methods=['POST'])
def hello():
# Received JSON CDR from PIOPIY Platform
cdr = request.get_json()
print(cdr)
return "got it"
if __name__ == "__main__":
app.run(debug=True, port=5000)
To know more about testing webhooks for local development purposes, go to examples.