<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hello,</p>
    <p>can you remove the KSR::COREX.append_branch()? The uac_auth()
      should create a branch, should be no need to append a new one.</p>
    <p>As for realm, you can leave it unset, to avoid an extra op of
      setting an empty string.<br>
    </p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 05.04.19 05:43, Andrew White wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:092AA65F-C270-4B04-B7FF-AAD50E7616EC@uconnected.com.au">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      Hi all,
      <div class=""><br class="">
      </div>
      <div class="">I’ve gotten a little closer.<br class="">
        <div class="">
          <div dir="auto" class="" style="word-wrap: break-word;
            -webkit-nbsp-mode: space; line-break: after-white-space;">
            <div dir="auto" class="" style="word-wrap: break-word;
              -webkit-nbsp-mode: space; line-break: after-white-space;">
              <div class=""><br class="">
                After setting my $avp(arealm) to an empty string, I’ve
                been able to get a Authorization response sent. It
                appears that my trunk in this case regularly responds
                from different realms, which is an issue I’ll have to
                deal with another time.</div>
              <div class=""><br class="">
              </div>
              <div class="">Since then, I’m now sending a valid
                Authorization header back in a second invite, however
                I’m also sending an identical invite immediately after:</div>
              <div class=""><br class="">
              </div>
              <div class=""><a href="https://i.imgur.com/lmuglwu.png"
                  class="" moz-do-not-send="true">https://i.imgur.com/lmuglwu.png</a></div>
              <div class=""><br class="">
              </div>
              <div class="">The code block generating this is the same
                as below, but with the append_branch():</div>
              <div class=""><br class="">
              </div>
              <div class="">
                <div class="" style="color: rgb(212, 212, 212); background-color: rgb(30, 30, 30); font-family: Menlo, Monaco, "Courier New", monospace; line-height: 18px; white-space: pre;"><div class=""> <span class="" style="color: rgb(197, 134, 192);">if</span> <span class="" style="color: rgb(78, 201, 176);">KSR</span>::<span class="" style="color: rgb(78, 201, 176);">UAC</span>.uac_auth() <span class="" style="color: rgb(197, 134, 192);">then</span></div><div class="">    <span class="" style="color: rgb(78, 201, 176);"><a href="http://KSR.info" class="" moz-do-not-send="true">KSR</a></span><a href="http://KSR.info" class="" moz-do-not-send="true">.info</a>(<span class="" style="color: rgb(206, 145, 120);">"UAC authed, relaying"</span>)</div><div class="">    <span class="" style="color: rgb(78, 201, 176);">KSR</span>::<span class="" style="color: rgb(78, 201, 176);">COREX</span>.append_branch()</div><div class="">    <span class="" style="color: rgb(78, 201, 176);">KSR</span>::<span class="" style="color: rgb(78, 201, 176);">TM</span>.t_relay()</div><div class="">  <span class="" style="color: rgb(197, 134, 192);">else</span></div></div>
              </div>
              <div class=""><br class="">
              </div>
              <div class="">Removing the t_relay() obviously stops any
                response at all, and removing the append_branch means
                only an ACK is sent.</div>
              <div class=""><br class="">
              </div>
              <div class="">Can anyone point me the right way here?</div>
              <div class=""><br class="">
              </div>
              <div class="">Thanks!<br class="">
                ________________________________<br class="">
                <br class="">
                Andrew White - Director<br class="">
                uConnected<br class="">
                <a href="mailto:andrew@uconnected.com.au" class=""
                  moz-do-not-send="true">Email: andrew@uconnected.com.au</a><br
                  class="">
                Web: <a href="http://www.uConnected.com.au" class=""
                  moz-do-not-send="true">www.uConnected.com.au</a></div>
            </div>
          </div>
        </div>
      </div>
      <div><br class="">
        <blockquote type="cite" class="">
          <div class="">On 5 Apr 2019, at 2:07 pm, Andrew White <<a
              href="mailto:andrew@uconnected.com.au" class=""
              moz-do-not-send="true">andrew@uconnected.com.au</a>>
            wrote:</div>
          <br class="Apple-interchange-newline">
          <div class="">
            <meta http-equiv="Content-Type" content="text/html;
              charset=UTF-8" class="">
            <div style="word-wrap: break-word; -webkit-nbsp-mode: space;
              line-break: after-white-space;" class="">Hi all,
              <div class=""><br class="">
              </div>
              <div class="">I’m continuing on my quest to use app_ruby
                for my logic - it’s working very well so far!</div>
              <div class=""><br class="">
              </div>
              <div class="">The last major hurdle I’ve come across is
                UAC response to WWW challenge. On my outbound path, the
                correct URIs for From and To are set based on provider
                requirements, and the INVITE is sent using t_relay():</div>
              <div class=""><br class="">
              </div>
              <div class="">
                <div style="color: rgb(212, 212, 212); background-color: rgb(30, 30, 30); font-family: Menlo, Monaco, "Courier New", monospace; line-height: 18px; white-space: pre;" class=""><div style="line-height: 18px;" class=""><div class=""><span style="color: #c586c0;" class="">def</span> <span style="color: #dcdcaa;" class="">ksr_route_to_trunk</span>()</div><div class="">  <span style="color: #4ec9b0;" class="">KSR</span>.info(<span style="color: #ce9178;" class="">"Route to trunk"</span>)</div><div class="">  <span style="color: #c586c0;" class="">if</span> <span style="color: #4ec9b0;" class="">KSR</span>::<span style="color: #4ec9b0;" class="">TM</span>.t_is_set(<span style="color: #ce9178;" class="">"failure_route"</span>) < <span style="color: #b5cea8;" class="">0</span> <span style="color: #c586c0;" class="">then</span></div><div class="">    <span style="color: #4ec9b0;" class="">KSR</span>::<span style="color: #4ec9b0;" class="">TM</span>.t_on_failure(<span style="color: #ce9178;" class="">"ksr_failure_manage_trunk"</span>)</div><div class="">  <span style="color: #c586c0;" class="">end</span></div>
