SIPp / sipp

The SIPp testing tool
https://sipp.readthedocs.io
Other
912 stars 378 forks source link

Tell SIPp to setup "requests per second" instead of "calls per second" #608

Open Maratk1n opened 1 year ago

Maratk1n commented 1 year ago

I want to test performance of Kamailio-based SIP proxy. Kamailio has packets/sec or RPS notation. SIPp option -r specifies call rate (in calls per seconds).

The problem is that the proxy has authorization, so each call results in 2 requests. Scenario:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">

<scenario name="SimpleUAC">

 <pause distribution="uniform" min="0" max="600"/> 
<send>
<![CDATA[
INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch];rport
From: <sip:[field0]@[remote_ip]:[remote_port]>;tag=[pid]SIPpTag00[call_number]
To: <sip:[service]@[remote_ip]:[remote_port]>
Call-ID: [call_id]
CSeq: [cseq] INVITE
Contact: sip:[service]@[local_ip]:[local_port]
Max-Forwards: 70
User-Agent: [sipp_version]
Content-Type: application/sdp
Content-Length: [len]

v=0
o=- 3645868343 3645868343 IN IP4 192.168.40.254
s=pjmedia
b=AS:84
t=0 0
a=X-nat:0
m=audio 40282 RTP/AVP 0 98 97 105 3 99 8 9 100 102 104 96
c=IN IP4 192.168.22.22
b=TIAS:64000
a=sendrecv
a=rtpmap:0 PCMU/8000
a=rtpmap:98 speex/16000
a=rtpmap:97 speex/8000
a=rtpmap:105 iLBC/8000
a=fmtp:105 mode=30
a=rtpmap:3 GSM/8000
a=rtpmap:99 speex/32000
a=rtpmap:8 PCMA/8000
a=rtpmap:9 G722/8000
a=rtpmap:100 SILK/8000
a=fmtp:100 useinbandfec=0
a=rtpmap:102 SILK/16000
a=fmtp:102 useinbandfec=0
a=rtpmap:104 opus/16000
a=fmtp:104 maxcodedaudiobandwidth=16000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-15
]]>
</send>

<recv response="100" optional="true"/>
<recv response="180" optional="true"/>
<recv response="183" optional="true"/>
<recv response="200" rrs="true" optional="true" next="200ok"/>
<recv response="407" auth="true"/>
<send>
<![CDATA[
ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
[last_Via:]
[last_From:]
[last_To:]
[last_Call-ID:]
[last_CSeq]
Max-Forwards: 70
Content-Length: [len]
]]>
</send>

<send>
<![CDATA[
INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch];rport
From: <sip:[field0]@[remote_ip]:[remote_port]>;tag=[pid]SIPpTag00[call_number]
To: <sip:[service]@[remote_ip]:[remote_port]>
Call-ID: [call_id]
CSeq: [cseq+1] INVITE
Contact: sip:[service]@[local_ip]:[local_port]
Max-Forwards: 70
User-Agent: [sipp_version]
[field1]
Content-Type: application/sdp
Content-Length: [len]

v=0
o=- 3645868343 3645868343 IN IP4 192.168.40.254
s=pjmedia
b=AS:84
t=0 0
a=X-nat:0
m=audio 40282 RTP/AVP 0 98 97 105 3 99 8 9 100 102 104 96
c=IN IP4 192.168.22.22
b=TIAS:64000
a=sendrecv
a=rtpmap:0 PCMU/8000
a=rtpmap:98 speex/16000
a=rtpmap:97 speex/8000
a=rtpmap:105 iLBC/8000
a=fmtp:105 mode=30
a=rtpmap:3 GSM/8000
a=rtpmap:99 speex/32000
a=rtpmap:8 PCMA/8000
a=rtpmap:9 G722/8000
a=rtpmap:100 SILK/8000
a=fmtp:100 useinbandfec=0
a=rtpmap:102 SILK/16000
a=fmtp:102 useinbandfec=0
a=rtpmap:104 opus/16000
a=fmtp:104 maxcodedaudiobandwidth=16000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-15
]]>
</send>

<recv response="100" optional="true"/>
<recv response="180" optional="true"/>
<recv response="183" optional="true"/>
<recv response="200" rrs="true"/>
<label id="200ok"/>

<nop>
  <action>
    <assignstr assign_to="url" value="[next_url]" />
    <ereg regexp="sip:([0-9A-Za-z\.]+):([0-9]+)" search_in="var" check_it="true" assign_to="dummy,host,port" variable="url" />
    <setdest host="[$host]" port="[$port]" protocol="UDP" />
  </action>
</nop>
<Reference variables="dummy" /> <!-- ignore dummy variable -->

<send>
<![CDATA[
ACK [next_url] SIP/2.0
[routes]
Route: <sip:[remote_ip]:[remote_port];lr=on>
[last_Via:]
[last_From:]
[last_To:]
[last_Call-ID:]
[last_CSeq:]
Max-Forwards: 70
Content-Length: [len]
]]>
</send>
<pause milliseconds="1000"/>
<send retrans="500">
<![CDATA[
BYE [next_url] SIP/2.0
[routes]
Route: <sip:[remote_ip]:[remote_port];lr=on>
[last_Via:]
[last_To:]
[last_From:]
[last_Call-ID:]
CSeq: [cseq+2] BYE
Contact: sip:[service]@[local_ip]:[local_port]
Content-Length: [len]
]]>
</send>

<recv response="100" optional="true"/>
<recv response="200"/>
</scenario>

I want to know the exact RPS load so that the behavior is controlled.

I tried to fulfill the initial request and copy Proxy-Authorization header to set it up in the first request to avoid re-INVITE. But got "nonce expired" error from the proxy.

So, is it possible to perform something from this?

Maratk1n commented 1 year ago

It works, but maybe there is a better way.

# make a first call and steal an authorization header so that we can authorize the first time
sipp "127.0.0.1:5060" -sf sipp_scenarios/SimpleUACAuth.xml -inf $TEST_AUTH_INFO \
       -s 16504584412 -rsa 127.0.0.1 -nd -m 1
AUTH_HDR=$(grep -o "Proxy-Authorization: .*" $BACK_LOG_FILE | head -1)

TEST_AUTH_INFO=$(mktemp /tmp/test_auth.XXXXXX)
cat <<EOT >> $TEST_AUTH_INFO
[RANDOM]
18885555555*100;[authentication username=88843211 password=SuperPassword];$AUTH_HDR
EOT

# start load
# UACpreAUTH -- scenario with [filed2] in the first INVITE
# [field2] = "Proxy-Authorization: Digest username=..."
sipp -bg "127.0.0.1:5060" -sf $UACpreAUTH -inf $TEST_AUTH_INFO \
       -s 16504584412 -rsa 127.0.0.1 -nd -r 100