Skip to content

Instantly share code, notes, and snippets.

@J-O-N
Created June 22, 2012 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save J-O-N/2975540 to your computer and use it in GitHub Desktop.
Save J-O-N/2975540 to your computer and use it in GitHub Desktop.
A tool for viewing FreeSWITCH SIP logs
#!/bin/bash
# A useful tool for viewing FreeSWITCH SIP logs
# 2600hz - The Future of Cloud Telecom
awk 'BEGIN{I=0};/^(send|recv).*$/{SIPPACKET=1}; SIPPACKET==1{PACKET[I++]=$0;}; SIPPACKET==1&&/^\ +(Call-ID:).*$/{CALLID=$2}; SIPPACKET==0{print $0}; /^\ +-+$/{PRINT=(SIPPACKET==1?(PRINT==1?0:1):0);SIPPACKET=(PRINT==1?1:0);if(SIPPACKET==0){for(i=0;i<I;i++){print CALLID, PACKET[i]; delete PACKET[i];}I=0;CALLID="";}};' "$@" <&0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment