Hi

I am having an issue with the Async module. 

The async_route function doesn't seem able to take a dynamic value as is it's duration.

The module docs states:  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.

Docs here: http://kamailio.org/docs/modules/4.2.x/modules/async.html#async.f.async_route

However when I try:

async_route("WITHINDLG_DELAYED", $avp(buffer_duration) );

I get the following error when trying to restart kamailio:

parse error in config file /etc/kamailio/switchsoftk
amailio/includes/deployments/develop/callprocessing/../../../default.cfg, line 866, column 41-61: function async_route: parameter 2 is not constant ... failed!

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).

Perl gives:

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.
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?

I have gotten around this issue with a large if else structure like the following:

if ($avp(buffer_duration) == 1) {
  async_route("WITHINDLG_DELAYED", 1);
} else if ($avp(buffer_duration) == 2) {
  async_route("WITHINDLG_DELAYED", 2);
.........

This is messy but works for us.

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.

All the best.

Will Ferrer

Switchsoft