Billing mISDN trunks with Elastix Report Billing

Discussion in 'General' started by hpwr, Jun 4, 2009.

  1. hpwr

    Joined:
    Jun 4, 2009
    Messages:
    17
    Likes Received:
    0
    Hi, I have some ELastix PBX working, each with a lot of extensions and some with more than one company, I need billing and reporting transparently the existing extensions like the Billing solution integrated in Elastix, this work well with SIP and ZAP but not with ISDN and a lot of customers use these trunks.

    I cannot bill mISDN trunks with the integrated billing report from Elastix, I don´t know if this is an BUG or some miss configuration because the SIP trunks will be correctly billed.

    You can see it here:
    [img=http://img23.imageshack.us/img23/9053/billingisdn.th.png]

    I think it must be an problem with the billing script and the "mISDN/1/$OUTNUM" trunk not beeing filtered. Can I change something with my trunks so they will apear at the billing ?

    I am trying with A2Billing and AsterCC, I cannot bring to work the first one and by what I understand it is more for CARD use, creating a new extension or card number rather than simply billing and reporting the actual SIP extensions.

    ASterbilling by the other side DO work, but it also is more for a callshop, I have to clear or receip each extension manually until the apear at the CDR / Reports ...


    ANY help will be well apreciated,
    Best regards from Spain.
     
  2. rafael

    Joined:
    May 14, 2007
    Messages:
    1,454
    Likes Received:
    1
    What version of Elastix are you using? It seems to be a bug, we need your help because here in Ecuador we do not use ISDN. So please create a bug report and helps us solve this issue:
    http://bugs.elastix.org

    Saludos,

    Rafael
     
  3. hpwr

    Joined:
    Jun 4, 2009
    Messages:
    17
    Likes Received:
    0
    Thank you for your answer,

    We are using version 1.3-2 at this customer because we had some problems with DAHDI, we will try to upgrade to the lst version and see if the problem is solved.

    Can you tell me if there was any changes in the billing section in the new version ?

    Best regards !
     
  4. hpwr

    Joined:
    Jun 4, 2009
    Messages:
    17
    Likes Received:
    0
    Hello again,

    I tryed the same with the last version (1.5.2-2.3) with exactly the same behavior, the mISDN trunks are filtered by the billing script and won´t apear in the report.

    We really need billing reports for our clients and the integrated billing from elastix is just what we need, simple and exportable to csv ...

    I´ve checked A2billing and couldn´t get what I want, I thing it will only work with special created extensions like calling cards, we want to transparently bill all of the normal extensions in a office.

    By now we are using AsterCC´s billing and it work, but it is also meaned more for a callshop and need manual paying each extension and by what I understood hase limitation to 5 extensions without paying.


    I´ll open a BUG report with this maybe it get checked.

    Best regards !
     
  5. rafael

    Joined:
    May 14, 2007
    Messages:
    1,454
    Likes Received:
    1
    Thanks a lot for reporting the bug :D. That is the best way to solve the issue.

    Regards,

    Rafael
     
  6. abukhazneh

    Joined:
    Feb 10, 2009
    Messages:
    68
    Likes Received:
    0
    I cannot find the bug or the fix if there is any because am using the same version and the billing on the ISDN is not working , so any suggestions for help ????
     
  7. hpwr

    Joined:
    Jun 4, 2009
    Messages:
    17
    Likes Received:
    0
    Hello abukhazneh,
    The BUG report is id:127 visible under this link:

    http://bugs.elastix.org/view.php?id=127

    I you have some useful information you can leave a Note at this report and let us hope the Bug
    will be fixed soon ;)

    Regards
     
  8. abukhazneh

    Joined:
    Feb 10, 2009
    Messages:
    68
    Likes Received:
    0
    Thanx man, I saw the report of the Bug but I didnot find the fix but seems as you say that it is not fixed yet ,I will hope with that it will be fixes soon >>:woohoo:
     
  9. viti

    Joined:
    Jun 30, 2009
    Messages:
    9
    Likes Received:
    0
    you can make a very quick and non-elegant fix. In /var/www/html/modules/billing_report/index.php, search for the line "$sum_cost = 0;", and insert just before that line the next code:

    $troncales3 = array ("mISDN/1","mISDN/2")
    $troncales = array_merge ($troncales,$troncales3)

    It should do the trick. Different costs per trunk isn't going to work, but for a simple case (same cost for every trunk) it would. I hope it helps.
     
  10. hpwr

    Joined:
    Jun 4, 2009
    Messages:
    17
    Likes Received:
    0
    Hello,

    I seems that many people is wanting to bill mISDN trunks as well :)

    I´ve tryed that but it didn´t work in my case, at this moment i could only try it with a 1.3 version.

    This is the surrounding code and it seems that the BUG es at this point, isn´t it ?




    Code:
        // Bloque comun
        //consulto cuales son los trunks de salida
        $oTrunk    = new paloTrunk($pDBTrunk);
        $troncales = $oTrunk->getExtendedTrunksBill($grupos, $arrConfig['ASTETCDIR']['valor'].'/zapata.conf');//ej array("ZAP/1","ZAP/2");
        $sum_cost = 0;
        //echo "<pre>".print_r($troncales,1)."</pre>";
        //echo "<pre>".print_r($grupos,1)."</pre>";
        if (is_array($troncales) && count($troncales)>0){
            $arrCDR  = $oCDR->obtenerCDRs($limit, $offset, $date_start, $date_end, $field_name, $field_pattern,"ANSWERED","outgoing",$troncales);
    
            $total =$arrCDR['NumRecords'][0];
    
            foreach($arrCDR['Data'] as $cdr) {
            //tengo que buscar la tarifa para el numero de telefono
                if (ereg("^Zap/([[:digit:]]+)",$cdr[4],$regs3)) $trunk='ZAP/g'.$grupos[$regs3[1]];
                else $trunk=str_replace(strstr($cdr[4],'-'),'',$cdr[4]);
    
                $numero=$cdr[2];
                $arrTmp    = array();
                $arrTmp[0] = $cdr[0];
                if(isset($_GET['exportcsv']) && $_GET['exportcsv']=='yes'){
                    $arrTmp[1] = ($cdr[1]?$cdr[1]:$arrLang["Unknown"]);
                    $arrTmp[3] = $cdr[4];
                } else {
                    $arrTmp[1] = "<div title=\"{$arrLang['Channel']}: $cdr[3]\" align=\"left\">".($cdr[1]?$cdr[1]:$arrLang["Unknown"])."</div>";
                    $arrTmp[3] = "<div title=\"{$arrLang['Trunk']}: $trunk\" align=\"left\">$cdr[4]</div>";
                }
                $arrTmp[2] = $cdr[2];
                $arrTmp[4] = $cdr[8];
                $charge=0;
                $tarifa=array();
                $bExito=$pRate->buscarTarifa($numero,$tarifa,$trunk);
                if (!count($tarifa)>0 && ($bExito)) $bExito=$pRate->buscarTarifa($numero,$tarifa,'None');
    
                $rate_name="";
                if (!$bExito)
                {
                    echo "ERROR DE RATE: $pRate->errMsg <br>";
                }else
                {
    
                 //verificar si tiene tarifa
                    if (count($tarifa)>0)
                    {
                        $bTarifaOmision=FALSE;
                        foreach ($tarifa as $id_tarifa=>$datos_tarifa)
                        {
                            $charge=(($cdr[8]/60)*$datos_tarifa['rate'])+$datos_tarifa['offset'];
                            $rate_name=$datos_tarifa['name'];
                        }
                    }else
                    {
                        $bTarifaOmision=TRUE;
                        $rate_name=$arrLang["default"];
                    //no tiene tarifa buscar tarifa por omision
                    //por ahora para probar $1 el minuto
                        $rate=get_key_settings($pDBSet,"default_rate");
                        $rate_offset=get_key_settings($pDBSet,"default_rate_offset");
                        $charge=(($cdr[8]/60)*$rate)+$rate_offset;
                    }
                }
                $arrTmp[5] = number_format($charge,3);
                $sum_cost  = $sum_cost+$arrTmp[5];
                $arrTmp[6] = $sum_cost;
                $arrTmp[7] = $rate_name;
                $arrData[] = $arrTmp;
            }
        }
    

    Thanks !
     
  11. viti

    Joined:
    Jun 30, 2009
    Messages:
    9
    Likes Received:
    0
    What do you use to call? Groups or direct channels? If you're using a group I think the fix should also work for the code you paste like this (where g1 could be g2, g3 or whatever group/groups you've defined):

    Code:
    $troncales3 = array ("mISDN/g1");          
    $troncales = array_merge ($troncales,$troncales3);
    
    see if we can made an approach to a solution!;)
     
  12. abukhazneh

    Joined:
    Feb 10, 2009
    Messages:
    68
    Likes Received:
    0
    I use groups and the fix didnot work with me , is their any other suggestions ??????????????
     
  13. chrisisearth

    Joined:
    Nov 13, 2008
    Messages:
    23
    Likes Received:
    0
    I had the issue where it was seeing the calls on the isdn channel and I applied the fix listed in an earlier post,

    It fixed the issue but every call is applying the default rate? is there a fix for this?

    Cheers

    Chris
     
  14. viti

    Joined:
    Jun 30, 2009
    Messages:
    9
    Likes Received:
    0
    in the menu rate don't select any trunk to apply the rates
     
  15. abukhazneh

    Joined:
    Feb 10, 2009
    Messages:
    68
    Likes Received:
    0
    What you mean how you can apply the rates without selecting any trunk ?
     
  16. chrisisearth

    Joined:
    Nov 13, 2008
    Messages:
    23
    Likes Received:
    0
    Hi viti,

    This worked,

    Thank you

    Chris
     
  17. abukhazneh

    Joined:
    Feb 10, 2009
    Messages:
    68
    Likes Received:
    0
    Hi Chris ,

    Tell me what you did exactly to make it work ??

    Regards,
     
  18. chrisisearth

    Joined:
    Nov 13, 2008
    Messages:
    23
    Likes Received:
    0
    Hi abukhazneh,

    I inserted the code

    as mentioned by Viti in an earlier post,


    $troncales3 = array ("mISDN/1","mISDN/2")
    $troncales = array_merge ($troncales,$troncales3)

    In /var/www/html/modules/billing_report/index.php, search for the line "$sum_cost = 0;", and insert just before that line the next code:

    I then typed in all my rates and in each rate I set the Trunk: * to none,

    I hope this helps

    Chris
     
  19. hpwr

    Joined:
    Jun 4, 2009
    Messages:
    17
    Likes Received:
    0
    Hello, it seems that some people bring ISDN billing to work, I have tryed in a 1.5 and a 1.3v without success...

    Directly after adding the code as described, the ?menu=billing_report site won´t load any more, and searching the error LOGs y find this:

    # tail /var/log/httpd/ssl_error_log
    [error] [client 192.168.0.20] PHP Parse error: syntax error, unexpected T_VARIABLE in /var/www/html/modules /billing_report/index.php on line 221, referer: https://192.168.0.40/?menu=billing_setup

    Line 221 is actually: $troncales = array_merge ($troncales,$troncales3)

    This is in a Elastix 1.3-2
    I cannot try it right now in a 1.5.2 because I have none with ISDN trunks avialable.

    Regards ;)
     
  20. chrisisearth

    Joined:
    Nov 13, 2008
    Messages:
    23
    Likes Received:
    0
    Hi hpwr,

    Perhaps upgrading to 1.5.2 might be the easiest option!
     

Share This Page