HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [hylafax-users] Replace faxsend program



Hello,

thanks for pointing me to faxd/FaxSendStatus.h

for virtual modem - i'm using send-only environment (receiving is done by other means) so i do not use faxgetty.
for "sending" faxes i use script "bin/my_faxsend" so in "etc/config" there is line "SendFaxCmd:             bin/my_faxsend"

After restarting hylafax, i  use 
---------------------------------
[root@vmtnv02 bin]# faxmodem virtual
---------------------------------
command, to make faxq avare of the virtual modem called "virtual" (the name can be any string)
This command only tells faxq process, that there is a available modem in the system.
faxq then knows about it an can schedule jobs for it.

so when job is submitted with "sendfax" client, faxq executes script defined in config file, giving him modem name and qfile
as command line parameters.
see faxq logging
--------------------
Aug  6 15:54:15 vmtnv02 FaxQueuer[28104]: JOB 49 (active dest +42059973 pri 127 tts 0:00 killtime 2:58:58): CMD START bin/my_faxsend -m virtual sendq/q49 (PID 10991)
Aug  6 15:54:40 vmtnv02 FaxQueuer[28104]: BATCH to +42059973 CMD DONE: exit status 0x200
Aug  6 15:54:40 vmtnv02 FaxQueuer[28104]: NOTIFY: bin/notify "doneq/q49" "done" "0:25"
--------------------
1. line -> faxq execute bin/my_faxsend -m virtual sendq/q49                
2. line -> my_faxsend exited with value "2"
3. line -> job 49 moved to doneq and notifi script has been called

my "my_faxsend" testing script is very simple - just sleep for some 25 sec and then return.
depending on return value, faxq handles the job
   return 0 - retry - faxq reschedules the job for later retransmission
   return 1 - failed - faxq moves qfile from sendq to doneq and mark it as completed-failed
   return 2 - done - faxq moves qfile from sendq to doneq and mark it as completed-done
   return 3 - reformat - faxq reschedules the job for later retransmission


I also have a fifo "FIFO.virtual" and empty modem config file "etc/config.virtual"
With these files, hfaxd and faxstat are also aware of the virtual modem, so in "faxstat -s" output,
modem status is visible -> modem status can be changed in "my_faxend" script as well
having these lines in "my_faxsend"
---------------------------
echo "sending job $JOBID" > /var/spool/hylafax/status/$modem
sleep 25
echo "modem available for transmission" > /var/spool/hylafax/status/$modem
---------------------------
i do simulate modem sending (sleep 25) and echo lines writes status of modem into appropriate file.
Therefore modem status is also updated in "faxstat" output

A note to faxmodem command - when you issue a "faxmodem ttyIAX01", all it does is send a special message to faxq process via it's FIFO pipe.
see the log
-----------------
Aug  5 14:13:39 vmtnv02 FaxQueuer[28104]: FIFO RECV "+ttyIAX01:RPc87fcf01"
-----------------
when faxq receives "+ttyIAX01:RPc87fcf01" command throuhg FIFO, it consider ttyIAX01 as another available modem
and can use it for scheduling jobs.


