<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hello,</p>
    <p>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.</p>
    <p>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).</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 22.10.21 01:56, Joel Serrano wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAMtXxQnASaYBN-aTb0acSDYHW2CJD_Hfkhdfbc3-KMP51gCh8A@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">I think it could be related to: <a
          href="https://github.com/kamailio/kamailio/issues/2479"
          moz-do-not-send="true">https://github.com/kamailio/kamailio/issues/2479</a> 
        <div><br>
        </div>
        <div>Commit: <a
href="https://github.com/kamailio/kamailio/commit/2e7710e292a649c6c57e46d5994d3b2cf3815865"
            moz-do-not-send="true">https://github.com/kamailio/kamailio/commit/2e7710e292a649c6c57e46d5994d3b2cf3815865</a></div>
        <div><br>
        </div>
        <div>Thanks!</div>
        <div>Joel.</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Thu, Oct 21, 2021 at 4:22
          PM Joel Serrano <<a href="mailto:joel@textplus.com"
            moz-do-not-send="true">joel@textplus.com</a>> wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div dir="ltr">Hello, 
            <div><br>
            </div>
            <div>I'm in the process of updating some servers that are
              running Kam v5.1.4 to v5.5.2.</div>
            <div><br>
            </div>
            <div>
              <div>After the upgrade I've noticed that I've lost some
                custom metrics that we have defined via config-script. </div>
              <div><br>
              </div>
              <div>Snippet of the relevant config:</div>
              <div><br>
              </div>
            </div>
            <div><font face="monospace">event_route[dialog:start] {<br>
                    # Gather metrics regarding source IP<br>
                    xlog("L_WARN", "[DLG] - Checking country for ($si |
                $T_req($si)) - START\n");<br>
                    if (geoip2_match("$T_req($si)", "src")) {<br>
                        # Country found<br>
                        ...<br>
                    }<br>
                    xlog("L_WARN", "[DLG] - Checking country for ($si |
                $T_req($si)) - END\n");<br>
                }</font><br>
            </div>
            <div><br>
            </div>
            <div>NOTE: xlog lines added for debugging, they normally are
              not there.</div>
            <div><br>
            </div>
            <div><br>
            </div>
            <div>In version 5.1.4 in the logs I see: </div>
            <div><br>
            </div>
            <div><font face="monospace">Oct 21 15:55:47 13cn3
                sbc[22606]: WARNING: <script>: [DLG] - Checking
                country for (A.B.C.D | 186.185.186.7) - START<br>
                Oct 21 15:55:47 13cn3 sbc[22606]: WARNING:
                <script>: [DLG] - Checking country for (A.B.C.D |
                186.185.186.7) - END<br>
              </font></div>
            <div><br>
            </div>
            <div>The same config, on v5.5.2 is returning:</div>
            <div><br>
            </div>
            <div><font face="monospace">Oct 21 15:57:08 sbc0504
                sbc[22606]: WARNING: <script>: [DLG] - Checking
                country for (A.B.C.D | <null>) - START<br>
                Oct 21 15:57:08 sbc0504 sbc[22606]:
                WARNING: <script>: [DLG] - Checking country for
                (A.B.C.D | <null>) - END<br>
              </font></div>
            <div><br>
            </div>
            <div>After enabling debug logs I see:</div>
            <div><br>
            </div>
            <div><font face="monospace">WARNING: <script>: [DLG] -
                Checking country for (198.1.55.124 | <null>) -
                START<br>
                <b><font color="#ff0000">DEBUG: tmx [t_var.c:309]:
                    pv_get_t_var_req(): used in unsupported route block
                    - type 64<br>
                  </font></b>DEBUG: geoip2 [geoip2_pv.c:488]:
                geoip2_update_pv(): attempt to match: <null><br>
                DEBUG: geoip2 [geoip2_pv.c:491]: geoip2_update_pv(): no
                match for: <null></font><br>
            </div>
            <div><br>
            </div>
            <div><br>
            </div>
            <div>Did something change in the tmx module that could
              affect $T_req(pv) being accessible in the dialog:start
              event_route?</div>
            <div><br>
            </div>
            <div>Any alternatives to get the source IP of the request
              (not the reply) in the dialog:start event_route?</div>
            <div><br>
            </div>
            <div>Let me know if you prefer that I open a ticket for this
              in GH.</div>
            <div><br>
            </div>
            <div>Thanks, </div>
            <div>Joel.</div>
            <div><br>
            </div>
            <div><br>
            </div>
          </div>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
  * <a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
  * <a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - Online
Nov 08-11, 2021 (Europe Timezone) - Nov 22-25, 2021 (America Timezone)
  * <a class="moz-txt-link-freetext" href="https://www.asipto.com/sw/kamailio-advanced-training-online/">https://www.asipto.com/sw/kamailio-advanced-training-online/</a></pre>
  </body>
</html>