<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/4.6.2">
</HEAD>
<BODY>
Hi,<BR>
<BR>
Has anyone got any ideas about this, because it has me very confused.<BR>
<BR>
Peter<BR>
<BR>
On Wed, 2013-02-06 at 16:28 +0000, Peter Dunkley wrote:<BR>
<BLOCKQUOTE TYPE=CITE>
    Possible - but the inside the MSRP function the pv_get_intstrval() function is used, so in both the examples from my email I would expect $msrp(code) to resolve to an integer with a value of 200.<BR>
    <BR>
    Regards,<BR>
    <BR>
    Peter<BR>
    <BR>
    On Wed, 2013-02-06 at 14:09 -0200, Edson - Lists wrote: 
    <BLOCKQUOTE TYPE=CITE>
<PRE>
Just a guess....

hex('\n') =&gt; 0x0a or '10'

So, 10200 = concat('10','200')... don't know why... but that's a hint...

Edson.

Em 06/02/2013 14:03, Peter Dunkley escreveu:
<FONT COLOR="#737373">&gt;</FONT>
<FONT COLOR="#737373">&gt; I am having strange behaviour with $msrp(code).</FONT>
<FONT COLOR="#737373">&gt;</FONT>
<FONT COLOR="#737373">&gt; The following config. fragment:</FONT>
<FONT COLOR="#737373">&gt;</FONT>
<FONT COLOR="#737373">&gt;          if (msrp_is_reply()) {</FONT>
<FONT COLOR="#737373">&gt;                  xlog(&quot;Code: $msrp(code)\n&quot;);</FONT>
<FONT COLOR="#737373">&gt;                  if ($msrp(code) &lt; 300) {</FONT>
<FONT COLOR="#737373">&gt;                          xlog(&quot;Received OK MSRP reply\n&quot;);</FONT>
<FONT COLOR="#737373">&gt;                  } else {</FONT>
<FONT COLOR="#737373">&gt;                          xlog(&quot;Received failure MSRP reply\n&quot;);</FONT>
<FONT COLOR="#737373">&gt;                  }</FONT>
<FONT COLOR="#737373">&gt;</FONT>
<FONT COLOR="#737373">&gt;</FONT>
<FONT COLOR="#737373">&gt; Produces the following output:</FONT>
<FONT COLOR="#737373">&gt;</FONT>
<FONT COLOR="#737373">&gt;     Feb  6 15:55:02 blade14 /usr/sbin/kamailio[3831]: ERROR: &lt;script&gt;: Code: 200</FONT>
<FONT COLOR="#737373">&gt;     Feb  6 15:55:02 blade14 /usr/sbin/kamailio[3831]: ERROR: &lt;script&gt;: Received failure MSRP reply</FONT>
<FONT COLOR="#737373">&gt;</FONT>
<FONT COLOR="#737373">&gt;</FONT>
<FONT COLOR="#737373">&gt; Which I can't explain as 200 is clearly less than 300.</FONT>
<FONT COLOR="#737373">&gt;</FONT>
<FONT COLOR="#737373">&gt; It gets even stranger when I change the config. to this:</FONT>
<FONT COLOR="#737373">&gt;</FONT>
<FONT COLOR="#737373">&gt;          if (msrp_is_reply()) {</FONT>
<FONT COLOR="#737373">&gt;                 $var(tmp) = $msrp(code)</FONT>
<FONT COLOR="#737373">&gt;                  xlog(&quot;Code: $var(tmp)\n&quot;);</FONT>
<FONT COLOR="#737373">&gt;                  if ($var(tmp) &lt; 300) {</FONT>
<FONT COLOR="#737373">&gt;                          xlog(&quot;Received OK MSRP reply\n&quot;);</FONT>
<FONT COLOR="#737373">&gt;                  } else {</FONT>
<FONT COLOR="#737373">&gt;                          xlog(&quot;Received failure MSRP reply\n&quot;);</FONT>
<FONT COLOR="#737373">&gt;                  }</FONT>
<FONT COLOR="#737373">&gt;</FONT>
<FONT COLOR="#737373">&gt;</FONT>
<FONT COLOR="#737373">&gt; And this is the output:</FONT>
<FONT COLOR="#737373">&gt;</FONT>
<FONT COLOR="#737373">&gt;     Feb  6 15:56:17 blade14 /usr/sbin/kamailio[3831]: ERROR: &lt;script&gt;: Code: 10200</FONT>
<FONT COLOR="#737373">&gt;     Feb  6 15:56:17 blade14 /usr/sbin/kamailio[3831]: ERROR: &lt;script&gt;: Received failure MSRP reply</FONT>
<FONT COLOR="#737373">&gt;</FONT>
<FONT COLOR="#737373">&gt;</FONT>
<FONT COLOR="#737373">&gt; The MSRP response here was a 200 OK.  So where did the 10200 come from?</FONT>
<FONT COLOR="#737373">&gt;</FONT>
<FONT COLOR="#737373">&gt;</FONT>
<FONT COLOR="#737373">&gt; Regards,</FONT>
<FONT COLOR="#737373">&gt;</FONT>
<FONT COLOR="#737373">&gt; Peter</FONT>
<FONT COLOR="#737373">&gt;</FONT>
<FONT COLOR="#737373">&gt; --</FONT>
<FONT COLOR="#737373">&gt; Peter Dunkley</FONT>
<FONT COLOR="#737373">&gt; Technical Director</FONT>
<FONT COLOR="#737373">&gt; Crocodile RCS Ltd</FONT>
<FONT COLOR="#737373">&gt;</FONT>
<FONT COLOR="#737373">&gt;</FONT>
<FONT COLOR="#737373">&gt;</FONT>
<FONT COLOR="#737373">&gt; _______________________________________________</FONT>
<FONT COLOR="#737373">&gt; sr-dev mailing list</FONT>
<FONT COLOR="#737373">&gt; <A HREF="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</A></FONT>
<FONT COLOR="#737373">&gt; <A HREF="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</A></FONT>
<FONT COLOR="#737373">&gt;</FONT>
</PRE>
    </BLOCKQUOTE>
    <BR>
    <TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<PRE>
_______________________________________________
sr-dev mailing list
<A HREF="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</A>
<A HREF="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</A>

</PRE>
</TD>
</TR>
</TABLE>
</BLOCKQUOTE>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<PRE>
-- 
Peter Dunkley
Technical Director
Crocodile RCS Ltd
</PRE>
</TD>
</TR>
</TABLE>
<BR>
</BODY>
</HTML>