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
Net::SIP::Endpoint(3pm) 				User Contributed Perl Documentation				   Net::SIP::Endpoint(3pm)

NAME
Net::SIP::Endpoint - Endpoint for SIP packets (UAC,UAS) SYNOPSIS
my $disp = Net::SIP::Dispatcher->new(...); my $ua = Net::SIP::Endpoint->new($disp); $ua->register( from => 'sip:me@example.com', contact => 'sip:me@192.168.0.1', registrar => '192.168.0.10:5060' ); DESCRIPTION
The package implements a communication endpoint for SIP. This is usually a phone, but can also be a stateful proxy (because it retransmits packets itself). It provides methods to send arbitrary requests but also for sending special requests like INVITE or REGISTER. Together with Net::SIP::Endpoint::Context it implements the behavior of the endpoint. For incoming requests the endpoint usually communicates with the upper layer, the application, which is the interface to the user (e.g. let it ring for incoming calls, create response for call accepted if user picks up phone on incoming call etc). CONSTRUCTOR
new ( DISPATCHER ) Creates a new endpoint and sets it as the receiver for incoming packets at the Net::SIP::Dispatcher DISPATCHER. The endpoint will use DISPATCHER for outgoing packets and will receive incoming packets from it. METHODS
set_application ( APP ) Sets APP as the upper layer, e.g. the layer between the user and the endpoint object $self. APP is either an object which has a method receive or a callback usable by invoke_callback in Net::SIP::Util. The callback will be invoked with the following arguments: ENDPOINT This is the endpoint itself, e.g. $self. CTX The Net::SIP::Endpoint::Context object for the current call. REQUEST The Net::SIP::Request which caused the invocation of the call, e.g. an INVITE on new calls, ACK if the peer established the call, BYE if a call gets closed by the peer etc. LEG The Net::SIP::Leg object where the call came in. Together with FROM used to send response packet back to peer. FROM "ip:port" of the sender of the request. It will call into APP in various incoming requests, like: INVITE In this case APP should ring the user and while ringing send "180 Ringing" responses back to the peer, using "ENDPOINT->new_response". After some time it should send a final response (like "200 Ok" if the user accepted the call). ACK This is the sign, that the peer established the call. APP should now expect to process incoming RTP data and send RTP data itself. CANCEL, BYE This informs APP, that the call is closed. No need for the APP to send a response itself, this was already handled by the endpoint (because there is no choice of responses, it can hardly not accept a BYE). other requests Like OPTION,.. . Theseneed to be fully handled by APP, e.g. send the appropriate response back using "ENDPOINT->new_response". invite ( CTX, [ CALLBACK, BODY, %ARGS ] ) Creates a new INVITE request and delivers it to the peer. Simply calls new_request with the method 'INVITE'. See this method for information for the arguments. register ( %ARGS ) Registers endpoint at remote registrar. %ARGS needs to be filled as follows: registrar "ip:port" of registrar. Mandatory. from The address to register at the registrar. Mandatory. contact The contact, under which "from" will be registered. Mandatory. auth Authorization info, see method authorize in Net::SIP::Request for information about the format. Optional. expires Expires time. Optional, defaults to 900. callback Optional callback, e.g. called if requests come in from the peer on the call created for the registration. See invoke_callback in Net::SIP::Util for the format. All other keys will be used as header keys in generating the Net::SIP::Request object. new_request ( METHOD, CTX, [ CALLBACK, BODY, %ARGS ] ) Method is the uppercase name of the method for which a request should be generated. It can also be already a Net::SIP::Request object in which case no new request object will be generated, but the provided delivered. CTX is either an existing Net::SIP::Endpoint::Context object or a hash reference which will be used to construct one. It contains information about "from" and "to" etc. See constructor in Net::SIP::Endpoint::Context for details. In case of a hash reference auth and callid from ARGS will be used for the newly constructed context. If it is an existing CTX it has to be one which is already managed by this endpoint (e.g. one returned by this method), the endpoint will only manage CTX which it created itself so that a context cannot be shared between multiple endpoints. CALLBACK is a callback usable by invoke_callback in Net::SIP::Util. If defined it will be set up as the new default callback for the context. BODY is a string or an object for the SIP body accepted by the constructor of Net::SIP::Request. See there. If a response object is given as resp40x in ARGS it will be used to authorize the newly created request. Anything else in %ARGS will be used to construct the SIP header. See constructor in Net::SIP::Request. It returns the Net::SIP::Endpoint::Context object for this request which can be then used for further requests in the same call. cancel_invite ( CTX, REQUEST, CALLBACK ) Cancel the given request within the given context (e.g send CANCEL request). If no REQUEST is given it will cancel the most recent INVITE. Returns the number of requests canceled, e.g. 0 or 1. CALLBACK will be used as the callback for the CANCEL request it sends using new_request. close_context ( CTX ) Delete Net::SIP::Endpoint::Context object CTX from the list of active calls. receive ( PACKET, LEG, FROM ) Called from dispatcher on incoming packets. PACKET is the incoming Net::SIP::Packet, LEG the Net::SIP::Leg where the packet came in and FROM the "ip:port" of the sender. Just forwards to receive_request or receive_response based on the type of packet. receive_response ( RESPONSE, LEG, FROM ) Handles incoming response packets. Tries to find an active call based on the "Call-Id" header in the packet. If none was found it will drop the packet, otherwise call handle_response on the call context object (Net::SIP::Endpoint::Context). receive_request ( REQUEST, LEG, FROM ) Handles incoming requests. If there is already a call context for this Call-Id in the request it will use it, otherwise it will create a Net::SIP::Endpoint::Context object based on the information in the request ("from", "to", "contact",... ). Calls handle_request on the existing/new context object. new_response ( CTX, RESPONSE, LEG, ADDR ) Delivers Net::SIP::Response packet RESPONSE through the endpoints dispatcher to ADDR ("ip:port") using Net::SIP::Leg LEG. LEG and ADDR are usually the leg and the senders address where the associated request came in. CTX is the context from the call, where the associated request came in. If the response is a 2xx response to a INVITE and no "contact" header is given as required from the RFC it will add one based on the CTX. perl v5.14.2 2012-06-26 Net::SIP::Endpoint(3pm)
All times are GMT -4. The time now is 08:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy