Module: kamailio
Branch: master
Commit: 824920d5b159d80ce3c241313bf647b5dbbf6661
URL:
https://github.com/kamailio/kamailio/commit/824920d5b159d80ce3c241313bf647b…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-05-01T14:38:36+02:00
topos_redis: use initial transaction method for early dialog branch loading
---
Modified: src/modules/topos_redis/topos_redis_storage.c
---
Diff:
https://github.com/kamailio/kamailio/commit/824920d5b159d80ce3c241313bf647b…
Patch:
https://github.com/kamailio/kamailio/commit/824920d5b159d80ce3c241313bf647b…
---
diff --git a/src/modules/topos_redis/topos_redis_storage.c
b/src/modules/topos_redis/topos_redis_storage.c
index d63543dc38..c2d43b4c33 100644
--- a/src/modules/topos_redis/topos_redis_storage.c
+++ b/src/modules/topos_redis/topos_redis_storage.c
@@ -588,6 +588,7 @@ int tps_redis_load_initial_method_branch(sip_msg_t *msg, tps_data_t
*md, tps_dat
str skey = STR_NULL;
str sval = STR_NULL;
str xuuid = str_init("");
+ str smethod = str_init("INVITE");
if(msg==NULL || md==NULL || sd==NULL)
return -1;
@@ -622,12 +623,17 @@ int tps_redis_load_initial_method_branch(sip_msg_t *msg, tps_data_t
*md, tps_dat
xuuid.len = sd->b_uuid.len - 1;
}
+ if(md->s_method_id & (METHOD_SUBSCRIBE|METHOD_NOTIFY)) {
+ smethod.s = "SUBSCRIBE";
+ smethod.len =9;
+ }
+
rp = _tps_redis_cbuf;
rkey.len = snprintf(rp, TPS_REDIS_DATA_SIZE,
"%.*s%.*s:%.*s:%.*s:x%.*s",
_tps_redis_bprefix.len, _tps_redis_bprefix.s,
- md->s_method.len, md->s_method.s,
+ smethod.len, smethod.s,
md->a_callid.len, md->a_callid.s,
md->b_tag.len, md->b_tag.s,
xuuid.len, xuuid.s);
@@ -1161,15 +1167,11 @@ int tps_redis_update_branch(sip_msg_t *msg, tps_data_t *md,
tps_data_t *sd,
return -1;
}
- if(md->s_method.len==6 && strncmp(md->s_method.s, "INVITE",
6)==0) {
- if(tps_redis_insert_initial_method_branch(md, sd)<0) {
- LM_ERR("failed to insert INVITE extra branch data\n");
- return -1;
- }
- }
- if(md->s_method.len==9 && strncmp(md->s_method.s, "SUBSCRIBE",
9)==0) {
+ if(md->s_method_id==METHOD_INVITE
+ || md->s_method_id==METHOD_SUBSCRIBE) {
if(tps_redis_insert_initial_method_branch(md, sd)<0) {
- LM_ERR("failed to insert SUBSCRIBE extra branch data\n");
+ LM_ERR("failed to insert %.*s extra initial branch data\n",
+ md->s_method.len, md->s_method.s);
return -1;
}
}