Complete Script Examples

Top  Previous  Next

Due to the complex nature of the Filter script, we've created a few examples of how scripts can be implemented. This is by no means a complete list of everything that the script can do and is intended to be a set of examples to guide you through the possibilities the script offers.

 

Example 1

In this example, we've configured the filter script to search the message read from the input file for the text BIOHAZARD and replace it with bio_hazard. We're then inserting the static text WARNING! EXTREME HAZARD DETECTED: before the matched search string.

 

Example 2

In this example, we've configured the filter to scan through XML tags for the text Technical or Network in the <AlertType> tag, then pull in information from the <Incident> and <Description> tags. This collated data is then being passed to a statically named group in PageGate: techsupervisors.

 

Example 3

In this example, we've configured the filter to scan for certain keywords and key phrases. If it finds them, messages containing that text should not be allowed to go through and should instead be filtered.

 

Example 4

In this example, we've configured the filter script for a dispatching agency that needs all fire, rescue and accident calls dispatched but does not want non-emergency calls dispatched. To do this, the script reads in the entire input file and looks for certain flags like FIRE,DISPATCHED or RESCUE,DISPATCHED or ACCID,DISPATCHED.

 

If it finds any of those three strings, the script then begins massaging and reformatting the data to remove unwanted information and to determine who the message should go to and what the message should say.

 

In this particular example, all fire and rescue calls need to be delineated from each other so that the fire calls go to the fire department and the rescue calls go to the rescue department but  all accident calls should go to both fire and rescue departments.

 

Example 5

In this example, we're using an HTTPGET carrier to poll data from the National Weather service to have it delivered as an SMS.

 

Example 6

This example is designed to work with an SMS Replies system and is configured to look for the words 'subscribe' and 'unsubscribe' in the body of reply messages. If it finds 'subscribe', it reconfigures the message to go to the recipient or group in PageGate named 'subscribe'. If it finds 'unsubscribe', it reconfigures the message to go to the recipient or group named 'unsubscribe'.

 

Example 7

This example is designed to work with an SMS Replies system and is configured so that any time someone replies to a message with 'unsubscribe' or 'subscribe', those replies execute a batch file or script contained within a batch file. This can be especially useful if you're using an SQL environment and have PageGate's database linked to it with ODBC expressions. In theory, you could code a script to be executed that would automatically remove an entry from the users table of the database any time the 'unsubscribe' script was executed.

 

Example 8

This example is designed to work with an SMS Replies system. This script is configured with a list of 'allowed' phone numbers and is also configured to scan the sender value of all replies. If the sender's phone number isn't in the 'allowed' list, the message is filtered as spam.