Re: [SR-Users] BYE and TCP

2020-11-04 Thread Kjeld Flarup

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/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 



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 
mailto:kjeld.fla...@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 


___
Kamailio (SER) - Users Mailing List
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


tcpbye.cap
Description: application/vnd.tcpdump.pcap
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] send_reply() related feature request

2020-11-04 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> I wanted to say that the new function to be added should be a bit more
> generic, not targeting only set_reply_close()+send_reply(), but have a
> "mode" parameter to control what other operations should be done before
> sending the reply out.

That is how I understood it too.  For me a new function with mode param
would be fine.

-- Juha

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] BYE and TCP

2020-11-04 Thread Carsten Bock
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

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.fla...@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
>
>
> ___
> Kamailio (SER) - Users Mailing List
> 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


Re: [SR-Users] send_reply() related feature request

2020-11-04 Thread Daniel-Constantin Mierla


On 03.11.20 11:10, Juha Heinanen wrote:
> Daniel-Constantin Mierla writes:
>
>> set_reply_close() is very minimal wrapper action from the core setting
>> an internal flag. It can be merged with a reply function, but maybe it
>> should be a new function a little bit more generic, like
>> send_reply_mode(code, reason, mode) where mode is a parameter that can
>> be used for other purposes in the future (by using bit-based flags).
> There may be cases where it is not good idea to close connection after
> reply.  So it should not be automatically done by send_reply().

Maybe my phrasing was confusing, I didn't want to suggest to be included
in existing sl reply functions.

I wanted to say that the new function to be added should be a bit more
generic, not targeting only set_reply_close()+send_reply(), but have a
"mode" parameter to control what other operations should be done before
sending the reply out.

Cheers,
Daniel


> A new
> function either with or without an extra argument would be fine.
>
> -- Juha

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Funding: https://www.paypal.me/dcmierla


___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] BYE and TCP

2020-11-04 Thread Daniel-Constantin Mierla
Hello,

your message is confusing somehow, what do you mean by "never sees the
BYE, because BYE is a new dialog"?

Maybe you can grab the pcap with sip packets for such call on kamailio
server and sent it over to see if the headers are as expected.

Cheers,
Daniel

On 04.11.20 12:04, Kjeld Flarup wrote:
> 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
>
>
> ___
> 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
Funding: https://www.paypal.me/dcmierla


___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] BYE and TCP

2020-11-04 Thread Kjeld Flarup

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


___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users