<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>In this case, the function will perform a string matching
      between the first valid contact URI from the message and the
      registered contacts (the `Contact` field). Again, it is a string
      matching over the entire SIP URI.<br>
      <br>
      So far, based on your logs, I would say they should match. Could
      you doublecheck again ?<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="https://www.opensips-solutions.com">https://www.opensips-solutions.com</a>
OpenSIPS Summit 2019
  <a class="moz-txt-link-freetext" href="https://www.opensips.org/events/Summit-2019Amsterdam/">https://www.opensips.org/events/Summit-2019Amsterdam/</a>
</pre>
    <div class="moz-cite-prefix">On 8/22/19 12:07 PM, Peter Pulham
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAA6ie1BkthteKZs279_CJVYsbwH8naozsimUq_Pt6z4igbYvfw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hi,
        <div><br>
        </div>
        <div>I am calling is_contact_registered("location")</div>
        <div><br>
        </div>
        <div>For the mi command, I used "mi ul_show_contact location <a
            href="mailto:5001@domain.net" moz-do-not-send="true">5001@domain.net</a>"
          in opensips-cli</div>
        <div><br>
        </div>
        <div>Many thanks</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Thu, Aug 22, 2019 at 10:00
          AM Bogdan-Andrei Iancu <<a
            href="mailto:bogdan@opensips.org" moz-do-not-send="true">bogdan@opensips.org</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 bgcolor="#FFFFFF"> <tt>Hi Peter,<br>
              <br>
              How exactly do you invoke the is_contact_registered()
              function (as params) for your script?<br>
              <br>
              Regards,<br>
            </tt>
            <pre class="gmail-m_5665734764938766537moz-signature" cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a class="gmail-m_5665734764938766537moz-txt-link-freetext" href="https://www.opensips-solutions.com" target="_blank" moz-do-not-send="true">https://www.opensips-solutions.com</a>
OpenSIPS Summit 2019
  <a class="gmail-m_5665734764938766537moz-txt-link-freetext" href="https://www.opensips.org/events/Summit-2019Amsterdam/" target="_blank" moz-do-not-send="true">https://www.opensips.org/events/Summit-2019Amsterdam/</a>
</pre>
            <div class="gmail-m_5665734764938766537moz-cite-prefix">On
              8/21/19 10:34 PM, Peter Pulham wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">
                <div>Hi,</div>
                <div><br>
                </div>
                <div>Thanks for the input.</div>
                <div><br>
                </div>
                Adding the logging of $ct before call
                is_contact_registered show this (also added a log for
                when it returned false):
                <div><br>
                </div>
                <div>Aug 21 19:24:52 ip-10-100-100-62
                  /usr/local/sbin/opensips[21114]: CONTACT OF REGISTER:
                  "Peter Pulham" <a
                    class="gmail-m_5665734764938766537moz-txt-link-rfc2396E"
                    moz-do-not-send="true"><sip:5001@y.y.y.y:49710;ob></a><br>
                  Aug 21 19:24:52 ip-10-100-100-62
                  /usr/local/sbin/opensips[21114]: IS CONTACT REGISTERED
                  RETURNED FALSE<br>
                </div>
                <div><br>
                </div>
                <div>The contact from the <span
                    style="font-family:monospace">ul_show_contact
                    command shows the same contact:</span></div>
                <div><span style="font-family:monospace"><br>
                  </span></div>
                <div>{<br>
                      "AOR": "<a href="mailto:5001@domain.net"
                    target="_blank" moz-do-not-send="true">5001@domain.net</a>",<br>
                      "Contacts": [<br>
                          {<br>
                              "Contact": <a
                    class="gmail-m_5665734764938766537moz-txt-link-rfc2396E"
                    moz-do-not-send="true">"sip:5001@y.y.y.y:49710;ob"</a>,<br>
                              "ContactID": "1491535901589791905",<br>
                              "Expires": 18,<br>
                              "Q": "",<br>
                              "Callid":
                  "8..5AzWHdLmUQNXHdQhwDR3qMwOGPaWH",<br>
                              "Cseq": 56286,<br>
                              "User-agent": "Telephone 1.4",<br>
                              "Received": <a
                    class="gmail-m_5665734764938766537moz-txt-link-rfc2396E"
                    moz-do-not-send="true">"sip:x.x.x.x:49710"</a>,<br>
                              "State": "CS_NEW",<br>
                              "Flags": 0,<br>
                              "Cflags": "NAT",<br>
                              "Socket": "udp:z.z.z.z:5060",<br>
                              "Methods": 8063<br>
                          }<br>
                      ]<br>
                  }<span style="font-family:monospace"><br>
                  </span></div>
                <div><br>
                </div>
                <div>y.y.y.y is the same in the log as the mi output.</div>
                <div><br>
                </div>
                <div>Through testing, I have realised that if the
                  contact is not NAT'd then the is_contact_registered
                  returns true.</div>
                <div><br>
                </div>
                <div>Any input appreciated.</div>
              </div>
              <br>
              <div class="gmail_quote">
                <div dir="ltr" class="gmail_attr">On Wed, Aug 21, 2019
                  at 11:56 AM Bogdan-Andrei Iancu <<a
                    href="mailto:bogdan@opensips.org" target="_blank"
                    moz-do-not-send="true">bogdan@opensips.org</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 bgcolor="#FFFFFF"> <tt>Hi Peter,<br>
                      <br>
                      To doublecheck, do this:<br>
                      <br>
                      * before calling the is_contact_registered(), use
                      xlog() to print the contact you are testing (use
                      $ct).<br>
                      <br>
                      * before running the test, use the ul_show_contact
                      MI function [1] to print the in-memory contacts
                      for the desired AOR.<br>
                      <br>
                      <br>
                      [1] <a