Hope the stuff is not very confusing ;-(
Let me know if you'll anything more

Tomas Novosad





------------ Původní zpráva ------------
Od: Atis Lezdins <atis@xxxxxxxxxxx>
Předmět: Re: [hylafax-users] Replace faxsend program
Datum: 06.8.2008 13:17:15
----------------------------------------
On Wed, Aug 6, 2008 at 11:44 AM, Tomas Novosad <kbbl@xxxxxxxx> wrote:
> Hello,
>
> so far i'v found that i do not need any dummy modem.
> I just add vitrual modem to faxq, using faxmodem command.
> This is for 1st question.
> For second - faxsend inform faxq about result of outbound job with return
value
> so far i'v tested that returning "2" mean - documend send successfuly.
> I found some info about other returning values
>
>    return 0; - retry
>    return 1; - error
>    return 2; - done
>    return 3; - reformat
>
> Can anyone confirm/disconfirm these return values?
> I tried to search faxsend source, but C++ is a bit tricky for me.

I think it's defined in faxd/FaxSendStatus.h:

enum FaxSendStatus {
    send_retry,     // waiting for retry
    send_failed,    // finished w/o success
    send_done,      // completed successfully
    send_reformat,    // retry with reformatted documents
    send_v34fail,   // failed due to V.34-Fax trouble
    send_v17fail,   // failed due to V.17-Fax trouble
    send_batchfail    // batch failure, retry
};


Your question pinpointed me to location i've been searching in Hylafax
sources, as i'm currently debugging Hylafax/T38modem problem with not
sending DCS. If i'll be unsuccessful, i could use the same virtual
modem - to have Hylafax for receiving/generating TIFF, and then use
Callweaver to send it, as my current setup uses Hylafax. So, could you
describe more in detail - what have you done to have virtual modem?

Regards,
Atis

>
> Thanks in advance
>
> Tomas
>
> ------------ Původní zpráva ------------
> Od: Tomas Novosad <kbbl@xxxxxxxx>
> Předmět: [hylafax-users] Replace faxsend program
> Datum: 05.8.2008 09:37:59
> ----------------------------------------
> Hello,
>
> i'd like to use my own script instead of "faxsend" command.
> This is because i need to run hylafax on server which has no telephone line
> connected - therefore there is no modem.
>
> I inted to write my own script which will transmit the documents via scp,
while
> server pretends it send it via fax.
> The T.37 nor T.38 protocols are not suitable for for my solution.
>
> So i have two questions
>  1) as there is no phone line on server, there is no modem - ho do i create a
> dummy modem for faxq process.
>       if there is no modem, faxq says it has no resouurces and does not invoke
> the FaxSendCmd script
>   2) my FaxSendScript send the document over scp, then return 0 for success
and
> update qfile with "returned: send_done"  but,
>      faxq still does not consider the job as completed.(see the log few line
> lower). What exactly has to be done, to mark the job
>       completed, so that faxq process consider the job as completed a move it
> from senq to doneq?
>
> ------------------------  faxq log
> Aug  5 06:58:01 vmtnv02 FaxQueuer[6388]: JOB 24 (active dest +42059979 pri 127
> tts 0:00 killtime 2:58:56): CMD START bin/my_faxsend -m ttyIAX01 sendq/q24
(PID
> 2963)
> Aug  5 06:58:01 vmtnv02 FaxQueuer[6388]: BATCH to +42059979 CMD DONE: exit
> status 0
> Aug  5 06:58:01 vmtnv02 FaxQueuer[6388]: JOB 24 (sleeping dest +42059979 pri
126
> tts 0:00 killtime 2:58:56): SEND INCOMPLETE: requeue for 6:48;
> -----------------------
> on first line, faxq is invoking my_faxsend command
> on second line "my_faxsend" returned 0 - command completed
> on third line faxq complains about send incomplete
>
> do you have any idea why faxq think the send is not completed or rather, what
> has to be done to persuade faxq thet the job has been successfuly sent.
>
> Many thanks in advance and have a nice day
>
> Tomas Novosad
>
>
> ____________________ HylaFAX(tm) Users Mailing List _______________________
>  To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
>  On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null
>  *To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxx*
>
>
>
>
>
> Tomáš Novosad
> mailto:kbbl@xxxxxxxx
> jabber:kbbl@xxxxxxxxx
> +420737309887
> # rm -rf /*
>
>
> ____________________ HylaFAX(tm) Users Mailing List _______________________
>  To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
>  On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null
>  *To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxx*
>
>



-- 
Atis Lezdins,
VoIP Project Manager / Developer,
atis@xxxxxxxxxxx
Skype: atis.lezdins
Cell Phone: +371 28806004
Cell Phone: +1 800 7300689
Work phone: +1 800 7502835




Tomáš Novosad
mailto:kbbl@xxxxxxxx
jabber:kbbl@xxxxxxxxx
+420737309887
# rm -rf /*


____________________ HylaFAX(tm) Users Mailing List _______________________
  To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
 On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null
  *To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxx*




Project hosted by iFAX Solutions