<div dir="ltr">Hi Daniel<div><br></div><div>Thanks very much for the response.</div><div><br></div><div>I tried this:</div><div><br></div><div><div>$var(buffer_duration) = $avp(buffer_duration);</div><div>async_route("WITHINDLG_DELAYED", "$var(buffer_duration)");</div></div><div><br></div><div>It worked! I guess it needed to be in quotes.</div><div><br></div><div>Thanks much as always.</div><div><br></div><div>Will</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 28, 2015 at 5:55 AM, Daniel-Constantin Mierla <span dir="ltr"><<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    can you put the second parameter in between double quotes?<br>
    <br>
    I checked the sources and the second parameter can be specified as
    variable.<br>
    <br>
    Cheers,<br>
    Daniel<div><div class="h5"><br>
    <br>
    <div>On 28/01/15 06:22, Will Ferrer wrote:<br>
    </div>
    </div></div><blockquote type="cite"><div><div class="h5">
      <div dir="ltr">
        <div>Hi</div>
        <div><br>
        </div>
        <div>I am having an issue with the Async module. </div>
        <div><br>
        </div>
        <div>The async_route function doesn't seem able to take a
          dynamic value as is it's duration.</div>
        <div><br>
        </div>
        <div>The module docs states:  <span style="color:rgb(0,0,0);font-family:Helvetica,Arial;font-size:12px;text-align:justify">The
            sleep parameter represent the number of seconds to suspend
            the processing of a SIP request. Maximum value is 100. The
            parameter can be a static integer or a variable holding an
            integer.</span></div>
        <div><span style="color:rgb(0,0,0);font-family:Helvetica,Arial;font-size:12px;text-align:justify"><br>
          </span></div>
        <div><span style="color:rgb(0,0,0);font-family:Helvetica,Arial;font-size:12px;text-align:justify">Docs
            here: </span><font color="#000000" face="Helvetica, Arial"><span style="font-size:12px"><a href="http://kamailio.org/docs/modules/4.2.x/modules/async.html#async.f.async_route" target="_blank">http://kamailio.org/docs/modules/4.2.x/modules/async.html#async.f.async_route</a></span></font></div>
        <div><font color="#000000" face="Helvetica, Arial"><span style="font-size:12px"><br>
            </span></font></div>
        <div><span style="color:rgb(0,0,0);font-family:Helvetica,Arial;font-size:12px;text-align:justify">However
            when I try:</span></div>
        <div><br>
        </div>
        <div>
          <div>async_route("WITHINDLG_DELAYED", $avp(buffer_duration) );</div>
        </div>
        <div><br>
        </div>
        <div>I get the following error when trying to restart kamailio:</div>
        <div><br>
        </div>
        <div>parse error in config file /etc/kamailio/switchsoftk</div>
        <div>amailio/includes/deployments/develop/callprocessing/../../../default.cfg,
          line 866, column 41-61: function async_route: parameter 2 is
          not constant ... failed!</div>
        <div><br>
        </div>
        <div>I also tried with $var instead of an AVP, and even tried
          having perl call the function (since we have gotten around
          this sort of limitation in the past using perl).</div>
        <div><br>
        </div>
        <div>Perl gives:</div>
        <div><br>
        </div>
        <div>
          <div>
            <div style="font-size:12.8000001907349px">Jan 24 03:27:07
              develop-callprocessing /usr/sbin/kamailio[1424]: ERROR:
              app_perl [kamailioxs.xs:289]: moduleFunc(): Module
              function 'async_route' is unsafe. Call is refused.</div>
            <div style="font-size:12.8000001907349px">Jan 24 03:27:07
              develop-callprocessing /usr/sbin/kamailio[1424]: ERROR:
              app_perl [kamailioxs.xs:986]:
              XS_Kamailio__Message_moduleFunction(): calling module
              function 'async_route' failed. Missing loadmodule?</div>
            <div style="font-size:12.8000001907349px"><br>
            </div>
            <div style="font-size:12.8000001907349px">I have gotten
              around this issue with a large if else structure like the
              following:</div>
            <div style="font-size:12.8000001907349px"><br>
            </div>
            <div>
              <div><span style="font-size:12.8000001907349px">if
                  ($avp(buffer_duration) == 1) {</span></div>
              <div><span style="font-size:12.8000001907349px"> 
                  async_route("WITHINDLG_DELAYED", 1);</span></div>
              <div><span style="font-size:12.8000001907349px">}
                  else if ($avp(buffer_duration) == 2) {</span></div>
              <div><span style="font-size:12.8000001907349px"><span style="white-space:pre-wrap">  </span>async_route("WITHINDLG_DELAYED",
                  2);</span></div>
              <div><span style="font-size:12.8000001907349px">.........</span></div>
              <div><span style="font-size:12.8000001907349px"><br>
                </span></div>
              <div><span style="font-size:12.8000001907349px">This
                  is messy but works for us.</span></div>
              <div><span style="font-size:12.8000001907349px"><br>
                </span></div>
              <div><span style="font-size:12.8000001907349px">The
                  bug is not blocking our progress due to this work
                  around but I wanted to post it any way incase it helps
                  improve the module.</span></div>
              <div><span style="font-size:12.8000001907349px"><br>
                </span></div>
              <div><span style="font-size:12.8000001907349px">All
                  the best.</span></div>
              <div><span style="font-size:12.8000001907349px"><br>
                </span></div>
              <div><span style="font-size:12.8000001907349px">Will
                  Ferrer</span></div>
              <div><span style="font-size:12.8000001907349px"><br>
                </span></div>
              <div><span style="font-size:12.8000001907349px">Switchsoft</span></div>
              <div><span style="font-size:12.8000001907349px"><br>
                </span></div>
              <div><span style="font-size:12.8000001907349px"><br>
                </span></div>
            </div>
          </div>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>
          <div><br>
          </div>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><span class="HOEnZb"><font color="#888888">
</font></span></pre><span class="HOEnZb"><font color="#888888">
    </font></span></blockquote><span class="HOEnZb"><font color="#888888">
    <br>
    <pre cols="72">-- 
Daniel-Constantin Mierla
<a href="http://twitter.com/#!/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a></pre>
  </font></span></div>

<br>_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br></blockquote></div><br></div>