[sr-dev] git:5.8:215af598: pdb server: allow carrier id 0
Module: kamailio Branch: 5.8 Commit: 215af59832efc6e485563b55e3af9d209121d0c5 URL: https://github.com/kamailio/kamailio/commit/215af59832efc6e485563b55e3af9d209121d0c5 Author: Stefan-Cristian Mititelu Committer: Stefan-Cristian Mititelu Date: 2024-04-08T12:47:20+03:00 pdb server: allow carrier id 0 (cherry-picked from commit 60ded00a3b574a08457a696334d11d668595cc0b) --- Modified: utils/pdbt/common.h --- Diff: https://github.com/kamailio/kamailio/commit/215af59832efc6e485563b55e3af9d209121d0c5.diff Patch: https://github.com/kamailio/kamailio/commit/215af59832efc6e485563b55e3af9d209121d0c5.patch --- diff --git a/utils/pdbt/common.h b/utils/pdbt/common.h index 2146109a29d..a014e7d97e4 100644 --- a/utils/pdbt/common.h +++ b/utils/pdbt/common.h @@ -36,7 +36,7 @@ -1000..-1 used in dtm to indicate a carrier id and that no more nodes will follow (leaf node compression). -1001 used in dtm to mark a pointer to a child node as NULL. */ -#define MIN_PDB_CARRIERID 1 +#define MIN_PDB_CARRIERID 0 #define MAX_PDB_CARRIERID 999 #define OTHER_CARRIERID 1000 #define MAX_CARRIERID 1000 ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:5.7:46cf3559: pdb server: allow carrier id 0
Module: kamailio Branch: 5.7 Commit: 46cf3559f4847b00790c043de41699b6c16f4920 URL: https://github.com/kamailio/kamailio/commit/46cf3559f4847b00790c043de41699b6c16f4920 Author: Stefan-Cristian Mititelu Committer: Stefan-Cristian Mititelu Date: 2024-04-08T12:46:54+03:00 pdb server: allow carrier id 0 (cherry-picked from commit 60ded00a3b574a08457a696334d11d668595cc0b) --- Modified: utils/pdbt/common.h --- Diff: https://github.com/kamailio/kamailio/commit/46cf3559f4847b00790c043de41699b6c16f4920.diff Patch: https://github.com/kamailio/kamailio/commit/46cf3559f4847b00790c043de41699b6c16f4920.patch --- diff --git a/utils/pdbt/common.h b/utils/pdbt/common.h index 7d121430f1b..e10e2d11658 100644 --- a/utils/pdbt/common.h +++ b/utils/pdbt/common.h @@ -32,7 +32,7 @@ -1000..-1 used in dtm to indicate a carrier id and that no more nodes will follow (leaf node compression). -1001 used in dtm to mark a pointer to a child node as NULL. */ -#define MIN_PDB_CARRIERID 1 +#define MIN_PDB_CARRIERID 0 #define MAX_PDB_CARRIERID 999 #define OTHER_CARRIERID 1000 #define MAX_CARRIERID 1000 ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:5.6:2a6f18aa: pdb server: allow carrier id 0
Module: kamailio Branch: 5.6 Commit: 2a6f18aaf08d87c71c530a14ebae17d211ae8a25 URL: https://github.com/kamailio/kamailio/commit/2a6f18aaf08d87c71c530a14ebae17d211ae8a25 Author: Stefan-Cristian Mititelu Committer: Stefan-Cristian Mititelu Date: 2024-04-08T12:46:21+03:00 pdb server: allow carrier id 0 (cherry-picked from commit 60ded00a3b574a08457a696334d11d668595cc0b) --- Modified: utils/pdbt/common.h --- Diff: https://github.com/kamailio/kamailio/commit/2a6f18aaf08d87c71c530a14ebae17d211ae8a25.diff Patch: https://github.com/kamailio/kamailio/commit/2a6f18aaf08d87c71c530a14ebae17d211ae8a25.patch --- diff --git a/utils/pdbt/common.h b/utils/pdbt/common.h index 7d121430f1b..e10e2d11658 100644 --- a/utils/pdbt/common.h +++ b/utils/pdbt/common.h @@ -32,7 +32,7 @@ -1000..-1 used in dtm to indicate a carrier id and that no more nodes will follow (leaf node compression). -1001 used in dtm to mark a pointer to a child node as NULL. */ -#define MIN_PDB_CARRIERID 1 +#define MIN_PDB_CARRIERID 0 #define MAX_PDB_CARRIERID 999 #define OTHER_CARRIERID 1000 #define MAX_CARRIERID 1000 ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:master:60ded00a: pdb server: allow carrier id 0
Module: kamailio Branch: master Commit: 60ded00a3b574a08457a696334d11d668595cc0b URL: https://github.com/kamailio/kamailio/commit/60ded00a3b574a08457a696334d11d668595cc0b Author: Stefan-Cristian Mititelu Committer: Stefan-Cristian Mititelu Date: 2024-04-08T11:35:38+03:00 pdb server: allow carrier id 0 --- Modified: utils/pdbt/common.h --- Diff: https://github.com/kamailio/kamailio/commit/60ded00a3b574a08457a696334d11d668595cc0b.diff Patch: https://github.com/kamailio/kamailio/commit/60ded00a3b574a08457a696334d11d668595cc0b.patch --- diff --git a/utils/pdbt/common.h b/utils/pdbt/common.h index 2146109a29d..a014e7d97e4 100644 --- a/utils/pdbt/common.h +++ b/utils/pdbt/common.h @@ -36,7 +36,7 @@ -1000..-1 used in dtm to indicate a carrier id and that no more nodes will follow (leaf node compression). -1001 used in dtm to mark a pointer to a child node as NULL. */ -#define MIN_PDB_CARRIERID 1 +#define MIN_PDB_CARRIERID 0 #define MAX_PDB_CARRIERID 999 #define OTHER_CARRIERID 1000 #define MAX_CARRIERID 1000 ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:5.8:6410f375: pdb: Return negative carrierid for failures
Module: kamailio Branch: 5.8 Commit: 6410f375cd6d1e357afeb9e100bd3a3c51321280 URL: https://github.com/kamailio/kamailio/commit/6410f375cd6d1e357afeb9e100bd3a3c51321280 Author: Stefan-Cristian Mititelu Committer: Stefan-Cristian Mititelu Date: 2024-03-18T13:35:05+02:00 pdb: Return negative carrierid for failures (cherry-picked from commit bf78b619ae28924361fb2c757a4d09eb1a39f5cd) --- Modified: src/modules/pdb/pdb.c --- Diff: https://github.com/kamailio/kamailio/commit/6410f375cd6d1e357afeb9e100bd3a3c51321280.diff Patch: https://github.com/kamailio/kamailio/commit/6410f375cd6d1e357afeb9e100bd3a3c51321280.patch --- diff --git a/src/modules/pdb/pdb.c b/src/modules/pdb/pdb.c index 6889e63b915..1398f7574f8 100644 --- a/src/modules/pdb/pdb.c +++ b/src/modules/pdb/pdb.c @@ -393,20 +393,20 @@ static int pdb_query(struct sip_msg *_msg, struct multiparam_t *_number, goto found; } break; - case PDB_CODE_NOT_NUMBER: - LM_NOTICE("Number %s has letters in it\n", - number.s); - carrierid = 0; - goto found; case PDB_CODE_NOT_FOUND: LM_NOTICE("Number %s pdb_id not found\n", number.s); - carrierid = 0; + carrierid = -1; + goto found; + case PDB_CODE_NOT_NUMBER: + LM_NOTICE("Number %s has letters in it\n", + number.s); + carrierid = -2; goto found; default: LM_NOTICE("Invalid code %d received\n", msg.hdr.code); - carrierid = 0; + carrierid = -3; goto found; } ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:5.8:0af55b0e: pdb server: Return negative carrierid for failures. Clang format
Module: kamailio Branch: 5.8 Commit: 0af55b0eac8c3457db859a9c37fea211ece91b8a URL: https://github.com/kamailio/kamailio/commit/0af55b0eac8c3457db859a9c37fea211ece91b8a Author: Stefan-Cristian Mititelu Committer: Stefan-Cristian Mititelu Date: 2024-03-18T13:36:10+02:00 pdb server: Return negative carrierid for failures. Clang format (cherry-picked from commit 88b698e0f62c39ed60af9f0a4fb3ca2dc6867d8f) --- Modified: utils/pdbt/pdb_server.c Modified: utils/pdbt/pdb_server_backend.c --- Diff: https://github.com/kamailio/kamailio/commit/0af55b0eac8c3457db859a9c37fea211ece91b8a.diff Patch: https://github.com/kamailio/kamailio/commit/0af55b0eac8c3457db859a9c37fea211ece91b8a.patch ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:5.7:e8150f78: pdb: Return negative carrierid for failures
Module: kamailio Branch: 5.7 Commit: e8150f78630f7991ea31a385c899c32c0e330a26 URL: https://github.com/kamailio/kamailio/commit/e8150f78630f7991ea31a385c899c32c0e330a26 Author: Stefan-Cristian Mititelu Committer: Stefan-Cristian Mititelu Date: 2024-03-18T13:23:29+02:00 pdb: Return negative carrierid for failures (cherry picked from commit bf78b619ae28924361fb2c757a4d09eb1a39f5cd) --- Modified: src/modules/pdb/pdb.c --- Diff: https://github.com/kamailio/kamailio/commit/e8150f78630f7991ea31a385c899c32c0e330a26.diff Patch: https://github.com/kamailio/kamailio/commit/e8150f78630f7991ea31a385c899c32c0e330a26.patch --- diff --git a/src/modules/pdb/pdb.c b/src/modules/pdb/pdb.c index 75013cccb7a..3c37e5971ea 100644 --- a/src/modules/pdb/pdb.c +++ b/src/modules/pdb/pdb.c @@ -386,20 +386,20 @@ static int pdb_query(struct sip_msg *_msg, struct multiparam_t *_number, goto found; } break; - case PDB_CODE_NOT_NUMBER: - LM_NOTICE("Number %s has letters in it\n", - number.s); - carrierid = 0; - goto found; case PDB_CODE_NOT_FOUND: LM_NOTICE("Number %s pdb_id not found\n", number.s); - carrierid = 0; + carrierid = -1; + goto found; + case PDB_CODE_NOT_NUMBER: + LM_NOTICE("Number %s has letters in it\n", + number.s); + carrierid = -2; goto found; default: LM_NOTICE("Invalid code %d received\n", msg.hdr.code); - carrierid = 0; + carrierid = -3; goto found; } ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:5.7:c717c016: pdb server: Return negative carrierid for failures. Clang format
Module: kamailio Branch: 5.7 Commit: c717c016b70a82566dfc58d8d9dee3d3f51ddb01 URL: https://github.com/kamailio/kamailio/commit/c717c016b70a82566dfc58d8d9dee3d3f51ddb01 Author: Stefan-Cristian Mititelu Committer: Stefan-Cristian Mititelu Date: 2024-03-18T13:25:21+02:00 pdb server: Return negative carrierid for failures. Clang format (cherry-picked from commit 88b698e0f62c39ed60af9f0a4fb3ca2dc6867d8f) --- Modified: utils/pdbt/pdb_server.c Modified: utils/pdbt/pdb_server_backend.c --- Diff: https://github.com/kamailio/kamailio/commit/c717c016b70a82566dfc58d8d9dee3d3f51ddb01.diff Patch: https://github.com/kamailio/kamailio/commit/c717c016b70a82566dfc58d8d9dee3d3f51ddb01.patch --- diff --git a/utils/pdbt/pdb_server.c b/utils/pdbt/pdb_server.c index 6ce32557cc7..2de2ba789d7 100644 --- a/utils/pdbt/pdb_server.c +++ b/utils/pdbt/pdb_server.c @@ -151,7 +151,7 @@ int udp_server(int so) carrierid = lookup_number(msg.bdy.payload); /* check if not found pdb_id */ - if(carrierid == 0) { + if(carrierid == -1) { pdb_msg_format_send(&msg, PDB_VERSION_1, PDB_TYPE_REPLY_ID, PDB_CODE_NOT_FOUND, htons(msg.hdr.id), NULL, 0); goto msg_send; diff --git a/utils/pdbt/pdb_server_backend.c b/utils/pdbt/pdb_server_backend.c index dc4028bee19..931e28d7603 100644 --- a/utils/pdbt/pdb_server_backend.c +++ b/utils/pdbt/pdb_server_backend.c @@ -44,8 +44,8 @@ carrier_t lookup_number(char *number) carrier_t carrierid; int nmatch = dtm_longest_match(mroot, number, strlen(number), &carrierid); if(nmatch <= 0) { - /* nothing found - return id 0 */ - carrierid = 0; + /* nothing found - return id -1 */ + carrierid = -1; } LINFO("request='%s', nmatch=%ld, carrier=%ld\n", number, (long int)nmatch, (long int)carrierid); ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:5.6:16f053f5: pdb server: Return negative carrierid for failures. Clang format
Module: kamailio Branch: 5.6 Commit: 16f053f5eb3a36992225c1a72db3575165bb68a8 URL: https://github.com/kamailio/kamailio/commit/16f053f5eb3a36992225c1a72db3575165bb68a8 Author: Stefan-Cristian Mititelu Committer: Stefan-Cristian Mititelu Date: 2024-03-18T13:21:18+02:00 pdb server: Return negative carrierid for failures. Clang format (cherry picked from commit 88b698e0f62c39ed60af9f0a4fb3ca2dc6867d8f) --- Modified: utils/pdbt/pdb_server.c Modified: utils/pdbt/pdb_server_backend.c --- Diff: https://github.com/kamailio/kamailio/commit/16f053f5eb3a36992225c1a72db3575165bb68a8.diff Patch: https://github.com/kamailio/kamailio/commit/16f053f5eb3a36992225c1a72db3575165bb68a8.patch --- diff --git a/utils/pdbt/pdb_server.c b/utils/pdbt/pdb_server.c index 6ce32557cc7..2de2ba789d7 100644 --- a/utils/pdbt/pdb_server.c +++ b/utils/pdbt/pdb_server.c @@ -151,7 +151,7 @@ int udp_server(int so) carrierid = lookup_number(msg.bdy.payload); /* check if not found pdb_id */ - if(carrierid == 0) { + if(carrierid == -1) { pdb_msg_format_send(&msg, PDB_VERSION_1, PDB_TYPE_REPLY_ID, PDB_CODE_NOT_FOUND, htons(msg.hdr.id), NULL, 0); goto msg_send; diff --git a/utils/pdbt/pdb_server_backend.c b/utils/pdbt/pdb_server_backend.c index dc4028bee19..931e28d7603 100644 --- a/utils/pdbt/pdb_server_backend.c +++ b/utils/pdbt/pdb_server_backend.c @@ -44,8 +44,8 @@ carrier_t lookup_number(char *number) carrier_t carrierid; int nmatch = dtm_longest_match(mroot, number, strlen(number), &carrierid); if(nmatch <= 0) { - /* nothing found - return id 0 */ - carrierid = 0; + /* nothing found - return id -1 */ + carrierid = -1; } LINFO("request='%s', nmatch=%ld, carrier=%ld\n", number, (long int)nmatch, (long int)carrierid); ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:5.6:831b8329: pdb: Return negative carrierid for failures
Module: kamailio Branch: 5.6 Commit: 831b832916083900d1426e53518f34ed77aa28ad URL: https://github.com/kamailio/kamailio/commit/831b832916083900d1426e53518f34ed77aa28ad Author: Stefan-Cristian Mititelu Committer: Stefan-Cristian Mititelu Date: 2024-03-18T13:20:09+02:00 pdb: Return negative carrierid for failures (cherry picked from commit bf78b619ae28924361fb2c757a4d09eb1a39f5cd) --- Modified: src/modules/pdb/pdb.c --- Diff: https://github.com/kamailio/kamailio/commit/831b832916083900d1426e53518f34ed77aa28ad.diff Patch: https://github.com/kamailio/kamailio/commit/831b832916083900d1426e53518f34ed77aa28ad.patch --- diff --git a/src/modules/pdb/pdb.c b/src/modules/pdb/pdb.c index bfe31b4e8eb..e310d43acae 100644 --- a/src/modules/pdb/pdb.c +++ b/src/modules/pdb/pdb.c @@ -386,20 +386,20 @@ static int pdb_query(struct sip_msg *_msg, struct multiparam_t *_number, goto found; } break; - case PDB_CODE_NOT_NUMBER: - LM_NOTICE("Number %s has letters in it\n", - number.s); - carrierid = 0; - goto found; case PDB_CODE_NOT_FOUND: LM_NOTICE("Number %s pdb_id not found\n", number.s); - carrierid = 0; + carrierid = -1; + goto found; + case PDB_CODE_NOT_NUMBER: + LM_NOTICE("Number %s has letters in it\n", + number.s); + carrierid = -2; goto found; default: LM_NOTICE("Invalid code %d received\n", msg.hdr.code); - carrierid = 0; + carrierid = -3; goto found; } ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:master:4efd1fc3: p_usrloc: Add new modparam 'preload'
Module: kamailio Branch: master Commit: 4efd1fc33ceb5dc33b01020968b0d7281e902d1f URL: https://github.com/kamailio/kamailio/commit/4efd1fc33ceb5dc33b01020968b0d7281e902d1f Author: Stefan-Cristian Mititelu Committer: Stefan-Cristian Mititelu Date: 2024-02-01T14:00:17+02:00 p_usrloc: Add new modparam 'preload' Useful when using kemi with p_usrloc, in order to preload location table. --- Modified: src/modules/p_usrloc/p_usrloc_mod.c --- Diff: https://github.com/kamailio/kamailio/commit/4efd1fc33ceb5dc33b01020968b0d7281e902d1f.diff Patch: https://github.com/kamailio/kamailio/commit/4efd1fc33ceb5dc33b01020968b0d7281e902d1f.patch --- diff --git a/src/modules/p_usrloc/p_usrloc_mod.c b/src/modules/p_usrloc/p_usrloc_mod.c index 8179d12ae14..539ad31b031 100644 --- a/src/modules/p_usrloc/p_usrloc_mod.c +++ b/src/modules/p_usrloc/p_usrloc_mod.c @@ -88,6 +88,11 @@ static int child_init(int rank); /*!< Per-child init function */ extern int bind_usrloc(usrloc_api_t *api); extern int ul_locks_no; +#define UL_PRELOAD_SIZE 8 +static char *ul_preload_list[UL_PRELOAD_SIZE]; +static int ul_preload_index = 0; +static int ul_preload_param(modparam_t type, void *val); + /* * Module parameters and their default values */ @@ -269,6 +274,7 @@ static param_export_t params[] = {{"ruid_column", PARAM_STR, &ruid_col}, {"db_update_as_insert", INT_PARAM, &default_p_usrloc_cfg.db_update_as_insert}, {"mdb_availability_control", INT_PARAM, &mdb_availability_control}, + {"preload", PARAM_STRING | USE_FUNC_PARAM, (void *)ul_preload_param}, {0, 0, 0}}; @@ -310,6 +316,8 @@ struct module_exports exports = { */ static int mod_init(void) { + int i = 0; + udomain_t *d; int matching_mode_cfg = cfg_get(p_usrloc, p_usrloc_cfg, matching_mode); #ifdef STATISTICS @@ -352,6 +360,14 @@ static int mod_init(void) return -1; } + /* preload tables */ + for(i = 0; i < ul_preload_index; i++) { + if(register_udomain((const char *)ul_preload_list[i], &d) < 0) { + LM_ERR("cannot register preloaded table %s\n", ul_preload_list[i]); + return -1; + } + } + if(db_mode != DB_ONLY) { LM_ERR("DB_ONLY is the only mode possible for partitioned usrloc. " "Please set db_mode to 3\n"); @@ -513,3 +529,23 @@ time_t ul_db_datetime_get(time_t v) return v; } } + +/*! \brief + * preload module parameter handler + */ +static int ul_preload_param(modparam_t type, void *val) +{ + if(val == NULL) { + LM_ERR("invalid parameter\n"); + goto error; + } + if(ul_preload_index >= UL_PRELOAD_SIZE) { + LM_ERR("too many preloaded tables\n"); + goto error; + } + ul_preload_list[ul_preload_index] = (char *)val; + ul_preload_index++; + return 0; +error: + return -1; +} ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] Re: Make dlg_dmq_replicate_action() available from config
Thank you for all the feedback. Definitely I have to give this subject a second thought. --- Stefan From: Henning Westerholt Sent: Saturday, January 27, 2024 10:00:26 AM To: Kamailio (SER) - Development Mailing List Cc: Stefan-Cristian Mititelu Subject: RE: Make dlg_dmq_replicate_action() available from config Hello Stefan, Alex already provided some background why its not that easy and probably not a good idea. If you want to access lower level DMQ functions, there are dmq_send_message(..) and similar functions available already. There is also always the possibility to implement a more simple tracking htable (dmq replication) modules. Just keep in mind that this will be not 100% accurate, due to some possible race conditions in the DMQ processing. If there are some limitations in the DMQ module dialog replication, they should probably be addressed instead of providing some manual workarounds. As mentioned, some of the limitations might be caused from the intricacies of the TM module state. As you observed in your previous e-mail, if the dialog is going e.g. in state 4 or state 5, this should be replicated. Cheers, Henning -- Henning Westerholt – https://skalatan.de/blog/ Kamailio services – https://gilawa.com<https://gilawa.com/> From: Stefan-Cristian Mititelu via sr-dev Sent: Freitag, 26. Januar 2024 20:06 To: Kamailio (SER) - Development Mailing List Cc: Stefan-Cristian Mititelu Subject: [sr-dev] Make dlg_dmq_replicate_action() available from config Hello, I am thinking of making dlg_dmq_replicate_action() available to be called from config, so one can do the following on the DMQ peer node: def ksr_reply_route(self, msg): if KSR.tm.t_check_trans() < 0: if KSR.dialog.is_known_dlg(): if KSR.pv.get("$rs") == "180": KSR.dialog.dlg_dmq_replicate_action(DLG_STATE_EARLY, dlg, 0, 0) else if KSR.pv.get("$rs") == "200": KSR.dialog.dlg_dmq_replicate_action(DLG_STATE_CONFIRMED, dlg, 0, 0) Similar for BYEs, but I have to check that: KSR.dialog.dlg_dmq_replicate_action(DLG_STATE_DELETED, dlg, 0, 0) Is this a good idea? Or someone can see some issues with that? Thanks, Stefan ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] Make dlg_dmq_replicate_action() available from config
Hello, I am thinking of making dlg_dmq_replicate_action() available to be called from config, so one can do the following on the DMQ peer node: def ksr_reply_route(self, msg): if KSR.tm.t_check_trans() < 0: if KSR.dialog.is_known_dlg(): if KSR.pv.get("$rs") == "180": KSR.dialog.dlg_dmq_replicate_action(DLG_STATE_EARLY, dlg, 0, 0) else if KSR.pv.get("$rs") == "200": KSR.dialog.dlg_dmq_replicate_action(DLG_STATE_CONFIRMED, dlg, 0, 0) Similar for BYEs, but I have to check that: KSR.dialog.dlg_dmq_replicate_action(DLG_STATE_DELETED, dlg, 0, 0) Is this a good idea? Or someone can see some issues with that? Thanks, Stefan ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:master:f59dacf7: p_usrloc: Add missing api function get_udomain()
Module: kamailio Branch: master Commit: f59dacf7993da83553cd67de516fc31f493d2a7d URL: https://github.com/kamailio/kamailio/commit/f59dacf7993da83553cd67de516fc31f493d2a7d Author: Stefan-Cristian Mititelu Committer: Stefan-Cristian Mititelu Date: 2024-01-19T15:54:24+02:00 p_usrloc: Add missing api function get_udomain() When registrar kemi save()/save_uri() function is called, then usrloc api function get_udomain() is called. This usrloc api function is missing in p_usrloc module and results in a segfault. --- Modified: src/modules/p_usrloc/dlist.c Modified: src/modules/p_usrloc/dlist.h Modified: src/modules/p_usrloc/usrloc.c --- Diff: https://github.com/kamailio/kamailio/commit/f59dacf7993da83553cd67de516fc31f493d2a7d.diff Patch: https://github.com/kamailio/kamailio/commit/f59dacf7993da83553cd67de516fc31f493d2a7d.patch --- diff --git a/src/modules/p_usrloc/dlist.c b/src/modules/p_usrloc/dlist.c index fa66b20b9a7..0a7080e2c63 100644 --- a/src/modules/p_usrloc/dlist.c +++ b/src/modules/p_usrloc/dlist.c @@ -171,3 +171,42 @@ int synchronize_all_udomains(void) LM_INFO("not available with partitioned interface\n"); return res; } + +/*! + * \brief Registers a new domain with usrloc + * + * Find and return a usrloc domain (location table) + * \param _n domain name + * \param _d usrloc domain + * \return 0 on success, -1 on failure + */ +int get_udomain(const char *_n, udomain_t **_d) +{ + struct domain_list_item *item; + str s; + + if(_n == NULL) { + LM_ERR("null location table name\n"); + goto notfound; + } + + s.s = (char *)_n; + s.len = strlen(_n); + if(s.len <= 0) { + LM_ERR("empty location table name\n"); + goto notfound; + } + + item = find_dlist(&s); + if(item == NULL) { + LM_ERR("domain %s not found.\n", _n); + goto notfound; + } + + *_d = &item->domain; + return 0; + +notfound: + *_d = NULL; + return -1; +} diff --git a/src/modules/p_usrloc/dlist.h b/src/modules/p_usrloc/dlist.h index 20152694f4f..662847fb131 100644 --- a/src/modules/p_usrloc/dlist.h +++ b/src/modules/p_usrloc/dlist.h @@ -118,5 +118,13 @@ int get_all_ucontacts(void *, int, unsigned int, unsigned int part_idx, */ int find_domain(str *_d, udomain_t **_p); +/*! + * \brief Find and return usrloc domain + * + * \param _n domain name + * \param _d usrloc domain (location table) + * \return 0 on success, -1 on failure + */ +int get_udomain(const char *_n, udomain_t **_d); #endif diff --git a/src/modules/p_usrloc/usrloc.c b/src/modules/p_usrloc/usrloc.c index 6de32f2eeda..221f2d68262 100644 --- a/src/modules/p_usrloc/usrloc.c +++ b/src/modules/p_usrloc/usrloc.c @@ -79,5 +79,6 @@ int bind_usrloc(usrloc_api_t *api) api->db_mode = db_mode; api->nat_flag = nat_bflag; + api->get_udomain = get_udomain; return 0; } ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:5.6:5fea7e17: xlog: add kemi xlog_facility function
Module: kamailio Branch: 5.6 Commit: 5fea7e17389dfc71efee7caff215668335867699 URL: https://github.com/kamailio/kamailio/commit/5fea7e17389dfc71efee7caff215668335867699 Author: Stefan-Cristian Mititelu Committer: Stefan-Cristian Mititelu Date: 2024-01-19T15:39:14+02:00 xlog: add kemi xlog_facility function (cherry-picked from commit e506b60c1045cfbd4485434165305fbc2fb57aa9) --- Modified: src/modules/xlog/xlog.c --- Diff: https://github.com/kamailio/kamailio/commit/5fea7e17389dfc71efee7caff215668335867699.diff Patch: https://github.com/kamailio/kamailio/commit/5fea7e17389dfc71efee7caff215668335867699.patch --- diff --git a/src/modules/xlog/xlog.c b/src/modules/xlog/xlog.c index a6fe9e9aace..94920ca421d 100644 --- a/src/modules/xlog/xlog.c +++ b/src/modules/xlog/xlog.c @@ -877,8 +877,9 @@ static int xlog_log_colors_param(modparam_t type, void *val) /** * write message after evaluation of lmsg for pseudo-variables */ -int ki_xlog_ex(sip_msg_t *msg, int llevel, str *lmsg) +int ki_xlog_ex(sip_msg_t *msg, str *lfacility, int llevel, str *lmsg) { + int lf = xlog_facility; pv_elem_t *xmodel = NULL; str txt = {0, 0}; @@ -895,13 +896,23 @@ int ki_xlog_ex(sip_msg_t *msg, int llevel, str *lmsg) pv_elem_free_all(xmodel); return -1; } - LOG_FN(xlog_facility, llevel, _xlog_prefix, "%.*s", txt.len, txt.s); + + if(lfacility != NULL) { + lfacility->s[lfacility->len] = '\0'; + lf = str2facility(lfacility->s); + if(lf == -1) { + LM_WARN("invalid syslog facility %.*s, using default\n", + lfacility->len, lfacility->s); + lf = xlog_facility; + } + } + LOG_FN(lf, llevel, _xlog_prefix, "%.*s", txt.len, txt.s); ; pv_elem_free_all(xmodel); return 1; } -int ki_xlog(sip_msg_t *msg, str *slevel, str *lmsg) +int ki_xlog_get_level(str *slevel) { int llevel; @@ -926,42 +937,55 @@ int ki_xlog(sip_msg_t *msg, str *slevel, str *lmsg) } else { llevel = L_ERR; } - return ki_xlog_ex(msg, llevel, lmsg); + + return llevel; +} + +int ki_xlog_facility(sip_msg_t *msg, str *lfacility, str *slevel, str *lmsg) +{ + int llevel = ki_xlog_get_level(slevel); + return ki_xlog_ex(msg, lfacility, llevel, lmsg); +} + +int ki_xlog(sip_msg_t *msg, str *slevel, str *lmsg) +{ + int llevel = ki_xlog_get_level(slevel); + return ki_xlog_ex(msg, NULL, llevel, lmsg); } int ki_xdbg(sip_msg_t *msg, str *lmsg) { - return ki_xlog_ex(msg, L_DBG, lmsg); + return ki_xlog_ex(msg, NULL, L_DBG, lmsg); } int ki_xerr(sip_msg_t *msg, str *lmsg) { - return ki_xlog_ex(msg, L_ERR, lmsg); + return ki_xlog_ex(msg, NULL, L_ERR, lmsg); } int ki_xinfo(sip_msg_t *msg, str *lmsg) { - return ki_xlog_ex(msg, L_INFO, lmsg); + return ki_xlog_ex(msg, NULL, L_INFO, lmsg); } int ki_xnotice(sip_msg_t *msg, str *lmsg) { - return ki_xlog_ex(msg, L_NOTICE, lmsg); + return ki_xlog_ex(msg, NULL, L_NOTICE, lmsg); } int ki_xwarn(sip_msg_t *msg, str *lmsg) { - return ki_xlog_ex(msg, L_WARN, lmsg); + return ki_xlog_ex(msg, NULL, L_WARN, lmsg); } int ki_xalert(sip_msg_t *msg, str *lmsg) { - return ki_xlog_ex(msg, L_ALERT, lmsg); + return ki_xlog_ex(msg, NULL, L_ALERT, lmsg); } int ki_xcrit(sip_msg_t *msg, str *lmsg) { - return ki_xlog_ex(msg, L_CRIT, lmsg); + return ki_xlog_ex(msg, NULL, L_CRIT, lmsg); } /** @@ -1009,6 +1033,11 @@ static sr_kemi_t sr_kemi_xlog_exports[] = { { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } }, + { str_init("xlog"), str_init("xlog_facility"), + SR_KEMIP_INT, ki_xlog_facility, + { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR, + SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } + }, { {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } } }; ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:5.7:306b4b09: xlog: add kemi xlog_facility function
Module: kamailio Branch: 5.7 Commit: 306b4b09e3cb46a0fe8bc2d25344e5cfa52941e0 URL: https://github.com/kamailio/kamailio/commit/306b4b09e3cb46a0fe8bc2d25344e5cfa52941e0 Author: Stefan-Cristian Mititelu Committer: Stefan-Cristian Mititelu Date: 2024-01-19T15:38:26+02:00 xlog: add kemi xlog_facility function (cherry picked from commit e506b60c1045cfbd4485434165305fbc2fb57aa9) --- Modified: src/modules/xlog/xlog.c --- Diff: https://github.com/kamailio/kamailio/commit/306b4b09e3cb46a0fe8bc2d25344e5cfa52941e0.diff Patch: https://github.com/kamailio/kamailio/commit/306b4b09e3cb46a0fe8bc2d25344e5cfa52941e0.patch --- diff --git a/src/modules/xlog/xlog.c b/src/modules/xlog/xlog.c index 03063bbfb1f..c7d239ea299 100644 --- a/src/modules/xlog/xlog.c +++ b/src/modules/xlog/xlog.c @@ -878,8 +878,9 @@ static int xlog_log_colors_param(modparam_t type, void *val) /** * write message after evaluation of lmsg for pseudo-variables */ -int ki_xlog_ex(sip_msg_t *msg, int llevel, str *lmsg) +int ki_xlog_ex(sip_msg_t *msg, str *lfacility, int llevel, str *lmsg) { + int lf = xlog_facility; pv_elem_t *xmodel = NULL; str txt = {0, 0}; @@ -896,13 +897,23 @@ int ki_xlog_ex(sip_msg_t *msg, int llevel, str *lmsg) pv_elem_free_all(xmodel); return -1; } - LOG_FN(xlog_facility, llevel, _xlog_prefix, "%.*s", txt.len, txt.s); + + if(lfacility != NULL) { + lfacility->s[lfacility->len] = '\0'; + lf = str2facility(lfacility->s); + if(lf == -1) { + LM_WARN("invalid syslog facility %.*s, using default\n", + lfacility->len, lfacility->s); + lf = xlog_facility; + } + } + LOG_FN(lf, llevel, _xlog_prefix, "%.*s", txt.len, txt.s); ; pv_elem_free_all(xmodel); return 1; } -int ki_xlog(sip_msg_t *msg, str *slevel, str *lmsg) +int ki_xlog_get_level(str *slevel) { int llevel; @@ -927,42 +938,55 @@ int ki_xlog(sip_msg_t *msg, str *slevel, str *lmsg) } else { llevel = L_ERR; } - return ki_xlog_ex(msg, llevel, lmsg); + + return llevel; +} + +int ki_xlog_facility(sip_msg_t *msg, str *lfacility, str *slevel, str *lmsg) +{ + int llevel = ki_xlog_get_level(slevel); + return ki_xlog_ex(msg, lfacility, llevel, lmsg); +} + +int ki_xlog(sip_msg_t *msg, str *slevel, str *lmsg) +{ + int llevel = ki_xlog_get_level(slevel); + return ki_xlog_ex(msg, NULL, llevel, lmsg); } int ki_xdbg(sip_msg_t *msg, str *lmsg) { - return ki_xlog_ex(msg, L_DBG, lmsg); + return ki_xlog_ex(msg, NULL, L_DBG, lmsg); } int ki_xerr(sip_msg_t *msg, str *lmsg) { - return ki_xlog_ex(msg, L_ERR, lmsg); + return ki_xlog_ex(msg, NULL, L_ERR, lmsg); } int ki_xinfo(sip_msg_t *msg, str *lmsg) { - return ki_xlog_ex(msg, L_INFO, lmsg); + return ki_xlog_ex(msg, NULL, L_INFO, lmsg); } int ki_xnotice(sip_msg_t *msg, str *lmsg) { - return ki_xlog_ex(msg, L_NOTICE, lmsg); + return ki_xlog_ex(msg, NULL, L_NOTICE, lmsg); } int ki_xwarn(sip_msg_t *msg, str *lmsg) { - return ki_xlog_ex(msg, L_WARN, lmsg); + return ki_xlog_ex(msg, NULL, L_WARN, lmsg); } int ki_xalert(sip_msg_t *msg, str *lmsg) { - return ki_xlog_ex(msg, L_ALERT, lmsg); + return ki_xlog_ex(msg, NULL, L_ALERT, lmsg); } int ki_xcrit(sip_msg_t *msg, str *lmsg) { - return ki_xlog_ex(msg, L_CRIT, lmsg); + return ki_xlog_ex(msg, NULL, L_CRIT, lmsg); } /** @@ -1010,6 +1034,11 @@ static sr_kemi_t sr_kemi_xlog_exports[] = { { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } }, + { str_init("xlog"), str_init("xlog_facility"), + SR_KEMIP_INT, ki_xlog_facility, + { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR, + SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } + }, { {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } } }; ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:master:21a685a2: ims_qos: Rename new parameter's C variable
Module: kamailio Branch: master Commit: 21a685a200e1ff638358dbbee607d4ab55c57359 URL: https://github.com/kamailio/kamailio/commit/21a685a200e1ff638358dbbee607d4ab55c57359 Author: Stefan-Cristian Mititelu Committer: Stefan-Cristian Mititelu Date: 2023-09-28T16:43:47+03:00 ims_qos: Rename new parameter's C variable --- Modified: src/modules/ims_qos/ims_qos_mod.c Modified: src/modules/ims_qos/rx_aar.c --- Diff: https://github.com/kamailio/kamailio/commit/21a685a200e1ff638358dbbee607d4ab55c57359.diff Patch: https://github.com/kamailio/kamailio/commit/21a685a200e1ff638358dbbee607d4ab55c57359.patch ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org