[SR-Users] kamailio as UAC and NAPTR / sendsocket question

Daniel-Constantin Mierla miconda at gmail.com
Wed Jun 26 10:10:21 CEST 2019


Hello,

does it happen for both UDP and TCP? Or only for TCP is the private
interface used? Normally should work no matter the transport, try to force
only ip with force_send_sock("x.y.z.w").

I assume that the IP routing rules allow traffic from private IP to public
addresses.

Cheers,
Daniel

On Fri, Jun 21, 2019 at 5:49 PM Karsten Horsmann <khorsmann at gmail.com>
wrote:

> Hi List,
>
> after reading the corebook in the wiki and some issue reports (1), I think
> it's not possible to force the outgoing ip for uac.so registration.
>
> I saw traffic with
> 172.20.120.53:45689 - - - > reg.sip-trunk.telekom.de
>
> So that's random highport generated traffic tcp traffic on the first
> interface ip.
>
> AFAIK this behavior could not change, right?
>
> (1)
> https://github.com/kamailio/kamailio/issues/1532
>
>
> Karsten Horsmann <khorsmann at gmail.com> schrieb am Fr., 21. Juni 2019,
> 11:44:
>
>> Hi List,
>>
>>
>> I try to register to Deutsche Telekom and there product Deutschland Lan
>> siptrunk.
>>
>> Thats works find but i see an intressting behaviour on selecting the
>> right outgoing interface.
>> Kamailio is sending out with tcp the REQUEST via first private ip
>> configured on that server (172.20.120.53).
>> There is no listen directive for that.
>>
>> I forced NAPTR to use tcp or udp and i assume that kamailio got the right
>> dns answers.
>>
>> On the list i read also that i can use force_send_socket to force the
>> outgoing request.
>>
>> Now my idea - hey i use the $rP for the outgoing to select the right
>> outgoing listen directive.
>> $rP - reference to transport protocol of R-URI
>> But to my surprise the logfile told me thats "UDP" - it sends out via TCP
>> (thats okay).
>>
>> Whats an good transport selector variable from kamailio that works?
>>
>>
>> event_route[tm:local-request] {
>>   if(!is_method("OPTIONS")) {
>>         xlog("L_INFO", "[tm:local-request] request [$rm] from [$fu] to
>> [$ru] [$rP]\n");
>>   }
>> }
>>
>> INFO: <script>: [tm:local-request] request [REGISTER] from [
>> sip:+49XXXXXXXX at sip-trunk.telekom.de] to [sip:sip-trunk.telekom.de] [UDP]
>>
>>
>> listen=tcp:2xx.xx.xx.xx:5060
>> listen=udp:2xx.xx.xx.xx:5060
>> listen=tls:2xx.xx.xx.xx:5061 advertise CFG_EXT_NAME:5061
>>
>>
>> listen=udp:172.20.120.55:5060
>> listen=udp:172.20.120.56:5060
>> listen=udp:172.20.120.57:5060
>> listen=udp:172.20.120.58:5060
>> listen=tcp:172.20.120.58:5060
>>
>>
>> use_dns_cache=on # use internal DNS cache
>> use_dns_failover=on # depends on internal DNS cache
>> dns_srv_loadbalancing=on
>> dns_try_naptr=on
>> dns_retr_time=1 # seconds before retrying a DNS request
>> dns_retr_no=3 # number of DNS retransmissions
>> dns_naptr_ignore_rfc=yes # ignore target NAPTR priority
>> dns_tcp_pref=30 # TCP has second-highest priority
>> dns_udp_pref=10 # use UDP with least priority
>> tcp_connection_lifetime=3605 # set higher than registration expires
>>
>> #dont' restore
>> modparam("uac","restore_mode","none")
>> modparam("uac","restore_dlg",0)
>>
>> ## UAC REGISTER
>> #!ifdef WITH_UAC_REGISTER
>> modparam("uac", "reg_contact_addr", "CFG_PROD_IP")
>> modparam("uac", "reg_timer_interval", 10)
>> modparam("uac", "reg_retry_interval", 10)
>> modparam("uac", "reg_db_url", DBURL)
>> modparam("uac", "restore_mode", "none")
>> modparam("uac", "auth_username_avp", "$avp(AVP_AUTH_USERNAME)")
>> modparam("uac", "auth_password_avp", "$avp(AVP_AUTH_PASSWORD)")
>> modparam("uac", "auth_realm_avp", "$avp(AVP_AUTH_REALM)")
>> #!endif
>>
>>
>>
>> ip a l
>> 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group
>> default qlen 1000
>>     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>>     inet 127.0.0.1/8 scope host lo
>>        valid_lft forever preferred_lft forever
>>     inet6 ::1/128 scope host
>>        valid_lft forever preferred_lft forever
>> 2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
>> state UP group default qlen 1000
>>     link/ether 00:50:56:b5:c1:48 brd ff:ff:ff:ff:ff:ff
>>     inet 172.20.120.53/24 brd 172.20.120.255 scope global ens192
>>        valid_lft forever preferred_lft forever
>>     inet 2xx.xx.xx.xx/29 scope global ens192
>>        valid_lft forever preferred_lft forever
>>     inet 172.20.120.56/24 scope global secondary ens192
>>        valid_lft forever preferred_lft forever
>>     inet 172.20.120.57/24 scope global secondary ens192
>>        valid_lft forever preferred_lft forever
>>     inet 172.20.120.58/24 scope global secondary ens192
>>        valid_lft forever preferred_lft forever
>>     inet 172.20.120.55/24 brd 172.20.120.255 scope global secondary
>> ens192
>>        valid_lft forever preferred_lft forever
>>     inet6 fe80::250:56ff:feb5:c148/64 scope link
>>        valid_lft forever preferred_lft forever
>>
>> default via 172.20.120.253 dev ens192
>> 172.20.120.0/24 dev ens192 proto kernel scope link src 172.20.120.53
>> 2xx.xx.xx.xx/29 dev ens192 proto kernel scope link src 2xx.xx.xx.xx
>>
>>
>> --
>> Kind Regards
>> Mit freundlichen Grüßen
>> *Karsten Horsmann*
>>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>


-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20190626/f590b192/attachment.html>


More information about the sr-users mailing list