<div dir="ltr"><div dir="ltr"><div dir="ltr">Now that made it really easy.<div><br></div><div>Untested as yet but added the UA strings to the dialplan table with a repl_ext of "BogusUA".</div><div><br></div><div>Then:</div><div><br></div><div><div>if (dp_translate(1, $ua, $var(BogusUA))) {</div><div>                xlog("CUSTOM_LOG: BogusUA Detected! ($ua)");</div><div>}</div><div><br></div><div>if $var(BogusUA)=BogusUA {</div><div>                xlog("CUSTOM_LOG: Ignoring $rm from BogusUA ($ua)");</div><div>                exit;</div><div>}</div></div><div><br></div><div>Using in memory data <i><b>was</b></i> on the wish list for this :)</div><div><br></div><div>As always - thank you everyone for your input.</div><div><br></div><div>Mark.</div><div><br></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:55, Liviu Chircu <<a href="mailto:liviu@opensips.org">liviu@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">
  
    
  
  <div bgcolor="#FFFFFF">
    <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" target="_blank">https://opensips.org/html/docs/modules/3.1.x/dialplan.html#func_dp_translate</a></tt></p>
    <pre class="gmail-m_1656981666073369368moz-signature" cols="72">Liviu Chircu
OpenSIPS Developer
<a class="gmail-m_1656981666073369368moz-txt-link-freetext" href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre>
    <div class="gmail-m_1656981666073369368moz-cite-prefix">On 28.08.2019 15:41, Mark Farmer wrote:<br>
    </div>
    <blockquote type="cite">
      
      <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" target="_blank">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">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">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">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">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">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">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">http://alexeyka.zantsev.com/</a><br>
          _______________________________________________<br>
          Users mailing list<br>
          <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
          <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">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-m_1656981666073369368gmail_signature">Mark Farmer<br>
        <a href="mailto:farmorg@gmail.com" target="_blank">farmorg@gmail.com</a></div>
      <br>
      <fieldset class="gmail-m_1656981666073369368mimeAttachmentHeader"></fieldset>
      <pre class="gmail-m_1656981666073369368moz-quote-pre">_______________________________________________
Users mailing list
<a class="gmail-m_1656981666073369368moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a class="gmail-m_1656981666073369368moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
  </div>

_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">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">farmorg@gmail.com</a></div>