[OpenSIPS-Users] How to delay a branch

ryan embgrets rembgrets at gmail.com
Mon Jul 13 13:02:36 EST 2020


Greetings,

I am using mid-registrar module to bind multiple devices to a single AOR. I
would like to put some delay between different branches while sending them
out.

So, I set a branch flag on those registrations before calling the save
function, and then try to use async sleep in the branch route after
lookup.

But I see sleep applies on the whole call(all branches are sent with delay)
no matter if it was called on a single branch.

*Method1: *
branch_route[REG_BRANCH] {
        xlog("INFO:[$ci] -> for $fU with flags $bf  with $ru and $du \n");
        if (isbflagset(delay)){
                xlog("INFO:[$ci] -> sleep was deducted on this call \n");
async( sleep(7), after_sleep );
        }
}

route[after_sleep] {
        xlog("delay branch\n");
}

*Method2: *

I tried to send delay branches to invalid destination, so I can use
failure_route to route them back to the correct destination.

branch_route[REG_BRANCH] {
        xlog("INFO:[$ci] -> for $fU with flags $bf  with $ru and $du \n");
        if (isbflagset(delay)){
                xlog("INFO:[$ci] -> sleep was deducted on this call \n");
                cache_store("local","$ci","$du",1200);
                $du = "sip:192.168.20.20";
                t_on_failure("after_sleep");
        }
}

failure_route[after_sleep] {
        cache_store("local","$ci","$var(dst)");
        $du = $var(dst);
        t_relay();
        exit;
}

But failure_routes gets executed for the whole transaction instead of
getting executed for a single branch. Do we have any t_on_failure_branch
route ?

I am really blocked here, any hint guys?

Ryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20200713/82f91bcd/attachment.html>


More information about the Users mailing list