Asterisk CDR Database

By default, asterisk will generate a CDR record in database for every call when hangup,
Is it possible to configure asterisk which generate CDR record in database when the call is answered by extension.
Aterisk version is 16.4

You would have to arrange for ResetCDR to be called when the call was answered. I presume that could be done using one of the serveral options for running code at that point.

On the other hand, most things bill according to the time after the answer, so I can’t think why you would want to do tihis.

I don’t think ResetCDR would cause the record to get written out at that time, but having never tried or wanted to do this I could be wrong.

Dear @jcolp,
At asterisk 13.X and Asterisk 16.0 i was able to get Remote-Caller ID for current call from CDR using sample php file…
But After update to Asterisk 16.4, i can’t get Remote-Caller ID for current call from CDR using same php file.

Following is my php file.

header('Access-Control-Allow-Origin:', false);
	echo 0;
$extention_id = (int) $_GET['extention_id'];

$servername = "localhost";
$username = "root";
$password = "";
$dbname = "asterisk";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);

$sql = "SELECT `cdr_id`, `src` FROM `cdr` WHERE `calltype`=2 AND `disposition`='ANSWERED' AND `dst`='".$extention_id."' ORDER BY `calldate` DESC LIMIT 1";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
        echo $row["src"];
} else {
    echo "No Call";
	echo 0;

Could you help please…
i am very new to asterisk

Didn’t you already create a thread for that specific problem? Did you create this new one to try to get another answer?

This was already addressed here Asterisk 16.4 API

Sorry for asking help from asterisk cummunity.

Sorry for asking help from asterisk cummunity…
Please ignore it…