Search for specific call in asterisk log files
- by chiborg
In my Asterisk log file, I have a line like this (truncated):
Executing [123@mycontext:1] Set("SIP/myhost-b7111840", "__INCOMINGCLI=4711")
Now I want to do the following filtering while looking at the log file with tail -f:
Match lines with a specific value for "INCOMINGCLI", storing the call ID (the "SIP/myhost-b7111840" part)
Output all subsequent lines that contain the call ID.
As a bonus, having a grep-like option like -A would be nice.
I could do that easily in various programming languages, but how would I do it with standard UNIX commands like sed or awk? Can it be done with these commands?