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] MT1932ZBA with DTMF DID



Mat Allgood wrote:

The problem is when I try
to do DID. I was having problems with hylafax sending the command then
then erroring out after the modem responds back with "OK".


Hrmm....


I have
read through the Bug list for DID and it seems there was a patch a
while back to allow DID (with AT>DT1 on the Modem). I also noticed
that there was an update to that same piece of code at a later date
that changed the
"atCmd(conf.ringResponse);" line to "atCmd(conf.ringResponse, AT_NOTHING);".



The difference here being that the former waits for "OK" and the latter does not.


It's a bit of a dilemma because some modems do this (like those that accept AT+VRID=1):

 <-- AT command
 --> CallID data (DID or Caller*ID)
 --> OK

and some modems do this (like yours):

 <-- AT command
 --> OK
 --> CallID data (DID or Caller*ID)

The former requires that we watch for OK to terminate the CallID data, and the latter requires that we don't - relying completely on the answer length to terminate the CallID data. I think, though, that something can be done.

Please try the attached patch (against current CVS, but 4.2.1 release should be fine, too). Let me know how it goes.

Lee.
--- hylafax-4.2.1.orig/faxd/ClassModem.c++	Mon Mar 21 08:20:26 2005
+++ hylafax-4.2.1/faxd/ClassModem.c++	Mon Mar 21 17:52:36 2005
@@ -1340,12 +1340,13 @@
 		atCmd(conf.ringResponse, AT_NOTHING);
 		ATResponse r;
 		time_t ringstart = Sys::now();
-		bool callidwasempty = true;
+		bool callidwasempty = true, gotok = false, answertrigger = false;
 		for (int i = 0; callidwasempty && i < callid.size(); i++)
 		    if (callid.length(i) )
 			callidwasempty = false;
 		do {
 		    r = atResponse(rbuf, 3000);
+		    if (r == AT_OK) gotok = true;
 		    if (r == AT_OTHER && callidwasempty) {
 			/*
 			 * Perhaps a modem will repeat CID/DID info for us
@@ -1353,7 +1354,11 @@
 			 */
 			conf.parseCallID(rbuf, callid);
 		    }
-		} while (r != AT_OK && (Sys::now()-ringstart < 3));
+		    for (int i = 0; i < conf.idConfig.length(); i++) {
+			if (conf.idConfig[i].answerlength && callid.length(i) >= conf.idConfig[i].answerlength && gotok)
+			answertrigger = true;
+		    }
+		} while (!answertrigger && (Sys::now()-ringstart < 3));
 		for (int i = 0 ; i < conf.idConfig.length(); i++) {
 		    if (conf.idConfig[i].pattern == "SHIELDED_DTMF") {	// retrieve DID, e.g. via voice DTMF
 			ringstart = Sys::now();



Project hosted by iFAX Solutions