Sun Java System Messaging Server 6.3 Administration Guide

C.2.5 Site-defined Text Conversions

Sites may customize Steps 1 - 6 described in C.2.2 The Email to SMS Conversion Process a mapping table in the MTA’s mapping file.

The name of the mapping table should be SMS_Channel_TEXT where SMS_Channel is the name of the SMS channel; for example, SMS_TEXT if the channel is named sms or SMS_MWAY_TEXT if the channel is named sms_mway.

Two types of entries may be made in this mapping table. However, before explaining the format of those entries, let it be made clear that an understanding of how to use the mapping file is essential in order to understand how to construct and use these entries. An example mapping table is given after the description of these two types of entries.

Now, the two types of entries are:

C.2.5.1 Message Header Entries

These entries specify which message header lines should be included in an SMS message and how they should be abbreviated or otherwise converted. Only if a header line is successfully mapped to a string of non-zero length by one of these entries will it be included in the SMS message being generated. Each entry has the format

H|pattern replacement-text

If a message header line matches the pattern then it will be replaced with the replacement text replacement-text using the mapping file’s pattern matching and string substitution facilities. The final result of mapping the header line will then be included in the SMS message provided that the metacharacter $Y was specified in the replacement text. If a header line does not match any pattern string, if it maps to a string of length zero, or if the $Y metacharacter is not specified in the replacement text, then the header line will be omitted from the SMS message. The two entries


H|From:* F:$0$Y 
H|Subject:* S:$0$Y

cause the From: and Subject: header lines to be included in SMS messages with From: and Subject: abbreviated as F: and S:. The entries:


H|Date:* H|D:$0$R$Y 
H|D:*,*%19%%*:*:* H|D:$0$ $5:$6$R$Y

cause the Date: header line to be accepted and mapped such that, for instance, the header line

Date: Wed, 16 Dec 1992 16:13:27 -0700 (PDT)

will be converted to

D: Wed 16:13

Very complicated, iterative mappings may be built. Sites wishing to set up custom filters will first need to understand how the mapping file works. The H| in the right-hand-side of the entry may be omitted, if desired. The H| is allowed in that side so as to cut down on the number of table entries required by sets of iterative mappings.

C.2.5.2 Message Body Entries

Body mappings are not supported.

C.2.5.3 Example SMS Mapping Table

An example SMS_TEXT mapping table is shown in Example C–1. The numbers inside parentheses at the end of each line correspond to the item numbers in the section titled Explanatory Text that follows this table.


Example C–1 Example SMS_TEXT Mapping Table.


SMS_TEXT

   H|From:*        H|F:$0$R$Y       (1)
   H|Subject:*     H|S:$0$R$Y       (1)
   H|F:*<*>*       H|F:$1$R$Y       ()
   H|F:*(*)*       H|F:$0$2$R$Y     (2)
   H|F:*"*"*       H|F:$0$2$R$Y     (3)
   H|F:*@*         H|F:$0$R$Y       (4)
   H|%:$ *         H|$0:$1$R$Y      (5)
   H|%:*$          H|$0:$1$R$Y      (5)
   H|%:*$ $ *      H|$0:$1$ $2$R$Y  (6)
   B|*--*          B|$0-$1$R        (7)
   B|*..*          B|$0.$1$R        (7)
   B|*!!*          B|$0!$1$R        (7)
   B|*??*          B|$0?$1$R        (7)
   B|*$ $ *        B|$0$ $1$R       (6)
   B|$ *           B|$0$R           (5)
   B|*$            B|$0$R           (5)

               

Explanatory Text

The entries in the example SMS_TEXT mapping table above are explained below:

In the example above, the metacharacter $R is used to implement and control iterative application of the mappings. By iterating on these mappings, powerful filtering is achieved. For instance, the simple mappings to remove a single leading or trailing space (6) or reduce two spaces to a single space (7) become, when taken as a whole, a filter which strips all leading and trailing spaces and reduces all consecutive multiple spaces to a single space. Such filtering helps reduce the size of each SMS message.

  1. These two entries cause From: and Subject: header lines to be included in an SMS message. From: and Subject: are abbreviated as, respectively, F: and S:. Some of the other entries may have further effects on From: and Subject: header lines.

    This entry will reduce a From: header line containing a <...> pattern to only the text within the angle brackets. For example:

    F: "John C. Doe" <jdoe@siroe.com> (Hello)

    will be replaced with:

    F: jdoe@siroe.com

  2. This entry will remove, inclusively, everything inside of a (...) pattern in a From: header line. For example:

    F: "John C. Doe" <jdoe@siroe.com> (Hello)

    will be replaced with:

    F: "John C. Doe" <jdoe@siroe.com>

  3. This entry will remove, inclusively, everything inside of a “...” pattern in a From: header line. For example:

    F: "John C. Doe" <jdoe@siroe.com> (Hello)

    will be replaced with:

    F: <jdoe@siroe.com> (Hello)

  4. This entry will remove, inclusively, everything to the right of an at-sign, @, in a From: header line. For example:

    F: "John C. Doe" <jdoe@siroe.com> (Hello)

    will be replaced with:

    F: "John C. Doe" <jdoe@

  5. These four entries remove leading and trailing spaces from lines in the message header and body.

  6. These two entries reduce two spaces to a single space in lines of the message header and body.

  7. These four entries reduce double dashes, periods, exclamation and question marks to single occurrences of the matching character. Again, this helps save bytes in an SMS message.

The order of the entries is very important. For instance, with the given ordering, the body of the message From: header line:

From: "John C. Doe" (Hello)

will be reduced to:

jdoe

The steps taken to arrive at this are as follows:

  1. We begin with the From: header line:

    From: "John C. Doe" (Hello)

    The pattern in the first mapping entry matches this and produces the result:

    F: "John C. Doe" (Hello)

    The $R metacharacter in the result string causes the result string to be remapped.

  2. The mapping is applied to the result string of the last step. This produces:

    F: jdoe@siroe.com

    The $R in the mapping causes the entire set of mappings to be re-applied to the result of this step.

  3. Next, the mapping is applied producing:

    F: jdoe

    The $R in the mapping causes the entire set of mappings to be re-applied to the result of this step.

  4. Next, the mapping is applied producing:

    F:jdoe

    The $R in the mapping causes the entire set of mappings to be re-applied to the result of this step.

  5. Since no other entries match, the final result string:

    F:jdoe

    is incorporated into the SMS message.


    Note –

    The imsimta test-mapping utility may be used to test a mapping table. For instance,


    # imsimta test -mapping -noimage_file -mapping_file=test.txt
    Enter table name: SMS_TEXT
    Input string: H|From: "John C. Doe"  (Hello)
    Output string: H|F:jdoe
    Output flags: [0,1,2,89]
    Input string: ^D
    #

    For further details on the imsimta test utility, see imsimta test in Sun Java System Messaging Server 6.3 Administration Reference.