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: