Index: hylafax-6.0.2/README.I4L
===================================================================
--- /dev/null
+++ hylafax-6.0.2/README.I4L
@@ -0,0 +1,10 @@
+
+This version contains sample config files for I4L Class1 and Class2
+modems.
+Note: You have to change ModemResetCmd to reflect your local setup.
+
+It also contains some extentions to dispatch faxes depending on the MSN
+or on the extention of local exchanges via email.
+To use this feature  you simply add "<email> <number>" pairs to etc/users
+and use the "ATS23=3&L<numberlist>" I4L command in ModemResetCmd to listen
+on these numbes an transmit the number.
Index: hylafax-6.0.2/config/Makefile.in
===================================================================
--- hylafax-6.0.2.orig/config/Makefile.in
+++ hylafax-6.0.2/config/Makefile.in
@@ -72,6 +72,7 @@ CONFIGFILES=class1 \
 	iaxmodem \
 	intel-400e \
 	ip568x \
+	linux-isdn-1 \
 	linux-isdn-2 \
 	lucent \
 	lucent-isa \
Index: hylafax-6.0.2/config/topic
===================================================================
--- hylafax-6.0.2.orig/config/topic
+++ hylafax-6.0.2/config/topic
@@ -5,7 +5,6 @@
 
 # CONFIG:CLASS1:TP560.*:.*:.*: Manufacturer=Topic Model=TP560
 # CONFIG:CLASS1:Hamlet H56XCT.*:.*:.*: Manufacturer=Hamlet Model=H56XCT
-# CONFIG:CLASS1:Linux ISDN.*:.*:.*: Manufacturer=Sedlbauer Model=Speedfax
 #
 # BEGIN-SERVER
 # END-SERVER
Index: hylafax-6.0.2/etc/Makefile.in
===================================================================
--- hylafax-6.0.2.orig/etc/Makefile.in
+++ hylafax-6.0.2/etc/Makefile.in
@@ -90,6 +90,7 @@ install: default
 	${PUTSERVER} -F ${SBIN} -m 755 -src probemodem.sh -O probemodem
 	${PUTSAMPLE} -F ${SPOOL}/etc -m 644 -o xferfaxlog
 	${PUTSAMPLE} -F ${SPOOL}/etc -m 600 -o hosts.hfaxd
+	${PUTSAMPLE} -F ${SPOOL}/etc -m 644 -o users
 	for i in ${DIALRULES}; do \
 	    ${PUTSERVER} -F ${SPOOL}/etc -m 444 -src ${SRCDIR}/$$i \
 		-idb "config(update)" -O $$i; \
