-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAutoGenComments.pl
More file actions
executable file
·265 lines (238 loc) · 6.58 KB
/
Copy pathAutoGenComments.pl
File metadata and controls
executable file
·265 lines (238 loc) · 6.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
#!/usr/bin/perl
#print "Opening $ARGV[0] for parsing....\n";
open (MYFILE, $ARGV[0]);
open (OUTFILE, ">$ARGV[0].commented.out");
open (WEBSEQFILE, ">$ARGV[0].webseq.out");
open (CALLLISTFILE,">$ARGV[0].calllist.out");
open (NETANNCONFCOUNT,">$ARGV[0].netann.out");
open (SESSIONS,">$ARGV[0].sessions.out");
open (STREAMS,">$ARGV[0].streams.out");
print OUTFILE "File Commented by AutoComment marked with AC\n";
while (<MYFILE>) {
#Support for lognote
if(/.*LOGNOTE.*/){
print OUTFILE "//AC $_";
#Tags used by LogMerge
#Get the start loggen info
}elsif(/^.*Startline.*/){
print OUTFILE "/*AC\n";
print OUTFILE "$_";
$inblock=1;
#remove the \n
chomp;
$block="$_\\n";
}elsif(/^.*----------------------------------------.*/){
print OUTFILE "$_\nAC*/\n";
$inblock=0;
################ XMSREST PARSES ##################
#start call
}elsif(/DEBUG.*Request URI = /){
print OUTFILE "/*AC\n";
print OUTFILE "$_";
$inblock=1;
chomp;
$block="$_\\n";
#end action
}elsif(/DEBUG.*Content = /){
print OUTFILE "$_ ";
/^.{34}(.*)\[/;
$block="$block $1";
$inblock=1;
$flushonnexttimestamp=1;
}elsif($flushonnexttimestamp && /^20..-..-..*(DEBUG|INFO)/){
$block =~ s/
/\\n/g;
$block =~ s/
//g;
print WEBSEQFILE "App->XMS: $block\n";
$flushonnexttimestamp=0;
$block="";
$inblock=0;
print OUTFILE "AC*/ \n$_";
#grab the Rest Register deregister
}elsif(/Router::RegURI -Register Resource URI =/){
print OUTFILE "//AC $_";
print CALLLISTFILE $_;
}elsif(/Router::DeRegURI -Unregister Resource/){
print OUTFILE "//AC $_";
print CALLLISTFILE $_;
#response code for PUT
}elsif(/.*Call::Put\(\) Response/){
print OUTFILE "/*AC\n";
print OUTFILE "$_";
$inblock=1;
chomp;
$block="$_\\n";
}elsif(/.*Call::Put\(\) Exit/){
#$inblock=0;
/^.{34}(.*?)\[/;
$block="$block$1\n";
$block =~ s/
/\\n/g;
$block =~ s/
//g;
print OUTFILE "$_AC*/\n";
#$flushonnexttimestamp=1;
print WEBSEQFILE "XMS->App: $block\n";
$block="";
$inblock=0;
#response code for Get
}elsif(/.*Call::Get\(\) Response/){
print OUTFILE "/*AC\n";
$inblock=1;
chomp;
$block="$_\\n";
print OUTFILE "$_";
}elsif(/.*Call::Get\(\) Exit/){
#$inblock=0;
/^.{34}(.*?)\[/;
$block="$block$1\n";
$block =~ s/
/\\n/g;
$block =~ s/
//g;
print OUTFILE "$_AC*/\n";
#$flushonnexttimestamp=1;
print WEBSEQFILE "XMS->App: $block\n";
$block="";
$inblock=0;
#response code for Create conf
}elsif(/.*Conference::GenXML\(\) Response/){
print OUTFILE "/*AC\n";
print OUTFILE "$_";
$inblock=1;
chomp;
$block="$_\\n";
}elsif(/.*Conference::GenXML\(\) Exit/){
print OUTFILE "$_AC*/\n";
$inblock=0;
/^.{34}(.*?)\[/;
$block="$block $1\\n";
$flushonnexttimestamp=1;
#response code
}elsif(/.*SessionThread::run\(\) retCode =/){
print OUTFILE "//AC $_";
/^.{34}(.*?)\[/;
$block="$block $1";
$block =~ s/
/\\n/g;
$block =~ s/
//g;
print WEBSEQFILE "XMS->App: $block\n";
$block="";
############## XMS Server Logs ##################
#add IPM startmedia
}elsif(/IpmDevice::setLocalMediaInfo\(\)/){
print OUTFILE "//AC $_";
}elsif(/IpmDevice::stopMedia\(\)/){
print OUTFILE "//AC $_";
}
elsif(/IpmDevice::onStopped\(\)/){
print OUTFILE "//AC ***************** MEDIA STOPPED!! *********************************\n";
print OUTFILE "//AC $_";
}elsif(/Sdp::choose\(\)/){
print OUTFILE "//AC $_";
}elsif(/IpmDevice::setRemoteMediaInfo\(\)/){
print OUTFILE "//AC $_";
}elsif(/MediaServer::setEncryption\(\)/){
print OUTFILE "//AC $_";
}elsif(/MediaServer::setIce\(\)/){
print OUTFILE "//AC $_";
}elsif(/StreamResource::setState\(\)/){
print OUTFILE "//AC $_";
}elsif(/StreamResource::set.*Direction\(\) direction:/){
print OUTFILE "//AC $_";
#The other Startmedia block
}elsif(/.*IpmDevice::startMedia\(\)/){
print OUTFILE "//AC $_";
}elsif(/.*IpmDevice::onStartMedia\(\)/){
print OUTFILE "//AC ***************** MEDIA STARTED!! *********************************\n";
print OUTFILE "//AC $_";
#grab the Stream State
}elsif(/DEBUG StreamResource::setState\(\) state:/){
print OUTFILE "//AC $_";
#grab the onStuns with USE-CANDIDATE
}elsif(/.*StreamResource::onStun\(\) USE-CANDIDATE for.*/){
print WEBSEQFILE "EndPoint->XMS: $_\n";
print OUTFILE "//AC $_";
#grab MediaServer INFO prints
}elsif(/IPMEV_GENERATEIFRAME/){
print OUTFILE "//AC $_";
#grab Alarm
}elsif(/Alarm/){
print OUTFILE "//AC $_";
#grab Event
}elsif(/Event/){
print OUTFILE "//AC $_";
}elsif(/DeviceManager::onDeviceEvent\(\)/){
print OUTFILE "//AC $_";
#grab the version number
}elsif(/NOTICE Starting xmserver/){
print OUTFILE "//AC $_";
############## APPManager Logs ##################
#add session
}elsif(/DEBUG AppManager::onApiCreateCall\(\) session_id:/){
print OUTFILE "//AC $_";
#add create streamid
}elsif(/AppManager::onApiCreateCall\(\) create stream, stream_id:/){
print OUTFILE "//AC $_";
print STREAMS "$_";
}elsif(/DEBUG AppManager::onApiAnswer\(\) create stream, stream_id:/){
print OUTFILE "//AC $_";
print STREAMS "$_";
#add destroy stream
}elsif(/DEBUG AppManager::onHangup\(\) destroying stream, id:/){
print OUTFILE "//AC $_";
print STREAMS "$_";
#sessions
}elsif(/DEBUG Session::Session\(\) id:/){
print OUTFILE "//AC $_";
print SESSIONS "$_";
#add destroy stream
}elsif(/DEBUG Session::~Session\(\) id:/){
print OUTFILE "//AC $_";
print SESSIONS "$_";
############## RTCWeb Logs ##################
}elsif(/INFO.*RtcWeb::.*/){
print OUTFILE "/*AC\n";
print OUTFILE "$_";
$inblock=1;
chomp;
$block="$_\\n";
$flushonnexttimestamp=1;
}elsif(/DEBUG Message written to web:.*/){
print OUTFILE "/*AC\n";
print OUTFILE "$_";
$inblock=1;
chomp;
$block="$_\\n";
$flushonnexttimestamp=1;
############## NETANN PRINTS ##################
}elsif(/NetAnn::run/){
print OUTFILE "//AC $_";
print NETANNCONFCOUNT "$_";
}elsif(/Count::/){
print OUTFILE "//AC $_";
print NETANNCONFCOUNT "$_";
}elsif(/Conf::parseUri/){
print OUTFILE "//AC $_";
print NETANNCONFCOUNT "$_";
}elsif(/Conference::add/){
print OUTFILE "//AC $_";
print NETANNCONFCOUNT "$_";
}elsif(/Conference::remove/){
print OUTFILE "//AC $_";
print NETANNCONFCOUNT "$_";
############## MISC OTHER PRINTS ##################
#Print out all ERRORS
}elsif(/.*ERROR.*/){
print OUTFILE "//AC $_";
#Add in blocks to the call
}elsif($inblock==1){
print OUTFILE "$_";
if(/^.{34}(.*?)\[/){
$block="$block\\n$1";
}else{
chomp;
$block="$block\\n$_";
}
}else{
#print everything else
print OUTFILE "$_";
}
}
close (MYFILE);
close (OUTFILE);
close (CALLLISTFILE);