Running SIPp in 3pcc mode


I was struggling to run SIPp in 3PCC mode for quite some time.
Of course, Googling didn't help much.
Either its working for everyone else, or no one is using it. :)

Anyway, here is The Hitchhiker's Guide to SIPp in 3PCC mode :

Prerequisites:
Install SIPp 3.2 (3.1 has a bug)
Set these system environment variables:
    SIPP_HOME=c:\Program Files\Sipp_3.2
    TERMINFO=<<CYGWIN INSTALL DIRECTORY>>\usr\share\terminfo
Also, add sip_home in PATH to directly run sipp.exe


Running the inbuilt examples:

Open 4 cmd prompts and run these
"c:\Program Files\Sipp_3.2\sipp.exe" -p 5061 -sn 3pcc-A
"c:\Program Files\Sipp_3.2\sipp.exe" -p 5062 -sn 3pcc-B
"c:\Program Files\Sipp_3.2\sipp.exe" -p 5070 -sn 3pcc-C-B -3pcc 127.0.0.1:4000 127.0.0.1:5062
"c:\Program Files\Sipp_3.2\sipp.exe" -p 5071 -sn 3pcc-C-A -3pcc 127.0.0.1:4000 127.0.0.1:5061 (Should be run last)

The Use Case:



Running simple 3pcc case (like above), where only 2 nodes will suffice :

sipp.exe -p 5061 -sf A.xml                                          
sipp.exe -p 5062 -sf B.xml                                          
sipp.exe -p 5070 -3pcc 127.0.0.1:4000 127.0.0.1:5062 -sf ctrlB1.xml 
sipp.exe -p 5071 -3pcc 127.0.0.1:4000 127.0.0.1:5061 -sf ctrlA1.xml  (run last. This is the MASTER)

Here 127.0.0.1:4000 is how the control pair communicates with each other.

Relevant changes in scenario files:

ctrlA.xml
     <sendCmd**DO NOT SPECIFY dest HERE**
           <![CDATA[
                Call-ID: [call_id] **MANDATORY**
                var1: [$2]
           ]]>
     </sendCmd>
     <recvCmd> **DO NOT SPECIFY src HERE**
           <action>
                <ereg regexp="var1: ([^\r\n]*)[\r]?\n" search_in="msg" check_it="true" assign_to="0,1" />
                <log message="Dump:[$0] [$1]" />
           </action>
     </recvCmd>

ctrlB.xml
     <recvCmd> **DO NOT SPECIFY src HERE**
           <action>
                <ereg regexp="var1: ([^\r\n]*)[\r]?\n" search_in="msg" check_it="true" assign_to="0,1" />
                <log message="Dump: [$0] [$1]" />
           </action>
     </recvCmd>
.
.
.
     <sendCmd>**DO NOT SPECIFY dest HERE**
           <![CDATA[
                Call-ID: [call_id] **MANDATORY**
                var1: [$2]
           ]]>
     </sendCmd>



Running 3pcc in Extended Mode, where more than 2 nodes needed:
(Taking the same example as above)

sipp.exe -p 5061 -sf A.xml                                                           
sipp.exe -p 5062 -sf B.xml                                                          
sipp.exe -p 5070 -slave ctrlB  127.0.0.1:5062 -sf ctrlB.xml -slave_cfg clntconfig.txt (there cud be multiple slaves)
sipp.exe -p 5071 -master ctrlA 127.0.0.1:5061 -sf ctrlA.xml -slave_cfg clntconfig.txt (master to run last)

Notes:
-           -  Do not give -3pcc arg
-           - master/-slave is followed by the name
-           Slave_cfg is the file where we specify all the salave(and master)’s name and ip:port
ctrlB;10.2.59.174:8070 (these are different ports from what we give in –p above)
ctrlA;10.2.59.174:8071

Changes in the scenario files:
ctrlA.xml
     <sendCmd dest="ctrlB"**MUST SPECIFY dest HERE(any named slave)**
           <![CDATA[
                From: ctrlA **MANDATORY**
                Call-ID: [call_id] **MANDATORY**
                var1: [$2]
           ]]>
     </sendCmd>
     <recvCmd src="ctrlB"> **MUST SPECIFY src HERE**
           <action>
                <ereg regexp="var1: ([^\r\n]*)[\r]?\n" search_in="msg" check_it="true" assign_to="0,1" />
                <log message="Dump:[$0] [$1]" />
           </action>
     </recvCmd>

ctrlB.xml
     <recvCmd src="ctrlA"> **MUST SPECIFY src HERE. This should match the "From" specified in sendCmd in ctrlA**
           <action>
                <ereg regexp="var1: ([^\r\n]*)[\r]?\n" search_in="msg" check_it="true" assign_to="0,1" />
                <log message="Dump: [$0] [$1]" />
           </action>
     </recvCmd>
.
.
.
     <sendCmd  dest="ctrlA">**MUST SPECIFY dest HERE(need not return back to master..can call another slave)**
           <![CDATA[
                From: ctrlB **MANDATORY**
                Call-ID: [call_id] **MANDATORY**
                var1: [$2]
           ]]>
     </sendCmd>



BONUS

#1 Open all windows in one go
Precede ur commands with start cmd /k in ur batch file and u have all of them opened in separate windows and start running with one click 
start cmd /k "sipp.exe -p 5061 -sn 3pcc-A"
start cmd /k "sipp.exe -p 5062 -sn 3pcc-B"
start cmd /k "sipp.exe -p 5070 -sn 3pcc-C-B -3pcc 127.0.0.1:4000 127.0.0.1:5062"
start cmd /k "sipp.exe -p 5071 -sn 3pcc-C-A -3pcc 127.0.0.1:4000 127.0.0.1:5061"

#2 Background execution for load testing
Run SIPp in background mode for performance testing and grab all the stats in a CSV file 
-bg: background mode
-trace_stat: creates a CSV file with a lot of stat counters including failed calls etc
-trace_screen: dumps whatever we should have seen on screen otherwise
And the other args to control the load(eg –m 10 below runs 10 calls)

sipp.exe -p 5061 -m 10 -sn 3pcc-A -bg -trace_stat -trace_screen
sipp.exe -p 5062 -m 10 -sn 3pcc-B -bg -trace_stat -trace_screen
sipp.exe -p 5070 -m 10 -sn 3pcc-C-B -3pcc 127.0.0.1:4000 127.0.0.1:5062 -bg -trace_stat -trace_screen
sipp.exe -p 5071 -m 10 -sn 3pcc-C-A -3pcc 127.0.0.1:4000 127.0.0.1:5061 -bg -trace_stat -trace_screen

REFERENCE

      SIPp 3PCC Reference
      A.xml
      B.xml
      ctrlA.xml
      ctrlB.xml


That’s it. :)