[SR-Users] Kamailio creates tons of REDIRECT packages...
Daniel-Constantin Mierla
miconda at gmail.com
Thu Nov 20 09:19:03 CET 2014
Hello,
don't use forward() and sl_send_reply() at the same time. If you want to
send a redirect reply:
/
if (!lookup("location")) {//
rewritehostport("10.80.129.177");
/// sl_send_reply("300",("REDIRECT"));/
exit;
}/
If you want to do forwarding:
/ if (!lookup("location")) {
rewritehostport("10.80.129.177");
t_relay();
exit;
}
/When doing forwarding, then be sure you don't loop back to the other
proxy if you received the request from it.
Cheers,
Daniel
On 19/11/14 21:17, Arnau Riba wrote:
> 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
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, Nov 24-27, Berlin - http://www.asipto.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20141120/e03d9006/attachment.html>
More information about the sr-users
mailing list