<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix"><tt>Hi, James!<br>
        <br>
        I am not sure what exactly is the problem, but I have an
        assumption. When the scenario was failing, where exactly was the
        $avp(jimmy) first declared? Inside the LUA script? Is it now
        first declared in OpenSIPS?<br>
        Is there any chance you could reproduce this issue again in full
        debugging?<br>
        <br>
        Regards,<br>
      </tt>
      <pre class="moz-signature" cols="72">Razvan Crainea
OpenSIPS Core Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a>
</pre>
      On 06/15/2012 12:30 AM, Gledhill, James wrote:<br>
    </div>
    <blockquote
cite="mid:A671FCA12875564E8CC11878981732BB1577FBBA@mse2be2.mse2.exchange.ms"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator" content="Microsoft Word 11 (filtered
        medium)">
      <!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
      <style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:Arial;
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
 /* List Definitions */
 @list l0
        {mso-list-id:1125083363;
        mso-list-type:hybrid;
        mso-list-template-ids:1111262430 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:.5in;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l0:level2
        {mso-level-tab-stop:1.0in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level3
        {mso-level-tab-stop:1.5in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level4
        {mso-level-tab-stop:2.0in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level5
        {mso-level-tab-stop:2.5in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level6
        {mso-level-tab-stop:3.0in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level7
        {mso-level-tab-stop:3.5in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level8
        {mso-level-tab-stop:4.0in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level9
        {mso-level-tab-stop:4.5in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1
        {mso-list-id:1360397260;
        mso-list-template-ids:-1635618030;}
@list l1:level1
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:.5in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Symbol;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
-->
</style>
      <div class="Section1">
        <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
              style="font-size:
              10.0pt;font-family:Arial;color:navy">I made a few more
              changes to my code and
              tested some more and now the problem has gone away and I
              can no longer
              replicate it.  Perhaps it is just something I do not fully
              understand
              about AVPs or opensips or the lua implementation.   I was
              able to
              reproduce it 100% of the time for a while, but now can not
              – strange!<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
              style="font-size:
              10.0pt;font-family:Arial;color:navy"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
              style="font-size:
              10.0pt;font-family:Arial;color:navy">Any thoughts what
              happened in the original
              post?<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
              style="font-size:
              10.0pt;font-family:Arial;color:navy"><o:p> </o:p></span></font></p>
        <div>
          <div class="MsoNormal" style="text-align:center"
            align="center"><font face="Times New Roman" size="3"><span
                style="font-size:12.0pt">
                <hr tabindex="-1" align="center" size="2" width="100%">
              </span></font></div>
          <p class="MsoNormal"><b><font face="Tahoma" size="2"><span
                  style="font-size:10.0pt;
                  font-family:Tahoma;font-weight:bold">From:</span></font></b><font
              face="Tahoma" size="2"><span
                style="font-size:10.0pt;font-family:Tahoma">
                <a class="moz-txt-link-abbreviated" href="mailto:users-bounces@lists.opensips.org">users-bounces@lists.opensips.org</a>
                [<a class="moz-txt-link-freetext" href="mailto:users-bounces@lists.opensips.org">mailto:users-bounces@lists.opensips.org</a>] <b><span
                    style="font-weight:bold">On Behalf Of </span></b>Gledhill,
                James<br>
                <b><span style="font-weight:bold">Sent:</span></b>
                Thursday, June 14, 2012 3:54
                PM<br>
                <b><span style="font-weight:bold">To:</span></b>
                <a class="moz-txt-link-abbreviated" href="mailto:users@lists.opensips.org">users@lists.opensips.org</a><br>
                <b><span style="font-weight:bold">Subject:</span></b>
                [OpenSIPS-Users] LUA AVP
                issue?</span></font><o:p></o:p></p>
        </div>
        <p class="MsoNormal"><font face="Times New Roman" size="3"><span
              style="font-size:
              12.0pt"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">I am testing the Lua module in hopes of
              being able to use it
              more later, but am coming across some strange things.<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">Is this the best place to ask about
              it?  If not point
              me in the right direction. <o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">AVP_set or AVP_get (in Lua module) seem
              to be getting data
              for/from other AVP(s).<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">I have included enough code from
              opensips.cfg and the lua
              file to be able to replicate this problem.  It happens
              100% of the time. <o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial"> I am using <o:p></o:p></span></font></p>
        <ul style="margin-top:0in" type="disc">
          <li class="MsoNormal" style="mso-list:l0 level1 lfo3"><font
              face="Arial" size="2"><span
                style="font-size:10.0pt;font-family:Arial">opensips 1.8<o:p></o:p></span></font></li>
          <li class="MsoNormal" style="mso-list:l0 level1 lfo3"><font
              face="Arial" size="2"><span
                style="font-size:10.0pt;font-family:Arial">CentOS 5.8<o:p></o:p></span></font></li>
          <li class="MsoNormal" style="mso-list:l0 level1 lfo3"><font
              face="Arial" size="2"><span
                style="font-size:10.0pt;font-family:Arial">Lua 5.1.4<o:p></o:p></span></font></li>
        </ul>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">=============<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">Opensips.cfg (partial file)<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">=============<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">## route[INVITE] is called for all
              invites – simple
              way to test </span></font><font face="Wingdings" size="2"><span
              style="font-size:
              10.0pt;font-family:Wingdings">J</span></font><font
            face="Arial" size="2"><span
              style="font-size:10.0pt;font-family:Arial"><o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">route[INVITE] {<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">    xlog("In route_INVITE\n");<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">    $avp(abcde) = "bean";<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">    xlog("** ** avp(abcde) =
              $avp(abcde)\n");<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">    if ( lua_exec("invite") )
              {     ## call the invite method in lua file<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">       
              xlog("lua_exec returned TRUE\n");<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">    } else {<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">       
              xlog("lua_exec returned not true\n");<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">    }<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">    xlog("** ** avp(jimmy) =
              $avp(jimmy)\n");    ## this avp is reporting the value set
              in lua to another avp … WHY?<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">    sl_send_reply("486", "I am
              not answering now!");<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">    exit;<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">}<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">=============<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">Lua (partial file)<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">=============<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">function invite(param)<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">   
              xlog("**********     ---&gt;  INVITE test from
              lua -- getpid =" .. getpid() .. "\n");<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">    -- AVP_get("jimmy") returns a null
              because it is not set - this is expected.<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">   
              xlog("**********     ---&gt;  INVITE test from
              lua -- AVP_get(jimmy) =" .. tostring(AVP_get("jimmy")) ..
              "\n");<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">   
              AVP_set("bingo","Old_mcDonald");<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">   
              xlog("**********     ---&gt;  INVITE test from
              lua -- AVP_get(bingo) =" .. tostring(AVP_get("bingo")) ..
              "\n");<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">   
              xlog("**********     ---&gt;  INVITE test from
              lua -- AVP_get(abcde) =" .. tostring(AVP_get("abcde")) ..
              "\n");<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">   
              xlog("**********     ---&gt;  INVITE test from
              lua -- AVP_get(fred) =" .. tostring(AVP_get("fred")) ..
              "\n");<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font color="red" face="Arial" size="2"><span
              style="font-size:
              10.0pt;font-family:Arial;color:red">    -- NOW …
              AVP_get("jimmy")  returns "Old_mcDonald" which is what
              "bingo" is set to .. WHY IS avp(jimmy) returning this?<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font color="red" face="Arial" size="2"><span
              style="font-size:
              10.0pt;font-family:Arial;color:red">   
              xlog("**********     ---&gt;  INVITE test from
              lua -- AVP_get(jimmy) =" .. tostring(AVP_get("jimmy")) ..
              "\n");<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">   
              xlog("**********     ---&gt;  INVITE test from
              lua -- filemtime =" .. filemtime("/root/foo.dump") ..
              "\n");<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">    return 0;<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">end<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">=============<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">Output<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">=============<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">In route_INVITE<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">** ** avp(abcde) = bean<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">siplua: **********     ---&gt;  INVITE
              test from lua -- getpid =6269<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">siplua: **********     ---&gt; 
              INVITE test from lua -- AVP_get(jimmy) =nil<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">siplua: **********     ---&gt; 
              INVITE test from lua -- AVP_get(bingo) =Old_mcDonald<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">siplua: **********     ---&gt; 
              INVITE test from lua -- AVP_get(abcde) =bean<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">siplua: **********     ---&gt; 
              INVITE test from lua -- AVP_get(fred) =nil<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font color="red" face="Arial" size="2"><span
              style="font-size:
              10.0pt;font-family:Arial;color:red">siplua: **********    
              ---&gt;  INVITE test from lua -- AVP_get(jimmy)
              =Old_mcDonald
                &lt;&lt;HOW/WHY is this getting set?&gt;&gt;<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">siplua: **********     ---&gt; 
              INVITE test from lua -- filemtime =1277825218<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">lua_exec returned TRUE<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font color="red" face="Arial" size="2"><span
              style="font-size:
              10.0pt;font-family:Arial;color:red">** ** avp(jimmy) =
              Old_mcDonald<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial"><o:p> </o:p></span></font></p>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
    <br>
  </body>
</html>