class="gmail-m_5665734764938766537gmail-m_6706597972070815991moz-txt-link-freetext"
href="https://opensips.org/html/docs/modules/2.4.x/usrloc.html#mi_ul_show_contact"
                        target="_blank" moz-do-not-send="true">https://opensips.org/html/docs/modules/2.4.x/usrloc.html#mi_ul_show_contact</a><br>
                      <br>
                      Regards,<br>
                    </tt>
                    <pre class="gmail-m_5665734764938766537gmail-m_6706597972070815991moz-signature" cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a class="gmail-m_5665734764938766537gmail-m_6706597972070815991moz-txt-link-freetext" href="https://www.opensips-solutions.com" target="_blank" moz-do-not-send="true">https://www.opensips-solutions.com</a>
OpenSIPS Summit 2019
  <a class="gmail-m_5665734764938766537gmail-m_6706597972070815991moz-txt-link-freetext" href="https://www.opensips.org/events/Summit-2019Amsterdam/" target="_blank" moz-do-not-send="true">https://www.opensips.org/events/Summit-2019Amsterdam/</a>
</pre>
                    <div
class="gmail-m_5665734764938766537gmail-m_6706597972070815991moz-cite-prefix">On
                      08/16/2019 06:38 PM, Peter Pulham wrote:<br>
                    </div>
                    <blockquote type="cite">
                      <div dir="ltr">Hi,
                        <div><br>
                        </div>
                        <div>I am using mid_registrar to save
                          registrations to the location table.</div>
                        <div><br>
                        </div>
                        <div>If I use is_registered - everything works
                          as expected. So AOR matching is working.</div>
                        <div><br>
                        </div>
                        <div>However, when I use is_contact_registered -
                          it returns false.</div>
                        <div><br>
                        </div>
                        <div>I have checked the contact header in the
                          request against the contact value of the AOR
                          in the db and they match (the request has a
                          display name but I am presuming only the uri
                          is checked.</div>
                        <div><br>
                        </div>
                        <div>The endpoint is behind NAT, but the
                          contacts match in the db and request. Can some
                          explain what is actually checked when using
                          is_contact_registered?</div>
                        <div><br>
                        </div>
                        <div>Many thanks</div>
                      </div>
                      <br>
                      <fieldset
class="gmail-m_5665734764938766537gmail-m_6706597972070815991mimeAttachmentHeader"></fieldset>
                      <br>
                      <pre>_______________________________________________
Users mailing list
<a class="gmail-m_5665734764938766537gmail-m_6706597972070815991moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank" moz-do-not-send="true">Users@lists.opensips.org</a>
<a class="gmail-m_5665734764938766537gmail-m_6706597972070815991moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank" moz-do-not-send="true">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
                    </blockquote>
                    <br>
                  </div>
                </blockquote>
              </div>
            </blockquote>
            <br>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <br>
  </body>
</html>