4

I am trying to write a front-end for sending faxes in PHP. I want to know how can I get the status of a fax job.

When the user sent a fax, how can I report the status of the job to the user ? In case when the destination line was busy, unreachable, etc.

Is there any log file or a command that contains the status of a specific fax job which is transfer-able to the front-end ? So I can report back the success/failed message to user.

I know about faxstat -d, but it's a report for all jobs and i can't fetch that on php side.

enter image description here

As you can see the format of output is not something that can be parsed easily.

Just for reference, here is the list of all status codes.

I had a look at Hylafax's documentation but couldn't find anything on how to trace a job status.

xperator
  • 437
  • 2
  • 11
  • 23

2 Answers2

3

I know about faxstat -d, but it's a report for all jobs and i can't fetch that on php side.

Sure you can. You have a couple options: system and exec.

Use one of those to run the faxstat command in combination with grep, and you should be able to get the data you want. Alternatively, suck in all of faxstat's output into a php variable, and then parse out the data you're looking for.

EEAA
  • 108,414
  • 18
  • 172
  • 242
  • Please have a look at the edit. Is there a chance to get status from that kind of output ? Also, the output of `faxstat -d` will grow by time and the list will increase. Won't there be a problem with putting all these into a single php variable ? – xperator Jun 19 '12 at 17:57
  • Looks easy enough to parse. Very simple using standard unix tools like grep, cut, etc. – EEAA Jun 19 '12 at 18:19
3

The file in /var/spool/hylafax/doneq/q$job_id, where $job_id is your job #, is more descriptive. See here: http://hylafax.sourceforge.net/man/doneq.php

Files in the doneq directory specify completed transmission job requests. These files are created by hfaxd(8C), when submitting a job on behalf of sendfax(1) or sendpage(1). Job description files also reside in the sendq directory; they are moved from there to the doneq directory by faxq(8C) when a job completes.

slm
  • 7,355
  • 16
  • 54
  • 72
Ryan
  • 31
  • 1