Incoming Missed CDR
To receive the incoming missed cdr, you must complete the webhooks setup. After completing the webhooks setup, our TeleCMI platform will notify your web server POST or GET method URL with JSON Call Detail Record(CDR) when an incoming call missed.
Sample CDR response
This is the sample JSON Call Detail Record(CDR), where the TeleCMI platform will notify your web server POST or GET method URL.
{
virtual_number: 440000000000,
custom: '{"crm":"true"}',
appid: 2222223,
type: 'cdr',
direction: 'inbound',
cmiuuid: '4d1f9521-50e5-447d-bf5f-c3292995a727',
status: 'missed',
from: 440000000001,
time: 1634721099442,
waitedsec: 127,
hangup_reason: 'recv_bye',
voicemail: true,
voicename: '1634721220656289350027_2222223.mp3',
conversation_uuid: '4d1f9521-50e5-447d-bf5f-c3292995a727',
team: 'Sales_2222223',
ivr_name: 'salesivr'
}
The above sample JSON Call Detail Record(CDR) consists of several properties. Each property has a description, so take a look at it.
Properties
This is the list of properties and their descriptions.
Property | Type | Description |
---|---|---|
custom | string | Your custom parameters. |
appid | number | Your app id. |
type | string | Type of notification from TeleCMI platform it may be cdr or event. |
direction | string | The direction of this call is inbound. |
cmiuuid | string | A unique identifier for this call. |
status | string | The status of this missed call. |
from | number | The call was made from this number. |
time | number | A timestamp indicates the time the call was missed. |
waitedsec | number | The caller wait time is shown in seconds. |
hangup_reason | string |
|
voicemail | boolean | If the Voicemail is enabled, it shows the status as true. |
voicename | string | The file name of the voicemail. |
team | string | Name of the team where the call has missed. |
conversation_uuid | string | A unique identifier for this overall conversation. |
ivr_name | string | The name of the last IVR stage touched by the customer during their call interaction. |
Implementation
TeleCMI webhooks implementation in different languages.
- Python
- Node.js
- PHP
- Java
from flask import Flask,request
app = Flask(__name__)
# Receive webhooks from TeleCMI platform when call receive or make
@app.route("/webhook/cdr",methods=['POST'])
def hello():
# Received JSON CDR from TeleCMI Platform
cdr = request.get_json()
print(cdr)
return "got it"
if __name__ == "__main__":
app.run(debug=True, port=5000)
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 TeleCMI platform
var cdr = req.body;
console.log(cdr);
res.send('got it');
})
app.listen(5000);
app.run(debug=True, port=5000)
<?php
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
require 'vendor/autoload.php';
$app = new \Slim\App;
$handler = function (Request $req, Response $res) {
$cdr = $req->getParsedBody();
error_log(print_r($cdr, true));
return $res->withStatus(204);
};
$app->post('/webhook/cdr', $handler);
$app->run();
/*
* This Java source file was generated by the Gradle 'init' task.
*/
package telecmi_example_java;
import static spark.Spark.*;
import com.cedarsoftware.util.io.JsonWriter;
public class App {
public static void main(String[] args) {
port(5000);
post("/webhook/cdr", (req, res) -> {
System.out.println("You got CDR from TeleCMI Platform");
String cmiJSON = JsonWriter.formatJson(req.body());
System.out.println(cmiJSON);
res.status(204);
return "";
});
}
}
To know more about testing webhooks for local development purposes, go to examples.