I’m new to Kamailio and currently evaluating it’s capabilities. One of the things I would like to be able to do is to change outbound message transport based on some dynamic logic. 

Kamailio setup: I’m running on a setup from this guide - http://kamailio.org/docs/tutorials/5.1.x/kamailio-install-guide-git/ and using default configuration file.

In a basic scenario of one2one call, I was able to make Kamailio to forward INVITE to callee over TCP by issuing a REGISTER request with “transport=tcp” parameter. Although it worked, as far as I understand that means all communication with the callee will be happening over TCP. I would like to be able to change transport dynamically so looking for a way to do that from config file.

I tried modifying $ru/$du in the following manner, but it didn’t seem to work. 

# default config content
if (is_method("INVITE")) {
        setflag(FLT_ACC); # do accounting
# added to try to force TCP transport
        $du = $du + ";transport=tcp";
}

Any pointers as to how can I modify the outbound message transport? Do I need to use some extra modules or can it be achieved with a basic setup?

Thanks in advance,
Ivan