Index: hylafax-6.0.2/etc/users
===================================================================
--- /dev/null
+++ hylafax-6.0.2/etc/users
@@ -0,0 +1,6 @@
+#
+# Sample users file for FaxDispatch on ISDN lines
+# format: <email>  <MSN or extention>
+#
+user1@example.com  123
+user2@example.com  124
Index: hylafax-6.0.2/faxd/ClassModem.c++
===================================================================
--- hylafax-6.0.2.orig/faxd/ClassModem.c++
+++ hylafax-6.0.2/faxd/ClassModem.c++
@@ -839,6 +839,9 @@ ClassModem::atResponse(char* buf, long m
 	case 'R':
 	    if (streq(buf, "RING"))		// NB: avoid match of RINGING
 		lastResponse = AT_RING;
+	    else if (strneq(buf, "RING/", 5)) {	// Match RING/CALLEDPARTYNUMBER
+		lastResponse = AT_RING;
+	    }
 	    break;
 	case '\020':
 	    if (streq(buf, "\020\003"))		// DLE/ETX
@@ -1372,6 +1375,12 @@ ClassModem::waitForRings(u_short rings, 
 		if (conf.ringExtended.length() && strneq(rbuf, conf.ringExtended, conf.ringExtended.length()))	// extended RING
 		    gotring = true;
 		conf.parseCallID(rbuf, callid);
+		fxStr callid_formatted;
+		for (u_int i = 0; i < callid.size(); i++) {
+			callid_formatted.append(callid.id(i));
+			callid_formatted.append(",");
+		}
+		modemTrace("MODEM CID %s", (const char *)callid_formatted);
 		/* DID modems may send DID data in lieu of RING */
 		for (u_int i = 0; i < conf.idConfig.length(); i++) {
 		    if (conf.idConfig[i].answerlength && callid.length(i) >= conf.idConfig[i].answerlength)
@@ -1400,6 +1409,12 @@ ClassModem::waitForRings(u_short rings, 
 			 * with AT+VRID if we missed it before.
 			 */
 			conf.parseCallID(rbuf, callid);
+			fxStr callid_formatted;
+			for (u_int i = 0; i < callid.size(); i++) {
+				callid_formatted.append(callid.id(i));
+				callid_formatted.append(",");
+			}
+			modemTrace("MODEM CID %s", (const char *)callid_formatted);
 		    }
 		} while (r != AT_OK && (Sys::now()-ringstart < 3));
 		for (u_int j = 0 ; j < conf.idConfig.length(); j++) {
Index: hylafax-6.0.2/faxd/FaxServer.c++
===================================================================
--- hylafax-6.0.2.orig/faxd/FaxServer.c++
+++ hylafax-6.0.2/faxd/FaxServer.c++
@@ -250,6 +250,10 @@ void
 FaxServer::readConfig(const fxStr& filename)
 {
     ModemServer::readConfig(filename);
+    if ((FAXNumber == "") && (phoneNumber != ""))
+    	FAXNumber = "+" | getcountryCode() |
+    		    "." | getareaCode() |
+    		    "." | phoneNumber;
     if (localIdentifier == "")
 	setLocalIdentifier(canonicalizePhoneNumber(FAXNumber));
 }
Index: hylafax-6.0.2/faxd/ServerConfig.c++
===================================================================
--- hylafax-6.0.2.orig/faxd/ServerConfig.c++
+++ hylafax-6.0.2/faxd/ServerConfig.c++
@@ -84,6 +84,7 @@ ServerConfig::S_booltag ServerConfig::bo
 ServerConfig::S_stringtag ServerConfig::strings[] = {
 { "logfacility",	&ServerConfig::logFacility,	LOG_FAX },
 { "faxnumber",		&ServerConfig::FAXNumber },
+{ "phonenumber",	&ServerConfig::phoneNumber },
 { "areacode",		&ServerConfig::areaCode	},
 { "countrycode",	&ServerConfig::countryCode },
 { "longdistanceprefix",	&ServerConfig::longDistancePrefix },
Index: hylafax-6.0.2/faxd/ServerConfig.h
===================================================================
--- hylafax-6.0.2.orig/faxd/ServerConfig.h
+++ hylafax-6.0.2/faxd/ServerConfig.h
@@ -123,6 +123,7 @@ public:
     u_int	maxConsecutiveBadCalls;	// max consecutive bad phone calls
     fxStr	localIdentifier;	// to use in place of FAXNumber
     fxStr	FAXNumber;		// phone number
+    fxStr	phoneNumber;		// the local number without area code
     u_int	maxSetupAttempts;	// # times to try initializing modem
     bool	batchLogs;		// Batch session logs togther or not
 
@@ -132,6 +133,8 @@ public:
 
     fxStr	canonicalizePhoneNumber(const fxStr& ds);
     fxStr	prepareDialString(const fxStr& ds);
+    const fxStr&	getareaCode() const;
+    const fxStr&	getcountryCode() const;
 
     UUCPLock*	getUUCPLock(const fxStr& deviceName);
 
@@ -144,4 +147,8 @@ public:
     void configError(const char* fmt, ...);
     void configTrace(const char* fmt, ...);
 };
+
+inline const fxStr& ServerConfig::getareaCode() const { return areaCode; }
+inline const fxStr& ServerConfig::getcountryCode() const { return countryCode; }
+
 #endif /* _ServerConfig_ */
Index: hylafax-6.0.2/faxsend
===================================================================
--- /dev/null
+++ hylafax-6.0.2/faxsend
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# This script is a wrapper to call the correct faxsend
+# program, depending of the modem type
+#
+PARA=$*
+SENDFAX=/usr/lib/fax/faxsend
+
+m_found="no"
+while [ $# -gt 0 ]; do
+    case $1 in
+	"-m")
+	    m_found="yes"
+	    ;;
+	faxCAPI*)
+	    if [ "$m_found" = "yes" ]; then
+		SENDFAX=/usr/bin/c2faxsend
+	    fi
+	    m_found="no"
+	    ;;
+	*)
+	    m_found="no"
+	    ;;
+    esac
+    shift
+done
+
+$SENDFAX $PARA
Index: hylafax-6.0.2/util/FaxDispatch.sh
===================================================================
--- /dev/null
+++ hylafax-6.0.2/util/FaxDispatch.sh
@@ -0,0 +1,12 @@
+#
+# Dispatch fax to email depending on own MSN or extention (ISDN lines)
+# sourced from faxrcvd
+#
+if [ "$7" != "" ]; then
+    PHONEMATCH=$7\$
+    USERENTRY=`grep -v "^#" etc/users | grep "$PHONEMATCH"`
+    if [ "$USERENTRY" != "" ]; then
+	USERNAME=`echo $USERENTRY | awk '{print $1}'`
+	SENDTO="$USERNAME"
+    fi
+fi
Index: hylafax-6.0.2/util/Makefile.in
===================================================================
--- hylafax-6.0.2.orig/util/Makefile.in
+++ hylafax-6.0.2/util/Makefile.in
@@ -194,6 +194,7 @@ install: installClient
 	${PUTSUPD} -m 755 -src common-functions.sh -O common-functions
 	${PUTSUPD} -m 755 -src dictionary.sh -O dictionary
 	${PUTSUPD} -m 755 -src faxrcvd.sh -O faxrcvd
+	${PUTSUPD} -m 755 -src ${SRCDIR}/FaxDispatch.sh -O FaxDispatch
 	${PUTSUPD} -m 755 -src pollrcvd.sh -O pollrcvd
 	${PUTSUPD} -m 755 -src mkcover.sh -O mkcover
 	${PUTSUPD} -m 755 -src wedged.sh -O wedged
Index: hylafax-6.0.2/util/faxrcvd.sh.in
===================================================================
--- hylafax-6.0.2.orig/util/faxrcvd.sh.in
+++ hylafax-6.0.2/util/faxrcvd.sh.in
@@ -138,8 +138,8 @@ export TOADDR
 # Apply customizations.  All customizable variables should
 # be set to their non-customized defaults prior to this.
 #
-if [ -f etc/FaxDispatch ]; then
-    . etc/FaxDispatch		# NB: FaxDispatch sets SENDTO
+if [ -f bin/FaxDispatch ]; then
+    . bin/FaxDispatch		# NB: FaxDispatch sets SENDTO
 fi
 
 if [ -f etc/templates/$TEMPLATE/hook.sh ]
Index: hylafax-6.0.2/config/linux-isdn-1
===================================================================
--- /dev/null
+++ hylafax-6.0.2/config/linux-isdn-1
@@ -0,0 +1,38 @@
+#
+# prototype config file for Linux ISDN (/dev/ttyIX) Class1 modems
+# Siemens ISURF or
+# Sedlbauer speedfax+ ISDN cards
+#
+#
+# CONFIG:CLASS1:"isdn4linux"-*-*
+#
+#
+# BEGIN-SERVER
+# END-SERVER
+#
+# Modem-related stuff: should reflect modem command interface
+# and hardware connection/cabling (e.g. flow control).
+#
+ModemType:		Class1		# use this to supply a hint
+ModemNoFlowCmd:		AT&K0
+ModemSoftFlowCmd:	AT&K4
+ModemHardFlowCmd:	AT&K3
+#
+# Put your MSN number in here...
+# &E outgoing MSN
+# &L incomming (listen) MSN, may be a list or wildcards
+#
+ModemResetCmds:		AT&E99&L99	# stuff to do when modem is reset
+
+#
+Class1Cmd:		AT+FCLASS=1	# command to enter class 1
+Class1PPMWaitCmd:	AT+FTS=7	# command to stop and wait before PPM
+Class1TCFWaitCmd:	AT+FTS=7	# command to stop and wait before TCF
+Class1EOPWaitCmd:	AT+FTS=9	# command to stop and wait before EOP
+Class1SwitchingCmd:	<delay:9>	# silence between HDLC recv and trans
+Class1TrainingRecovery:	1500		# 1.5sec delay after training failure
+Class1RecvAbortOK:	200		# wait 200ms for abort response
+Class1FrameOverhead:	4		# 4 byte overhead in recvd HDLC frames
+Class1RecvIdentTimer:	40000		# 35+5secs waiting for ident frames
+Class1TCFMaxNonZero:	10		# max 10% of data may be non-zero
+Class1TCFMinRun:	1000		# min run is 2/3rds of TCF duration
