On Tue, Mar 13, 2012 at 4:21 PM, Daniel Wong <dw...@netsapiens.com> wrote:

> I'm simulating the UAS side with SIPp.  I'm trying to control SIPp with
> variables such that when the UAS receives INVITE with a special code in the
> "Subject:" header, the header value will trigger a jump to a particular
> label.  For example, if UAS receives INVITE with "Subject: 480", jump to a
> section which sends SIP 480 message back.  I tried the following but it
> doesn't work, even though i'm successfully parsing the Subject: field in
> each incoming INVITE.
> Right now the result i'm getting is it's not branching and it's always
> sending only SIP 480...
>
> Help appreciated.  Thanks!
>
>
>   <recv request="INVITE">
>     <action>
>       <gettimeofday assign_to="sec,msec"/>
>       <ereg regexp=".*" search_in="hdr" header="Subject: " assign_to="1"/>
>       <test assign_to="480" variable="1" compare="equal" value="480"/>
>       <test assign_to="486" variable="1" compare="equal" value="486"/>
>       <log message=""/>
>       <log message="---Testing [$1]---" />
>       <log message="[$sec] RCV: INVITE" />
>     </action>
>   </recv>
>
>   <nop next="send_480" test="480">
>     <action>
>       <log message="checking for 480, got [$1]"/>
>     </action>
>   </nop>
>   <nop next="send_486" test="486">
>     <action>
>       <log message="checking for 486, got [$1]"/>
>     </action>
>   </nop>
>
>   <label id="send_480"/>
>   <send next="end">
>     <![CDATA[
>
>       SIP/2.0 480 Temporarily Unavailable
>       [last_Via:]
>       [last_From:]
>       [last_To:];tag=[call_number]
>       [last_Call-ID:]
>       [last_CSeq:]
>       Contact: <sip:[local_ip]:[local_port];transport=[transport]>
>       Content-Length: [len]
>
>     ]]>
>   </send>
>
>   <label id="send_486"/>
>   <send next="end">
>     <![CDATA[
>
>       SIP/2.0 486 Busy Here
>       [last_Via:]
>       [last_From:]
>       [last_To:];tag=[call_number]
>       [last_Call-ID:]
>       [last_CSeq:]
>       Contact: <sip:[local_ip]:[local_port];transport=[transport]>
>       Content-Length: [len]
>
>     ]]>
>   </send>
>
>   <label id="end"/>
>
> </scenario>
>

One problem that I see is that you are using test/compare. However this
only works with numeric values.
The match found by ereg will be a string (even if it contains only digits),
so you should use strcmp to do the comparison.

regards,
Takeshi
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Sipp-users mailing list
Sipp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sipp-users

Reply via email to