Read Log Realtime and Parse out Information for a Report

I'm not too fluent at this and having problems comprehending / coming up with a way to do it. Our telephone system is spitting out call information on it's maintenance (serial) port which i have connected to a linux box. I want to be able to monitor the output of this text and when a 911 call is dialed an email is sent out notifying people of specific information.

I currently have ttyS0 sending all output to call.log. A simiple "tail -f call.log" will display all output in real time which i want to analyze.

The text file will contain chunks of text that will look like this:

I want to be able to read the logfile realtime (tail -f) and create an email whenever 911 is dialed with specific information from above.

The text "911 CALL ALERT" will always exist as a way to indicate the start of an alert, and it will always end with "RECORD END". The middle text between those two events are key.

Out of the chunk of data above I want to be able to parse out the following information to put into an email:

-TIME:
-NAME:
-ORIG DN:
-DES:

What tools should i use to do this? awk?

Just to give you an idea, you can write something like this:-

#!/bin/ksh

typeset -i CURR_LINE_NO=0
typeset -i NEXT_LINE_NO=0
typeset -i SLEEP_TIME=2

clear

echo "\n*******************Starting call.log Scan*******************\n"

while (true)
do
        echo "Scanning call.log for \"911 CALL ALERT\"...\c"
        NEXT_LINE_NO=$( tail -40 call.log | grep -n "911 CALL ALERT" | tail -1 | awk -F: ' { print $1 } ' )
        if [ $NEXT_LINE_NO -ne 0 ] && [ $NEXT_LINE_NO -ne $CURR_LINE_NO ]
        then
                echo "911 call found."
                CURR_LINE_NO=$( echo $NEXT_LINE_NO )
                BOR_LINE=$( expr $CURR_LINE_NO + 1 )
                EOR_LINE=$( expr $CURR_LINE_NO + 7 )
                sed -n "${BOR_LINE},${EOR_LINE}p" call.log | mailx -s "911 CALL ALERT" someone@somedomain.com
                echo "Sleeping for $SLEEP_TIME seconds...\c"; sleep $SLEEP_TIME; echo "Done."
        else
                echo "911 call not found."
                echo "Sleeping for $SLEEP_TIME seconds...\c"; sleep $SLEEP_TIME; echo "Done."
        fi
done

This script actually scans last 40 lines of call.log every 2 seconds and report if there is a record matched. I hope this helps.

Note: If you are using bash use -e option with echo to enable interpretation of backslash escapes.