How to Implement the Script

Top  Previous  Next

Step 1: Copy the filter's executable in to the PageGate program directory

The file 'pgfilter.exe' must reside in the PageGate program folder. If you do not have a copy of this file, please contact our sales and registration department at sales@notepage.com or by phone at 781-829-0500.

 

Step 2: Determine what you want filtered

Filter scripts are called through PageGate's template system and can be broken down in to two categories: Inbound and Outbound

 

Inbound filters can trigger on and modify content passed to the program. These filters are applied to the program's input interfaces and on a global level to effect all input interfaces.

 

Outbound filters can trigger on and modify messages delivered by the program. These filters can be applied to a recipient, carrier, connector and on a global level.

 

You can have a system reference multiple filters for different purposes at the same time.

 

For example, you could configure an inbound filter to strip XML and JSON formatting from received data as well as a global outbound filter that inserted a custom header before every message.  You could then make exceptions to that global rule by configuring unique filters for a carrier, recipient or connector.

 

You could also configure an SMS reply processing system that filtered reply messages containing certain keywords to specific recipients and groups while also implementing an outbound filter to customize the contents or formatting of messages delivered to them.

 

You could do everything described all at once. It really is just a matter of determining what you want to do, then implementing an appropriate solution.

 

Step 3: Write the filter

Each filter exists as an XML file in a directory of your choosing; this directory just needs to be accessible to the PageGate server, whether that's on the local hard drive or via UNC to a network path. The XML file containing your filter may also be called anything you like, you can give the file any name as long as its extension is .xml

 

Steps for writing filters can be found here.

 

Step 4: Reference the filter

After writing a filter, you'll need to add reference it in the 'Settings' section of a template in PG Admin.

clip0001

 

IMPORTANT

\

Due to the way PageGate is programmed, the character '\' is system reserved. When referencing file paths in the template, you will need to use the ASCII value for a backslash. \ must be followed by the three digit ASCII code 092.

 

For example, c:\092PageGateData\092

 

Inbound Filters

Value

Description

Example

InterfaceFilter

This applies a filter to processed data. This allows the interfaces to apply the initial layer of data sorting and collection and then applies the filter to the result.

 

GetAscii

Standard polling: Filter is applied against temp file with recipient, sender and message

Advanced polling: Filter is applied against temp file with recipient, sender and message, and after lookup substitution

 

GetMail

Filter is applied against temp file with recipient, sender and message, after they have been extracted from the email, and decoding has taken place

 

GetSerial

Filter is applied against temp file with recipient, sender and message, and after lookup substitution

 

GetTap

Filter is applied against each message that is received. The file processed by PGFilter will have Id as first line, second line blank, and message on remaining lines.

 

GetWeb

Filter is applied against temp file with recipient, sender and message

 

This can be used on an interface or global level. If used in an interface, it applies the filter to that interface. If used on a global level, it applies the filter to all input from all interfaces.

InterfaceFilter = c:\092PageGateData\092Filters\092yourfilter.xml

RawInterfaceFilter

This applies a filter to raw, unprocessed data. This applies the filter before the interface has a chance to read the data. The specific behavior varies depending on the interface in question.
 
GetAscii

Standard polling: Filter is applied against the raw text file before GetAscii tries to process it

Advanced polling: Filter is applied against each record that is found, before it is processed any further (record pattern matching done first)

 

GetMail

Filter is applied against the raw file received from the PageGate mail server process. All headers are intact and no decoding has taken place yet. Envelope values for recipient and sender are not available for modification in the raw mail file (because they are read from the envelope).

 

GetSerial

Filter is applied against each record found before it is processed any further (record pattern matching is done first)

 

GetTap

Filter is applied against each message that is received.

 

GetWeb

Filter is applied against raw text file created by webgate.exe CGI program

 

This can be used on an interface or global level. If used in an interface, it applies the filter to that interface. If used on a global level, it applies the filter to all input from all interfaces.

RawInterfaceFilter = c:\092PageGateData\092Filters\092yourfilter.xml

 

Outbound Filters

Value

Description

Example

Filter

This applies a filter to outbound messages.

This can be applied on a recipient, carrier, connector or global level.

If used in a recipient template, all messages delivered to that recipient will be processed through the filter.

If used in a carrier template, all messages delivered through that carrier will be processed through the filter.

If used in the program template, it applies to all output from the program.

ConnectorFilter = c:\092PageGateData\092Filters\092yourfilter.xml

ConnectorFilter

This applies a filter to the messages delivered by a connector. This filter can only modify the contents of a message and cannot modify the recipient or sender information.

 

This can be applied on a connector or global level.

If used in the program template, it applies to all connectors in the program.

Filter = c:\092PageGateData\092Filters\092yourfilter.xml

SubjectFilter

This applies a filter to the subject line of any outbound email. This value is only referenced by the SMTP protocol and is not referenced by other protocols.

 

This can be applied on a recipient, carrier, connector or global level.

If used in a recipient template, all SMTP/email messages delivered to that recipient will have their subject lines processed through the filter.

 

If used in a recipient template, all SMTP/email messages delivered to through that SMTP/email carrier will have their subject lines processed through the filter.  

 

If used in the program template, all SMTP/email traffic sent from the system will have its subject line processed through the filter.

SubjectFilter = c:\092PageGateData\092Filters\092yourfilter.xml

 

Hierarchy

An Interface (and Global) template can have both a RawInterfaceFilter and an InterfaceFilter. Both filters will run in that order if they are both set.

 

Connectors will run any outbound filter according to which template has the highest priority. In order, they are:

1)Recipient

2)Carrier

3)Connector

4)Global

 

After implementing a filter script, it is highly recommend that you go through a debugging process to verify what you've configured. See Debugging the Script for more information.