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/ 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
On Fri, Sep 28, 2018 at 10:07:09AM +0200, Ivan Ribakov wrote:
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.
...
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?
You can do this by explicitly calling t_relay_to_tcp() instead of t_relay().
For example I modified route[RELAY] for a specific destination that wants TCP for large INVITEs.
if($avp(dispatcherid)=="1" && $ml>1249) { if(!t_relay_to_tcp()) { if(!t_relay()) { sl_reply_error(); } } } else { if(!t_relay()) { sl_reply_error(); } }
Thanks Daniel!
route[RELAY] section is what I’ve been looking for! I knew about t_relay_to_tcp() function but placing it directly in the end of “request_route” block lead to undesirable behaviour which made me think it’s not what I needed.
On 28 Sep 2018, at 10:40, Daniel Tryba d.tryba@pocos.nl wrote:
On Fri, Sep 28, 2018 at 10:07:09AM +0200, Ivan Ribakov wrote:
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.
...
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?
You can do this by explicitly calling t_relay_to_tcp() instead of t_relay().
For example I modified route[RELAY] for a specific destination that wants TCP for large INVITEs.
if($avp(dispatcherid)=="1" && $ml>1249) { if(!t_relay_to_tcp()) { if(!t_relay()) { sl_reply_error(); } } } else { if(!t_relay()) { sl_reply_error(); } }
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
How would one achieve the same using KEMI? I can see there is a KSR.tm module - https://kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/modules/#t... https://kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/modules/#tm which has “t_relay()” function but it has no “t_relay_to_tcp()”.
On 28 Sep 2018, at 11:22, Ivan Ribakov i.ribakov@zaleos.net wrote:
Thanks Daniel!
route[RELAY] section is what I’ve been looking for! I knew about t_relay_to_tcp() function but placing it directly in the end of “request_route” block lead to undesirable behaviour which made me think it’s not what I needed.
On 28 Sep 2018, at 10:40, Daniel Tryba d.tryba@pocos.nl wrote:
On Fri, Sep 28, 2018 at 10:07:09AM +0200, Ivan Ribakov wrote:
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.
...
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?
You can do this by explicitly calling t_relay_to_tcp() instead of t_relay().
For example I modified route[RELAY] for a specific destination that wants TCP for large INVITEs.
if($avp(dispatcherid)=="1" && $ml>1249) { if(!t_relay_to_tcp()) { if(!t_relay()) { sl_reply_error(); } } } else { if(!t_relay()) { sl_reply_error(); } }
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Am Freitag, 28. September 2018, 12:07:57 CEST schrieb Ivan Ribakov:
How would one achieve the same using KEMI? I can see there is a KSR.tm module - https://kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/modules/# tm https://kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/modules/ #tm which has “t_relay()” function but it has no “t_relay_to_tcp()”.
Hello Ivan,
could you maybe try to use this PV in the Kemi framework?
https://www.kamailio.org/wiki/cookbooks/devel/pseudovariables#fs_-_forced_so...
About the missing TM function - as there a a lot of function in the modules, any patches are welcome to speed up the conversion process.
Best regards,
Henning
Hello,
in KEMI you can do:
KSR.setdsturi("sip:_IP_OR_DOMAIN_:_PORT_;transport=tcp");
KSR.tm.t_relay()
I will review what tm functions are not exported yet and add those that are still relevant. In Kamailio we had the t_relay_to(...), which allow setting the transport in the parameter, the variants for t_relay_to_tcp/tls/... were retrieve via tm branch and I haven't use them.
Cheers, Daniel
On 28.09.18 12:07, Ivan Ribakov wrote:
How would one achieve the same using KEMI? I can see there is a KSR.tm module - https://kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/modules/#t... has “t_relay()” function but it has no “t_relay_to_tcp()”.
On 28 Sep 2018, at 11:22, Ivan Ribakov <i.ribakov@zaleos.net mailto:i.ribakov@zaleos.net> wrote:
Thanks Daniel!
route[RELAY] section is what I’ve been looking for! I knew about t_relay_to_tcp() function but placing it directly in the end of “request_route” block lead to undesirable behaviour which made me think it’s not what I needed.
On 28 Sep 2018, at 10:40, Daniel Tryba <d.tryba@pocos.nl mailto:d.tryba@pocos.nl> wrote:
On Fri, Sep 28, 2018 at 10:07:09AM +0200, Ivan Ribakov wrote:
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.
...
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?
You can do this by explicitly calling t_relay_to_tcp() instead of t_relay().
For example I modified route[RELAY] for a specific destination that wants TCP for large INVITEs.
if($avp(dispatcherid)=="1" && $ml>1249) { if(!t_relay_to_tcp()) { if(!t_relay()) { sl_reply_error(); } } } else { if(!t_relay()) { sl_reply_error(); } }
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org mailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users