Hi all,
I want to put the value of variable (like value of variable 1 ) into regular
expression to check whether it is present in header fields like To, From,
Contact or not but the value of variable is not getting assign to the
regular expression.

The following code I have tried:

<recv request="INVITE" optional="false">
<action>
<assignstr assign_to="1" value="[field0]"/>                     
<todouble assign_to="1" variable="1"/>
<ereg regexp="[$1]" search_in="hdr" header="From:" check_it="true"
assign_to="2" />                        
<log message="value of regex : [$2]"/>
</action>
</recv>

filed0 value can contain 7777454309 or <sip:[EMAIL PROTECTED]> (anything)
and variable 1 is getting loaded with field0 value but it is showing
following error: 
2008-02-27      05:13:22:622    1204114402.622078: Failed regexp match:
looking in ' "sumit"<sip:[EMAIL PROTECTED]>', with regexp '[$1]'

I have also tried in this way,
<ereg regexp=[$1] search_in="hdr" header="From:" check_it="true"
assign_to="2" />        

But still I m getting the error.

Please help me out.

Thanks and Regards

SUMEET 



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Charles P
Wright
Sent: Tuesday, February 26, 2008 9:37 PM
To: Niven N
Cc: [email protected]
Subject: Re: [Sipp-users] Conditional Brancing using test

Niven,

I am glad that this works for you.  I am Cc:ing the list so that others 
will know about this in the future.

Charles

"Niven N" <[EMAIL PROTECTED]> wrote on 02/26/2008 11:04:55 AM:

