HylaFAX The world's most advanced open source fax server

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

Re: Re: egetty and vgetty



Dear Matthias,

When I followed the code I found that:

1) answerCall is called
2) if Answer Rotary is set to "extern"
3) if EGettyArgs tag is defined non-null in the config.xxx file
4) answerCall calls runGetty that in turn return with the type of call
5) when runGetty returns if if returns with CALLTYPE_DONE nothing is done
6) if the call returns with CALLTYPE != ERROR then the
modemAnswerCallCmd is called. /* the guy who changed the code here calls
modemAnswerCall*/
7) modemAnswerCallCmd just calls answerCallCmd.
8) answerCallCmd defined in ClassModem for CALLTYPE_FAX sets beginCmd to
conf.answerFaxBeginCmd and then sends that command to the modem.
9) answerFaxBeginCmd is defined in the atcmds[] structure in the
ModemConfig class to be the whatever is assigned to the tag
ModemAnswerFaxBeginCmd in the config.xxx file.

This tag is used to define baud rates for modems that switch to fixed baud
rates when they are in fax mode like the Rockwell based ones, a typical
one would be "<19200><xon>". By this time hylafax thinks that the carrier
has been stablished and it is ready to receive the fax.

Funny enough, my egetty does not even when I incorporated the ata\r before
exiting. OK my egetty works but when it returns to faxgetty it hangs up.
On a private email I'll send to you the important part of the strace
output of the faxgetty command.

The guy that changed hylafax did two things, first intead of calling
modemAnswerCallCmd, calls modemAnswerCall, which does answer the call,
meaning you can leave egetty without having answered. [But I don't want to
do that for me it is more efficient to answer the call in egetty]

The second thing that he did is to disable the execution of the following 
statments:

signal(SIGTERM, fxSIGHANDLER(SIG_DFL));
signal(SIGHUP, fxSIGHANDLER(sigHUP));
setupSession(fd);

in Getty::run(int fd, fxBool parentIsInit) function when argv[0]==egetty
(I know this is the wrong syntaxis...)

I don't have a clue of the implications of doing this. I don't even
understand what these signals are for, except may be for SIGTERM that I
think catches Ctrl C.

With respect to setupSession, it seems to change the ownership of the
modem file descriptor fd and then I get really confused, it seems that it
tries to duplicate the modem file descriptor into the standard output file
descriptor. Would this make any output intended for the screen go to the
modem?? And then it tries to duplicate the modem file descriptor to be the
STDERR_FILENO, standard error. Could you anybody clarify this? The lines
of code I am talking about are:

(dup2(fd, STDOUT_FILENO); and (dup2(fd,STDERR_FILENO). Eventhough I don't
understand exactly what they do, they may make sense for the getty
process, but why do this (what I guess it does) for egetty and vgetty?

Anyway, all this is to say that:

1) If you use the egetty hook as it is you need to answer the call at the
end of your egetty code.
2) If you change the modem settings, don't expect faxGetty to reset your
modem to fax mode. You need to do it yourself inside egetty.
3) It does not work yet for me, hence I am missing something, may be it is
in the changes that my pal made. Can somebody help me understand what the
implications of those changes are (not the modemAnserCallCmd, that one I
got)?
4) This may be a Linux only problem.

Thanks for your help in advance,

Julio

On Thu, 23 Oct 1997 Matthias.Apitz@SOFTCON.de wrote:

> Prof. Julio C. Spinelli wrote:
>     
>     Thanks very much for the example, the only difference between what you are
>     doing and what I was doing is that you are issuing ATA before exiting
>     egetty. 100 to 1 that was my mistake, now I realize that of course hylafax
>     should expect that start the fax call handling is the responsibility of
>     the egetty program. And of course egetty should also reinitialize the
>     modem before issuing the ATA command. 
> 
> I don't think that the called egetty has to reinitialize
> the modem. The logic goes IMHO that way:
> 
> - faxgetty(1M) sees the modem ringing (RING) and is configured
>   to use egetty to let egetty deduce what's to do with this call
> - faxgetty(1M) handover the call (keep in mind the call and the
>   caller is waiting)
> - the first think that egetty hast to do: investigate the RING
>   message from the modem (there are modems showing the call-type
>   in the RING message) or pick-up this call with ATA (or something
>   like that) ond decide what's to do with this answered call,
>   e.g. look for PPP packets after the two modem are CONNECT'ed
> - ...
> - tell later faxgetty(1M) with the exit-state what's to do now
>   with this (maybe done) call
> 
> reinitializing the modem will perhaps drop that call;
> 
> 	matthias
>     
>     If this works I will still read the changes sent to me and try to see what
>     he did. I'll also send you a few lines with the changes that I recommend,
>     
>     Thanks very much!
>     
>     Julio
> 




Project hosted by iFAX Solutions