CDR, no incoming record when answered from ring group

  1. 10 years ago

    If I answer a ring group call, the incoming call does not appear in the CDR of FOP2. If I need to go back and get the number of someone who just called me, I can't.

    The FreePBX CDR has the same behaviour, it just shows the call stopping at the ring group. However, if you export the data into a CSV file, the data showing what extension picked up the call is there.
    Since 99% of the calls goto a ring group, the FOP2 CDR only shows outgoing calls for most of the extensions, so it's near useless.

    Can FOP2 be changed to pull the final extension and use that information?

    Thanks

  2. I patched the code so the CDR works as expected.

    --- showcdr.php.backup	2014-01-02 14:18:11.000000000 -0800
    +++ showcdr.php	2014-01-02 16:23:48.135836816 -0800
    @@ -161,7 +161,8 @@
     $grid->set_pk('uniqueid');
     $grid->add_structure('number', 'text',null,'');
     $grid->salt("dldli3ksa");
    -$grid->set_fields("calldate,IF(dst='".$extension."','inbound','outbound') as direction,IF(dst='".$extension."',src,dst) as number,duration,billsec,disposition,uniqueid");
    +$grid->set_fields("calldate,IF(dst='".$extension."' OR dstchannel LIKE 'SIP/$extension-________' ,'inbound','outbound') as direction,IF(dst='".$extension."' OR dstchannel LIKE 'SIP/$extension-________' ,src,dst) as number,duration,billsec,disposition,uniqueid");
    +
     $grid->hide_field('uniqueid');
     $grid->no_edit_field('uniqueid');
     $grid->no_edit_field('number');
    @@ -174,11 +175,11 @@
     $mifilt = $_REQUEST['filterdir'];
     
     if($mifilt=="") {
    -    $condstring ="(src='$extension' OR dst='$extension') ";
    +    $condstring ="(src='$extension' OR dst='$extension' OR dstchannel LIKE 'SIP/$extension-________' OR channel LIKE 'SIP/$extension-________') ";
     } else if($mifilt=="inbound") {
    -    $condstring ="(dst='$extension') ";
    +    $condstring ="(dst='$extension' OR dstchannel LIKE 'SIP/$extension-________' ) ";
     } else {
    -    $condstring="(src='$extension') ";
    +    $condstring="(src='$extension' OR channel LIKE 'SIP/$extension-________' ) ";
     }
     
     $customboton="<div class='fbutton'>
    @@ -211,6 +212,7 @@
     
     
     $grid->set_condition($condstring);
    +
     /*
     $fieldname = Array();
     $fieldname[]=trans('Unique ID');
    
    
  3. For 2.27

    --- showcdr.php.backup2.27	2013-11-11 07:32:18.000000000 -0800
    +++ showcdr.php	2014-01-12 22:06:09.312426112 -0800
    @@ -164,7 +164,7 @@
     $grid->set_pk('uniqueid');
     $grid->add_structure('number', 'text',null,'');
     $grid->salt("dldli3ksa");
    -$grid->set_fields("calldate,IF(dst='".$extension."','$transinbound','$transoutbound') as direction,IF(dst='".$extension."',src,dst) as number,duration,billsec,disposition,uniqueid");
    +$grid->set_fields("calldate,IF(dst='".$extension."' OR dstchannel LIKE 'SIP/$extension-________' ,'inbound','outbound') as direction,IF(dst='".$extension."' OR dstchannel LIKE 'SIP/$extension-________' ,src,dst) as number,duration,billsec,disposition,uniqueid");
     $grid->hide_field('uniqueid');
     $grid->no_edit_field('uniqueid');
     $grid->no_edit_field('number');
    @@ -177,11 +177,11 @@
     $mifilt = $_REQUEST['filterdir'];
     
     if($mifilt=="") {
    -    $condstring ="(src='$extension' OR dst='$extension') ";
    +    $condstring ="(src='$extension' OR dst='$extension' OR dstchannel LIKE 'SIP/$extension-________' OR channel LIKE 'SIP/$extension-________') ";
     } else if($mifilt=="inbound") {
    -    $condstring ="(dst='$extension') ";
    +    $condstring ="(dst='$extension' OR dstchannel LIKE 'SIP/$extension-________' ) ";
     } else {
    -    $condstring="(src='$extension') ";
    +    $condstring="(src='$extension' OR channel LIKE 'SIP/$extension-________' ) ";
     }
     
     $customboton="<div class='fbutton'>
    
  4. Hey,

    I too was looking for this functionality, and Nicolas recommended me to try out your modifications.

    After patching the code it now works perfectly. Thanks a lot!

    Carlos

  5. 9 years ago

    Anybody test this patch with current FOP2 (2.28)?

  6. admin

    16 Jan 2015 Administrator

    FOP 2.28 includes part of the patch, you will only need to change the condition bits:

     } else if($mifilt=="inbound") {
        $condstring ="(dst='$extension' OR dstchannel LIKE 'SIP/$extension-________' ) ";
     } else {
        $condstring="(src='$extension' OR channel LIKE 'SIP/$extension-________' ) ";
     }

or Sign Up to reply!