<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    On 9/8/11 6:30 PM, Carlos Ruiz Diaz wrote:
    <blockquote
cite="mid:CA+3gBcki8nHy9Etz4KEQF8pAAUYODxW-kWP6Z2R-2QcetbwzuA@mail.gmail.com"
      type="cite">
      <meta http-equiv="content-type" content="text/html;
        charset=ISO-8859-1">
      <span class="Apple-style-span" style="border-collapse: collapse;
        font-family: arial,sans-serif; font-size: 13px;">Hello.
        <div><br>
        </div>
        <div>I'm currently developing an OpenSER module which does some
          business logic for the company I work for. For compatibility
          reasons we are working with&nbsp;openser-1.2.2-tls and we haven't
          been able to upgrade to newer version yet.</div>
        <div><br>
        </div>
        <div>In one block of the code I have to read an avp which is
          written inside the openser.cfg script using:</div>
        <div><br>
        </div>
        <div>OPENSER:</div>
        <div>avp_copy(<a class="moz-txt-link-rfc2396E" href="sip:123@123.123.123:5060">"sip:123@123.123.123:5060"</a>,
          "$avp(s:selectedroute)/g");&nbsp;</div>
        <div><br>
        </div>
        <div>C CODE:</div>
        <div>
          <div>if (is_response &amp;&amp; is_invite_seq)</div>
          <div>{</div>
          <div><span style="white-space: pre-wrap; "> </span>struct
            usr_avp* destavp&nbsp;<span style="white-space: pre-wrap; "> </span>=
            NULL;</div>
          <div><span style="white-space: pre-wrap; "> </span>int_str
            destval;</div>
          <div><span style="white-space: pre-wrap; "> </span>const str
            selected_route&nbsp;<span style="white-space: pre-wrap; "> </span>=
            { "selectedroute", 13 };</div>
          <div><span style="white-space: pre-wrap; "> </span>int
            attempts = 1, max_attempts = 3;</div>
          <div><br>
          </div>
          <div><span style="white-space: pre-wrap; "> </span><span
              style="white-space: pre-wrap; ">for ( destavp =
              search_first_avp(AVP_NAME_STR | AVP_VAL_STR, (int_str)
              selected_route, NULL, 0); destavp != NULL; destavp =
              search_next_avp(destavp, NULL) ) { get_avp_val(destavp,
              &amp;destval); }</span></div>
        </div>
        <div>}</div>
        <div><br>
        </div>
        <div>The problem is that "selectedroute" avp cannot be found so
          I can't read its value. This happens sporadically and most of
          the time the code works just fine.&nbsp;</div>
        <div><br>
        </div>
        <div>I also checked for the list of available AVPs using
          get_avp_list() but it reports an empty list.&nbsp;</div>
        <div><br>
        </div>
        <div>Is there another way to read AVPs or is there something I'm
          missing which is causing this problem? <br>
        </div>
      </span></blockquote>
    If the avp list is null inside C code, then the avp was not added.
    Do you see any error message in syslog related to avp_copy()?<br>
    <br>
    After avp copy, do a xlog(..) line printing the avp, if it is
    printed in syslog and you don't get it in C, then would be very
    strange...<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <blockquote
cite="mid:CA+3gBcki8nHy9Etz4KEQF8pAAUYODxW-kWP6Z2R-2QcetbwzuA@mail.gmail.com"
      type="cite"><span class="Apple-style-span" style="border-collapse:
        collapse; font-family: arial, sans-serif; font-size: 13px; ">
        <div><br>
        </div>
        <div>Any help will be appreciated.</div>
        <div><br>
        </div>
        <div>Thanks in advance!</div>
        <div><br>
        </div>
        <font color="#888888">
          <div>Carlos.</div>
        </font></span>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
Kamailio Advanced Training, Oct 10-13, Berlin: <a class="moz-txt-link-freetext" href="http://asipto.com/u/kat">http://asipto.com/u/kat</a>
<a class="moz-txt-link-freetext" href="http://linkedin.com/in/miconda">http://linkedin.com/in/miconda</a> -- <a class="moz-txt-link-freetext" href="http://twitter.com/miconda">http://twitter.com/miconda</a></pre>
  </body>
</html>