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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2024-09-03T23:24:49+02:00

registrar: when provided, use host part from uri parameter

- instread of the To URI, which can be different

---

Modified: src/modules/registrar/save.c

---

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

---

diff --git a/src/modules/registrar/save.c b/src/modules/registrar/save.c
index c94f56563b2..2e25c8e000a 100644
--- a/src/modules/registrar/save.c
+++ b/src/modules/registrar/save.c
@@ -1094,22 +1094,29 @@ int unregister(struct sip_msg *_m, udomain_t *_d, str 
*_uri, str *_ruid)
 {
        str aor = {0, 0};
        sip_uri_t *u;
+       sip_uri_t turi;
        urecord_t *r;
        ucontact_t *c;
        int res;
 
-       if(_ruid == NULL) {
+       if(_ruid == NULL || _ruid->len <= 0) {
                /* No ruid provided - remove all contacts for aor */
-
-               if(extract_aor(_uri, &aor, NULL) < 0) {
-                       LM_ERR("failed to extract Address Of Record\n");
-                       return -1;
-               }
-
-               u = parse_to_uri(_m);
-               if(u == NULL) {
-                       LM_ERR("failed to extract Address Of Record\n");
-                       return -1;
+               if(_uri->len > 0) {
+                       if(extract_aor(_uri, &aor, &turi) < 0) {
+                               LM_ERR("failed to extract Address Of Record\n");
+                               return -1;
+                       }
+                       u = &turi;
+               } else {
+                       u = parse_to_uri(_m);
+                       if(u == NULL) {
+                               LM_ERR("failed to extract Address Of Record\n");
+                               return -1;
+                       }
+                       if(extract_aor(&(get_to(_m)->uri), &aor, NULL) < 0) {
+                               LM_ERR("failed to extract Address Of Record\n");
+                               return -1;
+                       }
                }
 
                if(star(_m, _d, &aor, &u->host) < 0) {

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to [email protected]

Reply via email to