<div class="">  <span style="color: #6a9955;" class=""># Relay</span></div><div class="">  <span style="color: #4ec9b0;" class="">KSR</span>::<span style="color: #4ec9b0;" class="">PV</span>.sets(<span style="color: #ce9178;" class="">"$fu"</span>, <span style="color: #ce9178;" class="">"sip:</span><span style="color: #569cd6;" class="">#{</span><span style="color: #9cdcfe;" class="">$uacs</span>[trunk][<span style="color: #ce9178;" class="">'r_username'</span>]<span style="color: #569cd6;" class="">}</span><span style="color: #ce9178;" class="">@</span><span style="color: #569cd6;" class="">#{</span><span style="color: #9cdcfe;" class="">$uacs</span>[trunk][<span style="color: #ce9178;" class="">'r_domain'</span>]<span style="color: #569cd6;" class="">}</span><span style="color: #ce9178;" class="">"</span>)</div><div class="">  <span style="color: #4ec9b0;" class="">KSR</span>::<span style="color: #4ec9b0;" class="">PV</span>.sets(<span style="color: #ce9178;" class="">"$fn"</span>, <span style="color: #ce9178;" class="">''</span>)</div><div class="">  new_uri = <span style="color: #ce9178;" class="">"<a href="sip:61400123123@" class="" moz-do-not-send="true">sip:61400123123@</a></span><span style="color: #569cd6;" class="">#{</span>uacs[trunk][<span style="color: #ce9178;" class="">'r_domain'</span>]<span style="color: #569cd6;" class="">}</span><span style="color: #ce9178;" class="">"</span></div><div class="">  <span style="color: #4ec9b0;" class="">KSR</span>.info(<span style="color: #ce9178;" class="">"New URI is </span><span style="color: #569cd6;" class="">#{</span>new_uri<span style="color: #569cd6;" class="">}</span><span style="color: #ce9178;" class="">"</span>)</div>
<div class="">  <span style="color: #4ec9b0;" class="">KSR</span>.seturi(uri)</div><div class="">  <span style="color: #4ec9b0;" class="">KSR</span>::<span style="color: #4ec9b0;" class="">UAC</span>.uac_replace_to(<span style="color: #ce9178;" class="">''</span>, uri)</div>
<div class="">  <span style="color: #4ec9b0;" class="">KSR</span>::<span style="color: #4ec9b0;" class="">TM</span>.t_relay()</div><div class="">  <span style="color: #dcdcaa;" class="">exit</span></div><div class=""><span style="color: #c586c0;" class="">end</span></div></div></div>
                <div class="">
                  <div dir="auto" style="text-align: start; text-indent:
                    0px; word-wrap: break-word; -webkit-nbsp-mode:
                    space; line-break: after-white-space;" class="">
                    <div dir="auto" style="word-wrap: break-word;
                      -webkit-nbsp-mode: space; line-break:
                      after-white-space;" class="">
                      <div style="caret-color: rgb(0, 0, 0);
                        letter-spacing: normal; text-transform: none;
                        white-space: normal; word-spacing: 0px;
                        text-decoration: none;
                        -webkit-text-stroke-width: 0px; font-family:
                        Helvetica; font-size: 12px; font-style: normal;
                        font-variant-caps: normal; font-weight: normal;
                        text-align: start; text-indent: 0px;" class=""><br
                          class="">
                        I’ve stripped it back, but this function is
                        great and works perfectly. An INVITE is sent to
                        the correct place, and the trunk receives the
                        INVITE. It then responds with a
                        401/WWW-Authenticate.</div>
                      <div style="caret-color: rgb(0, 0, 0);
                        letter-spacing: normal; text-transform: none;
                        white-space: normal; word-spacing: 0px;
                        text-decoration: none;
                        -webkit-text-stroke-width: 0px; font-family:
                        Helvetica; font-size: 12px; font-style: normal;
                        font-variant-caps: normal; font-weight: normal;
                        text-align: start; text-indent: 0px;" class=""><br
                          class="">
                      </div>
                      <div style="caret-color: rgb(0, 0, 0);
                        letter-spacing: normal; text-transform: none;
                        white-space: normal; word-spacing: 0px;
                        text-decoration: none;
                        -webkit-text-stroke-width: 0px; font-family:
                        Helvetica; font-size: 12px; font-style: normal;
                        font-variant-caps: normal; font-weight: normal;
                        text-align: start; text-indent: 0px;" class="">My
                        failure route is called fine. Below is the
                        stripped down code:</div>
                      <div style="caret-color: rgb(0, 0, 0);
                        letter-spacing: normal; text-transform: none;
                        white-space: normal; word-spacing: 0px;
                        text-decoration: none;
                        -webkit-text-stroke-width: 0px; font-family:
                        Helvetica; font-size: 12px; font-style: normal;
                        font-variant-caps: normal; font-weight: normal;
                        text-align: start; text-indent: 0px;" class=""><br
                          class="">
                      </div>
                      <div style="text-align: start; text-indent: 0px;"
                        class="">
                        <div style="caret-color: rgb(0, 0, 0); color: rgb(212, 212, 212); font-family: Menlo, Monaco, "Courier New", monospace; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-transform: none; white-space: pre; word-spacing: 0px; text-decoration: none; -webkit-text-stroke-width: 0px; background-color: rgb(30, 30, 30); line-height: 18px;" class=""><div class=""><span style="color: #c586c0;" class="">def</span> <span style="color: #dcdcaa;" class="">ksr_failure_manage_trunk</span>()</div><div class="">  <span style="color: #dcdcaa;" class="">exit</span> <span style="color: #c586c0;" class="">if</span> <span style="color: #4ec9b0;" class="">KSR</span>::<span style="color: #4ec9b0;" class="">TM</span>.t_is_canceled() > <span style="color: #b5cea8;" class="">0</span></div><div class="">  <span style="color: #4ec9b0;" class="">KSR</span>.info(<span style="color: #ce9178;" class="">"Hit trunk failure manage route"</span>)</div><div class="">  <span style="color: #4ec9b0;" class="">KSR</span>::<span style="color: #4ec9b0;" class="">PV</span>.sets(<span style="color: #ce9178;" class="">"$avp(auser)"</span>, <span style="color: #ce9178;" class="">'user'</span>)</div><div class="">  <span style="color: #4ec9b0;" class="">KSR</span>::<span style="color: #4ec9b0;" class="">PV</span>.sets(<span style="color: #ce9178;" class="">"$avp(apass)"</span>, <span style="color: #ce9178;" class="">'pass'</span>)</div><div class="">  <span style="color: #4ec9b0;" class="">KSR</span>::<span style="color: #4ec9b0;" class="">PV</span>.sets(<span style="color: #ce9178;" class="">"$avp(arealm)"</span>, <span style="color: #ce9178;" class="">'test.local'</span>)</div><div class="">  <span style="color: #4ec9b0;" class="">KSR</span>.info(<span style="color: #ce9178;" class="">"AVPs: </span><span style="color: #569cd6;" class="">#{</span><span style="color: #4ec9b0;" class="">KSR</span>::<span style="color: #4ec9b0;" class="">PV</span>.gete(<span style="color: #ce9178;" class="">"$avp(auser)"</span>)<span style="color: #569cd6;" class="">}</span><span style="color: #ce9178;" class=""> </span><span style="color: #569cd6;" class="">#{</span><span style="color: #4ec9b0;" class="">KSR</span>::<span style="color: #4ec9b0;" class="">PV</span>.gete(<span style="color: #ce9178;" class="">"$avp(apass)"</span>)<span style="color: #569cd6;" class="">}</span><span style="color: #ce9178;" class=""> </span><span style="color: #569cd6;" class="">#{</span><span style="color: #4ec9b0;" class="">KSR</span>::<span style="color: #4ec9b0;" class="">PV</span>.gete(<span style="color: #ce9178;" class="">"$avp(arealm)"</span>)<span style="color: #569cd6;" class="">}</span><span style="color: #ce9178;" class="">"</span>)</div>
<div class="">  <span style="color: #c586c0;" class="">if</span> <span style="color: #4ec9b0;" class="">KSR</span>::<span style="color: #4ec9b0;" class="">UAC</span>.uac_auth() <span style="color: #c586c0;" class="">then</span></div><div class="">    <span style="color: #4ec9b0;" class="">KSR</span>.info(<span style="color: #ce9178;" class="">"UAC authed, relaying"</span>)</div><div class="">    <span style="color: #4ec9b0;" class="">KSR</span>::<span style="color: #4ec9b0;" class="">TM</span>.t_relay()</div><div class="">  <span style="color: #c586c0;" class="">else</span></div><div class="">    <span style="color: #4ec9b0;" class="">KSR</span>.info(<span style="color: #ce9178;" class="">"UAC NOT authed, no relay"</span>)</div><div class="">  <span style="color: #c586c0;" class="">end</span></div><div class="">  <span style="color: #dcdcaa;" class="">exit</span></div>
<div class=""><span style="color: #c586c0;" class="">end</span></div></div>
                        <div style="caret-color: rgb(0, 0, 0);
                          font-family: Helvetica; font-size: 12px;
                          font-style: normal; font-variant-caps: normal;
                          font-weight: normal; letter-spacing: normal;
                          text-transform: none; white-space: normal;
                          word-spacing: 0px; text-decoration: none;
                          -webkit-text-stroke-width: 0px; text-align:
                          start; text-indent: 0px;" class=""><br
                            class="">
                        </div>
                        <div style="caret-color: rgb(0, 0, 0);
                          font-family: Helvetica; font-size: 12px;
                          font-style: normal; font-variant-caps: normal;
                          font-weight: normal; letter-spacing: normal;
                          text-transform: none; white-space: normal;
                          word-spacing: 0px; text-decoration: none;
                          -webkit-text-stroke-width: 0px; text-align:
                          start; text-indent: 0px;" class="">Also the
                          AVP values are set (I believe) correctly:</div>
                        <div style="caret-color: rgb(0, 0, 0);
                          font-family: Helvetica; font-size: 12px;
                          font-style: normal; font-variant-caps: normal;
                          font-weight: normal; letter-spacing: normal;
                          text-transform: none; white-space: normal;
                          word-spacing: 0px; text-decoration: none;
                          -webkit-text-stroke-width: 0px; text-align:
                          start; text-indent: 0px;" class=""><br
                            class="">
                        </div>
                        <div style="caret-color: rgb(0, 0, 0);
                          font-family: Helvetica; font-size: 12px;
                          font-style: normal; font-variant-caps: normal;
                          font-weight: normal; letter-spacing: normal;
                          text-transform: none; white-space: normal;
                          word-spacing: 0px; text-decoration: none;
                          -webkit-text-stroke-width: 0px; text-align:
                          start; text-indent: 0px;" class="">
                          <div style="color: rgb(212, 212, 212); background-color: rgb(30, 30, 30); font-family: Menlo, Monaco, "Courier New", monospace; line-height: 18px; white-space: pre;" class=""><div class="">modparam(<span style="color: #ce9178;" class="">"uac"</span>, <span style="color: #ce9178;" class="">"auth_username_avp"</span>, <span style="color: #ce9178;" class="">"$avp(auser)"</span>)</div><div class="">modparam(<span style="color: #ce9178;" class="">"uac"</span>, <span style="color: #ce9178;" class="">"auth_password_avp"</span>, <span style="color: #ce9178;" class="">"$avp(apass)"</span>)</div><div class="">modparam(<span style="color: #ce9178;" class="">"uac"</span>, <span style="color: #ce9178;" class="">"auth_realm_avp"</span>, <span style="color: #ce9178;" class="">"$avp(arealm)"</span>)</div></div>
                        </div>
                        <div style="caret-color: rgb(0, 0, 0);
                          font-family: Helvetica; font-size: 12px;
                          font-style: normal; font-variant-caps: normal;
                          font-weight: normal; letter-spacing: normal;
                          text-transform: none; white-space: normal;
                          word-spacing: 0px; text-decoration: none;
                          -webkit-text-stroke-width: 0px; text-align:
                          start; text-indent: 0px;" class=""><br
                            class="">
                        </div>
                        <div style="caret-color: rgb(0, 0, 0);
                          font-family: Helvetica; font-size: 12px;
                          font-style: normal; font-variant-caps: normal;
                          font-weight: normal; letter-spacing: normal;
                          text-transform: none; white-space: normal;
                          word-spacing: 0px; text-decoration: none;
                          -webkit-text-stroke-width: 0px; text-align:
                          start; text-indent: 0px;" class="">This throws
                          the following complaint, and doesn’t send a
                          new response back to the trunk:</div>
                        <div style="caret-color: rgb(0, 0, 0);
                          font-family: Helvetica; font-size: 12px;
                          font-style: normal; font-variant-caps: normal;
                          font-weight: normal; letter-spacing: normal;
                          text-transform: none; white-space: normal;
                          word-spacing: 0px; text-decoration: none;
                          -webkit-text-stroke-width: 0px; text-align:
                          start; text-indent: 0px;" class=""><br
                            class="">
                        </div>
                        <div style="text-align: start; text-indent:
                          0px;" class="">
                          <div class="">Apr  5 02:55:22 ip-10-0-0-2
                            /usr/local/sbin/kamailio[26870]: ERROR: {1
                            102 INVITE <a
                              href="mailto:3a84da15272da66e527a79144c48516c@10.0.0.20"
                              class="" moz-do-not-send="true">3a84da15272da66e527a79144c48516c@10.0.0.20</a>:5060}
                            tm [t_fwd.c:1728]: t_forward_nonack(): no
                            branches for forwarding</div>
                          <div class="">Apr  5 02:55:22 ip-10-0-0-2
                            /usr/local/sbin/kamailio[26870]: ERROR: {1
                            102 INVITE <a
                              href="mailto:3a84da15272da66e527a79144c48516c@10.0.0.20"
                              class="" moz-do-not-send="true">3a84da15272da66e527a79144c48516c@10.0.0.20</a>:5060}
                            tm [tm.c:1619]: _w_t_relay_to():
                            t_forward_noack failed</div>
                          <div class=""><br class="">
                          </div>
                          <div class="">I don’t understand branches very
                            well, however after some digging around, I
                            appended KSR::COREX.append_branch() in
                            before the t_relay() in the failure. This
                            stops the error and now we send an ACK and a
                            new INVITE, but still without the expected
                            authorisation header.</div>
                          <div class=""><br class="">
                          </div>
                          <div class="">I feel like my lack of
                            understanding about branches is the issue
                            here - I seem to be sending an INVITE, but
                            not adding the auth header that I suspect is
                            being generated somewhere!</div>
                          <div class=""><br class="">
                          </div>
                          <div class="">Thanks for your help.</div>
                        </div>
                        <br class="">
                        ________________________________<br class="">
                        <br class="">
                        Andrew White - Director<br class="">
                        uConnected<br class="">
                        <a href="mailto:andrew@uconnected.com.au"
                          class="" moz-do-not-send="true">Email: andrew@uconnected.com.au</a><br
                          class="">
                        Web: <a href="http://www.uConnected.com.au"
                          class="" moz-do-not-send="true">www.uConnected.com.au</a><br
                          class="">
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </blockquote>
      </div>
      <br class="">
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio World Conference - May 6-8, 2019 -- <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
  </body>
</html>