Unable to find CDR for SIP channel Asterisk 18

Hi,
I am running Asterisk 18.22 LTS.

I have been trying to make a call extension to extension, residing on the same vlan but I keep on getting the error, Unable to find CDR for channel SIP/xxx.

[Jun 29 16:25:57] ERROR[3183]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/1*7405-00000008
[Jun 29 16:25:57] ERROR[3183]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/1*7405-00000008
[Jun 29 16:25:57] ERROR[3183]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/1*7405-00000008

CDR modules loaded:

>module show like cdr
Module                         Description                              Use Count  Status      Support Level
app_cdr.so                     Tell Asterisk to not maintain a CDR for  0          Running              core
app_forkcdr.so                 Fork The CDR into 2 separate entities    0          Running              core
cdr                            CDR Engine                               14         Running              core
cdr_adaptive_odbc.so           Adaptive ODBC CDR backend                0          Running              core
cdr_csv.so                     Comma Separated Values CDR Backend       0          Running          extended
cdr_custom.so                  Customizable Comma Separated Values CDR  0          Running              core
cdr_manager.so                 Asterisk Manager Interface CDR Backend   0          Running              core
cdr_mysql.so                   MySQL CDR Backend                        0          Running        deprecated
cdr_odbc.so                    ODBC CDR Backend                         0          Running          extended
cdr_pgsql.so                   PostgreSQL CDR Backend                   0          Not Running      extended
cdr_radius.so                  RADIUS CDR Backend                       0          Not Running      extended
cdr_sqlite3_custom.so          SQLite3 Custom CDR Module                0          Not Running      extended
cdr_syslog.so                  Customizable syslog CDR Backend          0          Not Running          core
cdr_tds.so                     FreeTDS CDR Backend                      0          Not Running      extended
func_cdr.so                    Call Detail Record (CDR) dialplan functi 1          Running              core

My cdr files:
cdr.conf

[general]
endbeforehexten=yes
[csv]
usegmtime=yes  
loguniqueid=yes  
loguserfield=yes 
accountlogs=yes

cdr_mysql.conf

[columns]
alias start => calldate

cdr_manager.conf

[general]
enabled = no

Can anyone tell what the issue is?

Best,
Hisham

Please show us the code that is trying to read from the CDR.

this is the dailplan,

 [default]
exten => _XXXX,1,AGI(agi.php)
exten => h,1,AGI(agi.php,CDR)

then this is the cdr function in agi.php after argv[1] ==‘CDR’ in case of hangup…

