Hi Taner, Why do you have only one record per group in the LB table ? there is no LB if you have only one destination ;). It simply makes no sense.
Better put both destinations in the same group and LB over them both, with failover too: +----+----------+-----------------------+-----------+------------+-------------+ | id | group_id | dst_uri | resources | probe_mode | description | +----+----------+-----------------------+-----------+------------+-------------+ | 1 | 8080 | sip:[email protected] <mailto:sip%[email protected]> | sip=1 | 2 | | | 2 | 8080 | sip:[email protected] <mailto:sip%[email protected]> | sip=1 | 2 | | +----+----------+-----------------------+-----------+------------+-------------+ route[3] { if (is_method("INVITE")) { load_balance("8080", "sip"); if ($retcode < 0) { xlog("L_INFO", "load_balancer: Insufficient resource to balance request from $fu to $tu !\n"); send_reply("500","no resources available"); exit; } t_on_failure("2"); } # send request if (!t_relay()) { sl_reply_error(); } exit; } failure_route[2] { if (t_was_cancelled()) { exit; } if (t_check_status("486|408")) { xlog("L_INFO", "load_balancer: Request from $fu to $tu failed. Re-balancing!\n"); lb_disable(); load_balance("8080", "sip"); if ($retcode < 0) { xlog("L_INFO", "load_balancer: Insufficient resource to balance request from $fu to $tu \n"); send_reply("500","no resources available"); exit; } t_on_failure("2"); t_relay(); } } Regards, Bogdan Taner Sener wrote: > Hi Bogdan, > > I used your approach and defined the same resource name "sip" for both > definitions. It is working now as expected but another requirement > raised for my scenario. > > When all destinations for a specific group id are busy I want to re > load-balance the request to a different group id. I expect this to run > with the following configuration but it is not possible to re > load_balance the request. I hope you can help me to find a solution. > > I'm testing this the following configuration. I'm making a call to > 8080. If [email protected] <mailto:[email protected]> is busy or if it > receives timeout I expect call to be re load-balanced to a destination > from group id 9090. But it is not. > > load_balancer > +----+----------+-----------------------+-----------+------------+-------------+ > | id | group_id | dst_uri | resources | probe_mode | > description | > +----+----------+-----------------------+-----------+------------+-------------+ > | 1 | 8080 | sip:[email protected] > <mailto:sip%[email protected]> | sip=1 | 2 > | | > | 2 | 9090 | sip:[email protected] > <mailto:sip%[email protected]> | sip=1 | 2 > | | > +----+----------+-----------------------+-----------+------------+-------------+ > > opensips.cfg > .... > route { > ... > route(3); > } > > route[3] { > if (is_method("INVITE")) { > > load_balance("8080", "sip"); > if ($retcode < 0) { > xlog("L_INFO", "load_balancer: Insufficient resource > to balance request from $fu to $tu . Re-balancing to route 4!\n"); > route(4); > } > } > > t_on_failure("2"); > > # send request > if (!t_relay()) { > sl_reply_error(); > } > exit; > } > > route[4] { > if (is_method("INVITE")) { > > load_balance("9090", "sip"); > if ($retcode < 0) { > xlog("L_INFO", "load_balancer: Insufficient resource > to balance request from $fu to $tu . Sending error!\n"); > sl_send_reply("500", "Service full"); > exit; > } > } > > t_on_failure("2"); > > # send request > if (!t_relay()) { > sl_reply_error(); > } > exit; > } > > failure_route[2] { > if (t_was_cancelled()) { > exit; > } > > if (t_check_status("486|408")) { > xlog("L_INFO", "load_balancer: Request from $fu to $tu > failed. Re-balancing to 8080!\n"); > lb_disable(); > load_balance("8080", "sip"); > > if ($retcode < 0) { > xlog("L_INFO", "load_balancer: Insufficient resource > to balance request from $fu to $tu . Re-balancing to route 4!\n"); > route(4); > } > t_on_failure("2"); > t_relay(); > } > } > > opensips.log > ... > Dec 8 10:56:57 sipproxy /sbin/opensips[11299]: load_balancer: Request > from sip:[email protected] <mailto:sip%[email protected]> to > sip:[email protected]:5060 <http://sip:[email protected]:5060> failed. > Re-balancing to 8080! > Dec 8 10:56:57 sipproxy /sbin/opensips[11299]: load_balancer: > Insufficient resource to balance request from sip:[email protected] > <mailto:sip%[email protected]> to sip:[email protected]:5060 > <http://sip:[email protected]:5060> . Re-balancing to route 4! > Dec 8 10:56:57 sipproxy /sbin/opensips[11299]: load_balancer: > Insufficient resource to balance request from sip:[email protected] > <mailto:sip%[email protected]> to sip:[email protected]:5060 > <http://sip:[email protected]:5060> . Sending error! > > > Thanks, > Taner > > > On Sun, Nov 15, 2009 at 10:12 PM, Bogdan-Andrei Iancu > <[email protected] <mailto:[email protected]>> wrote: > > Hi Taner, > > I would suggest a different approach - as from LB point of view you do > not care too much if it VM or CONF - what is important is that each of > your box has only on channel, so I would define a resource the > number of > channels each box can handle . > > > +----+----------+------------------------+---------------------------------+ > | id | group_id | dst_uri | resources > | > > +----+----------+------------------------+---------------------------------+ > > | 1 | 555 | sip:[email protected] > <mailto:sip%[email protected]> <mailto:sip%[email protected] > <mailto:sip%[email protected]>> | channel=1 > | > | 2 | 555 | sip:[email protected] > <mailto:sip%[email protected]> <mailto:sip%[email protected] > <mailto:sip%[email protected]>> | channel=1 > | > > > +----+----------+------------------------+---------------------------------+ > > > and do (when routing a VM or conference call) : > 'load_balance(.., "channel");' > > Regards, > Bogdan > > > Taner Sener wrote: > > Hi, > > > > I'm using load balancer module on 1.6.0-notls (i386/linux) to > balance > > incoming sip calls to sip clients. The case is; my sip clients are > > capable of serving multiple types of calls. But not in the same time > > like in the definition "vm=1;conf=1". Only one of them is > available at > > that moment. They can process either a vm call, either a conf call; > > not one vm call and one conf call. Is there a way to define it? > > > > > > +----+----------+------------------------+---------------------------------+ > > | id | group_id | dst_uri | resources > | > > > > +----+----------+------------------------+---------------------------------+ > > > > | 1 | 555 | sip:[email protected] > <mailto:sip%[email protected]> <mailto:sip%[email protected] > <mailto:sip%[email protected]>> | vm=1; conf=1 > | > > | 2 | 555 | sip:[email protected] > <mailto:sip%[email protected]> <mailto:sip%[email protected] > <mailto:sip%[email protected]>> | vm=1; conf=1 > | > > > > > > +----+----------+------------------------+---------------------------------+ > > > > Current 'resources' field of load_balancer table ANDs resource types > > given with semi-colon and I when I invoke > > > > 'load_balance(.., "vm")' > > > > and > > > > 'load_balance(.., "conf")' > > > > second load balanced call receives busy and balancing fails there > > because that client is serving to vm call. How can I configure > > load_balanced module to select it right? > > > > Thanks, > > Taner > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Users mailing list > > [email protected] <mailto:[email protected]> > > http://lists.opensips.org/cgi-bin/mailman/listinfo/users > > > > > _______________________________________________ > Users mailing list > [email protected] <mailto:[email protected]> > http://lists.opensips.org/cgi-bin/mailman/listinfo/users > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > [email protected] > http://lists.opensips.org/cgi-bin/mailman/listinfo/users > -- Bogdan-Andrei Iancu www.voice-system.ro _______________________________________________ Users mailing list [email protected] http://lists.opensips.org/cgi-bin/mailman/listinfo/users
