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...

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:

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).

This is the code I'm using to do this in kamailio.cfg, I replaced this lines of code:

$avp(oexten) = $rU;
    if (!lookup("location")) {
        $var(rc) = $rc;
        route(TOVOICEMAIL);
        t_newtran();
        switch ($var(rc)) {
            case -1:
            case -3:
                send_reply("404", "Not Found");
                exit;
            case -2:
                send_reply("405", "Method Not Allowed");
                exit;
        }
    }


For this ones:

$avp(oexten) = $rU;
    if (!lookup("location")) {
      sl_send_reply("300",("REDIRECT"));
      rewritehostport("10.80.129.177");
      forward(uri:host,uri:port);
      break;
      }

And it didn't work, then I putted the lines above as the following:

$avp(oexten) = $rU;
    if (!lookup("location")) {
     
forward(uri:host,uri:port);
      rewritehostport("10.80.129.177");
      sl_send_reply("300",("REDIRECT"));     
      break;
      }


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...

Again I'm sorry for taking your time, I'm asshamed.

Thank you very much