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] problem receiving faxes with Hylafax v4.2.0 alpha 023



On 2004.08.18 10:32 Patrice Fournier wrote:
Quoting Lee Howard <faxguy@xxxxxxxxxxxxxxxx>:

> On 2004.08.18 09:12 Daniel Moreda García wrote:
> > This is a session of the same fax, but with Hylafax v4.2.0beta2:
> >
> > Aug 18 17:38:03.46: [ 3015]: <-- data [10]
> > Aug 18 17:38:03.46: [ 3015]: <-- data [2]
> > Aug 18 17:38:06.68: [ 3015]: --> [2:OK]

Notice the 3.22 seconds delay before the modem response.

Ah yes, I missed that. Thanks for catching this, Patrice.


> Here's the same segment from the 4.2.0 session that you sent:
>
> > Aug 18 11:37:45.64: [ 6052]: <-- data [10]
> > Aug 18 11:37:45.64: [ 6052]: <-- data [2]
> > Aug 18 11:37:48.19: [ 6052]: --> [0:]
> > Aug 18 11:37:48.19: [ 6052]: MODEM <Empty line>
> > Aug 18 11:37:48.19: [ 6052]: MODEM TIMEOUT: sending DIS/DCS frame
>
> Notice that HylaFAX is waiting for the modem to respond OK and gives
up
> at 11:37:48.19.

Notice that HylaFAX gave up after 2.55 seconds.

Indeed.


I believe the change in sendRawFrame() causes this. That change where
putModemDLEData was called with a timeout value of 60 seconds
replacing
the 2.55 seconds timeout already set before the call to sendFrame().

Now, is our 2.55 seconds delay not long enough or is the sender
non-compliant with T.30?

Well, in truth it doesn't matter because even if the modem is not compliant we still have to cope with it anyway. So our timeout is not long enough. (But the modem is compliant.)


The timeout is there because T.30 requires an HDLC frame to be transmitted in its entirety within 3 seconds +/- 15%. But that doesn't really specify how long the DCE can take to respond to the DTE that it is done.

T.31 8.3.5 requires the DCE to respond CONNECT or result OK within 5 seconds of the time the DTE stopped transmitting data or it must result ERROR. So we should increase this timeout to at least 7500 ms (5 seconds plus 2500 ms) and no more than 8500 ms. I've used a 7550 ms timeout in the attached patch.

I've attached and committed to CVS a patch that I've also hung on:
http://bugs.hylafax.org/bugzilla/show_bug.cgi?id=543
It applies to CVS, so I don't know if it will apply cleanly to 4.2.0 as released.


Thanks.

