<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi, Jan!<br>
    <br>
    I am glad you are interested in developing a small feature in
    OpenSIPS, but you should have opened this discussion on the devel
    list[1].<br>
    Your assumption is right, the rtpproxy_offer/answer functions don't
    accept variables as arguments.<br>
    In order to change that, you will have to modify the
    rtpproxy_offer/answer functions interface. Each module has to
    declare a "static cmd_export_t" structure, that contains information
    about the functions the module exports. For nathelper, this
    structure is declared in "modules/nathelper/nathelper.c", line ~430.
    Each function contains the name used in the script, the equivalent C
    function that handles the processing, the number of parameters it
    can take, a fixup function, plus some other information. This fixup
    function is the one that parses the string ("wz$avp(s:mode)" in your
    case), and builds a structure that can be evaluated when the
    function is called. <br>
    If you need an example of how this is done, you can take a look at
    the registrar module. You can find the export structure in
    "modules/registrar/reg_mod.c", line ~138. "save" and "lookup" are
    two functions that accept variables in the second argument (take a
    look at the "registrar_fixup" C function, that parses the 3
    parameters). This approach is also used in textops module for the
    "add_body" function, or "append_hf", "insert_hf", in the exec module
    for all the functions and other places.<br>
    If you need any more help, please send a mail on the devel list.<br>
    <br>
    [1] <a class="moz-txt-link-abbreviated" href="mailto:devel@lists.opensips.org">devel@lists.opensips.org</a><br>
    <br>
    Regards,<br>
    <pre class="moz-signature" cols="72">--
R&#259;zvan Crainea
OpenSIPS Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
    <br>
    On 02/09/2012 12:26 AM, Jan Blom wrote:
    <blockquote
cite="mid:9FB2841AEC9F7345A369F3A9A4BCADE901D103@AMSPRD0502MB116.eurprd05.prod.outlook.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <meta name="Generator" content="Microsoft Word 14 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span lang="EN-US">Hello,<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">I am using OpenSIPS
            1.6.4-2 and rtpproxy 1.2.1. I was trying to use an avp as
            part of the argument to Nathelper&#8217;s rtpproxy_offer() and
            rtpproxy_answer() functions. Like:<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
        <p class="MsoNormal" style="text-indent:65.2pt"><span
            lang="EN-US">rtpproxy_offer("wz$avp(s:mode)");<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">This doesn&#8217;t work and
            results in the following log line:<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
        <p class="MsoNormal" style="text-indent:65.2pt"><span
            lang="EN-US">ERROR:nathelper:force_rtp_proxy_body: unknown
            option `$'<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">I guess these functions
            are not prepared to handle variables as arguments. I would
            like to fix this in the source, but would appreciate some
            pointers on what to actually change. I guess there are
            number of similar places that does this right.<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">Thanks!<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">Best regards,<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">Jan Blom<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></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>
  </body>
</html>