Location: PHPKode > projects > ICTFAX > ictfax/agi-bin/sendfax.php
#!/usr/bin/php -q
<?php
    require_once dirname(__FILE__)  . '/phpagi/phpagi.php';

    global $argv;
    $stdinRequest = array();

    //Getting input data (Parameter Passed to Script)
    $faxCid    = $argv[1];
    $faxFile   = $argv[2];
    $faxheader = $argv[3];

    //creating PHPAGI instance and getting dialplan status
    $agi = new AGI();
    $stdinRequest = $agi->request;

    $agi->set_variable('LOCALHEADERINFO',$faxHeader);
    $agi->set_variable('LOCALSTATIONID',$faxCid);
    $agi->exec('SendFAX',array($faxFile));

    $faxPages = $agi->get_variable('FAXPAGES');
    $faxStatus = $agi->get_variable('FAXSTATUS');
    $faxStatusString = $agi->get_variable('FAXERROR');

    //sending output to asterisk
    $agi->database_put('FAX_'.$faxCid, 'FAXPAGES', $faxPages['data']);
    $agi->verbose('Fax Pages : ' . $faxPages['data'], 1);
    $agi->database_put('FAX_'.$faxCid, 'STATUS', $faxStatus['data']);
    $agi->verbose('Fax Status : ' . $faxStatus['data'], 1);
    $agi->database_put('FAX_'.$faxCid, 'STATUSSTRING', $faxStatusString['data']);
    $agi->verbose('Fax Result : ' . $faxStatusString['data'], 1);
?>
Return current item: ICTFAX