Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Script shell calculate mean arrival request duration Post 302847981 by Amouna on Wednesday 28th of August 2013 10:34:49 AM
Old 08-28-2013
Script shell calculate mean arrival request duration

hello,
I have implemented this command :
Code:
tshark -eth0 -T fiels -e frame.time et sip.Request-Line -z sip,stat > test2.txt

the result of this command : test.txt:
Code:
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

Thanks you.

---------- Post updated at 09:34 AM ---------- Previous update was at 06:49 AM ----------

Smilie
Please how can help me ?
Smilie

Last edited by Scott; 08-28-2013 at 09:18 AM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell Script calculate the hits ?!

could you please find a solution for this a complex command using pipes to Calculate the number of hits per client in Squid log file (access.log), the command should display most active hosts first. Line example 1197979501.787 1 10.1.14.62 TCP_NEGATIVE_HIT/404 1463 GET http://url The... (0 Replies)
Discussion started by: anything
0 Replies

2. Shell Programming and Scripting

need to invoke a script upon arrival of a file

hi all, i recieve a file from other server, on a daily basis .... but the time of arrival is unpredictable .... i need to move this file to another directory before the next file arrives ... i have written a script that does this op and performs some manipulations on the data... but i... (2 Replies)
Discussion started by: sais
2 Replies

3. Shell Programming and Scripting

Calling a request set from Unix shell Script

Hi All, I want to call a concurrent request set from a shell script. I am getting the syntax error "syntax error at line 417 : `(' unexpected" in the below script. v_request_id=fnd_request.submit_request(application => 'APPL_SHORT_NAME' ,program => 'PROGRAM_SHORT_NAME' ... (4 Replies)
Discussion started by: swatipevekar
4 Replies

4. Shell Programming and Scripting

shell script to get the arrival count of file

Hello All, I have come across a small problem. It would be great if any of you could help me in resolving the issue. one file named dummy.txt will be ftped to Unix machine twice daily. If i receive it second time in a day i need to do some processing with the file. How to find the... (2 Replies)
Discussion started by: RSC1985
2 Replies

5. Shell Programming and Scripting

date duration fail to calculate

Hi Everyone, I was very sad after a long way but still cannot figure out the duration between two date. $date1="20090812 23:48:56"; $date2="20090813 00:01:37"; The output will be "001241". I did the following tries, like print localtime(UnixDate(ParseDate("20090812 23:48:56"),"%s"));... (2 Replies)
Discussion started by: jimmy_y
2 Replies

6. Shell Programming and Scripting

Calculate Date from shell script

I have a txt file which now has the following output Sat Mar 6 04:00:01 Sat Mar 6 04:02:09 processing 585 Sat Mar 6 17:00:01 Sat Mar 6 17:00:58 processing 109 Sun Mar 7 04:00:01 Sun Mar 7 04:00:51 processing 309 Sun Mar 7 17:00:01 Sun Mar 7 17:00:41 processing 48 I want output as... (1 Reply)
Discussion started by: gubbu
1 Replies

7. Shell Programming and Scripting

Shell script request

I've a master file which will contain 100 file names, The script should read file name from a master file and format the file as below in AIX. input file Filename This is a test file Output File Filename|This is a test file Thanks in advance for file in $FileList; do (5 Replies)
Discussion started by: udayakumar
5 Replies

8. Shell Programming and Scripting

Convert Date from File and Calculate Duration

Hi - I am looking for a little help to read in 2 date fields from a file in format: 20120508134012.3 yyyymmddhhmmss.tenths of a second So i want to: 1. Read in the 1st date from the file 2. Read in the second date from the file 3. Calculate the difference in minutes (or seconds) 4. ... (5 Replies)
Discussion started by: Newbie2012
5 Replies

9. Shell Programming and Scripting

Shell script to calculate the max cpu usage from the main script

Hi All, I have a script which does report the cpu usuage, there are few output parameter/fields displayed from the script. My problem is I have monitor the output and decide which cpu number (column 2) has maximum value (column 6). Since the output is displayed/updated every seconds, it's very... (1 Reply)
Discussion started by: Optimus81
1 Replies

10. UNIX for Beginners Questions & Answers

How to calculate time duration in Linux?

I want to calculate duration for below file in this format SID | Date | Starttime |Date |End time 1607 |2019-04-05|13:06:42|2019-04-05|13:07:12 2327 |2019-04-05|13:57:26|2019-04-05|13:57:43 O/p should be like this: SID | Date | Starttime |Date |Endtime... (4 Replies)
Discussion started by: anupmishra
4 Replies
sip_get_request_method(3SIP)			   Session Initiation Protocol Library Functions		      sip_get_request_method(3SIP)

NAME
sip_get_request_method, sip_get_response_code, sip_get_response_phrase, sip_get_sip_version - obtain attributes from the start line in a SIP message SYNOPSIS
cc [ flag ... ] file ... -lsip [ library ... ] #include <sip.h> sip_method_t sip_get_request_method(const sip_msg_t sip_msg, int *error); int sip_get_response_code(sip_msg_t sip_msg, int *error); const sip_str_t *sip_get_response_phrase(sip_msg_t sip_msg, int *error); const sip_str_t*sip_get_sip_version(sip_msg_t sip_msg, int *error); DESCRIPTION
For functions that return a pointer of type sip_str_t, sip_str_t is supplied by: typedef struct sip_str { char *sip_str_ptr; int sip_str_len; }sip_str_t; The sip_str_ptr parameter points to the start of the returned value and sip_str_len supplies the length of the returned value. For example, given the following request line in a SIP message sip_msg that is input to sip_get_request_uri_str(): FROM : <Alice sip:alice@atlanta.com>;tag=1928301774 the return is a pointer to sip_str_t with the sip_str_ptr member pointing to "A" of Alice and sip_str_len being set to 5, the length of Alice. Access functions for headers that can have multiple values take the value as the input, while those that can have only one value take the SIP message sip_msg as the input. The sip_get_request_method() function will return the SIP method from the request line in the SIP message sip_msg. The method can be one of the following: INVITE ACK OPTIONS BYE CANCEL REGISTER REFER INFO SUBSCRIBE NOTIFY PRACK UNKNOWN The sip_get_response_code() function will return the response code response from the request line in the SIP message sip_msg. The sip_get_respose_phrase() function will return the response phrase response from the request line in the SIP message sip_msg. The sip_get_sip_version() function will return the version of the SIP protocol from the request or the response line in the SIP message sip_msg. RETURN VALUES
For functions that return a pointer to sip_str_t, the return value is the specified value on success or NULL in case of error. For func- tions that return an integer, the return value is the specified value on success and -1 on error. The value of errno is not changed by these calls in the event of an error. ERRORS
These functions take a pointer to an integer error as an argument. If the error is non-null, one of the following values is set: EINVAL The input SIP message sip_msg or the header value is null; or the specified header/header value is deleted. EPROTO The header value is not present or invalid. The parser could not parse it correctly. ENOMEM There is an error allocating memory for the return value. On success, the value of the location pointed to by error is set to 0. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
libsip(3LIB) SunOS 5.11 25 Jan 2007 sip_get_request_method(3SIP)
All times are GMT -4. The time now is 01:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy