[OpenSIPS-Users] using load balancer and lookup together

Ben Newlin Ben.Newlin at genesys.com
Sun Apr 5 19:08:28 EST 2020


That is what failure_routes are for. You can “catch” the 404 in a failure_route and choose somewhere else to attempt to send the call. You don’t have to just send back the response all the time.

But what I think David was trying to ask is just why you are combining the lb_start and lookup calls always into a single if statement. This is very confusing and will end up with lb_start and/or lookup being called more than once in many cases. I don’t use the load_balancer module, but I think calling lb_start multiple times in the same call/transaction may skew the load balancing stats.

In your code snippet, you are even calling both lb_start and lookup again within if legs where their return values have already been checked.

Ben Newlin

From: Users <users-bounces at lists.opensips.org> on behalf of Michael Vale via Users <users at lists.opensips.org>
Reply-To: Michael Vale <masked at vale.ski>, OpenSIPS users mailling list <users at lists.opensips.org>
Date: Sunday, April 5, 2020 at 9:57 AM
To: David Villasmil <david.villasmil.work at gmail.com>, OpenSIPS users mailling list <users at lists.opensips.org>
Subject: Re: [OpenSIPS-Users] using load balancer and lookup together

Ok, to explain,

Using your logic,

To call say '555' will goto Voicemail, if I disable voicemail it will return a 404 instead of going to the load balancer.

That's fine, if 555 is an extension, but if it's (for this example) a PSTN number (or a all-else catch all, like I'm trying to achieve) thats not OK because I get a 404 rather than it getting routed to the load balancer.

If 555 is an extension/user the call will go through to the registered extension, but if it's not registered in the usrloc table, it goes to 404, instead of the load balancer.

If I reverse the logic, It will goto the load balancer even if it's a registered extension, or Too Many Hops, depending on how I adjust the logic.

I cannot seem to create a catch all for non-usrloc registered extension calls to goto the load balancer otherwise return a 404.

I hope I explained it well enough. I will keep trying,

Regards,

Michael.

On Sun, 2020-04-05 at 11:47 +0100, David Villasmil wrote:
Why are you trying to do all at once?

Why not first do the lookup

https://github.com/davidcsi/kamailio-private-public/blob/a81d7f777a8c5ee2dbb32311f7e6b5a3cf94bf32/kamailio.cfg#L771<https://github.com/davidcsi/kamailio-private-public/blob/a81d7f777a8c5ee2dbb32311f7e6b5a3cf94bf32/kamailio.cfg#L771>


and then start load balancing?

https://github.com/davidcsi/kamailio-private-public/blob/a81d7f777a8c5ee2dbb32311f7e6b5a3cf94bf32/kamailio.cfg#L1109<https://github.com/davidcsi/kamailio-private-public/blob/a81d7f777a8c5ee2dbb32311f7e6b5a3cf94bf32/kamailio.cfg#L1109>


Do you have some special need to fulfill?

David

On Sun, 5 Apr 2020 at 06:34, Michael Vale via Users <users at lists.opensips.org<mailto:users at lists.opensips.org>> wrote:
hi,

perhaps this can be solved with a failure route and or a check status
but i dont know and it would be nice if i could do it without it.

no matter how i write the script, either a uac to uac call goes to the
load balancer or the load balancer is stuck with a 404 reply from the
script or uac to uac works but when one end is not registered it goes
to the load balancer instead of getting a 404.

i've tried failure routes and get the same problem.  here is a snippet.

       if (!lb_start(1,"pstn")) && (!lookup("location","m",)) {
                lb_disable_dst();
                #route(relay);
                #send_reply(404,"No user or gateway");
                        if (lb_start(1,"pstn")) {
                                send_reply(500,"SIPSIPSIPS");
                                #       t_relay();
                                exit;
                        }
#               exit;
                } else if (lookup("location","m")) &&
(!lb_start(1,"pstn")) {
                        lb_disable_dst();
                        route(relay);
                        exit;
                } else if (lb_start(1,"pstn")) &&
(lookup("location","m")) {
                        lb_disable_dst();
                        route(relay);
                        exit;
                } else if (!lookup("location","m")) &&
(!lb_start(1,"pstn")) {
                        send_reply(404,"Not Found");
                        exit;
                } else if (lb_start(1,"pstn")) &&
(!lookup("location","m")) {
#                       #lb_disable_dst();
                        if (!lookup("location","m")) {
                                route(relay);
                                exit;
                        }
                        if (lookup("location","m")) {
                                lb_disable_dst();
                                route(relay);
                                exit;
                        }
                }

thanks in advance,

michael.


_______________________________________________
Users mailing list
Users at lists.opensips.org<mailto:Users at lists.opensips.org>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users<http://lists.opensips.org/cgi-bin/mailman/listinfo/users>
--
Regards,

David Villasmil
email: david.villasmil.work at gmail.com<mailto:david.villasmil.work at gmail.com>
phone: +34669448337
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20200405/f5af51cf/attachment-0001.html>


More information about the Users mailing list