<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>Hi Volkan,<br>
      <br>
      I think you are looking for the is_registered() function:<br>
         
<a class="moz-txt-link-freetext" href="http://www.opensips.org/html/docs/modules/2.2.x/registrar.html#idp5648928">http://www.opensips.org/html/docs/modules/2.2.x/registrar.html#idp5648928</a><br>
      <br>
      Regards,<br>
    </tt>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
  OpenSIPS Founder and Developer
  <a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a>

OpenSIPS Bootcamp 2017, Houston, US
  <a class="moz-txt-link-freetext" href="http://opensips.org/training/OpenSIPS_Bootcamp_2017.html">http://opensips.org/training/OpenSIPS_Bootcamp_2017.html</a>
</pre>
    <div class="moz-cite-prefix">On 07/21/2017 12:34 PM, Volkan Oransoy
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:8D149D5C-B73E-42C5-BC2C-7BE157F94869@gmail.com">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <div class="">Hi all,</div>
      <div class=""><br class="">
      </div>
      <div class="">I use uac_registrant to register to remote SIP
        systems and registration phase seems ok. What I want to do is to
        receive calls from these systems and before accepting calls to
        my box, I want to check destination, if it is a valid record on
        my system. I found a couple of replies on list archives and one
        of them suggests to lookup agains AOR. But that doesn’t work
        right now. What is the most suitable way to do this?</div>
      <div class=""><br class="">
      </div>
      <div class=""><br class="">
      </div>
      <div class="">       if (
        check_source_address("1","$avp(trunk_attrs)") ) {</div>
      <div class="">                # request comes from trunks</div>
      <div class="">                setflag(IS_TRUNK);</div>
      <div class="">        } else if ( is_from_gw() ) {</div>
      <div class="">                # request comes from GWs</div>
      <div class=""><b class=""><font class="" color="#ff2600">        }
            else if ( lookup("location","","$ru") ){</font></b></div>
      <div class=""><b class=""><font class="" color="#ff2600">         
                  xlog("Location check for $ru passed.\n");</font></b></div>
      <div class="">        } else {</div>
      <div class="">                xlog("Location check for $ru
        failed.\n");</div>
      <div class="">                send_reply("403","Forbidden");</div>
      <div class="">                exit;</div>
      <div class="">        }</div>
      <div class=""><br class="">
      </div>
      <div class="">Regards,</div>
      <div class=""><br class="">
      </div>
      <div class="">/Volkan</div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <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>
    <br>
  </body>
</html>