File hylafax-6.0.4-isdn.patch of Package hylafax
Index: README.I4L
================================================================================
--- README.I4L
+++ 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.
--- config/Makefile.in
+++ config/Makefile.in
@@ -70,6 +70,7 @@
iaxmodem \
intel-400e \
ip568x \
+ linux-isdn-1 \
linux-isdn-2 \
lucent \
lucent-isa \
--- config/linux-isdn-1
+++ 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
--- config/topic
+++ 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
--- etc/Makefile.in
+++ etc/Makefile.in
@@ -88,6 +88,7 @@
${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; \
--- etc/users
+++ 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
--- faxd/ClassModem.c++
+++ faxd/ClassModem.c++
@@ -888,6 +888,9 @@
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 'V':
if (streq(buf, "VCON"))
@@ -1432,6 +1435,12 @@
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)
@@ -1460,6 +1469,12 @@
* 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);
}
if (r == AT_OK) cmddone = true;
else if (r == AT_VCON) cmddone = true; // VCON for modems that require ATA
--- faxd/FaxServer.c++
+++ faxd/FaxServer.c++
@@ -250,6 +250,10 @@
FaxServer::readConfig(const fxStr& filename)
{
ModemServer::readConfig(filename);
+ if ((FAXNumber == "") && (phoneNumber != ""))
+ FAXNumber = "+" | getcountryCode() |
+ "." | getareaCode() |
+ "." | phoneNumber;
if (localIdentifier == "")
setLocalIdentifier(canonicalizePhoneNumber(FAXNumber));
}
--- faxd/ServerConfig.c++
+++ faxd/ServerConfig.c++
@@ -85,6 +85,7 @@
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 },
--- faxd/ServerConfig.h
+++ faxd/ServerConfig.h
@@ -124,6 +124,7 @@
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
@@ -133,6 +134,8 @@
fxStr canonicalizePhoneNumber(const fxStr& ds);
fxStr prepareDialString(const fxStr& ds);
+ const fxStr& getareaCode() const;
+ const fxStr& getcountryCode() const;
UUCPLock* getUUCPLock(const fxStr& deviceName);
@@ -145,4 +148,8 @@
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_ */
--- faxsend
+++ 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
--- util/FaxDispatch.sh
+++ 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
--- util/Makefile.in
+++ util/Makefile.in
@@ -150,6 +150,7 @@
${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
--- util/faxrcvd.sh.in
+++ util/faxrcvd.sh.in
@@ -139,8 +139,8 @@
# 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
#