public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in net-misc/asterisk/files/1.8.0: find_call_sip_trace.sh find_call_ids.sh
@ 2012-06-06 10:07 Tony Vroon (chainsaw)
  0 siblings, 0 replies; only message in thread
From: Tony Vroon (chainsaw) @ 2012-06-06 10:07 UTC (permalink / raw
  To: gentoo-commits

chainsaw    12/06/06 10:07:45

  Added:                find_call_sip_trace.sh find_call_ids.sh
  Log:
  Bugfix releases on both the 1.8 & 10 branches, squelches a warning with bind address set to "any", prevents an overflow on 32-bit systems for ast_tvdiff_ms calculation and various rerouting/transfer fixes. Updated helper scripts by Jaco Kroon, closes bug #414585.
  
  (Portage version: 2.1.10.63/cvs/Linux x86_64)

Revision  Changes    Path
1.1                  net-misc/asterisk/files/1.8.0/find_call_sip_trace.sh

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/asterisk/files/1.8.0/find_call_sip_trace.sh?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/asterisk/files/1.8.0/find_call_sip_trace.sh?rev=1.1&content-type=text/plain

Index: find_call_sip_trace.sh
===================================================================
#! /bin/bash

logfile=$1
callid=$2

function usage()
{
	echo "USAGE: $1 logfile Call-ID [Call-ID ...]"
	exit -1
}

[ -r "${logfile}" ] || usage $0
[ -n "${callid}" ] || usage $0

shift; shift;
while [ $# -gt 0 ]; do
	callid="${callid}|$1"
	shift
done

# modes:
# 0 - searching for SIP start block ...
# 1 - transmit of sorts
# 2 - receive

dos2unix < "${logfile}" | awk '
	BEGIN { mode = 0 }
	mode==0 && $4~"^VERBOSE" {
		dt=$1" "$2" "$3
	}

	mode!=0 && $1 == "Call-ID:" {
		#print

		if ($2 ~ /('"${callid}"')/) {
			callidmatch=1
		} else {
			#print $2" does not match ^('"${callid}"')$"
			mode=0
		}
	}

	(mode==1 && $0=="---") || (mode==2 && $0=="<------------->") {
		if (callidmatch) {
			print dt" "sipmode"\n"pckt"---"
		}

		mode=0
	}

	mode!=0 {
		pckt = pckt $0 "\n"
	}

	mode==0 && $0 ~ "chan_sip[.]c: .*[tT]ransmitting" {
		#print

		if ($6 == "Retransmitting") {
			sipmode = $6" "$7" to "$NF
		} else {
			sipmode = "Transmitting to "$NF
		}

		mode=1
		pckt=""
		callidmatch=0
	}

	mode==0 && $0 ~ "SIP read from" {
		#print
		mode=2
		pckt=""
		callidmatch=0
		sipmode="Received from "$5":"
	}
'



1.1                  net-misc/asterisk/files/1.8.0/find_call_ids.sh

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/asterisk/files/1.8.0/find_call_ids.sh?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/asterisk/files/1.8.0/find_call_ids.sh?rev=1.1&content-type=text/plain

Index: find_call_ids.sh
===================================================================
#! /bin/bash

logfile=$1
anum=$2
bnum=$3

function usage()
{
	echo "USAGE: $1 logfile anum bnum"
	exit -1
}

[ -r "${logfile}" ] || usage $0
[ -n "${anum}" ] || usage $0
[ -n "${bnum}" ] || usage $0

#echo "Finding calls from '${anum}' to '${bnum}' in ${logfile}."

# modes:
# 0 - not processing an INVITE.
# 1 - processing an INVITE.
# 2 - from matched (processing).
dos2unix < "${logfile}" | awk '
	BEGIN { mode = 0 }
	mode==0 && $4~"^VERBOSE" {
		dt=$1" "$2" "$3
	}

	mode==0 && $1=="INVITE" && $2 ~ "^sip:'"${bnum}"'@" {
		#print

		mode=1

		split($2, a, "[:@]")
		bnum=a[2]
	}

	mode==1 && $1=="From:" {
		#print
		if ($3 ~ "^<sip:'"${anum}"'@.*>") {
			mode=2
			split($3, a, "[:@]")
			anum=a[2]
		} else {
			#print "From does not match ... leaving block."
			mode = 0
		}
	}

	mode!=0 && $1=="Call-ID:" {
		callid=$2

		if (NF!=2) {
			print "WTF @ Call-ID header having NF!=2"
		}
	}

	mode==1 && $0=="" {
		#print "Leaving block (no match)"
		mode = 0
	}

	mode==2 && $0=="" {
		#print "Leaving block (match)"
		print dt " " anum " " bnum " " callid
		mode = 0
	}
'






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-06-06 10:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-06 10:07 [gentoo-commits] gentoo-x86 commit in net-misc/asterisk/files/1.8.0: find_call_sip_trace.sh find_call_ids.sh Tony Vroon (chainsaw)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox