Факсы принимаются и отправляются на почту с прикрепленным файлом fax.pdf
Как заставить переименовывать файл либо по порядковым номерам, либо в имени писать номер телефона?
предвижу очередной вопрос - где он ?
сразу ответ от клуба знатоков - посмотреть во время факса лог в консоле и там будет написан - что и как запускается
Вот логи:
Из этого лога я полез в bin/faxrcvd.php
| Код: |
| May 24 09:33:41.64: [ 3200]: SESSION BEGIN 000000065 74212325606 May 24 09:33:41.64: [ 3200]: HylaFAX (tm) Version 4.3.10 May 24 09:33:41.64: [ 3200]: CallID: "4212322428" "4212322428" "" "s" May 24 09:33:41.64: [ 3200]: MODEM set XON/XOFF/FLUSH: input ignored, output disabled May 24 09:33:41.64: [ 3200]: [7:CONNECT] May 24 09:33:45.36: [ 3200]: ANSWER: FAX CONNECTION DEVICE '/dev/ttyIAX1' May 24 09:33:45.36: [ 3200]: STATE CHANGE: ANSWERING -> RECEIVING May 24 09:33:45.36: [ 3200]: RECV FAX: begin May 24 09:33:45.36: [ 3200]: [2:OK] May 24 09:34:17.94: [ 3200]: RECV recv EOP (no more pages or documents) May 24 09:34:17.94: [ 3200]: [2:OK] May 24 09:34:18.06: [ 3200]: [7:CONNECT] May 24 09:34:18.18: [ 3200]: [2:OK] May 24 09:34:20.70: [ 3200]: RECV recv DCN (disconnect) May 24 09:34:20.70: [ 3200]: RECV FAX: bin/faxrcvd.php "recvq/fax000000020.tif" "ttyIAX1" "000000065" "" "4212322428" "4212322428" "" "s" May 24 09:34:20.70: [ 3200]: RECV FAX: end May 24 09:34:20.70: [ 3200]: SESSION END |
Там следущее:
| Код: |
| #! /bin/bash # $Id$ # # HylaFAX Facsimile Software # # Copyright (c) 1990-1996 Sam Leffler # Copyright (c) 1991-1996 Silicon Graphics, Inc. # HylaFAX is a trademark of Silicon Graphics # # Permission to use, copy, modify, distribute, and sell this software and # its documentation for any purpose is hereby granted without fee, provided # that (i) the above copyright notices and this permission notice appear in # all copies of the software and related documentation, and (ii) the names of # Sam Leffler and Silicon Graphics may not be used in any advertising or # publicity relating to the software without the specific, prior written # permission of Sam Leffler and Silicon Graphics. # # THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, # EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY # WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. # # IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR # ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, # OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, # WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF # LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE # OF THIS SOFTWARE. # # # faxrcvd file devID commID error-msg # if [ $# -lt 4 ]; then echo "Usage: $0 file devID commID error-msg [ callID-1 [ callID-2 [ ... [ callID-n ] ] ] ]" exit 1 fi test -f etc/setup.cache || { SPOOL=`pwd` cat$ERRORSTO | $SENDMAIL -f"$FROMADDR" -oi "$TOADDR" else CreateMailMessage etc/templates/$TEMPLATE/faxrcvd-notify-error.txt \ 2>$ERRORSTO | $SENDMAIL -f"$FROMADDR" -oi "$TOADDR" fi fi if [ -n "$SENDTO" ]; then # Create the document to attache if [ -z "$MSG" ]; then MailWithFAX success else MailWithFAX error fi fi else # # Generate notification mail for a failed attempt. # There is no file to send... # CreateMailMessage etc/templates/$TEMPLATE/faxrcvd-failure.txt \ 2>$ERRORSTO | $SENDMAIL -f"$FROMADDR" -oi "$TOADDR" fi CleanupPrivateTmp |
Пытался что-то менять но без результатно
Файл лежит в /var/spool/hylafax/bin
Называется elastix-faxevent
$sDestPath = $sFaxesDir.'/fax' .$faxinfo['properties']['commid']. '.pdf';
if (count($pdflist) > 1) {
// Combine all of the PD files in one big PDF for output
invokeCommand($conn,
'/usr/bin/gs '.implode(' ', array_map(
'escapeshellarg',
array_merge(
array('-q', '-dNOPAUSE', '-dBATCH', '-sDEVICE=pdfwrite',
'-dCompatibilityLevel=1.4', '-sPAPERSIZE=a4', '-dSAFER',
'-sOutputFile='.$sDestPath, '-f'),
$pdflist))));
if (count($pdflist) != count(array_filter(array_map('unlink', $pdflist))))
dblog($conn, 'WARN', 'Failed to remove all temporar PDF files');
} elseif (count($pdflist) == 1) {
// Rename cannot fail due to filesystem boundaries - same directory
if (!rename($pdflist[0], $sDestPath))
dblog_exit($conn, 'Failed to rename file: '.$pdflist[0]);
} else {
// This should not happen
dblog_exit($conn, 'No files found in supported formats');
}
// Required since reception might leave file as 0600
chmod($sDestPath, 0644);
insertFaxRecord($conn,
$sRepresentativeName,
$faxinfo['properties']['modem'],
$idModemDevice,
$faxinfo['properties']['commid'],
$status, // done|failed
$faxinfo['properties']['status'],
$faxinfo['properties']['sender'],
$faxinfo['properties']['number'],
$sDirection,
$sDestDir);
// Send email with attached fax
$emailList = array();
if ($idModemDevice != 0) {
$sDestinationEmail = readNotificationEmail($conn, $idModemDevice);
if (!is_null($sDestinationEmail)) $emailList[] = $sDestinationEmail;
}
if (isset($faxinfo['properties']['mailaddr']) && !empty($faxinfo['properties']['mailaddr'])) {
$sDestinationEmail = $faxinfo['properties']['mailaddr'];
foreach (array('/@localhost$/', '/@localhost.localdomain/', '/@127.0.0.1/') as $regexp) {
if (!is_null($sDestinationEmail) && preg_match($regexp, $sDestinationEmail))
$sDestinationEmail = NULL;
}
if (!is_null($sDestinationEmail)) $emailList[] = $sDestinationEmail;
}
foreach ($emailList as $sDestinationEmail) {
sendEmailFax($conn, $sRepresentativeName, $sDestinationEmail,
$faxinfo['properties']['sender'], $faxinfo['properties']['number'],
"$sDestDir/fax" .$faxinfo['properties']['commid']. ".pdf", $status, $faxinfo['properties']['status']);