> Hello Charles,
> Thank you very much for the help. It is working perfectly as I 
> wanted. I have changed the assign statement as follows....
>   <nop>
>       <action>
>             <!-- Assign the value in field5 of the CSV file to a $1 -->
>             <assignstr assign_to="1" value="[field5]"/>
>             <todouble assign_to="1" variable="1"/>
>             <log message="value of variable 1 is : [$1]"/>
>       </actions>
>   </nop>
> I have tested all the possible cases and it works fine.
> 
> Thanks again !
> Niven.
> 
> 
> 
> On Tue, Feb 26, 2008 at 10:16 AM, Charles P Wright <[EMAIL PROTECTED]
> > wrote:
> Niven,
> 
> Try inserting a todouble after the assignstr and see if that makes a
> difference.  You won't be able to properly compare a string and a 
number.
> 
> Charles
> 
> "Niven N" <[EMAIL PROTECTED]> wrote on 02/26/2008 09:48:45 AM:
> 
> > Thanks for your immediate response.
> > Yes, the log has the correct value of the variable $1.
> > Actually the value of Variable $1 would take a value from 0 to 60
> > and I am writing this scenario for handling options timer
> >
> > Hence in my scenario I have specified that
> >     UAC                            Server UAS
> >
> > ------- INVITE --------->
> > <------100 Trying ------
> > <------180 Ringing------
> > <------200 OK ----------
> >  <nop>
> >      <action>
> >            <!-- Assign the value in field5 of the CSV file to a $1 -->
> >            <assignstr assign_to="1" value="[field5]"/>
> >            <log message="value of variable 1 is : [$1]"/>
> >      </actions>
> >  </nop>
> >
> >  <nop>
> >      <action>
> >            <test assign_to="2" variable="1" compare="equal" 
value="0"/>
> >            <log message="value of variable 1 is : [$1]"/>
> >            <log message="value of variable 2 is : [$2]"/>
> >      </actions>
> >  </nop>
> >
> > -------ACK-------->
> > Send ACK next="1" test="2
> >
> > <label id="2"/>
> >      <recv request="OPTIONS" crlf="true">
> >      </recv>
> >  <nop>
> >      <action>
> >            <test assign_to="3" variable="1" compare="greater_than"
> value="0"/>
> >            <log message="value of variable 1 is : [$1]"/>
> >            <log message="value of variable 2 is : [$2]"/>
> >            <log message="value of variable 3 is : [$3]"/>
> >      </actions>
> >  </nop>
> >
> > ---------200 OK ------->
> > <Send 200 OK next="2" test="3">
> > Message
> > </send>
> >
> > <label id="1"/>
> >    <pause  X milliseconds/>
> >
> > ---BYE----->
> >
> > The Server sends OPTIONS message every 2 min, and the UAC should
> > support this, so I have made the scenario in such a way that when
> > the call is more than 2 min then wait until I receive the OPTIONS
> > message  and send a BYE.When call duration is more than 6 min then I
> > have to wait until I receive 3 OPTIONS message before I send a bye.
> >
> > I have taken the Call duration in a variable dur and calculated the
> > remainder and  Quotient when I divided it by 120 seconds.
> > The remainder goes in variable X and Quotient in Field5.
> >
> > And I always see that the Variable $2 is always set to TRUE, hence I
> > wanted to know if there was something wrong with the scenario I have
> written.
> >
> > Thanks in advance,
> > Kind reagrds,
> > NIven
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Tue, Feb 26, 2008 at 8:42 AM, Charles P Wright 
<[EMAIL PROTECTED]>
> wrote:
> > IIRC, the test will only be evaluated after you send the ACK.
> >
> > Does the log actually have the correct values of $1?  Also, for string
> > comparison you should try using strcmp.  If you know that the field5 
is
> > always 0 or 1 you can use todouble after the assignstr:
> > <todouble assign_to="1" variable="1" />
> >
> > Charles
> >
> > [EMAIL PROTECTED] wrote on 02/26/2008 08:35:34
> AM:
> >
> > > Hello,
> > > I am using test to check a variable 1 and set variable 2 if the
> > > condition is satisfied as follows...
> > > <nop>
> > >     <action>
> > >           <!-- Assign the value in field5 of the CSV file to a $1 
-->
> > >           <assignstr assign_to="1" value="[field5]"/>
> > >           <log message="value of variable 1 is : [$1]"/>
> > >     </actions>
> > > </nop>
> > >
> > > <nop>
> > >     <action>
> > >           <test assign_to="2" variable="1" compare="equal" 
value="0"/>
> > >           <log message="value of variable 1 is : [$1]"/>
> > >           <log message="value of variable 2 is : [$2]"/>
> > >     </actions>
> > > </nop>
> > >
> > > And in the next line of the scenario checks on this variable 2
> > >
> > >   <send next="1" test="2">
> > >     <![CDATA[
> > >       ACK sip:[EMAIL PROTECTED]:[field4] SIP/2.0
> > >       Via: SIP/2.0/[transport] 
[local_ip]:[local_port];branch=[branch]
> > >       From: [field1] <sip:[EMAIL PROTECTED]:[local_port]>;
> > > tag=[pid]SIPpTag09[call_number]
> > >       To: sut <sip:[EMAIL PROTECTED]:[field4]>[peer_tag_param]
> > >       Call-ID: [call_id]
> > >       CSeq: 1 ACK
> > >       Contact: sip:[EMAIL PROTECTED]:[local_port]
> > >       Max-Forwards: 70
> > >       Subject: Performance Test
> > >       Content-Length: 0
> > >     ]]>
> > >   </send>
> > > When the value of the variable $1 is "0" or "1" , the variable $2 is
> > > always set to TRUE and it is going to Label 1 always.
> > >
> > > Can somebody let me know if there is something wrong with my 
scenario.
> > >
> > > Thanks in advance,
> > > Kind regards,
> > > Niven.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > <nop>
> > > <action>
> > > <!-- Assign the value in field0 of the CSV file to a $1. -->
> > > <assignstr assign_to="1" value="[field5]" />
> > > </action>
> > > </nop>
> > >
> >
> 
-------------------------------------------------------------------------
> > > This SF.net email is sponsored by: Microsoft
> > > Defy all challenges. Microsoft(R) Visual Studio 2008.
> > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> > > _______________________________________________
> > > Sipp-users mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/sipp-users


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Sipp-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sipp-users


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Sipp-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sipp-users

Reply via email to