Skip to content

Instantly share code, notes, and snippets.

@ticklingcontest
Created March 20, 2016 22:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ticklingcontest/a0754549a88dc748f52d to your computer and use it in GitHub Desktop.
Save ticklingcontest/a0754549a88dc748f52d to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "USAGE: $0 <Test directory>";
exit;
fi
linesInCalleeCSVFile=`wc $1 | awk '{print $1}'`
totalRegistrations=$((linesInCalleeCSVFile - 1))
sipp 192.168.1.2 -aa -sf /newSippLT/calleeREGISTERAndWaitForINVITE.xml -inf $1/calleeCSVFile.csv -t tn -l $totalRegistrations -max_socket 3900 \
-trace_msg -message_file $1/messages.log \
-trace_shortmsg -shortmessage_file $1/shortMessages.log \
-trace_err -error_file $1/errors.log;
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">
<!-- This program is free software; you can redistribute it and/or -->
<!-- modify it under the terms of the GNU General Public License as -->
<!-- published by the Free Software Foundation; either version 2 of the -->
<!-- License, or (at your option) any later version. -->
<!-- -->
<!-- This program is distributed in the hope that it will be useful, -->
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
<!-- GNU General Public License for more details. -->
<!-- -->
<!-- You should have received a copy of the GNU General Public License -->
<!-- along with this program; if not, write to the -->
<!-- Free Software Foundation, Inc., -->
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
<!-- -->
<!-- Sipp default 'uas' scenario. -->
<!-- -->
<scenario name="Callee registration and call accept">
<send>
<![CDATA[
REGISTER sip:[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: <sip:[field0]@[field1]>;tag=[call_number]
To: <sip:[field0]@[field1]>
Call-ID: [call_id]
CSeq: [cseq] REGISTER
Contact: sip:[field0]@[local_ip]:[local_port]
Max-Forwards: 10
Expires: 120
User-Agent: SIPp/HolaCaller
Content-Length: 0
]]>
</send>
<!-- asterisk -->
<recv response="401" auth="true">
</recv>
<send>
<![CDATA[
REGISTER sip:[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: <sip:[field0]@[field1]>;tag=[call_number]
To: <sip:[field0]@[field1]>
Call-ID: [call_id]
CSeq: [cseq] REGISTER
Contact: sip:[field0]@[local_ip]:[local_port]
[field2]
Max-Forwards: 10
Expires: 120
User-Agent: SIPp/HolaCaller
Content-Length: 0
]]>
</send>
<!-- asterisk -->
<recv response="100" optional="true">
</recv>
<recv response="200">
</recv>
<!-- Pause a little bit before accepting a call: 1sec + 2 sec in sh file = 3 sec -->
<pause milliseconds="3000" />
<!-- By adding rrs="true" (Record Route Sets), the route sets -->
<!-- are saved and used for following messages sent. Useful to test -->
<!-- against stateful SIP proxies/B2BUAs. -->
<recv request="INVITE" crlf="true">
</recv>
<!-- The '[last_*]' keyword is replaced automatically by the -->
<!-- specified header if it was present in the last message received -->
<!-- (except if it was a retransmission). If the header was not -->
<!-- present or if no message has been received, the '[last_*]' -->
<!-- keyword is discarded, and all bytes until the end of the line -->
<!-- are also discarded. -->
<!-- -->
<!-- If the specified header was present several times in the -->
<!-- message, all occurrences are concatenated (CRLF separated) -->
<!-- to be used in place of the '[last_*]' keyword. -->
<send>
<![CDATA[
SIP/2.0 180 Ringing
[last_Via:]
[last_From:]
[last_To:];tag=[pid]SIPpTag01[call_number]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[field0]@[local_ip]:[local_port];transport=[transport]>
Content-Length: 0
]]>
</send>
<send retrans="500">
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:];tag=[pid]SIPpTag01[call_number]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[field0]@[local_ip]:[local_port];transport=[transport]>
Content-Type: application/sdp
Content-Length: [len]
v=0
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
s=-
c=IN IP[media_ip_type] [media_ip]
t=0 0
m=audio [media_port] RTP/AVP 0
a=rtpmap:0 PCMU/8000
]]>
</send>
<recv request="ACK"
optional="true"
rtd="true"
crlf="true">
</recv>
<recv request="BYE">
</recv>
<send>
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[field0]@[local_ip]:[local_port];transport=[transport]>
Content-Length: 0
]]>
</send>
<!-- Keep the call open for a while in case the 200 is lost to be -->
<!-- able to retransmit it if we receive the BYE again. -->
<timewait milliseconds="4000"/>
<!-- definition of the response time repartition table (unit is ms) -->
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
<!-- definition of the call length repartition table (unit is ms) -->
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
</scenario>
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "USAGE: $0 <Test directory>";
exit;
fi
linesInCallerCSVFile=`wc $1 | awk '{print $1}'`
totalRegistrations=$((linesInCallerCSVFile - 1))
#figlet "Caller registration"
sipp 192.168.1.2 -aa -sf /newSippLT/callerREGISTER.xml -inf $1/callerCSVFile.csv -t tn -m 15 -max_socket 3900 -l $totalRegistrations \
-trace_msg -message_file $1/callerREGISTERMessages.log \
-trace_shortmsg -shortmessage_file $1/callerREGISTERShortMessages.log \
-trace_err -error_file $1/callerREGISTERErrors.log;
sleep 5; # Wait for registration to complete
sipp 192.168.1.2 -aa -sf /newSippLT/callerSendINVITE.xml -inf $1/callerCSVFile.csv -t tn -l 100 -max_socket 3900 \
-trace_msg -message_file $1/callerSendINVITEMessages.log \
-trace_shortmsg -shortmessage_file $1/callerSendINVITEShortMessages.log \
-trace_err -error_file $1/callerSendINVITEErrors.log;
<?xml version="1.0" encoding="iso-8859-2" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">
<scenario name="REGISTER SIP endpoints">
<!-- Use with CSV file struct like: 32;192.168.1.211;[authentication username=32 password=32];21;
(user part of uri, server address, auth tag, call target)
-->
<send>
<![CDATA[
REGISTER sip:[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: <sip:[field0]@[field1]>;tag=[call_number]
To: <sip:[field0]@[field1]>
Call-ID: [call_id]
CSeq: [cseq] REGISTER
Contact: sip:[field0]@[local_ip]:[local_port]
Max-Forwards: 10
Expires: 120
User-Agent: SIPp/TicklingCaller
Content-Length: 0
]]>
</send>
<!-- asterisk -->
<recv response="401" auth="true">
</recv>
<send>
<![CDATA[
REGISTER sip:[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: <sip:[field0]@[field1]>;tag=[call_number]
To: <sip:[field0]@[field1]>
Call-ID: [call_id]
CSeq: [cseq] REGISTER
Contact: sip:[field0]@[local_ip]:[local_port]
[field2]
Max-Forwards: 10
Expires: 120
User-Agent: SIPp/TicklingCaller
Content-Length: 0
]]>
</send>
<!-- asterisk -->
<recv response="100" optional="true">
</recv>
<recv response="200">
</recv>
<!-- PAUSE A FEW -->
<pause milliseconds="1000" />
</scenario>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">
<!-- This program is free software; you can redistribute it and/or -->
<!-- modify it under the terms of the GNU General Public License as -->
<!-- published by the Free Software Foundation; either version 2 of the -->
<!-- License, or (at your option) any later version. -->
<!-- -->
<!-- This program is distributed in the hope that it will be useful, -->
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
<!-- GNU General Public License for more details. -->
<!-- -->
<!-- You should have received a copy of the GNU General Public License -->
<!-- along with this program; if not, write to the -->
<!-- Free Software Foundation, Inc., -->
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
<!-- -->
<!-- Sipp default 'uac' scenario. -->
<!-- -->
<scenario name="Basic Sipstone UAC">
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
<!-- generated by sipp. To do so, use [call_id] keyword. -->
<send>
<![CDATA[
INVITE sip:[field3]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: [field0] <sip:[field0]@[field1]>;tag=[call_number]
To: <sip:[field3]@[field1]:[remote_port]>
Call-ID: [call_id]
CSeq: [cseq] INVITE
Contact: sip:[field0]@[local_ip]:[local_port]
Max-Forwards: 10
Content-Type: application/sdp
Content-Length: [len]
v=0
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
s=-
c=IN IP[media_ip_type] [media_ip]
t=0 0
m=audio [media_port] RTP/AVP 0
a=rtpmap:0 PCMU/8000
]]>
</send>
<recv response="401" auth="true">
</recv>
<!-- SEND ACK -->
<send>
<![CDATA[
ACK sip:[field3]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: <sip:[field0]@[field1]>;tag=[call_number]
[last_To:]
Call-ID: [call_id]
CSeq: [cseq] ACK
Contact: sip:[field0]@[local_ip]:[local_port]
Max-Forwards: 10
Content-Length: 0
]]>
</send>
<!-- INVITE w/AUTH now... -->
<send>
<![CDATA[
INVITE sip:[field3]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: [field0] <sip:[field0]@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
To: [field3] <sip:[field3]@[remote_ip]:[remote_port]>
Call-ID: [call_id]
CSeq: 1 INVITE
Contact: sip:[field0]@[local_ip]:[local_port]
[field2]
Max-Forwards: 70
Subject: SIPp/TicklingCaller
Content-Type: application/sdp
Content-Length: [len]
v=0
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
s=-
c=IN IP[media_ip_type] [media_ip]
t=0 0
m=audio [media_port] RTP/AVP 0
a=rtpmap:0 PCMU/8000
]]>
</send>
<recv response="100"
optional="true">
</recv>
<recv response="180" optional="true">
</recv>
<recv response="183" optional="true">
</recv>
<!-- By adding rrs="true" (Record Route Sets), the route sets -->
<!-- are saved and used for following messages sent. Useful to test -->
<!-- against stateful SIP proxies/B2BUAs. -->
<recv response="200" rtd="true">
</recv>
<!-- Packet lost can be simulated in any send/recv message by -->
<!-- by adding the 'lost = "10"'. Value can be [1-100] percent. -->
<send>
<![CDATA[
ACK sip:[field3]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: [field0] <sip:[field0]@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
To: [field3] <sip:[field3]@[remote_ip]:[remote_port]>[peer_tag_param]
Call-ID: [call_id]
CSeq: 1 ACK
Contact: sip:[field0]@[local_ip]:[local_port]
Max-Forwards: 70
Subject: SIPp/TicklingCaller
Content-Length: 0
]]>
</send>
<!-- This delay can be customized by the -d command-line option -->
<!-- or by adding a 'milliseconds = "value"' option here. -->
<pause milliseconds="[field4]"/>
<!-- The 'crlf' option inserts a blank line in the statistics report. -->
<send>
<![CDATA[
BYE sip:[field3]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: [field0] <sip:[field0]@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
To: [field3] <sip:[field3]@[remote_ip]:[remote_port]>[peer_tag_param]
Call-ID: [call_id]
CSeq: 2 BYE
Contact: sip:[field0]@[local_ip]:[local_port]
Max-Forwards: 70
Subject: SIPp/TicklingCaller
Content-Length: 0
]]>
</send>
<recv response="200" crlf="true">
</recv>
<!-- Making sure messages aren't lost... -->
<timewait milliseconds="1000" />
<!-- definition of the response time repartition table (unit is ms) -->
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
<!-- definition of the call length repartition table (unit is ms) -->
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
</scenario>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment