Script shell calculate mean arrival request duration
I have implemented this command :
tshark -eth0 -T fiels -e frame.time et sip.Request-Line -z sip,stat > test2.txt
the result of this command : test.txt:
Aug 27, 2013 23:06:47.334270000 INVITE Aug 27, 2013 23:06:47.335045000 SIP/2.0 401 Unauthorized Aug 27, 2013 23:06:47.336897000 ACK Aug 27, 2013 23:06:47.350187000 INVITE Aug 27, 2013 23:06:47.351728000 SIP/2.0 100 Trying Aug 27, 2013 23:06:47.354311000 INVITE Aug 27, 2013 23:06:47.500954000 SIP/2.0 180 Ringing Aug 27, 2013 23:06:47.504776000 SIP/2.0 180 Ringing Aug 27, 2013 23:06:48.415368000 CANCEL Aug 27, 2013 23:06:48.416001000 SIP/2.0 487 Request Terminated Aug 27, 2013 23:06:48.416193000 SIP/2.0 200 OK Aug 27, 2013 23:06:48.416522000 CANCEL Aug 27, 2013 23:06:48.424779000 ACK Aug 27, 2013 23:06:48.590352000 SIP/2.0 200 OK Aug 27, 2013 23:06:48.590370000 SIP/2.0 487 Request Terminated Aug 27, 2013 23:06:48.595704000 ACK
so this file presents the arrival time and the name of the request or response of the sip protocol.
my purpose is to calculate :
1) the mean time duration of request = sum ( arrival_time_current_request - arrival_time_previous-request) / ( total number of request)
given that a sip request can be : ack, invite,cancel
1) I will repeat the same think with response :the mean time duration of response = sum ( arrival_time_current_resonset - arrival_time_previous-response) / ( total number of response)
given that a sip response can be : 180Ringing,200ok....etc
---------- Post updated at 09:34 AM ---------- Previous update was at 06:49 AM ----------
Please how can help me ?
Last edited by Scott; 08-28-2013 at 09:18 AM.. Reason: Please use code tags
To assist us in this, try breaking the problem up a bit - I can't spek fo the others here but I'm reluctant to expend a bunch of energy understanding how that packet dump format works and what the chain of events should be.
What specific questions do you have?
Are you having trouble making a script that identifies which lines in the output make up one 'conversation'? (If so, list what one conversation would look like and then show it in the larger output)
Are you having trouble scripting the maths to calculate the time differences? (If so, show exactly what values you are trying to perform the maths on).
Sorry I can't help more yet but you should find plenty of assistance once the problem is more clear.
|Thread Tools||Search this Thread|
|More UNIX and Linux Forum Topics You Might Find Helpful|
|Thread||Thread Starter||Forum||Replies||Last Post|
|Convert Date from File and Calculate Duration||Newbie2012||Shell Programming and Scripting||5||05-08-2012 10:04 PM|
|Shell script request||udayakumar||Shell Programming and Scripting||5||04-02-2012 02:31 PM|
|date duration fail to calculate||jimmy_y||Shell Programming and Scripting||2||08-25-2009 04:15 AM|
|shell script to get the arrival count of file||RSC1985||Shell Programming and Scripting||2||08-20-2009 05:49 AM|
|need to invoke a script upon arrival of a file||sais||Shell Programming and Scripting||2||12-26-2008 05:54 AM|