Porblemas para recibir Fax

Discussion in 'Elastix 2.x' started by magoc, May 15, 2010.

  1. magoc

    Joined:
    Mar 11, 2010
    Messages:
    83
    Likes Received:
    0
    Hola muchachos.. a ver quien me puede ayudar..

    mi problema es q no puedo recibir faxes.
    yo no se si toque algo o que ! antes funcionaba perfecto...

    Todo anda bien, da señal perfecto... la persona desde su fax lo envia sin problemas...
    pero yo a la hora de leerlo, no me aparece nada....

    este es el log... no encuentro ningun error. Pareciera q el fax se envia correctamente... pero a mi no me aparece !!


    May 16 21:21:42.88: [12862]: SESSION BEGIN 000000026
    May 16 21:21:42.88: [12862]: HylaFAX (tm) Version 4.3.3
    May 16 21:21:42.88: [12862]: CallID: "" "" "<NONE>" "s"
    May 16 21:21:42.88: [12862]: MODEM set XON/XOFF/FLUSH: input ignored, output disabled
    May 16 21:21:42.88: [12862]: <-- [4:ATA\r]
    May 16 21:21:46.59: [12862]: --> [7]
    May 16 21:21:46.59: [12862]: ANSWER: FAX CONNECTION DEVICE '/dev/ttyIAX1'
    May 16 21:21:46.59: [12862]: STATE CHANGE: ANSWERING -> RECEIVING
    May 16 21:21:46.59: [12862]: RECV FAX: begin
    May 16 21:21:46.60: [12862]: <-- HDLC<32:FF C0 04 B5 00 AA 12 9E 36 86 62 82 1A 04 14 2E B6 94 04 6A A6 4E CE 96 F6 76 04 2C 74 CC 74 CC>
    May 16 21:21:46.60: [12862]: <-- data [32]
    May 16 21:21:46.60: [12862]: <-- data [2]
    May 16 21:21:47.55: [12862]: --> [7]
    May 16 21:21:47.55: [12862]: <-- HDLC<23:FF C0 02 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04>
    May 16 21:21:47.55: [12862]: <-- data [23]
    May 16 21:21:47.55: [12862]: <-- data [2]
    May 16 21:21:48.29: [12862]: --> [7]
    May 16 21:21:48.29: [12862]: <-- HDLC<13:FF C8 01 00 73 5F 23 01 FB C1 01 01 18>
    May 16 21:21:48.29: [12862]: <-- data [13]
    May 16 21:21:48.29: [12862]: <-- data [2]
    May 16 21:21:48.87: [12862]: --> [2]
    May 16 21:21:48.87: [12862]: <-- [9:AT+FRH=3\r]
    May 16 21:21:49.23: [12862]: --> [7]
    May 16 21:21:50.71: [12862]: --> HDLC<25:FF C0 C2 04 04 04 04 04 04 04 04 04 04 04 04 4C 2C AC 4C 4C 1C EC 2C 5E FB>
    May 16 21:21:50.71: [12862]: --> [2]
    May 16 21:21:50.71: [12862]: REMOTE TSI "47822542"
    May 16 21:21:50.71: [12862]: <-- [9:AT+FRH=3\r]
    May 16 21:21:51.05: [12862]: --> [7]
    May 16 21:21:51.05: [12862]: --> HDLC<11:FF C8 C1 00 60 1F 23 01 00 8A 7D>
    May 16 21:21:51.09: [12862]: --> [2]
    May 16 21:21:51.09: [12862]: REMOTE wants 9600 bit/s
    May 16 21:21:51.09: [12862]: REMOTE wants A4 page width (215 mm)
    May 16 21:21:51.09: [12862]: REMOTE wants unlimited page length
    May 16 21:21:51.09: [12862]: REMOTE wants 3.85 line/mm
    May 16 21:21:51.09: [12862]: REMOTE wants 2-D MMR
    May 16 21:21:51.09: [12862]: REMOTE wants T.30 Annex A, 256-byte ECM
    May 16 21:21:51.09: [12862]: RECV training at v.29 9600 bit/s
    May 16 21:21:51.09: [12862]: MODEM set XON/XOFF/DRAIN: input ignored, output generated
    May 16 21:21:51.09: [12862]: <-- [10:AT+FRM=96\r]
    May 16 21:21:51.39: [12862]: --> [7]
    May 16 21:21:52.89: [12862]: MODEM set XON/XOFF/DRAIN: input ignored, output disabled
    May 16 21:21:52.89: [12862]: RECV: TCF 1793 bytes, 0% non-zero, 1776 zero-run
    May 16 21:21:52.89: [12862]: --> [10:NO CARRIER]
    May 16 21:21:52.89: [12862]: <-- [9:AT+FRS=7\r]
    May 16 21:21:52.95: [12862]: --> [2]
    May 16 21:21:52.95: [12862]: TRAINING succeeded
    May 16 21:21:52.95: [12862]: <-- [9:AT+FTH=3\r]
    May 16 21:21:52.97: [12862]: --> [7]
    May 16 21:21:52.97: [12862]: <-- HDLC<3:FF C8 21>
    May 16 21:21:52.97: [12862]: <-- data [3]
    May 16 21:21:52.97: [12862]: <-- data [2]
    May 16 21:21:54.04: [12862]: --> [2]
    May 16 21:21:54.04: [12862]: <-- [10:AT+FRM=96\r]
    May 16 21:21:54.60: [12862]: --> [7]
    May 16 21:21:54.60: [12862]: MODEM input buffering enabled
    May 16 21:21:54.60: [12862]: MODEM set XON/XOFF/FLUSH: input ignored, output generated
    May 16 21:21:55.22: [12862]: RECV received frame number 0
    May 16 21:21:55.42: [12862]: RECV received frame number 1
    May 16 21:21:55.62: [12862]: RECV received frame number 2
    May 16 21:21:55.84: [12862]: RECV received frame number 3
    May 16 21:21:56.04: [12862]: RECV received frame number 4
    May 16 21:21:56.24: [12862]: RECV received frame number 5
    May 16 21:21:56.44: [12862]: RECV received frame number 6
    May 16 21:21:56.66: [12862]: RECV received frame number 7
    May 16 21:21:56.86: [12862]: RECV received frame number 8
    May 16 21:21:57.06: [12862]: RECV received frame number 9
    May 16 21:21:57.48: [12862]: RECV received frame number 10
    May 16 21:21:57.68: [12862]: RECV received frame number 11
    May 16 21:21:57.90: [12862]: RECV received frame number 12
    May 16 21:21:58.10: [12862]: RECV received frame number 13
    May 16 21:21:58.30: [12862]: RECV received frame number 14
    May 16 21:21:58.52: [12862]: RECV received frame number 15
    May 16 21:21:58.72: [12862]: RECV received frame number 16
    May 16 21:21:58.92: [12862]: RECV received frame number 17
    May 16 21:21:59.14: [12862]: RECV received frame number 18
    May 16 21:21:59.34: [12862]: RECV received frame number 19
    May 16 21:21:59.54: [12862]: RECV received frame number 20
    May 16 21:21:59.74: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xc0
    May 16 21:21:59.74: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xf8
    May 16 21:21:59.96: [12862]: HDLC frame with bad address field 0xcb
    May 16 21:21:59.96: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:00.15: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xfc
    May 16 21:22:00.16: [12862]: HDLC frame not byte-oriented. Trailing byte: 0
    May 16 21:22:00.16: [12862]: HDLC frame too short (2 bytes)
    May 16 21:22:00.16: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:00.37: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xf0
    May 16 21:22:00.38: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:00.38: [12862]: HDLC frame with bad address field 0x92
    May 16 21:22:00.57: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:00.58: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:00.58: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xe0
    May 16 21:22:00.99: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xc0
    May 16 21:22:01.00: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:01.00: [12862]: HDLC frame not byte-oriented. Trailing byte: 0
    May 16 21:22:01.19: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:01.20: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xc0
    May 16 21:22:01.39: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:01.40: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xe0
    May 16 21:22:01.40: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xf0
    May 16 21:22:01.61: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:01.61: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xe0
    May 16 21:22:01.62: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:01.81: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xc0
    May 16 21:22:01.82: [12862]: HDLC frame not byte-oriented. Trailing byte: 0x80
    May 16 21:22:02.03: [12862]: HDLC frame with bad address field 0xe3
    May 16 21:22:02.03: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:02.24: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:02.45: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xfc
    May 16 21:22:02.45: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xc0
    May 16 21:22:02.46: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:02.65: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:02.65: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:02.85: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xf8
    May 16 21:22:02.86: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:03.07: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xe0
    May 16 21:22:03.07: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xc0
    May 16 21:22:03.08: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:03.27: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xf0
    May 16 21:22:03.27: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:03.48: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xc0
    May 16 21:22:03.48: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:03.48: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xf8
    May 16 21:22:03.70: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:03.70: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:03.70: [12862]: HDLC frame with bad address field 0xcd
    May 16 21:22:03.70: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xc0
    May 16 21:22:03.70: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:03.90: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:03.90: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xf0
    May 16 21:22:03.90: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xe0
    May 16 21:22:03.90: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xc0
    May 16 21:22:04.10: [12862]: HDLC frame not byte-oriented. Trailing byte: 0x80
    May 16 21:22:04.10: [12862]: HDLC frame too short (1 bytes)
    May 16 21:22:04.10: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xe0
    May 16 21:22:04.32: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:04.52: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xf8
    May 16 21:22:04.52: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:04.52: [12862]: HDLC frame not byte-oriented. Trailing byte: 0x80
    May 16 21:22:04.52: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:04.52: [12862]: HDLC frame with bad address field 0xa1
    May 16 21:22:04.74: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xfc
    May 16 21:22:04.74: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:04.74: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xf8
    May 16 21:22:04.94: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xc0
    May 16 21:22:04.94: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:04.94: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:04.94: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:05.14: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:05.14: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:05.14: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:05.35: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:05.35: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:05.55: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:05.55: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:05.55: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xe0
    May 16 21:22:05.56: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:05.77: [12862]: HDLC frame not byte-oriented. Trailing byte: 0x80
    May 16 21:22:05.77: [12862]: HDLC frame not byte-oriented. Trailing byte: 0x80
    May 16 21:22:05.77: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:05.97: [12862]: HDLC frame not byte-oriented. Trailing byte: 0x80
    May 16 21:22:06.17: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:06.17: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:06.17: [12862]: HDLC frame not byte-oriented. Trailing byte: 0
    May 16 21:22:06.17: [12862]: HDLC frame not byte-oriented. Trailing byte: 0
    May 16 21:22:06.39: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xf0
    May 16 21:22:06.39: [12862]: HDLC frame with bad address field 0xaa
    May 16 21:22:06.39: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xfc
    May 16 21:22:06.59: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xfc
    May 16 21:22:06.59: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:06.81: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:06.81: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:06.81: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:06.81: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:07.01: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xf8
    May 16 21:22:07.01: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:07.01: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:07.21: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xf8
    May 16 21:22:07.43: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:07.43: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:07.63: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xf0
    May 16 21:22:07.63: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xc0
    May 16 21:22:07.85: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xfc
    May 16 21:22:07.85: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xf0
    May 16 21:22:07.85: [12862]: HDLC frame not byte-oriented. Trailing byte: 0x80
    May 16 21:22:07.85: [12862]: HDLC frame with bad address field 0xbb
    May 16 21:22:08.03: [12862]: HDLC frame not byte-oriented. Trailing byte: 0xf0
    May 16 21:22:08.03: [12862]: Bad HDLC terminating flag received.
    May 16 21:22:08.03: [12862]: RECV assumed RCP frame with block end
    May 16 21:22:08.03: [12862]: MODEM set XON/XOFF/DRAIN: input ignored, output disabled
    May 16 21:22:08.03: [12862]: MODEM input buffering disabled
    May 16 21:22:08.03: [12862]: --> [10:NO CARRIER]
    May 16 21:22:08.03: [12862]: <-- [9:AT+FRH=3\r]
    May 16 21:22:16.77: [12862]: --> [7]
    May 16 21:22:17.89: [12862]: --> HDLC<10:FF C8 FD D2 00 00 03 19 B2 1F>
    May 16 21:22:17.89: [12862]: --> [5]
    May 16 21:22:17.89: [12862]: MODEM Command error
    May 16 21:22:17.89: [12862]: FCS error
    May 16 21:22:17.89: [12862]: <-- [9:AT+FRS=7\r]
    May 16 21:22:18.63: [12862]: --> [2]
    May 16 21:22:18.63: [12862]: <-- [9:AT+FTH=3\r]
    May 16 21:22:18.65: [12862]: --> [7]
    May 16 21:22:18.65: [12862]: <-- HDLC<3:FF C8 58>
    May 16 21:22:18.65: [12862]: <-- data [3]
    May 16 21:22:18.65: [12862]: <-- data [2]
    May 16 21:22:19.73: [12862]: --> [2]
    May 16 21:22:19.73: [12862]: RECV send CRP (command repeat)
    May 16 21:22:19.73: [12862]: <-- [9:AT+FRH=3\r]
    May 16 21:22:20.83: [12862]: --> [7]
    May 16 21:22:20.97: [12862]: --> [4:7C 00 10 03]
    May 16 21:22:20.97: [12862]: --> [5]
    May 16 21:22:20.97: [12862]: MODEM Command error
    May 16 21:22:20.97: [12862]: FCS error
    May 16 21:22:20.97: [12862]: <-- [9:AT+FRS=7\r]
    May 16 21:22:21.59: [12862]: --> [2]
    May 16 21:22:21.59: [12862]: <-- [9:AT+FTH=3\r]
    May 16 21:22:21.61: [12862]: --> [7]
    May 16 21:22:21.61: [12862]: <-- HDLC<3:FF C8 58>
    May 16 21:22:21.61: [12862]: <-- data [3]
    May 16 21:22:21.61: [12862]: <-- data [2]
    May 16 21:22:22.68: [12862]: --> [2]
    May 16 21:22:22.68: [12862]: RECV send CRP (command repeat)
    May 16 21:22:22.68: [12862]: <-- [9:AT+FRH=3\r]
    May 16 21:22:27.58: [12862]: --> [7]
    May 16 21:22:28.51: [12862]: --> HDLC<5:FF C8 DF 59 6F>
    May 16 21:22:28.59: [12862]: --> [2]
    May 16 21:22:28.60: [12862]: RECV recv DCN (disconnect)
    May 16 21:22:28.60: [12862]: RECV keeping unconfirmed page
    May 16 21:22:28.61: [12862]: RECV: 5376 bytes of data, 146 total lines
    May 16 21:22:28.61: [12862]: MODEM set XON/XOFF/DRAIN: input ignored, output disabled
    May 16 21:22:28.62: [12862]: RECV FAX (000000026): from 47822542, page 1 in 0:42, INF, 3.85 line/mm, 2-D MMR, 9600 bit/s
    May 16 21:22:28.62: [12862]: RECV FAX (000000026): recvq/fax000000013.tif from 47822542, route to <unspecified>, 1 pages in 0:42
    May 16 21:22:28.62: [12862]: RECV FAX: COMREC received DCN
    May 16 21:22:28.62: [12862]: MODEM input buffering enabled
    May 16 21:22:28.62: [12862]: RECV FAX (000000026): session with 47822542 terminated abnormally: COMREC received DCN
    May 16 21:22:28.62: [12862]: RECV FAX: bin/faxrcvd.php "recvq/fax000000013.tif" "ttyIAX1" "000000026" "COMREC received DCN" "" "" "<NONE>" "s"
    May 16 21:22:28.62: [12862]: RECV FAX: end
    May 16 21:22:28.62: [12862]: SESSION END

    Alguien me puede ayudar? graciasss
     
  2. magoc

    Joined:
    Mar 11, 2010
    Messages:
    83
    Likes Received:
    0
    alguien podria ayudarme por favor ??
     
  3. magoc

    Joined:
    Mar 11, 2010
    Messages:
    83
    Likes Received:
    0
    estuve mirando /var/spool/hylafax .... y ahi encontré todos los faxes recibidos perfectamente.
    Entonces ahora el problema esta mas localizado...

    los faxes se reciben correctamente, pero lo que sucede es que no me los muestra en el FAX VISOR, ni tampoco en el AVANTFAX...

    Seguramente la instalacion del AvantFax fue la que me produjo todo esto.
    Adverti que tampoco recibo los mails con la notificacion de los faxes.... que antes si recibia.


    alguien me puede dar la solucion ?? muchas gracias
     
  4. magoc

    Joined:
    Mar 11, 2010
    Messages:
    83
    Likes Received:
    0
    quien seria tan amable de ayudarme?
    gracias
     
  5. ramoncio

    Joined:
    May 12, 2010
    Messages:
    1,663
    Likes Received:
    0
    Hola Magoc,
    Echa un vistazo en /var/spoo/hylafax/bin/faxrcvd.php /var/spoo/hylafax/bin/faxrcvd-elastix.php y /var/spoo/hylafax/bin/faxrcvd-avantfax.php, revisa también los permisos.
    Otra opción es instalar el ultimo rpm de avantfax 3.2.2, que actualiza a la última versión y corrige permisos.
    Búscalo en el foro, tengo la comida al fuego.

    Suerte
     
  6. magoc

    Joined:
    Mar 11, 2010
    Messages:
    83
    Likes Received:
    0
    Ramoncio, ya tengo la ultima version de avantfax instalada. Lo hice mediante tu script, asi que no tengo nada para actualizar.

    Te pego el contenido de los 3 archivos que me nombras para ver si me podes ayudar. Gracias.

    faxrcvd

    Code:
    #! /bin/bash
    #	$Id: faxrcvd.sh.in,v 1.49 2007/02/28 13:18:01 aidan Exp $
    #
    # 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<<EOF
    
    FATAL ERROR: $SPOOL/etc/setup.cache is missing!
    
    The file $SPOOL/etc/setup.cache is not present.  This
    probably means the machine has not been setup using the faxsetup(8C)
    command.  Read the documentation on setting up HylaFAX before you
    startup a server system.
    
    EOF
        exit 1
    }
    
    # These settings may not be present in setup.cache if user upgraded and
    # didn't re-run faxsetup; we set them before calling setup.cache for
    # backward compatibility.
    ENCODING=base64
    TIFF2PDF=bin/tiff2pdf
    TTYCMD=tty
    
    . etc/setup.cache
    . bin/common-functions
    
    INFO=$SBIN/faxinfo
    FAX2PS=$TIFFBIN/fax2ps
    TIFF2PS=tiff2ps
    TOADDR=FaxMaster
    FROMADDR=fax
    TIFFINFO=tiffinfo
    NOTIFY_FAXMASTER=always
    
    #
    # Redirect errors to a tty, if possible, rather than
    # dev-nulling them or allowing them to creep into
    # the mail.
    #
    if $TTYCMD >/dev/null 2>&1; then
        ERRORSTO=`$TTYCMD`
    else
        ERRORSTO=/dev/null
    fi
    
    #
    # Permit various types of attachment types: ps, tif, pdf
    # Note that non-ASCII filetypes require an encoder.
    # pdf requires tiff2ps and tiff2pdf
    # Multiple file types may be specified by separating them with
    # whitespace; in that case a separate attachment for each filetype
    # will be created.
    #
    FILETYPE=ps
    SENDTO=
    
    #
    # There is no good portable way to find out the fully qualified
    # domain name (FQDN) of the host or the TCP port for the hylafax
    # service so we fudge here.  Folks may want to tailor this to
    # their needs; e.g. add a domain or use localhost so the loopback
    # interface is used.
    #
    HOSTNAME=`hostname`			# XXX no good way to find FQDN
    PORT=4559				# XXX no good way to lookup service
    
    FILE="$1"; shift;
    DEVICE="$1"; shift;
    COMMID="$1"; shift;
    MSG="$1"; shift;
    COUNT=1
    while [ $# -ge 1 ]; do
        # The eval has $1 set yet, and this forces a variable-to-variable
        # assignment, allowing us to not need to do escaping
        eval CALLID$COUNT='$1'
        export CALLID$COUNT
        shift
        COUNT=`expr $COUNT + 1`
    done
    CIDNUMBER="$CALLID1"
    CIDNAME="$CALLID2"
    
    FILENAME=`echo $FILE | $SED -e 's/\.tif//' -e 's/recvq\///'`
    
    SetupPrivateTmp
    
    parseFaxInfo $FILE
    
    MIMEBOUNDARY="NextPart$$"
    
    if [ -n "$MSG" ]; then
        SESSION_LOG=`cat log/c$COMMID`
        export SESSION_LOG
    fi
    
    export FILE
    export COMMID
    export DEVICE
    export MSG
    export FROMADDR
    export HOSTNAME
    export PORT
    export SENDTO
    export TOADDR
    
    #
    # Apply customizations.  All customizable variables should
    # be set to their non-customized defaults prior to this.
    #
    if [ -f etc/FaxDispatch ]; then
        . etc/FaxDispatch		# NB: FaxDispatch sets SENDTO
    fi
    
    if [ -f etc/templates/$TEMPLATE/hook.sh ]
    then
        # Any hooks that the templates need
        . etc/templates/$TEMPLATE/hook.sh
    fi
    
    
    ## MailWithFAX <type>
    ## Email the <type> template,adding the attachments according
    ## to $FILETYPE to $SENDTO
    ##
    ## We use the common CreateMailMessage <template> <f1> <t1> <n1> <d1>
    ## function, creating the file to mail as we go.
    MailWithFAX ()
    {
        template="etc/templates/$TEMPLATE/faxrcvd-$1.txt"
        files_1=$FILE;
        filetype_1=TIFF;
        nfiles=1;
        for ft in $FILETYPE
        do
    	ATTACH_ARGS="$ATTACH_ARGS "`BuildAttachArgs $ft`
        done
        eval CreateMailMessage $template $ATTACH_ARGS \
    	2>$ERRORSTO | $SENDMAIL -f"$FROMADDR" -oi "$SENDTO"
    
    }
    
    if [ -f $FILE ]; then
        #
        # Don't send FaxMaster duplicates, and FaxMaster may not even
        # want a message at all, depending on NOTIFY_FAXMASTER.
        #
        case $NOTIFY_FAXMASTER$MSG in
    	never*)		NOTIFY_FAXMASTER=no;;
    	errors)		NOTIFY_FAXMASTER=no;;
    	*)		NOTIFY_FAXMASTER=yes;;
        esac
        if [ "$TOADDR" != "$SENDTO" ] && [ "$NOTIFY_FAXMASTER" != "no" ]; then
            if [ -z "$MSG" ]; then
                CreateMailMessage etc/templates/$TEMPLATE/faxrcvd-notify-success.txt \
    	    		2>$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

    faxrcvd-avantfax.php

    Code:
    #!/usr/bin/php
    <?php
    /**
     * AvantFAX - "Web 2.0" HylaFAX management
     *
     * PHP 5 only
     *
     * @author		David Mimms <david@avantfax.com>
     * @copyright	2005 - 2007 MENTALBARCODE Software, LLC
     * @copyright	2007 - 2008 iFAX Solutions, Inc.
     * @license		http://www.gnu.org/copyleft/gpl.html GNU/GPL
     */
    
    	require_once 'classes.php';
    	
    	// check for proper arguments
    	if ($_SERVER['argc'] < 3) {
    		exit("Usage: ".$_SERVER['argv'][0]." file devID commID error-msg [CIDNumber] [CIDName] [DIDnum]\n");
    	}
    	
    	$debug		= false;
    	$tiff_file	= $_SERVER['argv'][1];
    	$modemdev	= $_SERVER['argv'][2];
    	
    	$commID		= ($_SERVER['argc'] >= 4) ? $_SERVER['argv'][3] : "";
    	$errormsg	= ($_SERVER['argc'] >= 5) ? $_SERVER['argv'][4] : "";
    	
    	$CIDNumber	= NULL;
    	$CIDName	= NULL;
    	$DIDNum		= NULL;
    	
    	// check if modemdev is configured for use
    	$modem		= new FaxModem;
    	if (!$modem->load_device($modemdev)) {
    		avantfaxlog("faxrcvd> Found unconfigured modem: $modemdev.  Configuring...", true);
    		$modem->create($modemdev, $modemdev, NULL);
    	}
    	
    	//
    	//	PROCESS TIFF FILE
    	//
    	// get the sender and pages
    	if (file_exists($tiff_file)) {
    		$faxinfo = faxinfo($tiff_file);
    		if (!$faxinfo) {
    			avantfaxlog("faxrcvd> failed: $tiff_file $modemdev corrupted", true);
    			exit;
    		}
    		
    		$sender	=	$faxinfo['Sender'];
    		$pages	=	$faxinfo['Pages'];
    		$date	=	$faxinfo['Received'];
    		
    		if (array_key_exists("CallID$CALLIDn_CIDNumber", $faxinfo)) {
    			if ($faxinfo["CallID$CALLIDn_CIDNumber"] != "<NONE>") {
    				$CIDNumber = $faxinfo["CallID$CALLIDn_CIDNumber"];
    			}
    		}
    		
    		if (array_key_exists("CallID$CALLIDn_CIDName", $faxinfo)) {
    			if ($faxinfo["CallID$CALLIDn_CIDName"] != "<NONE>") {
    				$CIDName = $faxinfo["CallID$CALLIDn_CIDName"];
    			}
    		}
    
    		if (array_key_exists("CallID$CALLIDn_DIDNum", $faxinfo)) {
    			if ($faxinfo["CallID$CALLIDn_DIDNum"] != "<NONE>") {
    				$DIDNum = $faxinfo["CallID$CALLIDn_DIDNum"];
    			}
    		}
    	} else {
    		avantfaxlog("faxrcvd> failed: $tiff_file not found", true);
    		exit;
    	}
    	
    	$company_name	= ($CIDName)	? $CIDName		: $sender;
    	$company_fax	= ($CIDNumber)	? $CIDNumber	: $sender;
    	
    	avantfaxlog("faxrcvd> executing: $tiff_file $modemdev '$commID' '$errormsg' CIDNum: '$CIDNumber' CIDName: '$CIDName' DID: '$DIDNum'", true);
    	avantfaxlog("faxrcvd> PROCESSING FAX from '$company_fax' ($pages pages) received '$date'", true);
    	
    	//
    	//	CREATE THUMBNAILS AND PDF
    	//
    	// preprare directory by year, month, day, fax number, hourminsec
    	list($day, $hour) = split(" ", $date);
    	$day		= preg_replace("/:/", DIRECTORY_SEPARATOR, $day);
    	$chour		= $hour;
    	$hylfaxid	= str_replace("recvq/fax", "", $tiff_file);
    	$hylfaxid	= str_replace(".tif", "", $hylfaxid);
    	$cpfax		= preg_replace("/\+/", "", clean_faxnum($company_fax));
    	$faxpath	= $ARCHIVE.DIRECTORY_SEPARATOR.$day.DIRECTORY_SEPARATOR.$cpfax.DIRECTORY_SEPARATOR.$hylfaxid;
    
    	// create the directories
    	mkdirs($faxpath);
    	
    	$faxfile	= $faxpath.DIRECTORY_SEPARATOR.TIFFNAME;
    	$pdffile	= $faxpath.DIRECTORY_SEPARATOR.PDFNAME;
    	$thumbnail	= $faxpath.DIRECTORY_SEPARATOR.THUMBNAIL;
    
    	// copy tiff file to new location
    	$tiff_prog	= ($TIFF_TO_G4) ? $TIFFCPG4 : $TIFFCP;
    	
    	// if fax failed to copy
    	if (system_v("$tiff_prog $tiff_file $faxfile") != 0) {
    		avantfaxlog("faxrcvd> Failed to copy $tiff_file to $faxfile", true);
    		exit;
    	}
    	
    	echo "Create PDF\n";
    	
    	// create pdf in new dir
    	tiff2pdf($faxfile, $pdffile);
    	
    	echo "Create Thumbnails\n";
    	
    	static_preview($faxpath, $pages);
    	
    	//
    	//	ADDRESSBOOK
    	//
    	$addressbook	= new AFAddressBook;
    	// lookup database entry for this fax number
    	if ($addressbook->loadbyfaxnum($company_fax, $mult)) {
    		if ($mult) {
    			$faxnumid = 0;
    			echo "WARNING: Multiple results for faxnumber\n";
    		} else {
    			$faxnumid = $addressbook->get_faxnumid();
    			$addressbook->inc_faxfrom();
    		}
    	} else { // if it doesn't exist, create it
    		echo $addressbook->get_error()."\n";
    		
    		if ($addressbook->create($company_name)) {
    			$addressbook->inc_faxfrom();
    			avantfaxlog("faxrcvd> Created company '$company_name'", true);
    			
    			if ($addressbook->create_faxnumid($company_fax)) {
    				$faxnumid = $addressbook->get_faxnumid();
    				$addressbook->inc_faxfrom();
    				avantfaxlog("faxrcvd> Created fax number '$company_fax'", true);
    			} else {
    				$faxnumid = 0;
    				avantfaxlog("faxrcvd> Couldn't create faxnumid".$addressbook->get_error(), true);
    			}
    		} elseif ($addressbook->get_error() == $LANG['COMPANY_EXISTS']) { // Company already exists, so create a new fax number
    			if ($addressbook->loadbycid($addressbook->get_companyid())) {
    				if ($addressbook->create_faxnumid($company_fax)) {
    					$faxnumid = $addressbook->get_faxnumid();
    					$addressbook->inc_faxfrom();
    					avantfaxlog("faxrcvd> Created new fax number '$company_fax' for company '$company_name'", true);
    				} else {
    					$faxnumid = 0;
    					avantfaxlog("faxrcvd> Failed to create new fax number '$company_fax' for company '$company_name'", true);
    				}
    			}
    		} else {
    			avantfaxlog("faxrcvd> FAILED to create company '$company_fax' - ".$addressbook->get_error(), true);
    			$faxnumid = 0;
    		}
    	}
    
    	//
    	//	LOAD DID/DTMF Routing info
    	//
    	$didr_id	= 0;
    	if ($ENABLE_DID_ROUTING) {
    		$didr		= new DIDRouting;
    		$didr_id	= ($didr->load_route($DIDNum)) ? $didr->get_didr_id() : 0;
    		
    		if ($didr_id) {
    			echo "Found DID for ".$didr->get_alias() . "\n";
    		} elseif ($DIDNum && $AUTOCONFDID) {
    			avantfaxlog("faxrcvd> configuring DID '$DIDNum'", true);
    			if ($didr->create($DIDNum, $DIDNum, NULL)) {
    				$didr_id = $didr->get_didr_id();
    			}
    		}
    	}
    	
    	//
    	//	ADD FAX TO ARCHIVE
    	//
    	$inbox	= new ArchiveIn;
    	$faxid	= NULL;
    	// create entry for fax in database
    	if ($inbox->create($faxpath, $faxnumid, $company_fax, $modemdev, $pages, "$day $chour", $didr_id)) {
    		$faxid = $inbox->get_fid();
    		avantfaxlog("faxrcvd> Inserted $faxpath from $company_name to Inbox", true);
    	} else {
    		avantfaxlog("faxrcvd> FAILED to insert $faxpath from $company_name to Inbox - ".$inbox->get_error(), true);
    	}
    	
    	//
    	//	PROCESS FAX ANNOTATION
    	//
    	if (ENABLE_FAX_ANNOTATION) {
    		$ann_pdf = annotate_fax($faxfile, "FaxID: $faxid");
    		rename($ann_pdf, $pdffile);
    	}
    	
    	//
    	//	PROCESS ROUTING PRIORITIES
    	//	From lowest to highest: DID/Modem, Fax2Email, Barcode
    	//
    	$barcode			= new BarcodeRouting;
    	$printer			= $PRINTERNAME;
    	$printer_type		= "SYS";
    	$email_recipient	= NULL;
    	$email_type			= NULL;
    	$faxcatid			= NULL;
    	$category_type		= NULL;
    	
    	// if in Modem mode
    	if (!$ENABLE_DID_ROUTING) {
    		// fax category
    		if ($test_faxcatid = $modem->get_faxcatid()) {
    			$faxcatid = $test_faxcatid;
    			$category_type = "MODEM";
    		}
    		
    		// printer
    		if ($test_printer = $modem->get_printer()) {
    			$printer = $test_printer;
    			$printer_type = "MODEM";
    		}
    		
    		// email
    		if ($test_email = $modem->get_contact()) {
    			$email_recipient = $test_email;
    			$email_type = "MODEM";
    		}
    	} elseif ($didr_id) { // in DID/DTMF mode
    		// fax category
    		if ($test_faxcatid = $didr->get_faxcatid()) {
    			$faxcatid = $test_faxcatid;
    			$category_type = "DID";
    		}
    		
    		// printer
    		if ($test_printer = $didr->get_printer()) {
    			$printer = $test_printer;
    			$printer_type = "DID";
    		}
    		
    		// email
    		if ($test_email = $didr->get_contact()) {
    			$email_recipient = $test_email;
    			$email_type = "DID";
    		}
    	}
    	
    	// check Fax2Email category
    	if ($test_faxcatid = $addressbook->get_category()) {
    		$faxcatid = $test_faxcatid;
    		$category_type = "Fax2Email";
    	}
    	
    	// check Fax2Email printer
    	if ($test_printer = $addressbook->get_printer()) {
    		$printer = $test_printer;
    		$printer_type = "Fax2Email";
    	}
    	
    	// check Fax2Email email
    	if ($test_email = $addressbook->get_email()) {
    		$email_recipient = $test_email;
    		$email_type		= "Fax2Email";
    	}
    	
    	// check Barcode rules
    	if ($bardecode = bardecode($faxfile)) {
    		$inbox->set_note($bardecode, NULL, NULL);
    		// fax category
    		if ($barcode->load_route($bardecode)) {
    			if ($test_faxcatid = $barcode->get_faxcatid()) {
    				$faxcatid = $test_faxcatid;
    				$category_type = "BARCODE";
    			}
    			
    			// printer
    			if ($test_printer = $barcode->get_printer()) {
    				$printer		= $test_printer;
    				$printer_type	= "BARCODE";
    			}
    			
    			// email
    			if ($test_email = $barcode->get_contact()) {
    				$email_recipient = $test_email;
    				$email_type = "BARCODE";
    			}
    		}
    	}
    
    	// OCR Data
    	if ($ocr_data = ocr_faxcontent ($faxfile)) {
    		$inbox->set_faxcontent ($ocr_data);
    	}
    	
    	//
    	//	SET FAX CATEGORY
    	//
    	if ($faxcatid) {
    		echo "Setting $category_type category id $faxcatid\n";
    		$inbox->set_category($faxcatid);
    	}	
    	
    	//
    	//	SEND EMAIL
    	//
    	$company = $addressbook->get_company();
    	if (!$company) $company = $company_name;
    	
    	$from		= get_admin_email();
    	$subject	= "fax: $company " . strftime(EMAIL_DATE_FORMAT);
    	$text		= "${LANG['FROM']}: $company";
    	
    	if ($desc = $addressbook->get_description()) {
    		$text .= " ($desc)\n";
    	}
    	
    	$text	.= "\nfax id: $faxid\n${LANG['PN_PAGES']}: $pages\n";
    	
    	$thumb	= ($FAXRCVD_INCLUDE_THUMBNAIL) ? $thumbnail : NULL;
    	$addpdf = ($FAXRCVD_INCLUDE_PDF) ? $pdffile : NULL;
    	
    	if ($email_recipient) {
    		if ($email_type == "Fax2Email") {
    			if ($ARCHIVEFAX2EMAIL) {
    				echo "Archiving fax\n";
    				$inbox->set_archivebox($faxid);
    			}
    		}
    		
    		if (send_mail($email_recipient, $from, $subject, $text, $addpdf, NULL, $thumb)) {
    			avantfaxlog("faxrcvd> Fax sent to $email_type contact $email_recipient", true);
    		}
    	}
    	
    	//
    	//	PRINTING SUPPORT
    	//
    	if ($PRINTFAXRCVD == true) {
    		avantfaxlog("faxrcvd> Sending fax to $printer_type printer $printer", true);
    		if ($FAXRCVD_PRINT_PDF) {
    			$printerArg = ($printer) ? "-P ".escapeshellcmd($printer) : NULL;
    			$cmd = $PDFPRINTCMD." $printerArg ".escapeshellarg($pdffile);
    		} else {
    			$cmd = sprintf($PRINTFAXCMD, escapeshellarg($tiff_file), ($printer) ? "-P ".escapeshellcmd($printer) : NULL);
    		}
    		
    		system_v($cmd);
    		avantfaxlog($cmd);
    		
    		if ($printer_type == "Fax2Email") {
    			if ($ARCHIVEFAX2EMAIL) {
    				echo "Archiving fax\n";
    				$inbox->set_archivebox($faxid);
    			}
    		}
    	}
    	exit;

    faxrcvd-elastix.php

    Code:
    #!/usr/bin/php
    <?php
        require_once "includes/functions.php";
        require_once "includes/config.php";
    
        /**********************************************
         *         1) OBTENGO INFORMACION             *
         **********************************************/
    
        // check for proper arguments
        if ($_SERVER['argc'] < 3) {
            echo $_SERVER['argv'][0]." file devID commID error-msg CIDNumber CIDName\n";
            exit;
        }
    
        $tiff_file = $_SERVER['argv'][1];
        $modemdev  = $_SERVER['argv'][2];
    	
        $commID    = ($_SERVER['argc'] >= 4) ? $_SERVER['argv'][3] : "";
        $errormsg  = ($_SERVER['argc'] >= 5) ? $_SERVER['argv'][4] : "";
        $CIDNumber = ($_SERVER['argc'] >= 6) ? $_SERVER['argv'][5] : "";
        $CIDName   = ($_SERVER['argc'] == 7) ? $_SERVER['argv'][6] : "";
        
        faxes_log ("faxrcvd> Obteniendo informacion del tiff ".obtener_nombre($tiff_file)." CIDNumber: ".$CIDNumber." CIDName: ".$CIDName);
       
        // OBTENGO INFORMACION DEL FAX
        if (!faxinfo ($tiff_file, $sender, $pages, $date, $fax_papersize)) {
            faxes_log ("faxrcvd> Failed: $tiff_file $modemdev corrupted");
            exit;
        }
        $company_name = ($CIDName) ? $CIDName : $sender;
        $company_number  = ($CIDNumber) ? clean_faxnum ($CIDNumber) : $sender;
        faxes_log ("faxrcvd> Processing FAX from company_name: $company_name, company_number: $company_number");
    
    
        /**********************************************
         *         2) ALMACENO FAX: HD Y DB           *
         **********************************************/
        // copy tiff file to new dir
        $name_pdf = str_replace("tif","pdf",obtener_nombre($tiff_file));
        global $faxes_path;
        $pathDB = createFolder($company_number, $commID, "in");
        $pdffile= "$faxes_path/recvd/$pathDB/fax.pdf";
    
        //El usuario actual es uucp
        // create pdf in new dir
        tiff2pdf_RCVD($tiff_file, $pathDB);
        // METO EL FAX EN LA BASE DE DATOS?
        fax_info_insert($name_pdf,$modemdev,$commID,$errormsg,$company_name,$company_number,'in',"recvd/$pathDB");
        faxes_log ("faxrcvd> Se copio el $name_pdf en la ruta $faxes_path/recvd/$pathDB y se grabo en la BD.");
        /**********************************************
         *         3) ENVIO EMAIL                     *
         **********************************************/
    
        $destinatario = obtener_mail_destiny($modemdev);
        $arrConfig    = getConfigurationSendingFaxMail($name_pdf,$company_name,$company_number);
        $titulo       = $arrConfig['subject'];
        $contenido    = $arrConfig['content'];
        $remite       = $arrConfig['remite'];
        $remitente    = $arrConfig['remitente'];
        $archivo      = $pdffile;
        $archivo_name = $name_pdf;
    
        print_r($arrConfig);
        echo $destinatario;
        enviar_mail_adjunto($destinatario,$titulo,$contenido,$remite,$remitente,$archivo,$archivo_name);
    
         /*
    	recvq/fax000000003.tif (ftp://elastix.palosanto.com:4559/recvq/fax000000003.tif):
    	          Sender: 
    	           Pages: 1
    	         Quality: Normal
    	            Size: ISO A4
    	        Received: 2007:06:11 16:30:20
    	 Time To Receive: 0:38
    	     Signal Rate: 9600 bit/s
    	     Data Format: 2-D MR
    	   Error Correct: No
    	         CallID1: 
    	         CallID2: 
    	     Received On: ttyIAX1
    	          CommID: 000000003 (ftp://elastix.palosanto.com:4559/log/c000000003)
        */
    ?>
     

Share This Page