I think it could be related to: https://github.com/kamailio/kamailio/issues/2479 

Commit: https://github.com/kamailio/kamailio/commit/2e7710e292a649c6c57e46d5994d3b2cf3815865

Thanks!
Joel.

On Thu, Oct 21, 2021 at 4:22 PM Joel Serrano <joel@textplus.com> wrote:
Hello, 

I'm in the process of updating some servers that are running Kam v5.1.4 to v5.5.2.

After the upgrade I've noticed that I've lost some custom metrics that we have defined via config-script. 

Snippet of the relevant config:

event_route[dialog:start] {
    # Gather metrics regarding source IP
    xlog("L_WARN", "[DLG] - Checking country for ($si | $T_req($si)) - START\n");
    if (geoip2_match("$T_req($si)", "src")) {
        # Country found
        ...
    }
    xlog("L_WARN", "[DLG] - Checking country for ($si | $T_req($si)) - END\n");
}


NOTE: xlog lines added for debugging, they normally are not there.


In version 5.1.4 in the logs I see: 

Oct 21 15:55:47 13cn3 sbc[22606]: WARNING: <script>: [DLG] - Checking country for (A.B.C.D | 186.185.186.7) - START
Oct 21 15:55:47 13cn3 sbc[22606]: WARNING: <script>: [DLG] - Checking country for (A.B.C.D | 186.185.186.7) - END

The same config, on v5.5.2 is returning:

Oct 21 15:57:08 sbc0504 sbc[22606]: WARNING: <script>: [DLG] - Checking country for (A.B.C.D | <null>) - START
Oct 21 15:57:08 sbc0504 sbc[22606]: WARNING: <script>: [DLG] - Checking country for (A.B.C.D | <null>) - END

After enabling debug logs I see:

WARNING: <script>: [DLG] - Checking country for (198.1.55.124 | <null>) - START
DEBUG: tmx [t_var.c:309]: pv_get_t_var_req(): used in unsupported route block - type 64
DEBUG: geoip2 [geoip2_pv.c:488]: geoip2_update_pv(): attempt to match: <null>
DEBUG: geoip2 [geoip2_pv.c:491]: geoip2_update_pv(): no match for: <null>



Did something change in the tmx module that could affect $T_req(pv) being accessible in the dialog:start event_route?

Any alternatives to get the source IP of the request (not the reply) in the dialog:start event_route?

Let me know if you prefer that I open a ticket for this in GH.

Thanks, 
Joel.