Outbound Webhooks Answered
To receive the outbound answered webhooks, you must complete the webhooks setup. After completing the webhooks setup, our PIOPIY platform will notify your web server POST method URL with JSON call detail record(CDR) when an incoming call answered.
Implementation
PIOPIY webhooks implementation in different languages.
- Python
- Node.js
- PHP
- Java
from flask import Flask,requestapp = 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 Platformcdr = 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.
Sample CDR response
This is the sample JSON live event, where the PIOPIY platform will notify your web server POST method URL.
- Leg A
- Leg B
{to: 9100000000,appid: 2222222,time: 1637122471000,from: 4471000000,extra_params: '{"key":"value"}',direction: 'outbound',duration: 8,cmiuuid: 'a3438686-746c-48f4-93de-e57e4c72f8d3',conversation_uuid: 'a3438686-746c-48f4-93de-e57e4c72f8d3',request_id: 'SxqRqbMbxXa6HVIGTbrGoJs4d6vqAiWIBaSFKqYqGkQ',callerid: '04471000000',vn: 4471000000,out: true,status: 'answered',leg: 'a',type: 'cdr'}
The above sample JSON live event consists of several properties. Each property has a description and take a look at it.
Properties
These are the list of properties and its description
Property | Type | Description |
---|---|---|
to | number | The number the call was made to |
app_id | number | Your app id |
time | number | Timestamp of this call |
from | number | Your default DID Number |
direction | string | Direction of this call |
duration | number | The total duration of this call in seconds |
cmiuuid | string | A unique identifier of this call |
conversation_uuid | string | A unique identifier of this conversation |
callerid | number | The incoming DID number |
vn | number | Your default DID Number |
out | string | This call is initiated from API |
status | string | Status of this call |
record | string | Call recording is enabled |
filename | string | The file name of the recorded conversation |
leg | string | Define the leg of the call either a or b |
type | string | Type of notification from PIOPIY platform it may be cdr or event |