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

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2018-04-12T14:52:01+02:00

topos: reuse uuid for requests withing dialog

- related to GH #1496

---

Modified: src/modules/topos/tps_storage.c

---

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

---

diff --git a/src/modules/topos/tps_storage.c b/src/modules/topos/tps_storage.c
index 950d1982f4..da141888c3 100644
--- a/src/modules/topos/tps_storage.c
+++ b/src/modules/topos/tps_storage.c
@@ -372,13 +372,28 @@ int tps_storage_link_msg(sip_msg_t *msg, tps_data_t *td, 
int dir)
 int tps_storage_record(sip_msg_t *msg, tps_data_t *td, int dialog)
 {
        int ret;
+       str suid;
 
-       sruid_next(&_tps_sruid);
+       if(dialog==0) {
+               sruid_next(&_tps_sruid);
+               suid = _tps_sruid.uid;
+       } else {
+               if(td->a_uuid.len>0) {
+                       suid = td->a_uuid;
+               } else if(td->b_uuid.len>0) {
+                       suid = td->b_uuid;
+               } else {
+                       goto error;
+               }
+               suid.s++;
+               suid.len--;
+       }
 
-       ret = tps_storage_fill_contact(msg, td, &_tps_sruid.uid, 
TPS_DIR_DOWNSTREAM);
+       ret = tps_storage_fill_contact(msg, td, &suid, TPS_DIR_DOWNSTREAM);
        if(ret<0) goto error;
-       ret = tps_storage_fill_contact(msg, td, &_tps_sruid.uid, 
TPS_DIR_UPSTREAM);
+       ret = tps_storage_fill_contact(msg, td, &suid, TPS_DIR_UPSTREAM);
        if(ret<0) goto error;
+
        ret = tps_storage_link_msg(msg, td, TPS_DIR_DOWNSTREAM);
        if(ret<0) goto error;
        if(td->as_contact.len <= 0 && td->bs_contact.len <= 0) {


_______________________________________________
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to