Module: kamailio Branch: master Commit: a2878889eb983798b2991e883011f1863ac363fe URL: https://github.com/kamailio/kamailio/commit/a2878889eb983798b2991e883011f1863ac363fe
Author: Xenofon Karamanos <[email protected]> Committer: Daniel-Constantin Mierla <[email protected]> Date: 2026-01-26T13:21:57+01:00 topos: Add new modparam for updating rectime on RE-INVITE - Allow disabling updates by providing empty modparam - Remove direction for subscribe - Allow any method provided to update the value --- Modified: src/modules/topos/topos_mod.c Modified: src/modules/topos/tps_msg.c Modified: src/modules/topos/tps_storage.c --- Diff: https://github.com/kamailio/kamailio/commit/a2878889eb983798b2991e883011f1863ac363fe.diff Patch: https://github.com/kamailio/kamailio/commit/a2878889eb983798b2991e883011f1863ac363fe.patch --- diff --git a/src/modules/topos/topos_mod.c b/src/modules/topos/topos_mod.c index 7622f7ac38f..2270f733b7f 100644 --- a/src/modules/topos/topos_mod.c +++ b/src/modules/topos/topos_mod.c @@ -89,6 +89,7 @@ int _tps_sanity_checks = 0; int _tps_rr_update = 0; int _tps_header_mode = 0; str _tps_storage = str_init("db"); +str _tps_methods_update_time_list = str_init("SUBSCRIBE"); extern int _tps_branch_expire; extern int _tps_dialog_expire; @@ -96,6 +97,7 @@ extern unsigned int _tps_methods_nocontact; str _tps_methods_nocontact_list = str_init(""); extern unsigned int _tps_methods_noinitial; str _tps_methods_noinitial_list = str_init(""); +unsigned int _tps_methods_update_time = METHOD_SUBSCRIBE; static topoh_api_t thb = {0}; @@ -191,6 +193,7 @@ static param_export_t params[] = { {"methods_nocontact", PARAM_STR, &_tps_methods_nocontact_list}, {"methods_noinitial", PARAM_STR, &_tps_methods_noinitial_list}, {"version_table", PARAM_INT, &_tps_version_table_check}, + {"methods_update_time", PARAM_STR, &_tps_methods_update_time_list}, {0, 0, 0} }; @@ -260,6 +263,20 @@ static int mod_init(void) return -1; } } + + if(_tps_methods_update_time_list.len <= 0) { + /* Modparam provided but empty. No methods */ + _tps_methods_update_time = 0; + } else { + /* Modparam provided with some methods or default value */ + if(parse_methods( + &_tps_methods_update_time_list, &_tps_methods_update_time) + < 0) { + LM_ERR("failed to parse methods_update_time parameter\n"); + return -1; + } + } + if(_tps_storage.len == 2 && strncmp(_tps_storage.s, "db", 2) == 0) { /* Find a database module */ if(db_bind_mod(&_tps_db_url, &_tpsdbf)) { diff --git a/src/modules/topos/tps_msg.c b/src/modules/topos/tps_msg.c index 8080e4a65c9..e724a8777ab 100644 --- a/src/modules/topos/tps_msg.c +++ b/src/modules/topos/tps_msg.c @@ -53,6 +53,7 @@ extern int _tps_contact_mode; extern str _tps_cparam_name; extern int _tps_rr_update; extern int _tps_header_mode; +extern unsigned int _tps_methods_update_time; extern str _tps_context_param; extern str _tps_context_value; @@ -1013,7 +1014,7 @@ int tps_request_received(sip_msg_t *msg, int dialog) goto error; } } - if(metid & METHOD_SUBSCRIBE) { + if(metid & _tps_methods_update_time) { if(tps_storage_update_dialog( msg, &mtsd, &stsd, TPS_DBU_CONTACT | TPS_DBU_TIME) < 0) { diff --git a/src/modules/topos/tps_storage.c b/src/modules/topos/tps_storage.c index 3f60ca7ec3c..b8d3378b1dc 100644 --- a/src/modules/topos/tps_storage.c +++ b/src/modules/topos/tps_storage.c @@ -64,6 +64,7 @@ extern str _tps_xavu_field_bcontact; extern str _tps_xavu_field_contact_host; extern str _tps_xavu_field_acontact_host; extern str _tps_xavu_field_bcontact_host; +extern int _tps_methods_update_time; extern str _tps_context_param; extern str _tps_context_value; @@ -1854,11 +1855,9 @@ int tps_db_update_dialog( } } if((mode & TPS_DBU_TIME) - && ((sd->b_tag.len > 0) - && ((md->direction == TPS_DIR_UPSTREAM) - && (msg->first_line.type == SIP_REQUEST)) + && ((sd->b_tag.len > 0) && (msg->first_line.type == SIP_REQUEST) && (msg->first_line.u.request.method_value - == METHOD_SUBSCRIBE))) { + & _tps_methods_update_time))) { db_ucols[nr_ucols] = &td_col_rectime; db_uvals[nr_ucols].type = DB1_DATETIME; db_uvals[nr_ucols].val.time_val = time(NULL); _______________________________________________ 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!
