<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
    <title></title>
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hello Bogdan,<br>
    <br>
    I implemented a similar test function that takes 6 parameters.<br>
    All values seems to be in the correct order in both fixup function
    and triggered function.<br>
    <br>
    I attached a small patch that prints the value of the parameters
    right after the fixup function and then again before the function is
    called.<br>
    <br>
    Please apply this patch and then check if the parameters values and
    order match between the fixup and triggered function?<br>
    <br>
    Regards,<br>
    Razvan<br>
    <br>
    On 04/06/2011 05:51 PM, rad bogdan wrote:
    <blockquote cite="mid:197069.62982.qm@web130224.mail.mud.yahoo.com"
      type="cite">
      <table border="0" cellpadding="0" cellspacing="0">
        <tbody>
          <tr>
            <td style="font: inherit;" valign="top">Hi Bogdan,<br>
              <br>
              The "inversion" is only in the triggered function.<br>
              The arguments are passed correctly from left to right to
              the fixup function.<br>
              <br>
              The triggered function is:<br>
              <br>
              test_function(struct sip_msg *msg, char *arg1, char *arg2,
              char* arg3, char* arg4, char* arg5, char* arg6)<br>
              {<br>
              &nbsp;&nbsp;&nbsp; str arg1_s&nbsp; = {NULL, 0};<br>
              <br>
              &nbsp;&nbsp;&nbsp; if(arg1 == NULL || fixup_get_svalue(msg,
              (gparam_p)arg1, &amp;arg1_s) != 0)<br>
              &nbsp;&nbsp;&nbsp; {<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; LM_ERR("Invalid arg1 argument\n");<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return -1;<br>
              &nbsp;&nbsp;&nbsp; }<br>
              .........<br>
              }<br>
              <br>
              arg1_s.s has the value of arg6_s.s while arg6_s.s has the
              correct value.<br>
              <br>
              Thanks,<br>
              Bogdan<br>
              <br>
              --- On <b>Wed, 4/6/11, Bogdan-Andrei Iancu <i><a class="moz-txt-link-rfc2396E" href="mailto:bogdan@opensips.org">&lt;bogdan@opensips.org&gt;</a></i></b>
              wrote:<br>
              <blockquote style="border-left: 2px solid rgb(16, 16,
                255); margin-left: 5px; padding-left: 5px;"><br>
                From: Bogdan-Andrei Iancu <a class="moz-txt-link-rfc2396E" href="mailto:bogdan@opensips.org">&lt;bogdan@opensips.org&gt;</a><br>
                Subject: Re: [OpenSIPS-Users] function with 6 parameters<br>
                To: "OpenSIPS users mailling list"
                <a class="moz-txt-link-rfc2396E" href="mailto:users@lists.opensips.org">&lt;users@lists.opensips.org&gt;</a><br>
                Cc: "rad bogdan" <a class="moz-txt-link-rfc2396E" href="mailto:bogdan_rad2004@yahoo.com">&lt;bogdan_rad2004@yahoo.com&gt;</a><br>
                Date: Wednesday, April 6, 2011, 5:15 PM<br>
                <br>
                <div id="yiv462067739"> Hi Bogdan,<br>
                  <br>
                  This "inversion" is visible in the fixup function or
                  is the triggered function ?<br>
                  <br>
                  Regards,<br>
                  Bogdan<br>
                  <br>
                  On 04/06/2011 02:44 PM, rad bogdan wrote:
                  <blockquote type="cite">
                    <table border="0" cellpadding="0" cellspacing="0">
                      <tbody>
                        <tr>
                          <td style="font: inherit;" valign="top">Hi
                            everyone,<br>
                            <br>
                            I implemented an OpenSIPS custom module that
                            communicates with an external application.
                            From the routing script I call a function
                            with 6 parameters:<br>
                            <br>
                            test_function('$fU', '$tU', '$ci',
                            '$avp(s:name1)', '$avp(s:name2)',
                            '$var(name3)')<br>
                            <br>
                            The problem is that when the corresponding
                            function is called in C, the first parameter
                            gets the value of the last one.<br>
                            <br>
                            This doesn't happen when the function is
                            made to take 5 parameters.<br>
                            <br>
                            The fixup function that I use is this:<br>
                            <br>
                            static int pvn_fixup_spve_spve_6(void**
                            param, int param_no)<br>
                            {<br>
                            &nbsp;&nbsp;&nbsp; if (!(param_no &gt;= 1 &amp;&amp;
                            param_no &lt;= 6))<br>
                            &nbsp;&nbsp;&nbsp; {<br>
                            &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; LM_ERR("invalid parameter number
                            %d\n", param_no);<br>
                            &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return E_UNSPEC;<br>
                            &nbsp;&nbsp;&nbsp; }<br>
                            &nbsp;&nbsp;&nbsp; <br>
                            &nbsp;&nbsp;&nbsp; return fixup_spve(param);<br>
                            }<br>
                            <br>
                            Is there something wrong with it or the
                            problem is elsewhere ?<br>
                            <br>
                            Thanks,<br>
                            Bogdan<br>
                          </td>
                        </tr>
                      </tbody>
                    </table>
                    <pre><fieldset class="yiv462067739mimeAttachmentHeader"></fieldset>
_______________________________________________
Users mailing list
<a moz-do-not-send="true" rel="nofollow" class="yiv462067739moz-txt-link-abbreviated" ymailto="mailto:Users@lists.opensips.org" target="_blank" href="/mc/compose?to=Users@lists.opensips.org">Users@lists.opensips.org</a>
<a moz-do-not-send="true" rel="nofollow" class="yiv462067739moz-txt-link-freetext" target="_blank" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
                  </blockquote>
                  <br>
                  <br>
                  <pre class="yiv462067739moz-signature">-- 
Bogdan-Andrei Iancu
OpenSIPS eBootcamp - 2nd of May 2011
OpenSIPS solutions and "know-how"</pre>
                </div>
              </blockquote>
            </td>
          </tr>
        </tbody>
      </table>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
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>
  </body>
</html>