Hello,

rewritehostporttrans function solves my problem. but there is another problem. rewritehostporttrans function dont pass $avp(val) so t_relay() gives invalid uri Error.

Thanks

For example

1: it works good 
rewritehostporttrans("test1.test:5060;transport=tcp");

if (!t_relay_to_tcp()) {
      xlog("L_ERR", "Error t_relay \n");
      t_reply("500","Server - ERROR ");
      exit;
    }
xlog([uri-dst : test1.test:5060;transport=tcp]  [uri-now : <null> ])

2: invalid uri error

$avp(dstx)=$_s($rd:$rp;transport=tcp);
rewritehostporttrans("$avp(dstx)");

xlog([uri-dst : test1.test:5060;transport=tcp]  [uri-now : <null> ])

3: invalid uri error

$avp(dstx)=$rd+":"+$rp+";transport=tcp;";
rewritehostporttrans("$avp(dstx)");

xlog([uri-dst : test1.test:5060;transport=tcp]  [uri-now : <null> ])

4: invalid uri error

$ru=$ru+"transport=tcp";

5:invalid Uri  error

$var(dstx)=$_s($rd:$rp;transport=tcp);
rewritehostporttrans("$var(dstx)");

xlog([uri-dst : test1.test:5060;transport=tcp]  [uri-now : <null> ])



From: Daniel-Constantin Mierla <miconda@gmail.com>
Sent: Friday, December 14, 2018 5:08 PM
To: Kamailio (SER) - Users Mailing List; YAS0 CANER
Subject: Re: [SR-Users] Problem with selection Transport Protocol - MultiHomed Problem
 

Hello,


is there any naptr or srv dns record behind test1.test domain? Or just A/CNAME record?


Cheers,
Daniel


On 14.12.18 14:35, YAS0 CANER wrote:
Hello;

i want to force message to send over TCP and IPv6 . so it should be R/W variable. When i set $fs or force_send_socket() it gives error about mismatch protocol !

Thanks.

Yasin CANER

From: sr-users <sr-users-bounces@lists.kamailio.org> on behalf of YAS0 CANER <caner_yaso@hotmail.com>
Sent: Friday, December 14, 2018 4:27 PM
To: Kamailio (SER) - Users Mailing List
Subject: [SR-Users] Problem with selection Transport Protocol - MultiHomed Problem
 
Hello , 
i have trouble  about selection transport protocol. i have tried so many thing but couldnt find TM selected which IPv? and protocol type (TCP or UDP)


For example;
i have 2 interface ipv6 and ipv4.  i will route my message (INVITE-Register etc.) another node  that use TCP and IPV6 , domain name is test1.test. TM module or some module resolve this domain to IPV6:UDP  but i want to sent it over IPV6:TCP socket.  so i cannot know which protocol is resolved and cannot route the right socket. 

$du variable show only sip:ali@test1.test 

Conclusion : There isn't any pseudo value about which destination of IP version  will use.


Thanks 


Flow:

UAC (IPv4:UDP) ----------> Kamailio (MultiHomed)  ---->  (TCP:IPv6)Kamailio

----
Kamailo (multiHomed ) cfg
------
auto_bind_ipv6=1
dns_try_ipv6=yes
dns_retr_time=1
dns_retr_no=1
dns_cache_flags=4
mhomed=1
fork=yes
tcp_source_ipv6 = [fd61:c23c:b3b6::5]
listen=tcp:[fd61:c23c:b3b2::5]:5060
listen=udp:[fd61:c23c:b3b2::5]:5060
listen=udp:192.168.1.107:5060
listen=tcp:192.168.1.107:5060


route []{

  if($dP=="TCP"){
    xlog("L_INFO","[route] [TCP] 1\n");
    if (!t_relay_to_tcp()) {
      xlog("L_ERR", "Error t_relay  [route] \n");
      t_reply("500","Server - ERROR ");
      exit;
    }
  } else if($dP=="TCP"){
    xlog("L_INFO","[route] [TCP] 2\n");
    if (!t_relay_to_tcp()) {
      xlog("L_ERR", "Error t_relay  [route] \n");
      t_reply("500","Server - ERROR ");
      exit;
    }
  }else if($dP=="UDP"){
    xlog("L_INFO","[route] [UDP] 1\n");
    if (!t_relay_to_udp()) {
      xlog("L_ERR", "Error t_relay  [route] \n");
      t_reply("500","Server - ERROR ");
      exit;
    }
  }else{
    xlog("L_INFO","[route] [??] 1\n");
    if (!t_relay()) {
      xlog("L_ERR", "Error t_relay  [route] \n");
      t_reply("500","Server - ERROR ");
      exit;
    }
  }
}

_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference - May 6-8, 2019 -- www.kamailioworld.com
Kamailio Advanced Training -- www.asipto.com