[SR-Users] BYE and TCP

Kjeld Flarup kjeld.flarup at liberalismen.dk
Wed Nov 4 22:00:51 CET 2020


Hello again

I have attached a Capture.

My public IP is 194.255.22.44, and I have a port forward of 5071 in my 
router

The Raspberry Pi running the Kamailio is on 192.168.2.9 with an alias 
192.168.2.40

My listening is setup like this

listen=127.0.0.1:5071
listen=eth0:5071  advertise 194.255.22.44:5071
alias=194.255.22.44:5071

Kamailio is forwarding an invite from a door phone thus I also rewrite FROM:

uac_replace_from("sip:"+$dbr(ra=>[0,1])+"@194.255.22.44:5071");
And the failure route to
$fu = "sip:"+$dbr(ra=>[0,0])+"@194.255.22.44:5071";

In the route doing the INVITE I also set this:

set_advertised_address("194.255.22.44:5071");


Regarding tcp_reuse_port, if I set this I get this error, which I 
understand is due to the way TCP works.

Nov  4 18:38:41 scantronpbx /usr/sbin/kamailio[15864]: {1 ACK 16191 ACK 
C2Az-Xm2b0CEPyV5eQuz7yEf9IJo4PyJ} WARNING: <core> 
[core/tcp_main.c:1061]: tcp_do_connect(): binding to source address 
192.168.2.40:5071 failed: Address already in use [98]

I do have tcp_reuse_port=yes with this capture. But much to my surprise, 
the 200 OK from is send to 37148, but the ACK to it comes from 37150


-------------------- Med Liberalistiske Hilsner ----------------------
    Civilingeniør, Kjeld Flarup - Mit sind er mere åbent end min tegnebog
    Sofienlundvej 6B, 7560 Hjerm, Tlf: 40 29 41 49
    Den ikke akademiske hjemmeside for liberalismen - www.liberalismen.dk

On 11/4/20 1:59 PM, Carsten Bock wrote:
> Hi,
>
> I think you are searching for this parameter:
>
> http://www.kamailio.org/wiki/cookbooks/devel/core#tcp_reuse_port
>
> It basically tells the kernel not to choose a new port at random for a 
> new connection, but it will try to reuse the existing port (in your 
> case 5071).
>
> Thanks,
> Carsten
>
>
> --
> Carsten Bock I CTO & Founder
>
> ng-voice GmbH
>
> Trostbrücke 1 I 20457 Hamburg I Germany
> T +49 40 524 75 93-40 | M +49 179 2021244 I www.ng-voice.com 
> <http://www.ng-voice.com/>
>
> Registry Office at Local Court Hamburg, HRB 120189
> Managing Directors: Dr. David Bachmann, Carsten Bock
>
>
>
> Am Mi., 4. Nov. 2020 um 12:07 Uhr schrieb Kjeld Flarup 
> <kjeld.flarup at liberalismen.dk <mailto:kjeld.flarup at liberalismen.dk>>:
>
>     Hello
>
>     I have a Kamailio running behind NAT, which sends calls to a VOIP
>     service provider.
>
>     I have setup the Kamalio to listen on port 5071, and also setup a
>     port
>     forward in the router.
>
>     Now the problem is that with TCP, 5071 is not used for the dialog,
>     but a
>     new port is chosen everytime. This means that when the mobile phone
>     called hands up, I never sees the BYE, because BYE is a new dialog.
>
>
>     To which port is the server supposed to send the BYE, and what field
>     tells the server this.
>
>
>     -- 
>     -------------------- Med Liberalistiske Hilsner ----------------------
>         Civilingeniør, Kjeld Flarup - Mit sind er mere åbent end min
>     tegnebog
>         Sofienlundvej 6B, 7560 Hjerm, Tlf: 40 29 41 49
>         Den ikke akademiske hjemmeside for liberalismen -
>     www.liberalismen.dk <http://www.liberalismen.dk>
>
>
>     _______________________________________________
>     Kamailio (SER) - Users Mailing List
>     sr-users at lists.kamailio.org <mailto:sr-users at lists.kamailio.org>
>     https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20201104/4e08c662/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tcpbye.cap
Type: application/vnd.tcpdump.pcap
Size: 24524 bytes
Desc: not available
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20201104/4e08c662/attachment.cap>


More information about the sr-users mailing list