<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hello,</p>
    <p>backup the $ru in a variable and set it back after the function
      execution:</p>
    <p>$var(ru) = $ru;</p>
    <p>...<br>
    </p>
    <p>$ru = $var(ru);</p>
    <p>You may need to do the same with dst uri ($du), but be careful
      that you need to handle the situation when $du is not set (is
      $null), because $var(...) doesn't have null values -- if you have
      a recent version of kamailio, use $vn(...) instead of $var(...),
      otherwise, just have some IFs to handle the situation properly.</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 01.08.17 11:00, Volkan Oransoy
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:0FBF4B82-710D-47C0-9809-A395943EF27E@gmail.com">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      Hi,
      <div class=""><br class="">
      </div>
      <div class="">I want to preserve the R-URI. What I want is to
        proxy request without changing anything except adding
        Authorization header.</div>
      <div class=""><br class="">
      </div>
      <div class="">Thanks.</div>
      <div class=""><br class="">
        <div>
          <blockquote type="cite" class="">
            <div class="">On 1 Aug 2017, at 11:47, Daniel-Constantin
              Mierla <<a href="mailto:miconda@gmail.com" class=""
                moz-do-not-send="true">miconda@gmail.com</a>> wrote:</div>
            <br class="Apple-interchange-newline">
            <div class="">
              <meta http-equiv="Content-Type" content="text/html;
                charset=utf-8" class="">
              <div text="#000000" bgcolor="#FFFFFF" class="">
                <p class="">Hello,</p>
                <p class="">do you want to preserve the R-URI before
                  uac_reg_request_to() or you want to change it to To
                  header URI?</p>
                <p class="">Cheers,<br class="">
                  Daniel<br class="">
                </p>
                <br class="">
                <div class="moz-cite-prefix">On 01.08.17 10:38, Volkan
                  Oransoy wrote:<br class="">
                </div>
                <blockquote type="cite"
                  cite="mid:93E223B8-8824-40CB-A81B-CD63C71EF6D8@gmail.com"
                  class="">
                  <meta http-equiv="Content-Type" content="text/html;
                    charset=utf-8" class="">
                  Hi again,
                  <div class=""><br class="">
                  </div>
                  <div class="">There is another issue on my setup. The
                    request URI is being replaced with my registration
                    info while being proxied. </div>
                  <div class="">How can I keep my original request URI
                    on proxied request?</div>
                  <div class="">When I set $rU to $tU in the script,
                    then it works but I don’t know this is the way it
                    should be?</div>
                  <div class=""><br class="">
                  </div>
                  <div class="">
                    <div class=""><font class="" face="Courier New">route[SENDTOREMOTE]
                        {</font></div>
                    <div class=""><font class="" face="Courier New">   
                            if(uac_reg_request_to("$fU", 1))</font></div>
                    <div class=""><font class="" face="Courier New">   
                            {</font></div>
                    <div class=""><font class="" face="Courier New">   
                                    xlog("L_NOTICE", "Found remote user
                        [$rU] on [$rd] via [$du]");</font></div>
                    <div class=""><font class="" face="Courier New">   
                                    <b class="">$rU = $tU;</b></font></div>
                    <div class=""><font class="" face="Courier New">   
                                    t_on_failure("REMOTE_AUTH");</font></div>
                    <div class=""><span style="font-family: 'Courier
                        New';" class="">                return;</span></div>
                    <div class=""><font class="" face="Courier New">   
                            }</font></div>
                    <div class=""><font class="" face="Courier New">}</font></div>
                  </div>
                  <div class=""><br class="">
                  </div>
                  <div class="">Thanks,</div>
                  <div class=""><br class="">
                  </div>
                  <div class="">
                    <div class="">
                      <blockquote type="cite" class="">
                        <div class="">On 1 Aug 2017, at 11:22,
                          Daniel-Constantin Mierla <<a
                            href="mailto:miconda@gmail.com" class=""
                            moz-do-not-send="true">miconda@gmail.com</a>>
                          wrote:</div>
                        <br class="Apple-interchange-newline">
                        <div class="">
                          <meta http-equiv="Content-Type"
                            content="text/html; charset=utf-8" class="">
                          <div text="#000000" bgcolor="#FFFFFF" class="">
                            <p class="">Hello,</p>
                            <p class="">ok, glad it worked as you wanted
                              at the end.</p>
                            <p class="">Cheers,<br class="">
                              Daniel<br class="">
                            </p>
                            <br class="">
                            <div class="moz-cite-prefix">On 01.08.17
                              09:09, Volkan Oransoy wrote:<br class="">
                            </div>
                            <blockquote type="cite"
                              cite="mid:6A725BA7-BB35-4B24-B21A-8C2C11B47B3E@gmail.com"
                              class="">
                              <meta http-equiv="Content-Type"
                                content="text/html; charset=utf-8"
                                class="">
                              Hi again,
                              <div class=""><br class="">
                              </div>
                              <div class="">After I set auth params in
                                module config, it worked. Thank you for
                                your help.</div>
                              <div class=""><br class="">
                              </div>
                              <div class="">
                                <div class=""><font class=""
                                    face="Courier New">modparam("uac","auth_realm_avp","$avp(i:10)")</font></div>
                                <div class=""><font class=""
                                    face="Courier New">modparam("uac","auth_username_avp","$avp(i:11)")</font></div>
                                <div class=""><font class=""
                                    face="Courier New">modparam("uac","auth_password_avp","$avp(i:12)")</font></div>
                              </div>
                              <div class=""><br class="">
                                <div class="">
                                  <blockquote type="cite" class="">
                                    <div class="">On 1 Aug 2017, at
                                      10:04, Volkan Oransoy <<a
                                        href="mailto:voransoy@gmail.com"
                                        class="" moz-do-not-send="true">voransoy@gmail.com</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;
                                        -webkit-line-break:
                                        after-white-space;" class=""><span
                                          class=""></span><span class="">Hi
                                          Daniel,</span><span class=""><br
                                            class="">
                                          <br class="">
                                        </span><span class="">I have
                                          applied this solution but
                                          failure_route doesn’t add
                                          Authorization header to the
                                          request after 401.</span>
                                        <div class=""><span class="">Is
                                            there anything missing in my
                                            failure_route block?<br
                                              class="">
                                          </span><span class=""><br
                                              class="">
                                          </span><span class=""><font
                                              class="" face="Courier
                                              New">failure_route[REMOTE_AUTH]
                                              {<br class="">
                                                      if ($T_reply_code
                                              == 401 or $T_reply_code ==
                                              407) {<br class="">
                                                             
                                              xlog("L_NOTICE", "Remote
                                              asked for
                                              authentication");<br
                                                class="">
                                                             
                                              append_branch();<br
                                                class="">
                                                             
                                              uac_auth();<br class="">
                                                              t_relay();<br
                                                class="">
                                                      }<br class="">
                                              }</font></span></div>
                                        <div class=""><span class=""><font
                                              class="" face="Courier
                                              New"><br class="">
                                            </font></span></div>
                                        <div class=""><span class=""><br
                                              class="">
                                            <blockquote type="cite"
                                              class="">On 1 Aug 2017, at
                                              09:40, Daniel-Constantin
                                              Mierla <<a
                                                href="mailto:miconda@gmail.com"
                                                class=""
                                                moz-do-not-send="true">miconda@gmail.com</a>>
                                              wrote:<br class="">
                                              <br class="">
                                              Hello,<br class="">
                                              <br class="">
                                              see:<br class="">
                                              <br class="">
                                               -<br class="">
                                              <a
href="https://www.kamailio.org/docs/modules/stable/modules/uac.html#uac.f.uac_reg_request_to"
                                                class=""
                                                moz-do-not-send="true">https://www.kamailio.org/docs/modules/stable/modules/uac.html#uac.f.uac_reg_request_to</a><br
                                                class="">
                                              <br class="">
                                              Might offer what you are
                                              looking for.<br class="">
                                              <br class="">
                                              Cheers,<br class="">
                                              Daniel<br class="">
                                              <br class="">
                                              On 31.07.17 17:05, Volkan
                                              Oransoy wrote:<br class="">
                                              <blockquote type="cite"
                                                class="">Hi all,<br
                                                  class="">
                                                <br class="">
                                                I use UAC module for
                                                remote registrations on
                                                my proxy box. There is
                                                no problem with incoming
                                                calls and I successfully
                                                register and receive
                                                calls. <br class="">
                                                I have a Freeswitch box
                                                behind this proxy box
                                                and I want my proxy to
                                                add authorisation
                                                headers for outgoing
                                                calls transparently. I
                                                already have credentials
                                                at uacreg table for
                                                remote registrations. Is
                                                it possible use same
                                                credentials at
                                                uac_auth() function? Or
                                                should I run SQL to
                                                retrieve necessary
                                                fields to feed uac_auth?<br
                                                  class="">
                                                <br class="">
                                                Thanks!<br class="">
                                                <br class="">
                                                /Volkan<br class="">
_______________________________________________<br class="">
                                                Kamailio (SER) - Users
                                                Mailing List<br class="">
                                                <a
                                                  href="mailto:sr-users@lists.kamailio.org"
                                                  class=""
                                                  moz-do-not-send="true">sr-users@lists.kamailio.org</a><br
                                                  class="">
                                                <a
                                                  class="moz-txt-link-freetext"
href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users"
                                                  moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br
                                                  class="">
                                              </blockquote>
                                              <br class="">
                                              -- <br class="">
                                              Daniel-Constantin Mierla<br
                                                class="">
                                              <a
                                                href="http://www.twitter.com/miconda"
                                                class=""
                                                moz-do-not-send="true">www.twitter.com/miconda</a>
                                              -- <a
                                                href="http://www.linkedin.com/in/miconda"
                                                class=""
                                                moz-do-not-send="true">www.linkedin.com/in/miconda</a><br
                                                class="">
                                              Kamailio Advanced Training
                                              - <a
                                                href="http://www.asipto.com/"
                                                class=""
                                                moz-do-not-send="true">www.asipto.com</a><br
                                                class="">
                                              Kamailio World Conference
                                              - <a
                                                href="http://www.kamailioworld.com/"
                                                class=""
                                                moz-do-not-send="true">www.kamailioworld.com</a><br
                                                class="">
                                              <br class="">
                                            </blockquote>
                                            <br class="">
                                          </span></div>
                                      </div>
                                    </div>
                                  </blockquote>
                                </div>
                                <br class="">
                              </div>
                            </blockquote>
                            <br class="">
                            <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda" moz-do-not-send="true">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda" moz-do-not-send="true">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - <a class="moz-txt-link-abbreviated" href="http://www.asipto.com/" moz-do-not-send="true">www.asipto.com</a>
Kamailio World Conference - <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com/" moz-do-not-send="true">www.kamailioworld.com</a></pre>
                          </div>
                        </div>
                      </blockquote>
                    </div>
                    <br class="">
                  </div>
                </blockquote>
                <br class="">
                <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda" moz-do-not-send="true">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda" moz-do-not-send="true">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - <a class="moz-txt-link-abbreviated" href="http://www.asipto.com/" moz-do-not-send="true">www.asipto.com</a>
Kamailio World Conference - <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com/" moz-do-not-send="true">www.kamailioworld.com</a></pre>
              </div>
            </div>
          </blockquote>
        </div>
        <br class="">
      </div>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<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 Advanced Training - <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
Kamailio World Conference - <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
  </body>
</html>