<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>you do not need mid_registrar. The logic should be :<br>
      <br>
    </tt><br>
    <div>route[PUBLISH_407] {</div>
    <div>        if(is_method("PUBLISH") && has_body("<span
        style="color: #000000; font-family: 'lucida console',
        sans-serif; font-size: 16px; font-style: normal;
        font-variant-ligatures: normal; font-variant-caps: normal;
        font-weight: 400; letter-spacing: normal; orphans: 2;
        text-align: start; text-indent: 0px; text-transform: none;
        white-space: normal; widows: 2; word-spacing: 0px;
        -webkit-text-stroke-width: 0px; background-color: #ffffff;
        text-decoration-style: initial; text-decoration-color: initial;
        display: inline !important; float: none;">application/dialog-info+xm</span><span
        style="font-size: 12pt;">l") &&
        $avp(DLG_dir)=="frompbx") {</span></div>
    <div>                xlog("L_INFO", "[$rm] from $si\n");</div>
    <div>                t_on_failure("SUPPLY_AUTH");</div>
    <div>}</div>
    <br>
    <div>
      <div>failure_route[SUPPLY_AUTH] {<br>
                if (is_method("PUBLISH") &&
        t_check_status("407")) {<br>
      </div>
      <div>        <strong>    populate $avp(10/11/12) from a DB with
          the credentials<br>
        </strong></div>
      <div>            if (uac_auth())<br>
                        t_relay();<br>
                }<br>
      </div>
    </div>
    <div>}</div>
    <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 2018
  <a class="moz-txt-link-freetext" href="http://opensips.org/training/OpenSIPS_Bootcamp_2018/">http://opensips.org/training/OpenSIPS_Bootcamp_2018/</a>
</pre>
    <div class="moz-cite-prefix">On 10/27/2018 10:34 PM, Slava Bendersky
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:51238164.49037.1540668874260.JavaMail.zimbra@skillsearch.ca">
      <div style="font-family: lucida console,sans-serif; font-size:
        12pt; color: #000000">
        <div>Is possible that issue in mid_registrar  ?</div>
        <div>I adjusted fail route to </div>
        <div><br data-mce-bogus="1">
        </div>
        <div>
          <div>failure_route[SUPPLY_AUTH] {</div>
          <div>        if(uac_auth()) {</div>
          <div>                append_branch();</div>
          <div>                t_relay();</div>
          <div>        }</div>
          <div>        exit;</div>
        </div>
        <div> and look like uac_auth() is never executed.</div>
        <div><br data-mce-bogus="1">
        </div>
        <div>volga629</div>
        <div><br>
        </div>
        <hr id="zwchr" data-marker="__DIVIDER__">
        <div data-marker="__HEADERS__"><b>From: </b>"Slava Bendersky"
          <a class="moz-txt-link-rfc2396E" href="mailto:volga629@networklab.ca"><volga629@networklab.ca></a><br>
          <b>To: </b>"Bogdan-Andrei Iancu" <a class="moz-txt-link-rfc2396E" href="mailto:bogdan@opensips.org"><bogdan@opensips.org></a><br>
          <b>Cc: </b>"OpenSIPS users mailling list"
          <a class="moz-txt-link-rfc2396E" href="mailto:users@lists.opensips.org"><users@lists.opensips.org></a><br>
          <b>Sent: </b>Saturday, October 27, 2018 12:42:09 AM<br>
          <b>Subject: </b>Re: [OpenSIPS-Users] presence blf<br>
        </div>
        <div><br>
        </div>
        <div data-marker="__QUOTED_TEXT__">
          <div style="font-family: lucida console,sans-serif; font-size:
            12pt; color: #000000">
            <div>Hello Bogdan,</div>
            <div>The issue that opensips is not handling user
              authentication, password is stored in 3cx. Is there are
              way set avp or into cache intial credentials ?</div>
            <div>I come up with something like this.</div>
            <div>My though  was.</div>
            <br>
            <div>
              <pre class="programlisting" style="font-family: monospace; white-space: pre; background-color: #fefeee; border: 1px solid #99cccc; color: #000000; padding-left: 15pt; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">modparam("uac_auth","auth_realm_avp","$avp(10)")
</pre>
              <pre class="programlisting" style="font-family: monospace; white-space: pre; background-color: #fefeee; border: 1px solid #99cccc; color: #000000; padding-left: 15pt; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">modparam("uac_auth","auth_username_avp","$avp(11)")
</pre>
            </div>
            <div>
              <pre class="programlisting" style="font-family: monospace; white-space: pre; background-color: #fefeee; border: 1px solid #99cccc; color: #000000; padding-left: 15pt; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">modparam("uac_auth","auth_password_avp","$avp(12)")
</pre>
            </div>
            <div><br>
              <div>route[PUBLISH_407] {</div>
              <div>        if(is_method("PUBLISH") && has_body("<span
                  style="color: #000000; font-family: 'lucida console',
                  sans-serif; font-size: 16px; font-style: normal;
                  font-variant-ligatures: normal; font-variant-caps:
                  normal; font-weight: 400; letter-spacing: normal;
                  orphans: 2; text-align: start; text-indent: 0px;
                  text-transform: none; white-space: normal; widows: 2;
                  word-spacing: 0px; -webkit-text-stroke-width: 0px;
                  background-color: #ffffff; text-decoration-style:
                  initial; text-decoration-color: initial; display:
                  inline !important; float: none;">application/dialog-info+xm</span><span
                  style="font-size: 12pt;">l") &&
                  $avp(DLG_dir)=="frompbx") {</span></div>
              <div>                xlog("L_INFO", "[$rm] from $si\n");</div>
              <div>                t_on_reply("6");</div>
              <div>}</div>
            </div>
            <br>
            <div>
              <div>onreply_route[6] {</div>
              <div>        if(is_method("PUBLISH") &&
                t_check_status("407")) {</div>
              <div>                xlog("L_INFO", "OnReply_Route6: [$rm]
                Direction: [FS ~> Client] asked for 407\n");</div>
              <div>                t_on_failure("SUPPLY_AUTH");</div>
              <div>        }</div>
              <div>}</div>
              <br>
              <div>failure_route[SUPPLY_AUTH] {</div>
              <div>        <strong>don't know how to supply credential 
                  yet</strong></div>
              <div>        uac_auth();</div>
            </div>
            <div>}</div>
            <br>
            <div>volga629</div>
            <br>
            <hr id="zwchr">
            <div><b>From: </b>"Bogdan-Andrei Iancu"
              <a class="moz-txt-link-rfc2396E" href="mailto:bogdan@opensips.org"><bogdan@opensips.org></a><br>
              <b>To: </b>"OpenSIPS users mailling list"
              <a class="moz-txt-link-rfc2396E" href="mailto:users@lists.opensips.org"><users@lists.opensips.org></a>, "Slava Bendersky"
              <a class="moz-txt-link-rfc2396E" href="mailto:volga629@networklab.ca"><volga629@networklab.ca></a><br>
              <b>Sent: </b>Friday, October 26, 2018 5:28:09 AM<br>
              <b>Subject: </b>Re: [OpenSIPS-Users] presence blf<br>
            </div>
            <br>
            <div><tt>Hi Slava,<br>
                <br>
                Sorry for the mistyping your name :D....one wrong
                character and something a bit weird resulted :D.<br>
                <br>
                Regards,</tt>
              <pre class="moz-signature">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com" target="_blank" moz-do-not-send="true">http://www.opensips-solutions.com</a>
OpenSIPS Bootcamp 2018
  <a class="moz-txt-link-freetext" href="http://opensips.org/training/OpenSIPS_Bootcamp_2018/" target="_blank" moz-do-not-send="true">http://opensips.org/training/OpenSIPS_Bootcamp_2018/</a>
</pre>
              <div class="moz-cite-prefix">On 10/26/2018 09:34 AM,
                Bogdan-Andrei Iancu wrote:<br>
              </div>
              <blockquote
                cite="mid:f730e33b-abe0-e95b-bc7f-2645d99adb7c@opensips.org">
                <tt>Hi Slave,<br>
                  <br>
                  If you cannot do an IP authentication / whitelisting
                  for OpenSIPS in 3CX, you could use the uac_auth module
                  and the uac_auth() function to perform user side
                  authentication in OpenSIPS. See<br>
                      <a class="moz-txt-link-freetext"
                    href="http://www.opensips.org/html/docs/modules/2.4.x/uac.html"
                    target="_blank" moz-do-not-send="true">http://www.opensips.org/html/docs/modules/2.4.x/uac.html</a><br>
                      <a class="moz-txt-link-freetext"
                    href="http://www.opensips.org/html/docs/modules/2.4.x/uac_auth.html"
                    target="_blank" moz-do-not-send="true">http://www.opensips.org/html/docs/modules/2.4.x/uac_auth.html</a><br>
                  <br>
                  Best regards,<br>
                </tt>
                <pre class="moz-signature">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com" target="_blank" moz-do-not-send="true">http://www.opensips-solutions.com</a>
OpenSIPS Bootcamp 2018
  <a class="moz-txt-link-freetext" href="http://opensips.org/training/OpenSIPS_Bootcamp_2018/" target="_blank" moz-do-not-send="true">http://opensips.org/training/OpenSIPS_Bootcamp_2018/</a>
</pre>
                <div class="moz-cite-prefix">On 10/25/2018 09:49 PM,
                  Slava Bendersky wrote:<br>
                </div>
                <blockquote
cite="mid:1540493029.local-e2a9f351-0c21-v1.5.0-92ed66b8@getmailspring.com">
                  <div>Hello Everyone,</div>
                  <div>I am trying make BLF working and how opensips
                    should handle PUBLISH where server reply 407 ?</div>
                  <div>Do we need forward to end point ?</div>
                  <div>Opensips send PUBLISH then 3CX send 407 and
                    conversation done.</div>
                  <div>Here some trace </div>
                  <br>
                  <div>[root@aitossbc01 ~]# cat BLF.txt</div>
                  <div>2018/10/25 12:22:19.148093 10.100.104.10:5060
                    -> 10.2.24.124:5060</div>
                  <div>PUBLISH <a class="moz-txt-link-freetext"
                      href="sip:120@domain.tld:5060" target="_blank"
                      moz-do-not-send="true">sip:120@domain.tld:5060</a>
                    SIP/2.0</div>
                  <div>Via: SIP/2.0/UDP
                    10.100.104.10:5060;branch=z9hG4bK9f23.99096732.0</div>
                  <div>To: <a class="moz-txt-link-freetext"
                      href="sip:120@domain.tld:5060" target="_blank"
                      moz-do-not-send="true">sip:120@domain.tld:5060</a></div>
                  <div>From: <a class="moz-txt-link-rfc2396E"
                      href="sip:120@domain.tld:5060" target="_blank"
                      moz-do-not-send="true"><sip:120@domain.tld:5060></a>;tag=4c20d2ebf66939afcc7c67fb6893f1be-672a</div>
                  <div>CSeq: 10 PUBLISH</div>
                  <div>Call-ID: <a class="moz-txt-link-abbreviated"
                      href="mailto:0324183200c79905-20534@10.100.104.10"
                      target="_blank" moz-do-not-send="true">0324183200c79905-20534@10.100.104.10</a></div>
                  <div>Max-Forwards: 70</div>
                  <div>Content-Length: 549</div>
                  <div>User-Agent: OpenSIPS (3.0.0-dev (x86_64/linux))</div>
                  <div>Event: dialog</div>
                  <div>Expires: 3601</div>
                  <div>Content-Type: application/dialog-info+xml</div>
                  <br>
                  <div><?xml version="1.0"?></div>
                  <div><dialog-info
                    xmlns="urn:ietf:params:xml:ns:dialog-info"
                    state="partial" entity=<a
                      class="moz-txt-link-rfc2396E"
                      href="sip:120@domain.tld:5060" target="_blank"
                      moz-do-not-send="true">"sip:120@domain.tld:5060"</a>><dialog
                    id=<a class="moz-txt-link-rfc2396E"
                      href="mailto:0_3095066305@192.168.88.146"
                      target="_blank" moz-do-not-send="true">"0_3095066305@192.168.88.146"</a>
                    call-id=<a class="moz-txt-link-rfc2396E"
                      href="mailto:0_3095066305@192.168.88.146"
                      target="_blank" moz-do-not-send="true">"0_3095066305@192.168.88.146"</a>
direction="recipient"><state>confirmed</state><remote><identity><a
                      class="moz-txt-link-freetext"
                      href="sip:221@domain.tld:5060" target="_blank"
                      moz-do-not-send="true">sip:221@domain.tld:5060</a></identity><target
                    uri=<a class="moz-txt-link-rfc2396E"
                      href="sip:221@domain.tld:5060" target="_blank"
                      moz-do-not-send="true">"sip:221@domain.tld:5060"</a>/></remote><local><identity><a
                      class="moz-txt-link-freetext"
                      href="sip:120@domain.tld:5060" target="_blank"
                      moz-do-not-send="true">sip:120@domain.tld:5060</a></identity><target
                    uri=<a class="moz-txt-link-rfc2396E"
                      href="sip:120@domain.tld:5060" target="_blank"
                      moz-do-not-send="true">"sip:120@domain.tld:5060"</a>/></local></dialog></dialog-info></div>
                  <br>
                  <br>
                  <div>2018/10/25 12:22:19.198773 10.2.24.124:5060 ->
                    10.100.104.10:5060</div>
                  <div>SIP/2.0 407 Proxy Authentication Required</div>
                  <div>Via: SIP/2.0/UDP
                    10.100.104.10:5060;branch=z9hG4bK9f23.99096732.0</div>
                  <div>Proxy-Authenticate: Digest
nonce="414d53595bd1fbcb12:61835c52c28e8a89737c489e16fa5965",algorithm=MD5,realm="3CXPhoneSystem"</div>
                  <div>To: <a class="moz-txt-link-rfc2396E"
                      href="sip:120@domain.tld:5060" target="_blank"
                      moz-do-not-send="true"><sip:120@domain.tld:5060></a>;tag=d9bb492f</div>
                  <div>From: <a class="moz-txt-link-rfc2396E"
                      href="sip:120@domain.tld:5060" target="_blank"
                      moz-do-not-send="true"><sip:120@domain.tld:5060></a>;tag=4c20d2ebf66939afcc7c67fb6893f1be-672a</div>
                  <div>Call-ID: <a class="moz-txt-link-abbreviated"
                      href="mailto:0324183200c79905-20534@10.100.104.10"
                      target="_blank" moz-do-not-send="true">0324183200c79905-20534@10.100.104.10</a></div>
                  <div>CSeq: 10 PUBLISH</div>
                  <div>User-Agent: 3CXPhoneSystem 15.5.15502.6 (15502)</div>
                  <div>Content-Length: 0</div>
                  <br>
                  <fieldset class="mimeAttachmentHeader"></fieldset>
                  <br>
                  <pre>_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank" moz-do-not-send="true">Users@lists.opensips.org</a>
<a class="moz-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>
                <br>
                <fieldset class="mimeAttachmentHeader"></fieldset>
                <br>
                <pre>_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank" moz-do-not-send="true">Users@lists.opensips.org</a>
<a class="moz-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>
              <br>
            </div>
          </div>
          <br>
          _______________________________________________<br>
          Users mailing list<br>
          <a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
          <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><br>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>