Hi. I try to make working kamailio on TCP infront of asterisk
Before to send to asteisk any packet i added $fs=ip.add.re.ss:port
Also discribed listen=tcp:ip.add.re.ss:port
But kamailio send outgoing packets from random prot throug TCP Presume i configured 5060 port but it send from 35410 port.
googling on a core functions didn gives me any answer.
May be i forget something to set at the config?
On Wed, Sep 07, 2016 at 08:35:30PM +0300, Yuriy Gorlichenko wrote:
Before to send to asteisk any packet i added $fs=ip.add.re.ss:port
Also discribed listen=tcp:ip.add.re.ss:port
But kamailio send outgoing packets from random prot throug TCP Presume i configured 5060 port but it send from 35410 port.
This is normal behavior, tcp port 5060 is already in use as a listener port.
Hi, about this subject: linux kernel starting from 3.9 introduced SO_REUSEPORT which allows reusing TCP sockets. It could be interesting supporting this in Kamailio. I worked on a patch for this, I can open a PR and start a discussion if you think it's worth.
Regards,
Federico
On Thu, Sep 8, 2016 at 11:12 AM, Daniel Tryba d.tryba@pocos.nl wrote:
On Wed, Sep 07, 2016 at 08:35:30PM +0300, Yuriy Gorlichenko wrote:
Before to send to asteisk any packet i added $fs=ip.add.re.ss:port
Also discribed listen=tcp:ip.add.re.ss:port
But kamailio send outgoing packets from random prot throug TCP Presume i configured 5060 port but it send from 35410 port.
This is normal behavior, tcp port 5060 is already in use as a listener port.
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
On Thu, Sep 08, 2016 at 11:16:29AM +0200, Federico Cabiddu wrote:
about this subject: linux kernel starting from 3.9 introduced SO_REUSEPORT which allows reusing TCP sockets. It could be interesting supporting this in Kamailio. I worked on a patch for this, I can open a PR and start a discussion if you think it's worth.
Interesting, I read about SO_REUSEPORT a couple of weeks ago but it didn't dawn on me that it lets you have multiple sender sockets (by just not accept()-ing). IMHO it is usefull for setups that use IP based authentication with TCP instead of UDP (probably something the OP want to do).
yes. Thats will be great because in some system design it must use same port that listening for sendinf like in UDP for example for transcoding SIP over WebSocket to SIP over TCP and masking registration behind thanscoder.
Like User sends registration, kamailio just Transcoding this request to TCP and then resend this registration packet to Asterisk. With this example asteisk must originate all PACKETS to TCP port of kamailio but it tries to send it to port from wich request arrived and if use TCP it will not equal port that kamailio listening for TCP.
2016-09-08 13:17 GMT+03:00 Daniel Tryba d.tryba@pocos.nl:
On Thu, Sep 08, 2016 at 11:16:29AM +0200, Federico Cabiddu wrote:
about this subject: linux kernel starting from 3.9 introduced
SO_REUSEPORT
which allows reusing TCP sockets. It could be interesting supporting this in Kamailio. I worked on a patch for this, I can open a PR and start a discussion if you think it's worth.
Interesting, I read about SO_REUSEPORT a couple of weeks ago but it didn't dawn on me that it lets you have multiple sender sockets (by just not accept()-ing). IMHO it is usefull for setups that use IP based authentication with TCP instead of UDP (probably something the OP want to do).
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
On Thu, Sep 08, 2016 at 02:43:03PM +0300, Yuriy Gorlichenko wrote:
yes. Thats will be great because in some system design it must use same port that listening for sendinf like in UDP for example for transcoding SIP over WebSocket to SIP over TCP and masking registration behind thanscoder.
Like User sends registration, kamailio just Transcoding this request to TCP and then resend this registration packet to Asterisk. With this example asteisk must originate all PACKETS to TCP port of kamailio but it tries to send it to port from wich request arrived and if use TCP it will not equal port that kamailio listening for TCP.
And this is a problem? Since all requests from kamailio to that asterisk should be send over the same connection it will stay open for some time, and enabling qualify for the users on asterisk will keep is open.
But I'd communicate over UDP with asterisk/any backend anyway, so what is the reason for TCP?
When packet arrives at from the WebSocket its length usually more that 1500 bytes THat is the problem. sometimes sdp data lost while sending. If asterisk at the sama machine it uses lo interface and then it is not a problem but for remote servers it can be.
I didnt thought about keepalive. I suppose it can help.
2016-09-08 15:04 GMT+03:00 Daniel Tryba d.tryba@pocos.nl:
On Thu, Sep 08, 2016 at 02:43:03PM +0300, Yuriy Gorlichenko wrote:
yes. Thats will be great because in some system design it must use same port that listening for sendinf like in UDP for example for transcoding
SIP
over WebSocket to SIP over TCP and masking registration behind
thanscoder.
Like User sends registration, kamailio just Transcoding this request to
TCP
and then resend this registration packet to Asterisk. With this example asteisk must originate all PACKETS to TCP port of kamailio but it tries to send it to port from wich request arrived and if use TCP it will not equal port that kamailio listening for TCP.
And this is a problem? Since all requests from kamailio to that asterisk should be send over the same connection it will stay open for some time, and enabling qualify for the users on asterisk will keep is open.
But I'd communicate over UDP with asterisk/any backend anyway, so what is the reason for TCP?
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
On Thu, Sep 08, 2016 at 03:38:32PM +0300, Yuriy Gorlichenko wrote:
I didnt thought about keepalive. I suppose it can help.
Better than using qualify in asterisk is to use the dispatcher module in kamailio. The idea is the same, but more configurable and it is just 1 keepalive mechanisme so the amount of keepalives doesn't scale linear with the number of registered users :)
The issue with dispatcher is that, in case of TCP transport, you cannot set the sending socket for the same reason. Basically, each time a client TCP socket is open by Kamailio, the SO select the port, due to the lack of support for SO_REUSEPORT.
Cheers,
Federico
On Thu, Sep 8, 2016 at 4:33 PM, Daniel Tryba d.tryba@pocos.nl wrote:
On Thu, Sep 08, 2016 at 03:38:32PM +0300, Yuriy Gorlichenko wrote:
I didnt thought about keepalive. I suppose it can help.
Better than using qualify in asterisk is to use the dispatcher module in kamailio. The idea is the same, but more configurable and it is just 1 keepalive mechanisme so the amount of keepalives doesn't scale linear with the number of registered users :)
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
I know about dispatcher but it not always canbe heplfull. Sometimes i need my own logic that not implemented at the dispatcher.
For checking kamailio live from asterisk im use qualfy for keepalives, if i use asterisk only as media server but it not always usefull. Sometimes scenarios need to use another logic.
2016-09-08 17:50 GMT+03:00 Federico Cabiddu federico.cabiddu@gmail.com:
The issue with dispatcher is that, in case of TCP transport, you cannot set the sending socket for the same reason. Basically, each time a client TCP socket is open by Kamailio, the SO select the port, due to the lack of support for SO_REUSEPORT.
Cheers,
Federico
On Thu, Sep 8, 2016 at 4:33 PM, Daniel Tryba d.tryba@pocos.nl wrote:
On Thu, Sep 08, 2016 at 03:38:32PM +0300, Yuriy Gorlichenko wrote:
I didnt thought about keepalive. I suppose it can help.
Better than using qualify in asterisk is to use the dispatcher module in kamailio. The idea is the same, but more configurable and it is just 1 keepalive mechanisme so the amount of keepalives doesn't scale linear with the number of registered users :)
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
On Thu, Sep 08, 2016 at 04:50:50PM +0200, Federico Cabiddu wrote:
The issue with dispatcher is that, in case of TCP transport, you cannot set the sending socket for the same reason. Basically, each time a client TCP socket is open by Kamailio, the SO select the port, due to the lack of support for SO_REUSEPORT.
I know, the solution that the dispatcher brings is 1 long living tcp connection from kamailio to asterisk, with kamailio keeping it alive. Asterisk stores the ip/port to send the INVITEs to, as long as kamailio or asterisk isn't restarted the ip/port combo (the same for all devices) is still valid.
On Thu, Sep 08, 2016 at 02:43:03PM +0300, Yuriy Gorlichenko wrote:
Like User sends registration, kamailio just Transcoding this request to TCP and then resend this registration packet to Asterisk. With this example asteisk must originate all PACKETS to TCP port of kamailio but it tries to send it to port from wich request arrived and if use TCP it will not equal port that kamailio listening for TCP.
Apparently this solved in a new enough Asterisk that supports Path (13.x appears to support Path in both PJSIP and chan_sip, still running 11.x in production myself so you have to test yourself). See https://blog.irontec.com/integracion-kamailio-y-asterisk-con-path/ Even if you don't read Portugese, it is understandable enough :)
If this indeed works, Olle (among others) has saved the day again ;)
hm. thanks for information. I will read this) nice to know that. Thx for advices again
2016-09-08 15:43 GMT+03:00 Daniel Tryba d.tryba@pocos.nl:
On Thu, Sep 08, 2016 at 02:43:03PM +0300, Yuriy Gorlichenko wrote:
Like User sends registration, kamailio just Transcoding this request to
TCP
and then resend this registration packet to Asterisk. With this example asteisk must originate all PACKETS to TCP port of kamailio but it tries to send it to port from wich request arrived and if use TCP it will not equal port that kamailio listening for TCP.
Apparently this solved in a new enough Asterisk that supports Path (13.x appears to support Path in both PJSIP and chan_sip, still running 11.x in production myself so you have to test yourself). See https://blog.irontec.com/integracion-kamailio-y-asterisk-con-path/ Even if you don't read Portugese, it is understandable enough :)
If this indeed works, Olle (among others) has saved the day again ;)
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users