Hello,
indeed, there was a change in the behaviour based on the links you provided. It was not safe to use $T_req() in other route blocks. Maybe for event_route[dialog:start] would still be ok, because it is executed only on 200ok for INVITE, but dialog:end can be executed on dialog timeout, without any request/reply within dialog being processed at time.
The solution is to store the source IP of the request avp/xavp (I think this event route is executed after corresponding transaction match), or in a dialog variable or in htable (using callid/from tag as a key).
Cheers,
Daniel
On 22.10.21 01:56, Joel Serrano wrote:
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.
__________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions * sr-users@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe: * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users-- Daniel-Constantin Mierla -- www.asipto.com www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio Advanced Training - Online Nov 08-11, 2021 (Europe Timezone) - Nov 22-25, 2021 (America Timezone) * https://www.asipto.com/sw/kamailio-advanced-training-online/