$Revision: 23$ $Date: 29.09.2009 17:33:31$ $Author: Esther Bergter$


Usually, there will be one gateway per site. If you need additional gateway
instances, look at section Parallel Gateway Configuration below.

Single Gateway Configuration:
First you have to create the gateway user in Papageno. We suggest 'smtpgw'.

Most configuration data is stored in the user configuration of the gateway
user. However, the primary identity (gateway user + alphahost) is stored in
the omega.


Omega Configuration:

The omega config variable needed to start daemon or gateway is  SMTPnative,
it should be set using PAPAGENO Administrator or the command o_put_config

o_put_config SMTPnative <gateway user>@<alphahost>

The gateway user is usually called 'smtpgw', and alphahost stores the
configuration of the gateway user.

If SMTPnative does exist but is not of correct syntax, the gateway user and
alphahost default to environment values SG_USER and ALPHAHOST , next to  
'smptgw' and localhost.

Alpha Configuration:

Create a subset of the following variables using command a_put_usrconf for
user smtpgw ( not user comfax!!).

To start gateway or daemon, the lambda server needs

SG_GWH=hostname    ; name of the gateway host
SG_DMH=hostname    ; name of the daemon host

The Daemon process has the following options:

(Note: the values after the equal sign are the default values)

SG_DMNU=0          ; if set to 1, EVERYBODY can use the gateway
SG_NRSES=10        ; number of simultan smtp sessions the server accepts
SG_DMSPP=25        ; the SMTP port the daemon listens at. (see troubleshooting below)
SG_DMSPA=          ; the SMTP IP address the daemon listens at (e.g. for routers)
SG_DMP3P=110       ; the POP3 port the daemon listens at.
SG_DMP3A=	   ; the POP3 IP address the daemon listens at (e.g. for routers)
SG_DMMAXS=1024     ; the maximum size of a message in kilobytes
SG_PIPE=	   ; if set: a command which filters the outgoing mail

The Gateway process has the following options:

(Note: the values after the equal sign are the default values)

SG_DMH=hostname    ; name of the daemon host (default=hostname)
SG_GWPWD=******    ; password of the gateway user
SG_GWNRP=          ; the number prefix (e.g.547502); used with ldap only
SG_GWEXPF=0        ; 0=multi page tiff, 1=single page tiff, 2=single page gif
				   ; 3=multi page pdf
SG_GWSPP=25        ; The SMTP port the gateway uses
SG_MYDOM=hostname  ; the name Daemon+Gateway use in conversations
SG_MAHOST=         ; the name of the outbound SMTP mail server (required)
SG_MADEFU=         ; where unknown incoming faxnumbers go (required)
SG_TCPTMO=120      ; tcp timeout, in seconds
SG_GWIATT=\.att$   ; blank separated list of regular expressions to ignore
                   ; e.g. \.att$ ignores all files ending up with .att.
                   ; the comparision is always lowercase
SG_GWFDR=1         ; default for delivery reports by daemon.
                   ; 0=no reports,1=failure reports
                   ; 2=failure and success reports
SG_GWNO=1          ; number of outgoing messages processed in one cycle
SG_GWNI=1          ;     " incoming
SG_GWNR=1          ;     " reports
SG_GWMAXP=100      ; maximum number of pages for outgoing message
SG_GWFLR=0         ; force live (html) reports.
		   ; 1=force live report, 0=do not force
SG_GWHTR=localhost/scripts/umgwrep    
                   ; http path where to find the umgwrep cgi bin for live 
                   ; reports. Full URL will be http://SG_GWHTR?...
SG_GWEDLL=         ; name of the extension dll to load
                   ; (see $FAXROOT/gateway/smtp/extapi)
SG_ATTn=           ; n=0..99; call external converter from type1 to type2
                   ; first parameter is input file, second is output file.
                   ; <type1>,<type2> <cmd with input and output>
                   ; eg. convert pdf to tif calling gs_pdftif
                   ; SG_ATT0=pdf,tif gs_pdftif %s %s                   
SG_CPI_CE=SG_LDE   ; 1=set (cooked) CPI for mailuser, 0=use default value
                   ; if SG_LDE=0, input is the mailuser extension
                   ; if SG_LDE=1, input is result of CPI request (see SG_LDUDA)
SG_CPI_CSK=0	   ; skip number of digits in CPI
                   ; negative values: keep rightmost digits
SG_CPI_CPR=        ; prefix added to CPI
SG_TSI_CE=SG_LDE   ; 1=set (cooked) TSI for mailuser, 0=use default value 
                   ; if SG_LDE=0, input is the mailuser extension
                   ; if SG_LDE=1, input is result of TSI request (see SG_LDUDA)
