<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p><tt>Hi all,</tt></p>
    <p><tt>If reloading the table whenever you update your banned UA
        list isn't a problem, then the optimal<br>
        answer is the dialplan module and its dp_translate [1] function
        in order to test against your UA list.<br>
        It works with in-memory data so it is super fast.</tt></p>
    <p><tt>Best regards,<br>
      </tt></p>
    <p><tt>[1]: </tt><tt><a
href="https://opensips.org/html/docs/modules/3.1.x/dialplan.html#func_dp_translate">https://opensips.org/html/docs/modules/3.1.x/dialplan.html#func_dp_translate</a></tt></p>
    <pre class="moz-signature" cols="72">Liviu Chircu
OpenSIPS Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
    <div class="moz-cite-prefix">On 28.08.2019 15:41, Mark Farmer wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAOvQDetTtHTLtjUGhBsUtcxqMqM20pNkYGpPN8RWy5bk8hXWsQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div dir="ltr">
          <div dir="ltr">Thanks for the reply, certainly a few options
            to consider :)
            <div><br>
            </div>
            <div>To be more specific, the table contains $ua
              identifiers:</div>
            <div><br>
            </div>
            <div>
              <div>MariaDB [tt]> select * from user_agent;</div>
              <div>+----+------------------+</div>
              <div>| id | ua               |</div>
              <div>+----+------------------+</div>
              <div>|  1 | sipcli           |</div>
              <div>|  2 | sipvicious       |</div>
              <div>|  3 | sip-scan         |</div>
              <div>|  4 | sipsak           |</div>
              <div>|  5 | sundayddr        |</div>
              <div>|  6 | friendly-scanner |</div>
              <div>|  7 | iWar             |</div>
              <div>|  8 | CSipSimple       |</div>
              <div>|  9 | SIVuS            |</div>
              <div>| 10 | Gulp             |</div>
              <div>| 11 | sipv             |</div>
              <div>| 12 | smap             |</div>
              <div>| 13 | friendly-request |</div>
              <div>| 14 | VaxIPUserAgent   |</div>
              <div>| 15 | VaxSIPUserAgent  |</div>
              <div>| 16 | siparmyknife     |</div>
              <div>| 17 | Test Agent       |</div>
              <div>+----+------------------+</div>
            </div>
            <div><br>
            </div>
            <div>What I'd like to do is something like:</div>
            <div><br>
            </div>
            <div>if($ua ~=(search_ua_column_for_match) {</div>
            <div>    exit;</div>
            <div>}</div>
            <div><br>
            </div>
            <div>I should add that I'm using OpenSIPS 3.0</div>
            <div><br>
            </div>
            <div><br>
            </div>
          </div>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Wed, 28 Aug 2019 at 13:31,
          Alexey Kazantsev via Users <<a
            href="mailto:users@lists.opensips.org"
            moz-do-not-send="true">users@lists.opensips.org</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Hi
          Mark,<br>
          <br>
          I haven't understood well enough what data do you store in the
          table.<br>
          <br>
          Something designed by OpenSIPS developers? E.g. 'subscribers'
          table.<br>
          Or some custom data which you use in your script say via AVPs?<br>
          <br>
          If it's possible to store it as key-value pairs, I'd recommend
          you using<br>
          local cache [1], [2], [3]<br>
          <br>
          [1]  <a
href="https://www.opensips.org/Documentation/Script-CoreFunctions-3-0#toc4"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://www.opensips.org/Documentation/Script-CoreFunctions-3-0#toc4</a><br>
          [2]  <a
href="https://www.opensips.org/Documentation/Script-CoreFunctions-3-0#toc5"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://www.opensips.org/Documentation/Script-CoreFunctions-3-0#toc5</a>
           <br>
          [3]  <a
href="https://www.opensips.org/Documentation/Script-CoreFunctions-3-0#toc6"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://www.opensips.org/Documentation/Script-CoreFunctions-3-0#toc6</a>
           <br>
          [4]  <a
            href="https://opensips.org/html/docs/modules/3.0.x/cachedb_redis.html"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://opensips.org/html/docs/modules/3.0.x/cachedb_redis.html</a>
           <br>
          [5]  <a
            href="https://opensips.org/html/docs/modules/3.0.x/cachedb_sql.html"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://opensips.org/html/docs/modules/3.0.x/cachedb_sql.html</a><br>
          [6]  <a
            href="https://opensips.org/html/docs/modules/3.0.x/exec.html"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://opensips.org/html/docs/modules/3.0.x/exec.html</a>
           <br>
          <br>
          Depending on your OpenSIPS architecture it can be more optimal
          to use Redis [4],<br>
          for example in case of OpenSIPS cluster.<br>
          <br>
          You may use CACHEDB_SQL [5] (I never used it).<br>
          You may execute some script with the EXEC [6] function.<br>
          <br>
          If your table is tiny and your system architecture allows it,<br>
          you may store data not in MariaDB but in SQLite.<br>
          <br>
          So, as you see, many things depend on the overall size of your
          system,<br>
          and it's not so easy to give some certain advice without
          knowing<br>
          its architecture and load level.<br>
          <br>
          <br>
          <br>
          -----------------------------------------------<br>
          BR, Alexey<br>
          <a href="http://alexeyka.zantsev.com/" rel="noreferrer"
            target="_blank" moz-do-not-send="true">http://alexeyka.zantsev.com/</a><br>
          _______________________________________________<br>
          Users mailing list<br>
          <a href="mailto:Users@lists.opensips.org" target="_blank"
            moz-do-not-send="true">Users@lists.opensips.org</a><br>
          <a
            href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users"
            rel="noreferrer" target="_blank" moz-do-not-send="true">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
        </blockquote>
      </div>
      <br clear="all">
      <div><br>
      </div>
      -- <br>
      <div dir="ltr" class="gmail_signature">Mark Farmer<br>
        <a href="mailto:farmorg@gmail.com" target="_blank"
          moz-do-not-send="true">farmorg@gmail.com</a></div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
  </body>
</html>