]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
Adds some enhancements to SHIELDED_DTMF handling from Lee
authorAidan Van Dyk <aidan@ifax.com>
Mon, 5 Jun 2006 14:29:56 +0000 (14:29 +0000)
committerAidan Van Dyk <aidan@ifax.com>
Mon, 5 Jun 2006 14:29:56 +0000 (14:29 +0000)
CHANGES
faxd/ClassModem.c++
man/hylafax-config.4f

diff --git a/CHANGES b/CHANGES
index e51de64676951c0ede71278007a6b57b273b2fa8..2ccb61a6d48a48f9d3cd556703226c1bb1b94080 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,7 @@
 
 Changelog since HylaFAX 4.3.0
 
+* Enhance SHIELDED_DTMF (5 Jun 2006)
 * Add resubmit capability to faxalter (2 Jun 2006)
 * Use ] && [ instead of -a for shell portability (2 Jun 2006)
 * Add continuation support to FaxClient in libfaxutil (31 May 2006)
index 4350a85d4fb83a07f5c914d30cbc2104cd9b1e76..3a3f157042747b6b12fd1bf498a62a0b4df623f6 100644 (file)
@@ -1349,19 +1349,42 @@ ClassModem::waitForRings(u_short rings, CallType& type, CallID& callid)
                for (u_int j = 0 ; j < conf.idConfig.length(); j++) {
                    if (conf.idConfig[j].pattern == "SHIELDED_DTMF") {  // retrieve DID, e.g. via voice DTMF
                        ringstart = Sys::now();
+                       bool marked = false, gotdigit = false;
                        do {
-                           int c = server.getModemChar(5000);
-                           if (c == 0x10) c = server.getModemChar(5000);
+                           int c = server.getModemChar(10000);
+                           if (c == 0x10) c = server.getModemChar(10000);
                            if (c == 0x23 || c == 0x2A || (c >= 0x30 && c <= 0x39)) {
                                // a DTMF digit was received...
-                               protoTrace("MODEM HEARD DTMF: %c", c);
-                               callid[j].append(fxStr::format("%c", c));
+                               if (!marked || (marked && !gotdigit)) {
+                                   protoTrace("MODEM HEARD DTMF: %c", c);
+                                   callid[j].append(fxStr::format("%c", c));
+                                   gotdigit = true;
+                               }
+                           } else if (c == 0x2F) {
+                               // got IS-101 DTMF lead marker
+                               marked = true;
+                               gotdigit = false;
+                           } else if (c == 0x7E) {
+                               // got IS-101 DTMF end marker
+                               marked = false;
+                               gotdigit = false;
+                           } else if (c == 0x73) {
+                               // got silence, keep waiting
+                               protoTrace("MODEM HEARD SILENCE");
+                           } else if (c == 0x62) {
+                               // got busy tone, fail
+                               protoTrace("MODEM HEARD BUSY");
+                               return (false);
+                           } else if (c == 0x63) {
+                               // got CNG tone, we're not going to get more DTMF, trigger answering
+                               protoTrace("MODEM HEARD CNG");
+                               break;
                            }
                        } while (callid.length(j) < conf.idConfig[j].answerlength && (Sys::now()-ringstart < 10));
-                       u_char buf[2];
-                       buf[0] = DLE; buf[1] = ETX;
-                       if (!putModem(buf, 2, 3000))
-                           return (false);
+                       /*
+                        * If the sender doesn't send enough DTMF then we want to answer anyway.
+                        */
+                       while (callid.length(j) < conf.idConfig[j].answerlength) callid[j].append(" ");
                    }
                }
            }
index 972614b1ac5700415992f24b72ac8fc44cfe5044..604885b001912627c933200ec53a39aad6b59483 100644 (file)
@@ -551,6 +551,10 @@ until
 is reached.  Note that if the modem is in voice mode to hear these
 DTMF digits, then it must be returned to fax mode in the
 .B ModemAnswerCmd.
+In order to prevent this feature from losing incoming fax calls, if
+fax sender CNG is detected while waiting for DTMF or if ten seconds
+elapse without sufficient DTMF then the remaining expected digits
+will be populated by whitespace, triggering fax answering.
 
 For example, the following settings will cause HylaFAX to enter
 voice mode and go off-hook when a RING is detected.  It will then