SG_TSI_CSK=0	   ; skip number of digits in TSI
                   ; negative values: keep rightmost digits
SG_TSI_CPR=        ; prefix added to TSI
SG_SAP=0           ; setting this options to 1 enables a SAP-SMTP compatible mode. This 
                   ; option disables all LDAP and user validation options. Please refer to
                   ; the SAP Documentation for the syntax and semantics.
		   
SG_TXTFAX=         ; the filename of a text file to add as body text for fax
SG_TXTVOC=         ; the filename of a text file to add as body text for voice 

additional parameter for special purpose:
SC_RRTO=           ; the specified mailaddress requests a read receipt		   


Sending faxes:

The format of a fax address is:

address:           faxnumber { '/' option }

option :           addresstype | 'night' | 'date=' date | 'time=' time
                     | resolution | 'costunit=' costunit

addrestype:        'fax' | 'telex '|'sms'|'voice'

date:              day '.' month [ '.' year ]

day:               '1' .. '31'

month:             '1' .. '12'

year:              '1970' ..

time:              hour [ '.' minute ]

hour:              '0' .. '23'

minute:            '0' .. '59'

resolution:        'normal' | 'fine'

costunit:          [a-zA-Z0-9]+


So a fax address could be e.g.
12345/fax/date=1.1.1999/time=17.30/fine@fax.vipcomag.de


Coverpages:

The gateway uses the coverid as the id of a pool document of the gateway
user. It will use the ascii file (pagecode type 4, pahe 1) as the input for
the faxpr program, so it will understand all faxpr control codes (please
refer to the faxpr interface manual). Besides the normal control codes it
will substitute the following control codes:

@from               The personal name phrase (friendly name) of the sender

@frommail           The e-mail address of the sender

@to                 The personal name phrase of the recipient (usually empty!)

@tomail             The e-mail address of the recipient

@tonumber           The fax number of the recipient

@time               The time the send job was generated (in the locales format)

@date               The date the send job was generated (in the locales format)

@subject            The subject line

@pages              The number of pages, including the coverpage

@pagesdoc           The number of pages, excluding the coverpage


Routing without LDAP

If you do not want to use LDAP, set the entry

SG_LDE=0

Now the gateway uses the mail user database of the fax server for 
verification and routing.


The use of LDAP:

The Daemon and the Gateway process use LDAP to access your directory. The
Daemon process uses LDAP only to check if a mail user is allowed to use the
gateway, but the Gateway process uses LDAP to get some information about the
mail user sending a fax and to route incoming faxes to a mail address.

LDAP gets configured with the following options:

SG_LDH=localhost    ; the host providing LDAP services
SG_LDTO=10          ; timeout in seconds for a LDAP query
SG_LDP=389          ; the port of the LDAP server
SG_LDBNAM=          ; the dn for binding
SG_LDBPWD=          ; the password for binding

;; The following options are used by the
;; Gateway to get some informations
;; about the mail user which wants to
;; send a fax

SG_LDUDB=           ; the starting point for the directory search. You
                    ; will decide on a start container, e.g
                    ; cn=FaxUsers,cn=Recipients,ou=nig,o=biz
SG_LDUDF=rfc822MailBox=%0  ; the search filter for the directory search. %0 gets
                           ; substituted by the mail address of the sender
SG_LDUDS=2          ; the depth of the search. 0 means the object itself,
                    ; 1 means one sublevel and 2 the complete subtree

SG_LDUDA=givenName,sn,facsimileTelephoneNumber,faxLineId,faxHeadLine
 ,faxCoverId,faxPinCode,faxCpi,Extension-Attribute-10
                    ;
                    ; The attributes we want to see. The name is not important,
                    ; but the Gateway asumes that
                    ; the 1st attribute is the given name,
                    ; the 2nd the surname
                    ; the 3rd the fax number which gets publicated as TSI,
                    ; the 4th the lineid (the virtual faxnumber)
                    ; the 5th the headline which gets publicated,
                    ; the 6th is the COVERID of a document which will be used
                    ;   as the coverpage and
                    ; the 7th is the pincode for dialing
                    ; the 8th is the calling party identifier for ISDN
                    ; the 9th optional attribute is string which
                    ;   gets parsed in the following way:
                    ; COVERID=123 HEADLINE="Headline" TSI="Tsi" PINCODE="pincode"
                    ; CPI="calling party identifier"
                    ; for this document. (refer to the MAPI connector manual for a description of
                    ; how to create cover pages.)
                    ; There are no blanks allowed in this string and we expect
		            ; exactly 8 or 9 attributes,
                    ; even if they are dummys!!

