Module: kamailio Branch: master Commit: 3f0a51b7c29d40136b44e0f7cbc9606902d8855f URL: https://github.com/kamailio/kamailio/commit/3f0a51b7c29d40136b44e0f7cbc9606902d8855f
Author: Daniel-Constantin Mierla <[email protected]> Committer: Daniel-Constantin Mierla <[email protected]> Date: 2026-01-08T11:49:20+01:00 corex: added msg_vbflag_parse() - parse via-body flags param to internal field --- Modified: src/modules/corex/corex_mod.c --- Diff: https://github.com/kamailio/kamailio/commit/3f0a51b7c29d40136b44e0f7cbc9606902d8855f.diff Patch: https://github.com/kamailio/kamailio/commit/3f0a51b7c29d40136b44e0f7cbc9606902d8855f.patch --- diff --git a/src/modules/corex/corex_mod.c b/src/modules/corex/corex_mod.c index a4f9c669759..0242cb44a86 100644 --- a/src/modules/corex/corex_mod.c +++ b/src/modules/corex/corex_mod.c @@ -82,6 +82,7 @@ static int w_is_socket_name(sip_msg_t *msg, char *psockname, char *p2); static int w_msg_vbflag_set(sip_msg_t *msg, char *pflag, char *p2); static int w_msg_vbflag_reset(sip_msg_t *msg, char *pflag, char *p2); static int w_msg_vbflag_is_set(sip_msg_t *msg, char *pflag, char *p2); +static int w_msg_vbflag_parse(sip_msg_t *msg, char *p1, char *p2); static int fixup_file_op(void **param, int param_no); static int fixup_free_file_op(void **param, int param_no); @@ -195,6 +196,8 @@ static cmd_export_t cmds[] = { fixup_igp_null, fixup_free_igp_null, ANY_ROUTE}, {"msg_vbflag_is_set", (cmd_function)w_msg_vbflag_is_set, 1, fixup_igp_null, fixup_free_igp_null, ANY_ROUTE}, + {"msg_vbflag_parse", (cmd_function)w_msg_vbflag_parse, 1, + 0, 0, ANY_ROUTE}, {0, 0, 0, 0, 0, 0} }; @@ -834,6 +837,45 @@ static int w_msg_vbflag_set(sip_msg_t *msg, char *flag, char *s2) return ki_msg_vbflag_set(msg, fval); } +extern str _ksr_via_body_flags; + +/** + * + */ +static int ki_msg_vbflag_parse(sip_msg_t *msg) +{ + via_param_t *vp; + + if(parse_headers(msg, HDR_EOH_F, HDR_VIA_T) < 0) { + LM_DBG("failed to parse sip headers\n"); + return -1; + } + if(msg->via1 == NULL) { + LM_DBG("no via headers\n"); + return -1; + } + for(vp = msg->via1->param_lst; vp != NULL; vp = vp->next) { + if(vp->name.len == _ksr_via_body_flags.len + && strncasecmp(vp->name.s, _ksr_via_body_flags.s, + _ksr_via_body_flags.len) + == 0) { + if(vp->value.len > 0) { + hexstr2int(vp->value.s, vp->value.len, &msg->vbflags); + return 1; + } + } + } + return -1; +} + +/** + * + */ +static int w_msg_vbflag_parse(sip_msg_t *msg, char *p1, char *p2) +{ + return ki_msg_vbflag_parse(msg); +} + /** * */ _______________________________________________ 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!
