[sr-dev] [kamailio/kamailio] topos: BYE befor 200 OK creates new connection (#1339)

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[sr-dev] [kamailio/kamailio] topos: BYE befor 200 OK creates new connection (#1339)

Victor Seva-3

Description

If call has ended with BYE after 180/183 before 200 OK, kamailio tries to create new connection to destination, not to use existing.
With firewall enabled and TLS transport this is issue.

Troubleshooting

Reproduction

Load topos module, register client (asterisk, it shows port 5061 in contact but real query comes from random tcp port) using TLS, make call to it, terminate call with BYE, before answering.

Log Messages

kamailio-topos.gz

SIP Traffic

topos-by-befor-ack.tar.gz

Additional Information

version: kamailio 5.2.0-dev1 (x86_64/linux)
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown
compiled on 09:24:06 Nov 27 2017 with gcc 4.8.5

  • Operating System:

Red Hat Enterprise Linux Server 7.3

3.10.0-514.el7.x86_64 #1 SMP Wed Oct 19 11:24:13 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"topos: BYE befor 200 OK creates new connection (#1339)"}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1339"}}}</script>
_______________________________________________
Kamailio (SER) - Development Mailing List
[hidden email]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
Reply | Threaded
Open this post in threaded view
|

Re: [kamailio/kamailio] topos: BYE befor 200 OK creates new connection (#1339)

Victor Seva-3

It looks like you need to use set_contact_alias() for the replies, because the contact in 180 is not matching the source port. Then use handle_ruri_alias() for BYE. It's more or less what it is done for natted traffic.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"PERSON","message":"@miconda in #1339: It looks like you need to use `set_contact_alias()` for the replies, because the contact in 180 is not matching the source port. Then use `handle_ruri_alias()` for BYE. It's more or less what it is done for natted traffic."}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1339#issuecomment-348814895"}}}</script>
_______________________________________________
Kamailio (SER) - Development Mailing List
[hidden email]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
Reply | Threaded
Open this post in threaded view
|

Re: [kamailio/kamailio] topos: BYE befor 200 OK creates new connection (#1339)

Victor Seva-3
In reply to this post by Victor Seva-3

I have tried it, but with no result for topos module.
For topoh it works.
But in me config I using fix_nated_contact();

Daniel, please look at line 1202 form debug output, in that line:
Contact: sip:12345@11.22.33.44:48418;transport=TLS
with correct port, but topos does not use or does not see it...

If you need more debug info please let me know.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"PERSON","message":"@sergey-vb in #1339: I have tried it, but with no result for topos module.\r\nFor topoh it works.\r\nBut in me config I using fix_nated_contact();\r\n\r\nDaniel, please look at line 1202 form debug output, in that line:\r\nContact: \u003csip:12345@11.22.33.44:48418;transport=TLS\u003e\r\nwith correct port, but topos does not use or does not see it...\r\n\r\nIf you need more debug info please let me know."}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1339#issuecomment-349207254"}}}</script>
_______________________________________________
Kamailio (SER) - Development Mailing List
[hidden email]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
Reply | Threaded
Open this post in threaded view
|

Re: [kamailio/kamailio] topos: BYE befor 200 OK creates new connection (#1339)

Victor Seva-3
In reply to this post by Victor Seva-3

Can you try with master or using the patch referenced above?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"PERSON","message":"@miconda in #1339: Can you try with master or using the patch referenced above?"}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1339#issuecomment-349269668"}}}</script>
_______________________________________________
Kamailio (SER) - Development Mailing List
[hidden email]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
Reply | Threaded
Open this post in threaded view
|

Re: [kamailio/kamailio] topos: BYE befor 200 OK creates new connection (#1339)

Victor Seva-3
In reply to this post by Victor Seva-3

Thank you Daniel.
Now it works correct, it creates BYE with correct ruri and send it to correct port, without creation of new connection.

In my kamailio configuration I using fix_nated_contact(). Do I need switch to set_contact_alias() and if so, how I can do this with minimal changes?

Also for best perfomance I had to add some indexes to topos_d and topos_t tables.
I have attached my structure to this message.

Thank you.
topos_db.sql.gz


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"PERSON","message":"@sergey-vb in #1339: Thank you Daniel.\r\nNow it works correct, it creates BYE with correct ruri and send it to correct port, without creation of new connection.\r\n\r\nIn my kamailio configuration I using fix_nated_contact(). Do I need switch to set_contact_alias() and if so, how I can do this with minimal changes?\r\n\r\nAlso for best perfomance I had to add some indexes to topos_d and topos_t tables.\r\nI have attached my structure to this message.\r\n\r\nThank you.\r\n[topos_db.sql.gz](https://github.com/kamailio/kamailio/files/1538888/topos_db.sql.gz)\r\n\r\n\r\n"}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1339#issuecomment-349943499"}}}</script>
_______________________________________________
Kamailio (SER) - Development Mailing List
[hidden email]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
Reply | Threaded
Open this post in threaded view
|

Re: [kamailio/kamailio] topos: BYE befor 200 OK creates new connection (#1339)

Victor Seva-3
In reply to this post by Victor Seva-3

Closed #1339.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Closed #1339."}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1339#event-1376734601"}}}</script>
_______________________________________________
Kamailio (SER) - Development Mailing List
[hidden email]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
Reply | Threaded
Open this post in threaded view
|

Re: [kamailio/kamailio] topos: BYE befor 200 OK creates new connection (#1339)

Victor Seva-3
In reply to this post by Victor Seva-3

OK, thanks for testing and reporting back.

For db indexes, can you make a PR by updating schema xml definition:

I am closing this one.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"PERSON","message":"@miconda in #1339: OK, thanks for testing and reporting back.\r\n\r\nFor db indexes, can you make a PR by updating schema xml definition:\r\n\r\n * https://github.com/kamailio/kamailio/tree/master/src/lib/srdb1/schema\r\n\r\nI am closing this one."}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1339#issuecomment-349944934"}}}</script>
_______________________________________________
Kamailio (SER) - Development Mailing List
[hidden email]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev