Module: kamailio
Branch: master
Commit: aa11de5f8bcd6c8d66c5a7ca8d9c4b771e88789b
URL: 
https://github.com/kamailio/kamailio/commit/aa11de5f8bcd6c8d66c5a7ca8d9c4b771e88789b

Author: ovoshlook <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2025-10-08T12:49:47+02:00

tm: Do not discard late forked REGISTER replies

Forked REGISTER negative replies won't be discarded in case of late 
authentication on multiple REGISTRARs:
if a negative reply from forked REGISTER comes after 200 reply from another 
fork already received,
it will be handled by kamailio, but won't be propagated to UAC as transaction 
status is already 200.

tm: Do not discard late forked REGISTER replies

- Forked REGISTER negative replies won't be discarded in case of late 
authentication on multiple REGISTRARs:
  if a negative reply from forked REGISTER comes after 200 reply from another 
fork already received,
  it will be handled by kamailio, but won't be propagated to UAC as transaction 
status is already 200.

remove unneeded whitespace

tm: Do not discard late forked REGISTER replies

Forked REGISTER negative replies won't be discarded in case of late 
authentication on multiple REGISTRARs:
if a negative reply from forked REGISTER comes after 200 reply from another 
fork already received,
it will be handled by kamailio, but won't be propagated to UAC as transaction 
status is already 200.

---

Modified: src/modules/tm/t_reply.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/aa11de5f8bcd6c8d66c5a7ca8d9c4b771e88789b.diff
Patch: 
https://github.com/kamailio/kamailio/commit/aa11de5f8bcd6c8d66c5a7ca8d9c4b771e88789b.patch

---

diff --git a/src/modules/tm/t_reply.c b/src/modules/tm/t_reply.c
index e6d1206db5e..449b9653b9a 100644
--- a/src/modules/tm/t_reply.c
+++ b/src/modules/tm/t_reply.c
@@ -1394,11 +1394,21 @@ static enum rps t_should_relay_response(struct cell 
*Trans, int new_code,
                        Trans->uac[branch].last_received = new_code;
                        *should_relay = branch;
                        return RPS_PUSHED_AFTER_COMPLETION;
-               } else {
+               }
+               /* Do not discard negative replies for forked REGISTER messages
+                * if 200 status for initial trasaction already been set.
+                * In case of REGISTER request is forked to multiple Registrars
+                * some of registrars may reply with AUTH response later than 
others. 
+                * Without this code negative replies will be just discarded 
silently.
+                * This part lests late negative replies for forked REGISTERs 
being treated
+                * the same way negative replies for INVITE requests are 
treated 
+                * However it won't be propagated to UAC, as transacton status 
already 200.
+                */
+               if(!(strncmp(Trans->method.s, "REGISTER", 8) == 0 && new_code 
>= 300)) {
+                       /*Except the exceptions above, too late  messages will 
be discarded */
                        LM_DBG("final reply already sent\n");
+                       goto discard;
                }
-               /* except the exception above, too late  messages will be 
discarded */
-               goto discard;
        }
 
        /* if final response received at this branch, allow only INVITE 2xx */

_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to