On Tue, Feb 17, 2009 at 5:25 PM, Evgeny Miloslavsky <
[email protected]> wrote:

>  Hi All!
>
> I need to subtract 500ms from Expires header value of SUBSCRIBE received.
>
> I have following statements at my SIPp-UAS-Notifier.xml:
>
> *<recv request="SUBSCRIBE">*
>
> *     <action>*
>
> *        <ereg regexp=".*" search_in="hdr" header="Expires:"
> case_indep="true" assign_to="4"/>*
>
> *        <log message="Expires header value before subtract is: [$4]"/>*
>
> *        <subtract assign_to="4" value="500" />*
>
> *        <log message="Expires header value after subtract is: [$4]"/>*
>
> *     </action>*
>
> At log file I have the following output:
>
> *Expires header value before subtract is:  25000*
>
> *Expires header value after subtract is: -500.000000*
>
> That is while subtracting SIPp somehow understand that variable 4 has value
> 0.
>
> What am I doing wrong?
>
Hello,
since variable 4 was assigned using ereg, it was set to a string. You cannot
perform arithmetic operations on a string. So convert it to a double using:
 <todouble assign_to="4" variable="4" />
After that you will be able perform the subtraction.

Also when injecting the value into a response, you will probably want get
rid of the decimals. To do so, Charles told me we have to use regex to get
only the integer part. If you need, follow this thread:
http://www.mail-archive.com/[email protected]/msg02992.html

Regards,
mayama
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Sipp-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sipp-users

Reply via email to