Отправка входящего факса на email









Last updated
Was this helpful?









Last updated
Was this helpful?
Was this helpful?
<?php
require_once 'Globals.php';
use \MikoPBX\Core\Asterisk\AGI;
use MikoPBX\Core\System\Notifications;
use MikoPBX\Core\System\{MikoPBXConfig};
$agi = new AGI();
$faxFile = "/tmp/" .$agi->get_variable("CDR(linkedid)", true).'.tiff';
$caller = $agi->get_variable("CALLERID(num)", true);
$agi->exec("ReceiveFax", "{$faxFile},d");
$result = $agi->get_variable("FAXOPT(status)", true);
if($result === 'SUCCESS' && file_exists($faxFile)){
$notify = new Notifications();
$notify->sendMail('[email protected]', 'Fax msg from '.$caller, 'Incoming fax <br><br>', $faxFile);
unlink($faxFile);
}
sleep(1);[SIP-1687941868-incoming](+)
exten => fax,1,Goto(internal,2200100,1)load => res_fax.so
load => res_fax_spandsp.so[endpoint]
fax_detect=yes
fax_detect_timeout=30