### Description
When kamailio need to pass call from carrier to customer VoIP PBX in docker container on swarm cluster then it not possible. Network interconnection. In docker environment eth1 NIC of kamailio and VoIP PBX connected to internet via iptables masquerading. eth1 NIC of kamailio and VoIP PBX have random IP address and generally no way to pass message between kamailio and VoIP PBX via eth1 NIC. Also both containers have eth0 NIC in same network with static IP. But network on eth0 NIC not connected to Internet.
SIP signaling is passed like eth1-Kamailio-eth0 <-> eth0-VoIP PBX
In this network kamailio add/removes two Record-Route. For ACK message with two `Route` headers this rule does not work. Each `Route` headers for same kamailio instance and must be translated by one loose_route call ``` The proxy will inspect the URI in the topmost Route header field value. If it indicates this proxy, the proxy removes it from the Route header field (this route node has been reached). ``` Really `Route` headers translated separately and second `loose_route` cannot be completed. Details in `details.txt` [details.txt](https://github.com/kamailio/kamailio/files/1220872/details.txt)
Wireshark pcap file and kamailio log with enabled debug attached of similar calls is attached. [full-call.zip](https://github.com/kamailio/kamailio/files/1220875/full-call.zip)
#### Reproduction
Create config when kamailio add two `Record-Route` headers and send ACK with two `Route` headers
The pcap has only one side of the call. We need incoming as well as outgoing traffic (what is received by kamailio and what is sent out). Tell also what are the IPs on which Kamailio is listening in order to match then with the headers.
Hello Daniel Kamailio listend IP: 1) eth1 - 172.18.0.7 advertised as 199.180.30.245; 2) eth0 - 10.0.9.21;
VoIP PBX have IP address 10.0.9.19 http://prntscr.com/g87p2a
according this code [here](https://github.com/kamailio/kamailio/blob/master/src/modules/rr/loose.c#L607...) and [here](https://github.com/kamailio/kamailio/blob/master/src/modules/rr/loose.c#L798...) second `Route` is removed if second present in same header. But second `Route` may be present in other header as in example. And second `Route` of same kamailio host is not removed
@sergey-safarov I need the pcap file so I investigate it here. A wireshark screenshot is not that useful.
Daniel pcap in file full-call.zip. This file also contains kamailio log
If you refer the zip from first comment, that has only one side of the call.
Not understand 1) packet 1 - kamailio received INVITE from carrier 2) packet 3 - kamailio send this INVITE to PBX 3) packet 5 - kamailio received from PBX ringing message 4) packet 6 - kamailio send this Ringing message to carrier
At PBX call is answered by IVR, bleg SIP device does not exists.
For what so ever reason, the sngrep does not show all the packets, using a bare ngrep shows more.
Anyhow, the problem is the caller device or the proxy/alg in between.
By RFC, the R-URI in ACK (and the other requests within dialog) has to be the URI from the Contact of 200ok. But there is the address of kamailio, making everything look like a strict routing and actually breaking the sip routing.
If you cannot fix the problem in the callee side, then you can try to fix it in kamailio, one option is to use htable to store the contact uri from 200ok and set it into ACK/re-INVITE/BYE/etc. before doing loose_route().
Overall, this is not an issue with kamailio code. If you need further assistance to do a fix via kamailio.cfg, the place to discuss is sr-users@lists.kamailio.cfg
Closed #1215.
Thank you vary math Daniel @miconda Using your table recommendation calls now goes correct. Respect.
Related [description](https://lists.kamailio.org/pipermail/sr-users/2013-August/079386.html)