Gentoo Archives: gentoo-commits

From: "Tony Vroon (chainsaw)" <chainsaw@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-misc/asterisk/files/1.8.0: find_call_sip_trace.sh find_call_ids.sh
Date: Wed, 06 Jun 2012 10:08:05
Message-Id: 20120606100745.885752004C@flycatcher.gentoo.org
1 chainsaw 12/06/06 10:07:45
2
3 Added: find_call_sip_trace.sh find_call_ids.sh
4 Log:
5 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.
6
7 (Portage version: 2.1.10.63/cvs/Linux x86_64)
8
9 Revision Changes Path
10 1.1 net-misc/asterisk/files/1.8.0/find_call_sip_trace.sh
11
12 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
13 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
14
15 Index: find_call_sip_trace.sh
16 ===================================================================
17 #! /bin/bash
18
19 logfile=$1
20 callid=$2
21
22 function usage()
23 {
24 echo "USAGE: $1 logfile Call-ID [Call-ID ...]"
25 exit -1
26 }
27
28 [ -r "${logfile}" ] || usage $0
29 [ -n "${callid}" ] || usage $0
30
31 shift; shift;
32 while [ $# -gt 0 ]; do
33 callid="${callid}|$1"
34 shift
35 done
36
37 # modes:
38 # 0 - searching for SIP start block ...
39 # 1 - transmit of sorts
40 # 2 - receive
41
42 dos2unix < "${logfile}" | awk '
43 BEGIN { mode = 0 }
44 mode==0 && $4~"^VERBOSE" {
45 dt=$1" "$2" "$3
46 }
47
48 mode!=0 && $1 == "Call-ID:" {
49 #print
50
51 if ($2 ~ /('"${callid}"')/) {
52 callidmatch=1
53 } else {
54 #print $2" does not match ^('"${callid}"')$"
55 mode=0
56 }
57 }
58
59 (mode==1 && $0=="---") || (mode==2 && $0=="<------------->") {
60 if (callidmatch) {
61 print dt" "sipmode"\n"pckt"---"
62 }
63
64 mode=0
65 }
66
67 mode!=0 {
68 pckt = pckt $0 "\n"
69 }
70
71 mode==0 && $0 ~ "chan_sip[.]c: .*[tT]ransmitting" {
72 #print
73
74 if ($6 == "Retransmitting") {
75 sipmode = $6" "$7" to "$NF
76 } else {
77 sipmode = "Transmitting to "$NF
78 }
79
80 mode=1
81 pckt=""
82 callidmatch=0
83 }
84
85 mode==0 && $0 ~ "SIP read from" {
86 #print
87 mode=2
88 pckt=""
89 callidmatch=0
90 sipmode="Received from "$5":"
91 }
92 '
93
94
95
96 1.1 net-misc/asterisk/files/1.8.0/find_call_ids.sh
97
98 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
99 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
100
101 Index: find_call_ids.sh
102 ===================================================================
103 #! /bin/bash
104
105 logfile=$1
106 anum=$2
107 bnum=$3
108
109 function usage()
110 {
111 echo "USAGE: $1 logfile anum bnum"
112 exit -1
113 }
114
115 [ -r "${logfile}" ] || usage $0
116 [ -n "${anum}" ] || usage $0
117 [ -n "${bnum}" ] || usage $0
118
119 #echo "Finding calls from '${anum}' to '${bnum}' in ${logfile}."
120
121 # modes:
122 # 0 - not processing an INVITE.
123 # 1 - processing an INVITE.
124 # 2 - from matched (processing).
125 dos2unix < "${logfile}" | awk '
126 BEGIN { mode = 0 }
127 mode==0 && $4~"^VERBOSE" {
128 dt=$1" "$2" "$3
129 }
130
131 mode==0 && $1=="INVITE" && $2 ~ "^sip:'"${bnum}"'@" {
132 #print
133
134 mode=1
135
136 split($2, a, "[:@]")
137 bnum=a[2]
138 }
139
140 mode==1 && $1=="From:" {
141 #print
142 if ($3 ~ "^<sip:'"${anum}"'@.*>") {
143 mode=2
144 split($3, a, "[:@]")
145 anum=a[2]
146 } else {
147 #print "From does not match ... leaving block."
148 mode = 0
149 }
150 }
151
152 mode!=0 && $1=="Call-ID:" {
153 callid=$2
154
155 if (NF!=2) {
156 print "WTF @ Call-ID header having NF!=2"
157 }
158 }
159
160 mode==1 && $0=="" {
161 #print "Leaving block (no match)"
162 mode = 0
163 }
164
165 mode==2 && $0=="" {
166 #print "Leaving block (match)"
167 print dt " " anum " " bnum " " callid
168 mode = 0
169 }
170 '