]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
[Bug 318] sendfax can't send SUB or PWD specification
authorDarren Nickerson <darren.nickerson@ifax.com>
Sat, 8 Feb 2003 22:58:09 +0000 (22:58 +0000)
committerDarren Nickerson <darren.nickerson@ifax.com>
Sat, 8 Feb 2003 22:58:09 +0000 (22:58 +0000)
adds subaddressing capability for faxes queued with sendfax
Excellent teamwork from Lee and Patrice. Thanks guyz. -d

etc/dialrules
etc/dialrules.europe
etc/dialrules.sf-ba
faxd/Class1.c++
faxd/Class1Send.c++
man/dialrules.4f
man/faxrcvd.1m
man/sendfax.1
sendfax/sendfax.c++
util/faxrcvd.sh.in

index 685b99a8a177f150fb6387e6bbf1f370a59991e0..5a565ce620103ff7e24ff9381bd6b465e1f2f13a 100644 (file)
@@ -32,7 +32,7 @@ WS="  "                       ! our notion of white space
 ! long distance and/or international dialing.
 !
 CanonicalNumber := [
-#.*                    =                       ! strip calling card stuff
+%.*                    =                       ! strip calling card stuff
 [abcABC]               = 2                     ! these convert alpha to numbers
 [defDEF]               = 3
 [ghiGHI]               = 4
index 3aa2504e98c21b402151dafe405c8d02074e5037..5bf7f1269a53473a9c2b092255cb2b8ae7221d0b 100644 (file)
@@ -31,7 +31,7 @@ WS="  "                       ! our notion of white space
 ! long distance and/or international dialing.
 !
 CanonicalNumber := [
-#.*                     =                       ! strip calling card stuff
+%.*                     =                       ! strip calling card stuff
 [abcABC]               = 2                     ! these convert alpha to numbers
 [defDEF]               = 3
 [ghiGHI]               = 4
index d042f2e1116036bc08b59e54445f8a01388c1d95..e6b05c3d859b3e115b0f89c447eea90ee8730e04 100644 (file)
@@ -29,7 +29,7 @@ WS="  "                       ! our notion of white space
 ! long distance and/or international dialing.
 !
 CanonicalNumber := [
-#.*                    =                       ! strip calling card stuff
+%.*                    =                       ! strip calling card stuff
 [abcABC]               = 2                     ! these convert alpha to numbers
 [defDEF]               = 3
 [ghiGHI]               = 4
index 1e78fccd2d879f83337c06641446ee39a17c3f2a..3cbce24335bd8beecd766f23dc9f4e2d30519bcb 100644 (file)
@@ -326,10 +326,7 @@ Class1Modem::decodeTSI(fxStr& ascii, const HDLCFrame& binary)
 void
 Class1Modem::encodePWD(fxStr& binary, const fxStr& ascii)
 {
-    u_int n = fxmin(ascii.length(), (u_int) 20);
-    binary.resize(n);
-    for (u_int i = 0, j = n-1; i < n; i++, j--)
-       binary[j] = frameRev[ascii[i]];
+    encodeTSI(binary, ascii);
 }
 
 /*
@@ -339,15 +336,7 @@ Class1Modem::encodePWD(fxStr& binary, const fxStr& ascii)
 const fxStr&
 Class1Modem::decodePWD(fxStr& ascii, const HDLCFrame& binary)
 {
-    u_int n = fxmin(binary.getFrameDataLength(), (u_int) 20);
-    ascii.resize(n);
-    u_int d = 0;
-    for (const u_char* cp = binary.getFrameData() + n-1; n > 0; cp--, n--) {
-       u_char c = frameRev[*cp];
-       if (isprint(c) || c == ' ')     // XXX accept only printable ascii
-           ascii[d++] = c;
-    }
-    return ascii;
+    return decodeTSI(ascii, binary);
 }
 
 /*
index 1ada087123f3f8601bac458f9abc93f75e1a76e0..ed86ddb9b7bcf87b47de209ef643af5a1985f0fe 100644 (file)
@@ -176,11 +176,11 @@ Class1Modem::getPrologue(Class2Params& params, bool& hasDoc, fxStr& emsg)
 void
 Class1Modem::sendSetupPhaseB(const fxStr& p, const fxStr& s)
 {
-    if (xinfo&DIS_PWD)
+    if (p != fxStr::null && xinfo&DIS_PWD)
        encodePWD(pwd, p);
     else
        pwd = fxStr::null;
-    if (xinfo&DIS_SUB)
+    if (p != fxStr::null && xinfo&DIS_SUB)
        encodePWD(sub, s);
     else
        sub = fxStr::null;
index 2f959722be4c5500772daf14e188a5863e5cf10b..c75b8c7f29a2ecd735ce0c307c7fa8c079aa5ee5 100644 (file)
@@ -195,7 +195,7 @@ LDPrefix=${LongDistancePrefix}      ! prefix for placing a long distance call
 !
 CanonicalNumber := [
 .ta \w'^${LDPrefix}      'u +\w'= 'u +\w'+${Country}${Area}&      'u
-#.*    =               ! strip calling card stuff
+%.*    =               ! strip calling card stuff
 [abcABC]       = 2     ! these convert alpha to numbers
 [defDEF]       = 3
 [ghiGHI]       = 4
@@ -212,7 +212,7 @@ CanonicalNumber := [
 .RE
 .fi
 .sp .5
-The first rule simply strips anything following a ``#''; this
+The first rule simply strips anything following a ``%''; this
 will remove any calling card-related information.
 The next eight rules convert upper and lower case alphabetics to the
 equivalent key numbers (this is convenient for users that use
@@ -237,12 +237,12 @@ LongDistancePrefix=1
 .fi
 .sp .5
 then if the above set of rules is applied
-to ``01123965-Tube#2345'', the transformations would be:
+to ``01123965-Tube%2345'', the transformations would be:
 .sp .5
 .nf
 .ta \w'01123965-Tube#2345    'u +\w'01123965-7824    'u
 .RS
-01123965-Tube#2345     01123965-Tube   ! strip calling card stuff
+01123965-Tube%2345     01123965-Tube   ! strip calling card stuff
 01123965-Tube  01123965-8823   ! convert alphabetics
 01123965-8823  011239658823            ! strip white space etc.
 011239658823   +239658823      ! replace int. dialing code
index 5c3e451fa300dd8828f992ab5fa44980b765599d..c517623f327c83f8d3f39776c32660c9dde0d228 100644 (file)
@@ -97,6 +97,10 @@ case "$CIDNUMBER" in
 435*)        SENDTO=lee; FILETYPE=pdf;; # all faxes from area code 435
 5059627777)  SENDTO=amy; FILETYPE=tif;; # Amy wants faxes in TIFF
 esac\s+1
+case "$SUBADDR" in
+53)          SENDTO=FaxMaster;;         # without double-notification
+roger)       SENDTO=roger;;             # possible text subaddressing
+esac\s+1
 .ft R
 .fi
 .sp
@@ -135,6 +139,10 @@ is the received TSI of the fax sender.
 controls the recipient of the received fax notification.  It is
 given as an e-mail address.
 .TP
+.I SUBADDR
+the received subaddress value, communicated by the sender for 
+post-reception routing purposes
+.TP
 Other shell variables are available.  Consult the faxrcvd script directly.
 .SH FILES
 .nf
index 35ee9f2bc42d434042e58dfdc693e3a7621c3890..5c7525f855963c80cfca65d07625aa0b8a2db131 100644 (file)
@@ -132,8 +132,9 @@ option.
 A destination is the dialing string to use to contact
 the remote fax machine.
 Phone numbers may include non-alphanumeric characters for
-readability\(emonly alphanumerics and ``+'' (for denoting a
-country code) are significant in placing a call.
+readability\(emonly alphanumerics, ``+'' (for denoting a
+country code), and ``#'' (for denoting a subaddress)
+are significant in placing a call.
 Alphabetic characters are automatically mapped to their numeric
 key equivalents: ``abcABC'' to ``2'', ``defDEF'' to ``3'', etc.
 Dialing prefixes, such as ``1'' and ``011''
@@ -298,8 +299,10 @@ a facsimile machine at the indicated
 .IR destination .
 If the
 .I destination
-is of the form ``\fIuser\fP@\fIphone-number\fP'' then any
-cover page will show \fIuser\fP as the intended receipient.
+is of the form ``\fIuser\fP@\fIphone-number\fP#\fIsubaddress\fP'' then any
+cover page will show \fIuser\fP as the intended receipient, and the 
+remote system will be supplied the subaddress value (i.e. for routing) 
+provided that the sending modem and the receiving system support it.
 .TP 12
 .B \-E
 Disable use of the Error Correction Mode (\s-1ECM\s+1)
index dd0b346896232190884bd483b26784caf3ab2526..08e8c672ab598b75fb021ecf24fa6d88dd00f1f9 100644 (file)
@@ -267,11 +267,22 @@ sendFaxApp::usage()
 }
 
 /*
- * Add a destination; parse ``person@number'' syntax.
+ * Add a destination; parse ``person@number#subaddress'' syntax.
+ * T.33 Appendix I suggests that ``#'' be used to tag a subaddress.
  */
 void
 sendFaxApp::addDestination(const char* cp)
 {
+    fxStr subaddress;
+    size_t sublen = 0;
+    const char* ap = strchr(cp, '#');
+    if (ap) {
+       ap = ap+1;
+       subaddress = fxStr(ap);
+       sublen = strlen(subaddress) + 1;
+    } else {
+       subaddress = "";
+    }
     fxStr recipient;
     const char* tp = strchr(cp, '@');
     if (tp) {
@@ -280,7 +291,7 @@ sendFaxApp::addDestination(const char* cp)
     } else {
         recipient = "";
     }
-    fxStr dest(cp);
+    fxStr dest(cp, strlen(cp) - sublen);
     if (db && dest.length() > 0) {
         fxStr name;
         FaxDBRecord* r = db->find(dest, &name);
@@ -296,6 +307,7 @@ sendFaxApp::addDestination(const char* cp)
     SendFaxJob& job = addJob();
     job.setDialString(dest);
     job.setCoverName(recipient);
+    job.setSubAddress(subaddress);
     if(job.getDesiredSpeed() > BR_14400 && job.getDesiredEC() == false) {
         printWarning("ECM disabled, limiting job to 14400 bps.");
         job.setDesiredSpeed(BR_14400);
index 0977c90964b4d15c7c164fa4f101f2c920fda79a..8444621019d33992001ec7dccdda0ee5fa44cac4 100644 (file)
@@ -90,6 +90,7 @@ if [ -f $FILE ]; then
     # Check the sender's TSI and setup to dispatch
     # facsimile received from well-known senders.
     #
+    SUBADDR="`$INFO $FILE | $AWK -F: '/SubAddr/ { print $2 }' 2>/dev/null`"
     SENDER="`$INFO $FILE | $AWK -F: '/Sender/ { print $2 }' 2>/dev/null`"
     SENDTO=
     if [ -f etc/FaxDispatch ]; then