Lee.
diff -Nru hylafax-4.2.0.orig/faxd/Class1.c++ hylafax-4.2.0/faxd/Class1.c++
--- hylafax-4.2.0.orig/faxd/Class1.c++	Wed Aug 18 08:22:54 2004
+++ hylafax-4.2.0/faxd/Class1.c++	Wed Aug 18 10:43:48 2004
@@ -1165,7 +1165,7 @@
 bool
 Class1Modem::transmitFrame(u_char fcf, bool lastFrame)
 {
-    startTimeout(2550);			// 3.0 - 15% = 2.55 secs
+    startTimeout(7550);
     bool frameSent =
 	(useV34 ? true : atCmd(thCmd, AT_NOTHING, 0)) &&
 	(useV34 ? true : atResponse(rbuf, 0) == AT_CONNECT) &&
@@ -1179,10 +1179,10 @@
 {
     /*
      * The T.30 spec says no frame can take more than 3 seconds
-     * (+/- 15%) to transmit.  We take the conservative approach.
-     * and guard against the send exceeding the lower bound.
+     * (+/- 15%) to transmit.  But the DCE can take as much as 5
+     * seconds to respond CONNECT or result OK, per T.31.
      */
-    startTimeout(2550);			// 3.0 - 15% = 2.55 secs
+    startTimeout(7550);
     bool frameSent =
 	(useV34 ? true : atCmd(thCmd, AT_NOTHING, 0)) &&
 	(useV34 ? true : atResponse(rbuf, 0) == AT_CONNECT) &&
@@ -1194,7 +1194,7 @@
 bool
 Class1Modem::transmitFrame(u_char fcf, const fxStr& tsi, bool lastFrame)
 {
-    startTimeout(3000);			// give more time than others
+    startTimeout(7550);
     bool frameSent =
 	(useV34 ? true : atCmd(thCmd, AT_NOTHING, 0)) &&
 	(useV34 ? true : atResponse(rbuf, 0) == AT_CONNECT) &&
@@ -1206,7 +1206,7 @@
 bool
 Class1Modem::transmitFrame(u_char fcf, const u_char* code, const fxStr& nsf, bool lastFrame)
 {
-    startTimeout(3000);			// give more time than others
+    startTimeout(7550);
     bool frameSent =
 	(useV34 ? true : atCmd(thCmd, AT_NOTHING, 0)) &&
 	(useV34 ? true : atResponse(rbuf, 0) == AT_CONNECT) &&
diff -Nru hylafax-4.2.0.orig/faxd/Class1Poll.c++ hylafax-4.2.0/faxd/Class1Poll.c++
--- hylafax-4.2.0.orig/faxd/Class1Poll.c++	Wed Aug 18 08:22:55 2004
+++ hylafax-4.2.0/faxd/Class1Poll.c++	Wed Aug 18 10:44:03 2004
@@ -60,7 +60,7 @@
     pageGood = false;				// quality of received page
 
     return atCmd(thCmd, AT_NOTHING) &&
-	atResponse(rbuf, 2550) == AT_CONNECT &&
+	atResponse(rbuf, 7550) == AT_CONNECT &&
 	recvIdentification(
 	    (send&DIS_PWD ? FCF_PPW : 0), pwd,
 	    (send&DIS_SEP ? FCF_SEP : 0), sep,
diff -Nru hylafax-4.2.0.orig/faxd/Class1Recv.c++ hylafax-4.2.0/faxd/Class1Recv.c++
--- hylafax-4.2.0.orig/faxd/Class1Recv.c++	Wed Aug 18 08:22:54 2004
+++ hylafax-4.2.0/faxd/Class1Recv.c++	Wed Aug 18 10:41:22 2004
@@ -148,41 +148,41 @@
      * station or (PWD) (SEP) (CIG) DTC when initiating a poll.
      */
     if (f1) {
-	startTimeout(3000);
+	startTimeout(7550);
 	framesSent = sendFrame(f1, pwd, false);
 	stopTimeout("sending PWD frame");
     } else if (f2) {
-	startTimeout(3000);
+	startTimeout(7550);
 	framesSent = sendFrame(f2, addr, false);
 	stopTimeout("sending SUB/SEP frame");
     } else if (f3) {
-	startTimeout(3000);
+	startTimeout(7550);
 	framesSent = sendFrame(f3, (const u_char*)HYLAFAX_NSF, nsf, false);
 	stopTimeout("sending NSF frame");
     } else {
-	startTimeout(3000);
+	startTimeout(7550);
 	framesSent = sendFrame(f4, id, false);
 	stopTimeout("sending CSI/CIG frame");
     }
     for (;;) {
 	if (framesSent) {
 	    if (f1) {
-		startTimeout(2550);
+		startTimeout(7550);
 		framesSent = sendFrame(f2, addr, false);
 		stopTimeout("sending SUB/SEP frame");
 	    }
 	    if (framesSent && f2) {
-		startTimeout(2550);
+		startTimeout(7550);
 		framesSent = sendFrame(f3, (const u_char*)HYLAFAX_NSF, nsf, false);
 		stopTimeout("sending NSF frame");
 	    }
 	    if (framesSent && f3) {
-		startTimeout(2550);
+		startTimeout(7550);
 		framesSent = sendFrame(f4, id, false);
 		stopTimeout("sending CSI/CIG frame");
 	    }
 	    if (framesSent) {
-		startTimeout(2550);
+		startTimeout(7550);
 		framesSent = sendFrame(f5, dics, xinfo);
 		stopTimeout("sending DIS/DCS frame");
 	    }
@@ -444,7 +444,7 @@
 	 * The carrier is already raised.  Thus we
 	 * use sendFrame() instead of transmitFrame().
 	 */
-	startTimeout(2550);
+	startTimeout(7550);
 	(void) sendFrame((sendERR ? FCF_ERR : FCF_MCF)|FCF_RCVR);
 	stopTimeout("sending HDLC frame");
     }
diff -Nru hylafax-4.2.0.orig/faxd/Class1Send.c++ hylafax-4.2.0/faxd/Class1Send.c++
--- hylafax-4.2.0.orig/faxd/Class1Send.c++	Wed Aug 18 08:22:55 2004
+++ hylafax-4.2.0/faxd/Class1Send.c++	Wed Aug 18 10:47:12 2004
@@ -518,31 +519,37 @@
 bool
 Class1Modem::sendPrologue(u_int dcs, u_int dcs_xinfo, const fxStr& tsi)
 {
+    /*
+     * T.31 8.3.5 requires the DCE to respond CONNECT or result OK within
+     * five seconds or it must result ERROR.  T.30 requires the data of
+     * the HDLC frame to be tranmsitted in 3 s +/- 15%.  Thus, our
+     * timeouts here must be at least 7500 ms and no more than 8500 ms.
+     */
     bool frameSent;
     if (useV34) frameSent = true;
-    else frameSent = (atCmd(thCmd, AT_NOTHING) && atResponse(rbuf, 2550) == AT_CONNECT);
+    else frameSent = (atCmd(thCmd, AT_NOTHING) && atResponse(rbuf, 7550) == AT_CONNECT);
     if (!frameSent)
 	return (false);
     if (pwd != fxStr::null) {
-	startTimeout(2550);		// 3.0 - 15% = 2.55 secs
+	startTimeout(7550);
 	bool frameSent = sendFrame(FCF_PWD|FCF_SNDR, pwd, false);
 	stopTimeout("sending PWD frame");
 	if (!frameSent)
 	    return (false);
     }
     if (sub != fxStr::null) {
-	startTimeout(2550);		// 3.0 - 15% = 2.55 secs
+	startTimeout(7550);
 	bool frameSent = sendFrame(FCF_SUB|FCF_SNDR, sub, false);
 	stopTimeout("sending SUB frame");
 	if (!frameSent)
 	    return (false);
     }
-    startTimeout(2550);			// 3.0 - 15% = 2.55 secs
+    startTimeout(7550);
     frameSent = sendFrame(FCF_TSI|FCF_SNDR, tsi, false);
     stopTimeout("sending TSI frame");
     if (!frameSent)
 	return (false);
-    startTimeout(2550);			// 3.0 - 15% = 2.55 secs
+    startTimeout(7550);
     frameSent = sendFrame(FCF_DCS|FCF_SNDR, dcs, dcs_xinfo);
     stopTimeout("sending DCS frame");
     return (frameSent);



Project hosted by iFAX Solutions