SG_LDUDD=%0 %1      ; how to build a full name. %0 is the 1st attribute
                    ; of SD_LDUDA, %1 is the 2nd

;; The following options are used by the
;; Daemon process to check if a mail user
;; is allowed to use the gateway

SG_LDALB=SG_LDUDB   ; as SG_LDUDB
SG_LDALF=SG_LDUDF   ; as SG_LDUDF
SG_LDALS=SG_LDUDS   ; as SG_LDUDS

;; The following options are used by the
;; Gateway process to route an incoming
;; fax based on the virtual number
;; to a mail user

SG_LDMBB=SG_LDUDB   ; as SG_LDUDB
SG_LDMBF=(|(faxLineId=%1%0)(facsimileTelephoneNumber=%1%0))
                    ; The search filter. A description of search
                    ; filters will follow in this document.
                    ; %0 gets substitued with the dialed extension and %1 with
		    ;   the NumberPrefix
SG_LDMBA=rfc822MailBox      ; the name of the attribute which contains
                            ; the mail address of the user
SG_LDBMS=SG_LDUDS   ; as SG_LDUDS

SG_LDOUTP           ; the attribute containing an outbound prefix

Standard Attributes we use:

givenName                   given name
sn                          surname
facsimileTelephoneNumber    the fax number

Non-Standard Attributes we use:

faxLineId               the virtual fax number of a user
faxHeadLine             the Headline we use for the user sending a fax
faxCoverId              the identifier of a document we using for the cover page
faxPinCode              the pincode of the user

Format of a search filter:

filter:             '(' filtercomp ')'

filtercomp:         and | or | not | simple

and :               '&' filterlist

or:                 '|' filterlist

not:                '!' filter

filterlist:         filter { filter }

simple:             attributetype filtertype attributevalue

filtertype:         '=' | '~=' | '<=' | '>='


The '~=' construct is used to specify approximate  matching. The
representation for attributetype and attributevalue are as described in RFC
1778.  In addition, attributevalue can be a single * to achieve an attribute
existence test, or can contain text and *'s interspersed to achieve
substring matching.

For example, the filter "mail=*" will find any entries that have a mail
attribute. The filter "mail=*@terminator.rs.itd.umich.edu" will find any
entries that have a mail attribute ending in the specified string. To put
parentheses in a filter, escape them with a backslash '\' character.  See
RFC 1588 for a more complete description of allowable filters.


Testing your LDAP configuration

use sgrestest for LDAP test. This program has the following options:

-a mailaddress       check if the user mailaddress is allowed to fax
-d mailaddress       display the additional user information
-r number            resolve the mailbox address from number
-v                   (verbose) shows lots of details

NT/Windows2000:

If you install the MAPI connector, the gateway can use its document conversion 
logic.

Troubleshooting

Most unix machines need root permission to start daemon on port 25. If the 
daemon doesn't start, look at $FAXROOT/gateway/smtp/dm/nohup.out. If you find 
permission denied, change owner of $FAXROOT/gateway/smtp/daemon to root and 
set s-bit. The commands are "chown root daemon" and "chmod +s daemon" (root login).
You may find 'address in use' if a different process uses the port address 
- you'll have to solve the conflict - or on restart, then simply wait
a minute until port is freed (the command netstat may be helpful).

Use sgrestest to confirm the SG_ parameters.
(sgrestest -d  searches for parameters SG_LDUDA, filter is SG_LDUDF.)

You can control debug output for the Daemon by SG_DMDL, and the output of
Gateway by SG_GWDL, in the range 0..4. The debug information is written to
$FAXROOT/gateway/smtp/dm/nohup.out or $FAXROOT/gateway/smtp/gw/nohup.out rsp.

Set SG_DMLIO to 1 to see a complete trace of its SMTP/POP3 conversation (this
may be confusing if you have more than one session) .

With SG_LDDL set to 1 you get debug output for the LDAP client side.

Converting pdf documents on Windows systems via mapi printer:
To convert pdf documents by acrobat/acroread, configure the Windows Service
FAX Server to be executed with 'Log on as user account' (not 'local system
account'), select a standard printer for this user and print one acrobat
document under this account. Make sure, acrobat/acroread printto command uses
option /t (/t terminates process after printout).

Parallel Gateway Instances:
Omega config variables SMTP0 ... SMTP999 define additional gateways (syntax 
like SMTPnative). You'll need a distinct gatewayuser for each instance.
It is possible to run multiple instances on one machine. If you do so, be 
careful to configure the ports individually.