elseif ($argv[1] == 'CDR') {
    cdr($agi, $TP);

function cdr($agi, $TP) {

    $new_dst = $TP->extension;
    $callerid = $TP->callerid;
    $dcontext = $agi->get_variable("CDR(dcontext)");
    $dcontext = $dcontext['data'];
    $channel = $agi->get_variable("CDR(channel)");
	$tr_src_channel = $channel = $channel['data'];	
	$customer_id = $agi->get_variable("CUSTOMERID");
    $custid = $customer_id = $customer_id['data'];	
	$slevel = $agi->get_variable('SLEVEL');	
	$slevel = $slevel['data'];
	$slevel_value = $agi->get_variable('SLEVELVALUE');	
	$slevel_value = $slevel_value['data'];
	if($slevel == 'SLEVEL' AND $slevel_value != ''){		
		$query = "UPDATE tp_servicelevel SET tp_servicelevel.service_level = $slevel_value, tp_servicelevel.cdr_callid =   (select tp_cdr.cdr_id from  tp_cdr  where  tp_cdr.uniqueid =  tp_servicelevel.callstatus_callid  and tp_cdr.call_type = 'INBOUND' order by  tp_cdr.cdr_id  desc limit 1)  WHERE tp_servicelevel.customer_id = '$custid' AND  tp_servicelevel.channel = '$tr_src_channel'";
		$TP->sqlQuery($query, $agi, 'queue_agentunpause');
		$agi->hangup;
	}
	
    $dstchannel = $agi->get_variable("CDR(dstchannel)");
    $dstchannel = $dstchannel['data'];
    $clid = $agi->get_variable("CDR(clid)");
    $clid = $clid['data'];
    $src = $agi->get_variable("CDR(src)");
    $tr_src = $src = $src['data'];
    $dst = $agi->get_variable("CDR(dst)");
    $dst = $dst['data'];
    $srcchannel = $agi->get_variable("DIALEDPEERNAME");
    print_r($srcchannel);
    $srcchannel = $srcchannel['data'];
    echo "line 2747:\n";
    print_r($srcchannel);
    $hangup_chanel = $TP->channel;
    echo "line 2748: \n";

    echo $hangup_chanel;
    $new_channel = str_replace('<ZOMBIE>', '', $hangup_chanel);
    $hangup_type = $TP->type;

    $forward_account_id = $agi->get_variable("FORWARDINGACCOUNT");
    $forward_account_id = $forward_account_id['data'];
    echo "below forwarding \n";
    echo $forward_account_id;
    echo "----\n";
    echo $hangup_type;
    if ($hangup_type == 'Kill' AND $new_channel != $hangup_chanel) {
        $dest_number = $TP->dnid;
        $TP->livecall($agi, $custid, $new_dst, 'ENDTRANSFER', $request_type = NULL, $uniqueid_answer = '', $dest_number, $new_channel, $tr_src_channel, $tr_src, $srcchannel, $dst);
    } else {        
        echo "hangup type not kill\n";
        $TP->test();
        echo "custid: ";var_dump($custid);echo "\n";
        echo "tr_src: ";var_dump($tr_src);echo "\n";
        echo "srcchannel: ";var_dump($srcchannel);echo "\n";
        echo "dst: ";var_dump($dst);echo "\n";
        echo "dstchannel: ";var_dump($dstchannel);echo "\n";
        $TP->livecall($agi, $custid, $new_dst, 'END', $request_type = NULL, $uniqueid_answer = '', $dest_number, $new_channel, $tr_src_channel, $tr_src, $srcchannel, $dst, $channel, $dstchannel);
        echo "below hangup type not kill\n";

    }
    $recordingfile = $agi->get_variable("MONITORFILE");
    $recordingfile = $recordingfile['data'];
    if ($recordingfile == '')
        $recordingfile = $on_demond_recordingfile = $TP->monitorfile;
    $TP->check_auth_account($agi, $forward_account_id);
    $calltypestart = $agi->get_variable("CALLTYPESTART");
    $calltypestart = $calltypestart['data'];
    $calltype = $agi->get_variable("CALLTYPE");
    $calltype = $calltype['data'];
    $dialstatus = $agi->get_variable("DIALSTATUS");
    $dialstatus = $dialstatus['data'];
    $clid = $agi->get_variable("CDR(clid)");
    $clid = $clid['data'];
    $auto_recording = $agi->get_variable("TOUCH_MIXMONITOR_OUTPUT");
    $auto_recording = $auto_recording['data'];
    if ($auto_recording != '')
        $recordingfile = $auto_recording;
    $newdst = $agi->get_variable("NEWDST");
    $newdst = $newdst['data'];
    $dialednumber = $agi->get_variable("DIALEDPEERNUMBER");
    $cn = $dialednumber['data'];
    $xy = substr($cn, 1, 1);
    if ($xy == '*') {
        $cn = explode('*', $cn);
        $dialednumber = $cn[1];
    } else {
        $dialednumber = $dialednumber['data'];
    }
    $accountid = $agi->get_variable("ACCOUNTCODEID");
    $accountid = $accountid['data'];
    if ($accountid == '')
        $accountid = $forward_account_id;
    $trunkid = $agi->get_variable("TRUNKID");
    $trunkid = $trunkid['data'];
    $rateid = $agi->get_variable("RATEID");
    $rateid = $rateid['data'];
    $rateplanid = $agi->get_variable("RATEPLANID");
    $rateplanid = $rateplanid['data'];
    $callplanid = $agi->get_variable("CALLPLANID");
    $callplanid = $callplanid['data'];
    $trunkgroupid = $agi->get_variable("TRUNKGROUPID");
    $trunkgroupid = $trunkgroupid['data'];
    $trunkprovider_id = $agi->get_variable("TRUNKPROVIDERID");
    $trunkprovider_id = $trunkprovider_id['data'];
    $lastdst = $agi->get_variable("LASTDST");
    $lastdst = $lastdst['data'];
    $uniqueid = NULL;
    $salerate = NULL;
    $salecost = NULL;
    $buyrate = NULL;
    $buycost = NULL;
    $sipiax = NULL;

    $lastapp = $agi->get_variable("CDR(lastapp)");
    $lastapp = $lastapp['data'];
    $lastappdata = $agi->get_variable("LASTAPPDATA");
    $lastappdata = $lastappdata['data'];
	
    if ($lastappdata == 'QUEUE' AND $lastapp == 'AGI')
        $lastapp = 'Queue';
    elseif ($lastappdata == 'MEETME' AND $lastapp == 'AGI')
        $lastapp = 'MeetMe';
    if ($calltype == 'DIDTOEXTEN' AND $lastapp == 'AGI') {
        $lastapp = "Exten";
    }if ($calltype == 'DIDTORINGGROUP' AND $lastapp == 'Dial') {
        $lastapp = "RingGroup";
    } elseif ($calltype == 'DIDTOIVR' AND $lastapp == 'AGI') {
        $lastapp = "IVR";
    } elseif ($calltype == 'DIDTOANNOUNCEMENT' AND $lastapp == 'AGI') {
        $lastapp = "Announcement";
    } elseif ($lastapp == 'Dial') {
        $lastapp = "Exten";
    }
    $lastdata = $agi->get_variable("CDR(lastdata)");
    $lastdata = $lastdata['data'];

    $starttime = $agi->get_variable("CDR(start)");
    $starttime = $starttime['data'];
    $answertime = $agi->get_variable("CDR(answer)");
    $answertime = $answertime['data'];
    $stoptime = $agi->get_variable("CDR(end)");
    $stoptime = $stoptime['data'];
    $callduration = $agi->get_variable("CDR(duration)");
    $callduration = $callduration['data'];
    $billsec = $agi->get_variable("CDR(billsec)");
    $billsec = $billsec['data'];
    $answeredtime = $agi->get_variable("ANSWEREDTIME");
    $answeredtime = (isset($answeredtime['data']) && $answeredtime['data'] != '') ? $answeredtime['data'] : 0;    
    if ($answeredtime > $billsec)
        $answeredtime = $billsec;
    $disposition = $agi->get_variable("CDR(disposition)");
    $disposition = $disposition['data'];
    if ($dialstatus == "")
        $dialstatus = $disposition;
    $accountcode = $agi->get_variable("CDR(accountcode)");
    $accountcode = $accountcode['data'];
    $uniqueid = $agi->get_variable("CDR(uniqueid)");
    $uniqueid = $uniqueid['data'];
    $ringduration = $callduration - $billsec;

    if ($lastapp == 'MeetMe' and $calltypestart != 'SERVICE') {
        $answeredtime = $billsec;
        if ($answeredtime != 0) {
            //$cmd = "/usr/bin/lame -v -o -m m -B 8 -s 44.2 ".$recordingfile.".wav  ".$recordingfile.".mp3 && /bin/rm -rf  ".$recordingfile.".wav";
            $cmd = "/usr/bin/lame  " . $recordingfile . ".wav  " . $recordingfile . ".mp3 && /bin/rm -rf  " . $recordingfile . ".wav";
			
            $output = system("$cmd");
            $TP->debug(INFO, $agi, __FILE__, __LINE__, 'CMD ' . $cmd);
        }
    }
    if ($auto_recording != '') {
		/*
		if (substr($TP->recording_path, -1) != '/') {
			$TP->recording_path .= '/';
		}else{
			$TP->recording_path = "/var/spool/asterisk/monitor/";
		}
		$recordingfile1 = $TP->recording_path.$recordingfile;
		
        $cmd = "/usr/bin/lame  /var/spool/asterisk/monitor/" . $recordingfile . ".wav  " . $recordingfile1 . ".mp3 && /bin/rm -rf  /var/spool/asterisk/monitor/" . $recordingfile . ".wav";
        $output = system("$cmd");
        $TP->debug(INFO, $agi, __FILE__, __LINE__, 'CMD ' . $cmd);
		*/
    }
    if ($on_demond_recordingfile != '') {
        $cmd = "/usr/bin/lame  " . $on_demond_recordingfile . ".wav  " . $on_demond_recordingfile . ".mp3 && /bin/rm -rf  " . $on_demond_recordingfile . ".wav";

        $output = system("$cmd");
        $TP->debug(INFO, $agi, __FILE__, __LINE__, 'CMD ' . $cmd);
    }

    if ($answeredtime == 0)
        $recordingfile = '';
    if ($answeredtime == 0)
        $dialednumber = $newdst;
    if ($answeredtime == 0 AND $lastdst != '')
        $dialednumber = $lastdst;
    if ($answeredtime == 0 AND $dialednumber == '')
        $dialednumber = '';

    $vads = $agi->get_variable("VADS");
    $vads = $vads['data'];
    if ($vads != '') {
        $query = "UPDATE `tp_agent_status` set `vads` = '$vads', agentName = '" . $TP->name . "' where `customer_id` = $customer_id and  agent_exten =" . $TP->extennumber;
        $TP->sqlQuery($query, $agi, 'VADS');
    }

	if(DEBUG)
		$TP->debug(INFO, $agi, __FILE__, __LINE__, 'CDR  clid ' . $clid . ' src ' . $src . ' dst ' . $dst . ' dcontext ' . $dcontext . ' channel ' . $channel . ' dstchannel ' . $dstchannel . ' lastapp ' . $lastapp . ' lastdata ' . $lastdata . ' starttime ' . $starttime . ' answertime ' . $answertime . ' endtime ' . $endtime . ' duration ' . $duration . ' billduration ' . $billduration . ' disposition ' . $disposition . ' Stotime ' . $stoptime);
	if(DEBUGF)
		$TP->debug_logfile(INFO, $agi, __FILE__, __LINE__, 'CDR  clid ' . $clid . ' src ' . $src . ' dst ' . $dst . ' dcontext ' . $dcontext . ' channel ' . $channel . ' dstchannel ' . $dstchannel . ' lastapp ' . $lastapp . ' lastdata ' . $lastdata . ' starttime ' . $starttime . ' answertime ' . $answertime . ' endtime ' . $endtime . ' duration ' . $duration . ' billduration ' . $billduration . ' disposition ' . $disposition);

    $arr_dst = explode('/', $dialednumber);
    if (isset($arr_dst[1])) {
        $query = "SELECT trunk_id from tp_trunk WHERE trunkname = '" . $arr_dst[0] . "'";
		if(DEBUG)
			$TP->debug(INFO, $agi, __FILE__, __LINE__, 'cdr trunk ' . $query);
        $result = $TP->sqlQuery($query, $agi, 'cdr');
        if ($row = mysqli_fetch_assoc($result)) {

            if ($calltypestart == 'INTERNAL') {
                $calltypestart = 'OUTBOUND';
            } else {
                $calltypestart = 'OUTBOUND';
            }
            $dialednumber = $arr_dst[1];
            if(DEBUG)
				$TP->debug(INFO, $agi, __FILE__, __LINE__, 'cdR NEW dialednumber ' . $dialednumber);
        }
    }

    if ($calltypestart == 'OUTBOUND' OR $calltypestart == 'OUTBOUND' or $calltypestart == 'OUTBOUND') {
        $call_duration = $answeredtime;
        $new_dstatus = $agi->get_variable("NEWDSTARTUS");
        $new_dstatus = $new_dstatus['data'];

        /* Generate Billing & CDR if rates and trunk exist */
        if ($new_dstatus == 'RUNDIAL') {
            $rate_result = $TP->get_rates($agi, $callplanid, $newdst, $custid, $rateid);
            if ($rates_row = mysqli_fetch_assoc($rate_result)) {
                $dialprefix = $rates_row['dialprefix'];
                $destination = $rates_row['destination'];
                $salerate = $rates_row['sale_rate'];
                $buyrate = $rates_row['buy_rate'];
                $destination_name = $rates_row['destination'];
                $TP->pbx2pbx = $rates_row['pbx2pbx'];
                if ($dialstatus != 'ANSWER') {
                    $new_call_duration = 0;
                } else {
                    $new_call_duration = $TP->get_minutes($agi, $rates_row, $amount = 0, $call_duration, 'bill');
                }
                $TP->get_billcost($agi, $rates_row, $new_call_duration);
            }
            $salecost = $TP->sale_cost;
            $buycost = $TP->buy_cost;
            if ($TP->billing_type == 'common' AND $TP->credit < 0.5) {
                $bill_level = 1;
                $amount = $TP->customer_commoncredit;
                $query = "UPDATE `tp_customer` set `commoncredit` = `commoncredit` - $salecost WHERE `customer_id` = '$customer_id'";
            } else {
                $bill_level = 0;
                $amount = $TP->credit;
                $query = "UPDATE `tp_account` set `credit` = `credit` - $salecost WHERE  `account_id` = '$accountid' AND `customer_id` = '$customer_id'";
            }
            $TP->sqlQuery($query, $agi, 'credit update');
            if ($TP->agentexten_type == '1') {
                $agent_interface = '';
                if ($TP->sipuser == '1')
                    $agent_interface = "SIP/";
                if ($TP->iaxuser == '1')
                    $agent_interface = "IAX2/";
                $agent_interface .=$TP->customer_id . "*" . $TP->extennumber;
                $queuelogstring = "NONE,NONE," . $agent_interface . ",OUTBOUND," . $answeredtime;
                $agi->exec("QueueLog $queuelogstring");
            }

            if ($forward_account_id == '')
                $forward_account_id = $accountid;
            $query = "INSERT INTO `tp_cdr` (`customer_id`, `account_id`, `trunk_id`, `rate_id`, `rateplan_id`, `callplan_id`, `trunkgroup_id`, `uniqueid`, `starttime`, `stoptime`, `answertime`, `ringduration`, `billsec`, `callduration`, `destination`, `src`, `terminatecause`, `sale_rate`, `sale_cost`, `buy_rate`, `buy_cost`, `sipiax`, `recording_file`, `call_type`,`app_billsec`,`last_app`, `dst`,`last_credit`,`bill_level`,`provider_id`, `destination_name`,bill_account_id) VALUES ('$customer_id', '$accountid', '$trunkid', '$rateid', '$rateplanid', '$callplanid', '$trunkgroupid', '$uniqueid', '$starttime', '$stoptime', '$answertime', '$ringduration', '$answeredtime', '$callduration','$dst', '$src', '$dialstatus', '$salerate', '$salecost', '$buyrate', '$buycost', '$sipiax', '$recordingfile', '$calltypestart','$billsec','$lastapp','$newdst','$amount','$bill_level','$trunkprovider_id','$destination_name','$forward_account_id')";
			if(DEBUG)
				$TP->debug(INFO, $agi, __FILE__, __LINE__, 'CDR  Query ' . $query);
            $TP->sqlQuery($query, $agi, 'cdr');
        }
    }else {

        if ($lastapp != 'Queue') {

            if ($TP->agentexten_type == '1') {
                $agent_interface = '';
                if ($TP->sipuser == '1')
                    $agent_interface = "SIP/";
                if ($TP->iaxuser == '1')
                    $agent_interface = "IAX2/";
                $agent_interface .=$TP->customer_id . "*" . $TP->extennumber;
                $queuelogstring = "NONE,NONE," . $agent_interface . ",INTERNAL," . $answeredtime;
                $agi->exec("QueueLog $queuelogstring");
            }
            $query = "INSERT INTO `tp_cdr` (`customer_id`, `account_id`, `trunk_id`, `rate_id`, `rateplan_id`, `callplan_id`, `trunkgroup_id`, `uniqueid`, `starttime`, `stoptime`, `answertime`, `ringduration`, `billsec`, `callduration`, `destination`, `src`, `terminatecause`, `sale_rate`, `sale_cost`, `buy_rate`, `buy_cost`, `sipiax`, `recording_file`, `call_type`,`app_billsec`,`last_app`, `dst`) VALUES ('$customer_id', '$accountid', '$trunkid', '$rateid', '$rateplanid', '$callplanid', '$trunkgroupid', '$uniqueid', '$starttime', '$stoptime', '$answertime', '$ringduration', '$answeredtime', '$callduration','$dst', '$src', '$dialstatus', '$salerate', '$salecost', '$buyrate', '$buycost', '$sipiax', '$recordingfile', '$calltypestart','$billsec','$lastapp','$dialednumber')";

            $TP->sqlQuery($query, $agi, 'cdr');
			if(DEBUG)
				$TP->debug(INFO, $agi, __FILE__, __LINE__, 'CDR  Query ' . $query);
        }
        $query = "delete from `tp_call_status` where `dead_call` = '1' AND `callId` = '$uniqueid'  AND `status` = 'NEW' AND `callerId` = ''";
        $TP->sqlQuery($query, $agi, 'cdr');

        /* New changes for BLF Pannel */
        if ($dialstatus != 'ANSWERED' AND $dialstatus != 'ANSWER') {           
            $query = "UPDATE blf_livestatus SET missed_call = ifnull(missed_call,0) + 1, exten_status_update = now() where customer_id = '$customer_id' AND extension IN ('$dialednumber' , '$dst') AND account_id<> '$accountid' ";
            $TP->sqlQuery($query, $agi, 'missedcall_count');
			if(DEBUG)
				$TP->debug(INFO, $agi, __FILE__, __LINE__, 'CDR  Query ' . $query);
        }
    }
	
	if ($lastapp == 'Queue') {
		$agent = reset(explode('-', end(explode('*', $dstchannel))));
		if(DEBUG)
			$TP->debug(INFO, $agi, __FILE__, __LINE__, 'Set Queue Agent status Pause' . $agent);
		$agent_status = $TP->queue_agentpause($agi, $agent, 'CDR', 'AFTERCALL');
		if(DEBUG)
			$TP->debug(INFO, $agi, __FILE__, __LINE__, 'Set Queue Agent status Pause' . $string);
	}

	$star = strpos($dstchannel, "*");

	if($star == true) {

		$arr = explode("/",$dstchannel);
		$arr2 = explode("-",$arr[1]);
		$user = $arr2[0];

		$cnu = explode("*",$user);
		$cid = $cnu[0];
		$username = $cnu[1];
		$localdst = 1;
	}

	$sql = "SELECT email from as_voicemail where mailbox = '$user'";
	if($res = $TP->sqlQuery($sql, $agi, 'cdr')){
		$result = mysqli_fetch_assoc($res);
		$email = $result['email'];
		if($email != "" AND  $localdst == 1 AND $dialstatus != 'ANSWERED' AND $dialstatus != 'ANSWER' AND $dialstatus != 'BUSY') {
			send_missedcall($agi,$TP, $dst, $src, $email);
		}
	}

}

where TP is $TP = new PBX($agi);

I’m wondering what cdr backends show enabled when you do the CLI command :
‘cdr show status’

and if you check your CDR logs, do you see a call with the channel name ‘SIP/1*7405-00000008’ ?

Hi @logikanet ,

CLI> cdr show status

Call Detail Record (CDR) settings
----------------------------------
  Logging:                    Enabled
  Mode:                       Simple
  Log calls by default:       Yes
  Log unanswered calls:       No
  Log congestion:             No

  Ignore bridging changes:    No

  Ignore dial state changes:  No

* Registered Backends
  -------------------
    cdr_manager (suspended)
    csv
    cdr-custom
    Adaptive ODBC

And as seen above. CDR logging for unanswered calls is ‘No’, hence, I see no logs for the call ‘SIP/1*7405-00000008’ or any other call

Also, the call is connecting, but as soon as I asnwer it, the call immedialtely drops.
Logs:

CLI>
[Jul  1 13:04:57] WARNING[3209][C-00000017]: sip/config_parser.c:818 sip_parse_nat_option: nat=yes is deprecated, use nat=force_rport,comedia instead
[Jul  1 13:04:57] WARNING[3209][C-00000017]: sip/config_parser.c:818 sip_parse_nat_option: nat=yes is deprecated, use nat=force_rport,comedia instead
[Jul  1 13:04:57] WARNING[3209][C-00000017]: sip/config_parser.c:818 sip_parse_nat_option: nat=yes is deprecated, use nat=force_rport,comedia instead
[Jul  1 13:04:57] WARNING[3209][C-00000017]: sip/config_parser.c:818 sip_parse_nat_option: nat=yes is deprecated, use nat=force_rport,comedia instead
[Jul  1 13:04:57] WARNING[3209][C-00000017]: sip/config_parser.c:818 sip_parse_nat_option: nat=yes is deprecated, use nat=force_rport,comedia instead
[Jul  1 13:04:57] WARNING[3209][C-00000017]: sip/config_parser.c:818 sip_parse_nat_option: nat=yes is deprecated, use nat=force_rport,comedia instead
  == Using SIP VIDEO CoS mark 6
  == Using SIP RTP TOS bits 184
  == Using SIP RTP CoS mark 5
[Jul  1 13:04:57] ERROR[3183]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/1*7403-00000025
[Jul  1 13:04:57] ERROR[3183]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/1*7403-00000025
[Jul  1 13:04:57] ERROR[3183]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/1*7403-00000025
    -- Executing [7405@default:1] AGI("SIP/1*7403-00000025", "agi.php") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/agi.php
    -- AGI Script Executing Application: (DIAL) Options: (SIP/1*7405,30,rRwM(recording^^vm-1719824697.53))
  == Using SIP VIDEO CoS mark 6
  == Using SIP RTP TOS bits 184
  == Using SIP RTP CoS mark 5
[Jul  1 13:04:57] ERROR[3183]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/1*7405-00000026
[Jul  1 13:04:57] ERROR[3183]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/1*7405-00000026
[Jul  1 13:04:57] ERROR[3183]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/1*7405-00000026
    -- Called SIP/1*7405
    -- SIP/1*7405-00000026 is ringing
    -- SIP/1*7405-00000026 answered SIP/1*7403-00000025
    -- Executing [s@macro-recording:1] AGI("SIP/1*7405-00000026", "livecall.php,LIVEUPDATE,vm-1719824697.53") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/livecall.php
    -- <SIP/1*7405-00000026>AGI Script livecall.php completed, returning 0
    -- Executing [s@macro-recording:2] NoOp("SIP/1*7405-00000026", "") in new stack
    -- Executing [s@macro-recording:3] NoOp("SIP/1*7405-00000026", "") in new stack
    -- Executing [s@macro-recording:4] GotoIf("SIP/1*7405-00000026", "0?agnet:rec") in new stack
    -- Goto (macro-recording,s,7)
    -- Executing [s@macro-recording:7] GotoIf("SIP/1*7405-00000026", "0?rec1:hang") in new stack
    -- Goto (macro-recording,s,10)
    -- Executing [s@macro-recording:10] NoOp("SIP/1*7405-00000026", "") in new stack
    -- Executing [s@macro-recording:11] Hangup("SIP/1*7405-00000026", "") in new stack
  == Spawn extension (macro-recording, s, 11) exited non-zero on 'SIP/1*7405-00000026' in macro 'recording'
    -- <SIP/1*7403-00000025>AGI Script agi.php completed, returning 0
    -- Auto fallthrough, channel 'SIP/1*7403-00000025' status is 'ANSWER'
    -- Executing [h@default:1] AGI("SIP/1*7403-00000025", "agi.php,CDR") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/agi.php
    -- <SIP/1*7403-00000025>AGI Script agi.php completed, returning 0

Hi @logikanet
were you able to view my configuration and the logs pasted above?

thanks,
Hisham

The OP has started another topic for this, see:

Actually these may be related, as the B side is being hung up before Dial has reached the point where it answers the A side, so the A side will be treated as an unanswered call.

@david551

Even though i resolved the issue based on your reply from my other post but this issue,

Unable to find CDR for channel SIP/xxx

remains unresolved as of now…

I have accepted your answer for that as a solution but I still need to understand and subsequently solve the ‘unable to find the CDR for channel issue’.

Hi @hishamjan

My knowledge here is quite limited, I’m just adventuring myself on your issue really; I don’t really know if I’m right, but I see these lines :

[Jul 1 13:04:57] ERROR[3183]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/17403-00000025
[Jul 1 13:04:57] ERROR[3183]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/1
7403-00000025
[Jul 1 13:04:57] ERROR[3183]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/17403-00000025
– Executing [7405@default:1] AGI("SIP/1
7403-00000025", “agi.php”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/agi.php
– AGI Script Executing Application: (DIAL) Options: (SIP/1*7405,30,rRwM(recording^^vm-1719824697.53))

[Jul 1 13:04:57] ERROR[3183]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/17405-00000026
[Jul 1 13:04:57] ERROR[3183]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/1
7405-00000026
[Jul 1 13:04:57] ERROR[3183]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/17405-00000026
– Called SIP/1
7405
– SIP/17405-00000026 is ringing
– SIP/1
7405-00000026 answered SIP/17403-00000025
– Executing [s@macro-recording:1] AGI("SIP/1
7405-00000026", “livecall.php,LIVEUPDATE,vm-1719824697.53”) in new stack

note that ast_cdr_getvar raises the error before the call is actually dialled by the AGI script, I don’t think the CDR is provisioned before the DIAL() happens, but of course I may be wrong; If that’s true it would make sense the error because the CDR is not there yet

again my point is that the error is raised before the lines :

– Called SIP/1 7405
– SIP/17405-00000026 is ringing
– SIP/1
7405-00000026 answered SIP/17403-00000025

Hopefully someone more experience with AGI can help better or correct me if I’m wrong

Hi @logikanet
You’re absoutely right about the error being populated before the channel is called and dialed.

The issue seems like a chacheing issue in the asterisk memeory or something becuase I have cross checked every module, my database connection etc but the error persists…

Again, as you said, someone with extensive knowledge about this issue or knowledge about AGI as a whole would be able to help me better :slight_smile:

Hey folks!

Due to this cdr error, I am unable to log cdrs to my database…even though there is communication between two peers and the channel hangups normally…

any idea on what might I be missing out on due to which this error keeps on populating?

All settngs are realtime in my case FYI

Hi Asterisk experts!

I am pasting the logs of a simple ext to ext call (7403 to 7405) with ‘cdr set debug on’:

[Jul  5 14:03:12] ERROR[61364]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/1*7405-00000062
[Jul  5 14:03:12] ERROR[61364]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/1*7405-00000062
[Jul  5 14:03:12] ERROR[61364]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/1*7405-00000062
0x7efd4c00a540 - Created CDR for channel SIP/1*7405-00000062
0x7efd4c00a540 - Transitioning CDR for SIP/1*7405-00000062 from state NONE to Single
[Jul  5 14:03:12] ERROR[61364]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/1*7403-00000063
[Jul  5 14:03:12] ERROR[61364]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/1*7403-00000063
[Jul  5 14:03:12] ERROR[61364]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/1*7403-00000063
0x7efd4c02e270 - Created CDR for channel SIP/1*7403-00000063
0x7efd4c02e270 - Transitioning CDR for SIP/1*7403-00000063 from state NONE to Single
Dial Begin message for SIP/1*7405-00000062, SIP/1*7403-00000063: 1720173792.00369812
0x7efd4c00a540 - Processing Dial Begin message for channel SIP/1*7405-00000062, peer SIP/1*7403-00000063
0x7efd4c00a540 - Updated Party A SIP/1*7405-00000062 snapshot
0x7efd4c00a540 - Updated Party B SIP/1*7403-00000063 snapshot
0x7efd4c00a540 - Transitioning CDR for SIP/1*7405-00000062 from state Single to Dial
Dial End message for SIP/1*7405-00000062, SIP/1*7403-00000063: 1720173792.00417586
0x7efd4c02e270 - Set answered time to 1720173794.013364
Dial End message for SIP/1*7405-00000062, SIP/1*7403-00000063: 1720173794.00080206
0x7efd4c00a540 - Processing Dial End message for channel SIP/1*7405-00000062, peer SIP/1*7403-00000063
0x7efd4c00a540 - Transitioning CDR for SIP/1*7405-00000062 from state Dial to DialedPending
0x7efd4c00a540 - Set answered time to 1720173794.080836
Bridge Enter message for channel SIP/1*7403-00000063: 1720173794.00081944
0x7efd4c02e270 - Updating Party A SIP/1*7403-00000063 snapshot
0x7efd4c02e270 - Processing bridge enter for SIP/1*7403-00000063
0x7efd4c02e270 - Transitioning CDR for SIP/1*7403-00000063 from state Single to Bridged
Bridge Enter message for channel SIP/1*7405-00000062: 1720173794.00082967
0x7efd4c00a540 - Updating Party A SIP/1*7405-00000062 snapshot
0x7efd4c00a540 - Processing bridge enter for SIP/1*7405-00000062
0x7efd4c00a540 - Transitioning CDR for SIP/1*7405-00000062 from state DialedPending to Dial
0x7efd4c00a540 - Transitioning CDR for SIP/1*7405-00000062 from state Dial to Bridged
Bridge Leave message for SIP/1*7403-00000063: 1720173796.00619814
0x7efd4c02e270 - Processing Bridge Leave for SIP/1*7403-00000063
0x7efd4c02e270 - Transitioning CDR for SIP/1*7403-00000063 from state Bridged to Finalized
Bridge Leave message for SIP/1*7405-00000062: 1720173796.00620014
0x7efd4c00a540 - Processing Bridge Leave for SIP/1*7405-00000062
0x7efd4c00a540 - Transitioning CDR for SIP/1*7405-00000062 from state Bridged to Finalized
0x7efd4c02e270 - Beginning finalize/dispatch for SIP/1*7403-00000063
0x7efd4c02e270 - Dispatching CDR for Party A SIP/1*7403-00000063, Party B <none>
0x7efd4c00a540 - Beginning finalize/dispatch for SIP/1*7405-00000062
0x7efd4c00a540 - Dispatching CDR for Party A SIP/1*7405-00000062, Party B SIP/1*7403-00000063

Even though CDR flat files are being logged in the Master.csv, but its not logging in my database…

anyone who can guide me what I might be missing? is it becuase of the CDR error that the DB is not logged with call records? or is that issue not related to it?

thanks in advance to everyone!

Hisham

I still get the subjected ‘error’ in my asterisk CLI but the issue was related to AGI and its connection with the database which i managed to resolve.
I don’t know which response should I mark as the ‘solution’ but the cdr error still populates for me!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.