Module: kamailio Branch: master Commit: c48ba19438b96912264a0e9fa859aee079461c0d URL: https://github.com/kamailio/kamailio/commit/c48ba19438b96912264a0e9fa859aee079461c0d
Author: Daniel-Constantin Mierla <mico...@gmail.com> Committer: Daniel-Constantin Mierla <mico...@gmail.com> Date: 2025-08-06T18:39:54+02:00 dispatcher: extract intern uid from transaction from_hdr field --- Modified: src/modules/dispatcher/dispatch.c --- Diff: https://github.com/kamailio/kamailio/commit/c48ba19438b96912264a0e9fa859aee079461c0d.diff Patch: https://github.com/kamailio/kamailio/commit/c48ba19438b96912264a0e9fa859aee079461c0d.patch --- diff --git a/src/modules/dispatcher/dispatch.c b/src/modules/dispatcher/dispatch.c index 7b7784cc38a..3a42b26eb25 100644 --- a/src/modules/dispatcher/dispatch.c +++ b/src/modules/dispatcher/dispatch.c @@ -4114,6 +4114,47 @@ int ds_is_active_uri(sip_msg_t *msg, int group, str *uri) return -1; } +/*! + * + */ +int ds_extract_fromhdr_iuid(str *from, str *iuid) +{ + char *p = NULL; + str stag = str_init(";tag="); + + if(from == NULL || from->s == NULL) { + return -1; + } + + p = str_search(from, &stag); + if(p == NULL) { + return -1; + } + p += 5; + iuid->s = p; + iuid->len = 0; + while(p < from->s + from->len) { + if(*p == ';' || *p == ' ' || *p == '\r' || *p == '\n' || *p == '\t') { + break; + } + iuid->len++; + p++; + } + if(iuid->len < 10) { + iuid->s = NULL; + iuid->len = 0; + return -1; + } + if(iuid->s[iuid->len - 5] != '-') { + iuid->s = NULL; + iuid->len = 0; + return -1; + } + iuid->len -= 5; + + return 0; +} + /*! \brief * Callback-Function for the OPTIONS-Request * This Function is called, as soon as the Transaction is finished @@ -4165,6 +4206,9 @@ static void ds_options_callback( rctx.setid = group; ds_rctx_set_uri(&rctx, &uri); + ds_extract_fromhdr_iuid(&t->from_hdr, &iuid); + LM_INFO("=== iuid: %.*s\n", iuid.len, iuid.s); + /* Check if in the meantime someone disabled probing of the target * through RPC or reload */ if(ds_probing_mode == DS_PROBE_ONLYFLAGGED _______________________________________________ Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org To unsubscribe send an email to sr-dev-le...@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!