[kamailio/kamailio] tm remap_503_500 breaks dialogs (#2405)
### Description Apparently the remapping of 503 to 500 codes in the tm module does also change the to-tag. This behaviour breaks dialogs with yate and therefore calls hang and the 503 remains unacknowledged. Removing to-tags seems to contradict RFC3261 "12 Dialogs A dialog is identified at each UA with a dialog ID, which consists of a Call-ID value, a local tag **and a remote tag**…" Due to the bug the UA cannot identify the dialog the 500 belongs to. Therefore the dialog remains open and Kamailio keeps repeating 500 messages. ### Troubleshooting After disabling the 503 to 500 remapping with modparam("tm", "remap_503_500", 0) dialogs get properly terminated . #### Reproduction 503 to 500 remapping is enabled by default. Inspect the to tags of the incoming 503 and outgoing 500 messages. #### Debugging Data Henning added this comment: Apparently, this is the way the code works: t_reply.c: if (relayed_code==503 && tm_remap_503_500){ /* replace a final 503 with a 500: * generate a "FAKE" reply and a new to_tag (for easier * debugging)*/ ### Possible Solutions Dont change the to-tag ### Additional Information kamailio -v version: kamailio 5.2.3 (x86_64/linux) c36229 flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, 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_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB poll method support: poll, epoll_lt, epoll_et, sigio_rt, select. id: c36229 compiled on 10:34:54 Jun 13 2019 with gcc 4.8.5 * **Operating System**: CentOS Linux release 7.6.1810 (Core) 3.10.0-957.12.2.el7.x86_64 -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/2405
Adding another comment from the mailing list:
The SIP code 503 is tricky in the sense that i can indicate either server maintenance or server overload. In both cases it can send Retry-After header and any subsequent requests from same source are ignored for the duration of Retry-After interval. [1].
Additionally RFC3261 and RFC3263 define that transport failures (generally due to fatal ICMP errors in UDP and connection failures in TCP) should be treated as 503 response. [2].
So in all above cases, it is most likely that dialog does not establishes at all and 503 response is treated similar to stateless response. Therefore, a to-tag can be added/replaced before sending it to UAC.
Theoretically, kamailio should check and use to-tag from 503 response when converting it to 500 response and only create new to-tag if it is absent.
References:
[1] https://tools.ietf.org/html/rfc3261#section-21.5.4
[2] https://tools.ietf.org/html/draft-hilt-sip-correction-503-01#section-4
-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/2405#issuecomment-662827291
Is anyone planning to work on this one and make a PR? -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/2405#issuecomment-671397151
I think the real bug is that the rewrite happens mid-dialog. I would expect it to only apply on initial INVITE's, not re-INVITE's. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/2405#issuecomment-831815473
This issue is stale because it has been open 6 weeks with no activity. Remove stale label or comment or this will be closed in 2 weeks. -- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/2405#issuecomment-1801300296 You are receiving this because you are subscribed to this thread. Message ID: <kamailio/kamailio/issues/2405/1801300296@github.com>
Closed #2405 as not planned. -- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/2405#event-11042727583 You are receiving this because you are subscribed to this thread. Message ID: <kamailio/kamailio/issue/2405/issue_event/11042727583@github.com>
participants (5)
-
Alex Hermann -
Daniel-Constantin Mierla -
geejay101 -
github-actions[bot] -
Henning Westerholt