sipp icon indicating copy to clipboard operation
sipp copied to clipboard

Pause variable is not working

Open hmoghani opened this issue 5 years ago • 4 comments

                             Messages  Retrans   Timeout   Unexpected-Msg
          [ NOP ]              
  INVITE ---------->         1         0         0                  
     100 <----------         0         0         0         0        
     180 <----------         0         0         0         0        
     200 <----------         1         0         0         0        
     ACK ---------->         1         0                            
          [ NOP ]              
   Pause [       $1]         1                             0 

it just shows the variable name and adds a $ sign to it. I defined the variable in various ways. with -set, -key and also with assignto inside the xml. none of them worked. I have the latest version SIPp 3.5.2

hmoghani avatar May 16 '19 19:05 hmoghani

hi @hmoghani

to reproduce can u provide your xml and sipp-command?

hagbard-c avatar May 24 '19 19:05 hagbard-c

Hi @hagbard-c Just add this in any scenario:

<recv response="200" rtd="true" >
    <action>
        <ereg regexp=".*" search_in="hdr" header="Expires: " assign_to="expiryTime"/>
    </action>
</recv>
<pause variable="expiryTime" />

Basically, in source code the variable value assignment to pause variable is hard-coded to double(getDouble()). I added a check just before the value is assigned to pause_variable to assign using proper function, as a workaround. Maybe someone with more experience can fix it better. My fix in call.cpp :

 double call::get_rhs(CAction *currentAction)
 {
     if (currentAction->getVarInId()) {
-        return M_callVariableTable->getVar(currentAction->getVarInId())->getDouble();
+        if(M_callVariableTable->getVar(currentAction->getVarInId())->isRegExp())
+            return atof( M_callVariableTable->getVar(currentAction->getVarInId())->getMatchingValue() );
+        else
+            return M_callVariableTable->getVar(currentAction->getVarInId())->getDouble();
     } else {
         return currentAction->getDoubleValue();
     }

rajeshsingh381 avatar Jul 16 '19 08:07 rajeshsingh381

@wdoekes I tried to reproduce the problem on. My goal is to be able to pass the "pause" variable to the sipp via the command. something like this:

sipp -sf register.xml -i 10.0.100.200 10.0.100.100 -inf customers.csv -r 1 -m 1 -t t1 -aa -set expirytime "30000"

or using "-key". I tried that and it didn't work. When I run the scneario with -key or -set it doesn't pass the variable and it instead shows the variable name in front of pause:

                             Messages  Retrans   Timeout   Unexpected-Msg
REGISTER ---------->         0         0         0                  
     401 <----------         0         0         0         0        
REGISTER ---------->         0         0         0                  
   Pause [$expirytime]       0                             0        
     200 <----------         0         0         0         0        

------ [+|-|*|/]: Adjust rate ---- [q]: Soft exit ---- [p]: Pause traffic -----

I attached the xml file I'm using.

register.txt

SIPP version: SIPp v3.5.3-PCAP-RTPSTREAM

hmoghani avatar Oct 07 '19 17:10 hmoghani

Another work around is to add this "todouble" action after assigning a variable using regexp to convert it into a numerical context

<ereg regexp=".*" search_in="hdr" header="someHeader: " assign_to="myVar"/>
<todouble assign_to="myVar" variable="myVar" />

rajeshsingh381 avatar Oct 15 '19 14:10 rajeshsingh381