<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hello,<br>
      <br>
      don't use forward() and sl_send_reply() at the same time. If you
      want to send a redirect reply:<br>
      <i><br>
            if (!lookup("location")) {</i><i><br>
              rewritehostport("10.80.129.177");<br>
      </i><i><i>      sl_send_reply("300",("REDIRECT"));</i>      <br>
              exit;<br>
            }</i><br>
      <br>
      If you want to do forwarding:<br>
      <br>
      <i>    if (!lookup("location")) {<br>
              rewritehostport("10.80.129.177");<br>
              t_relay();<br>
              exit;<br>
            }<br>
        <br>
      </i>When doing forwarding, then be sure you don't loop back to the
      other proxy if you received the request from it.<br>
      <br>
      Cheers,<br>
      Daniel<br>
      <br>
      On 19/11/14 21:17, Arnau Riba wrote:<br>
    </div>
    <blockquote
cite="mid:CALyCBOSZyVtQw0p2yKotQsQOZv9WOGKApCoPe69+=Xd8LpWH_w@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>Hello! I'm having this issue and I'm not able to solve
              it. I have searched it many times on the Internet but I
              found nothing, that's why I am asking here... I'm sorry I
              do not wanna cause any troubles but I need to get this
              done...<br>
              <br>
            </div>
            This is my scenario, I want to make a call through a
            Kamailio server that redirects to another server. I have an
            User A registered to Server A and a User B registered to
            Server B, what I want to do is the following:<br>
            <br>
            User A calls User B using Server A, because Server A doesn't
            have the User B the Server A will redirect to Server B and
            make the call. I'm using Ekiga and of course Kamailio (and I
            want to make it work both ways).<br>
            <br>
            This is the code I'm using to do this in kamailio.cfg, I
            replaced this lines of code:<br>
            <br>
            <i>$avp(oexten) = $rU;<br>
                  if (!lookup("location")) {<br>
                      $var(rc) = $rc;<br>
                      route(TOVOICEMAIL);<br>
                      t_newtran();<br>
                      switch ($var(rc)) {<br>
                          case -1:<br>
                          case -3:<br>
                              send_reply("404", "Not Found");<br>
                              exit;<br>
                          case -2:<br>
                              send_reply("405", "Method Not Allowed");<br>
                              exit;<br>
                      }<br>
                  }</i><br>
            <br>
          </div>
          <div>For this ones:<br>
          </div>
          <div><br>
            <i>$avp(oexten) = $rU;<br>
                  if (!lookup("location")) {<br>
                    sl_send_reply("300",("REDIRECT"));<br>
                    rewritehostport("10.80.129.177");<br>
                    forward(uri:host,uri:port);<br>
                    break;<br>
                    }<br>
            </i></div>
          <br>
        </div>
        <div>And it didn't work, then I putted the lines above as the
          following:<br>
          <br>
          <i>$avp(oexten) = $rU;<br>
                if (!lookup("location")) {<br>
                  </i><i><i> forward(uri:host,uri:port);</i><br>
                  rewritehostport("10.80.129.177");<br>
          </i><i><i>      sl_send_reply("300",("REDIRECT"));</i>      <br>
                  break;<br>
                  }</i><br>
          <br>
        </div>
        <div>And it worked but if I do a Wireshark Capture on the Server
          I get a lot of REDIRECT packets and my teacher says this is
          wrong, that I should only get 1. He did not help me and said I
          must learn and I want but I'm not able to understand what's
          going on, I need to do this because I want to pass the exam
          and not to fail...<br>
          <br>
        </div>
        Again I'm sorry for taking your time, I'm asshamed.<br>
        <br>
        Thank you very much</div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio Advanced Training, Nov 24-27, Berlin - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a></pre>
  </body>
</html>