[OpenSIPS-Users] OpenSIPS Load Balancer of an Asterisk Cluster - REFER Issue

Paris Stamatopoulos mobius at realize.gr
Tue May 11 14:32:39 CEST 2010


Hello again,

Silly fix but it might work until 1.7.x is production. Imagine the following scenario:

You have two asterisk servers in the load balancer group.

On asterisk #1 you specify resources: lbg0=1000, lbg1=1000, lbg2=1000 lbg3=1000 lbg4=1000, lbg5=500, lbg6=500, lbg7=500, lbg8=500, lbg9=500 while on asterisk #2: lbg0=500, lbg1=500, lbg2=500 lbg3=500 lbg4=500, lbg5=1000, lbg6=1000, lbg7=1000, lbg8=1000, lbg9=1000

You get the last digit of the caller's number (0-9): 

$var(group) = $(fU{s.substr,-1,1}); 

switch($var(group)) {
	case "0":
		Load_balance("1", "lbg0");
	break;
	case "1":
		Load_balance("1", "lbg1");
	break;
	...
}

So now you can break the load to up to ten asterisks, with failover between them and at the same time force all calls to pass through the same asterisk, thus eliminating the problem with the transfers. Unfortunately you pretty much destroy load_balancer's capacity features but I can live with this for now.

Regards,
Paris Stamatopoulos



-----Original Message-----
From: users-bounces at lists.opensips.org [mailto:users-bounces at lists.opensips.org] On Behalf Of Paris Stamatopoulos
Sent: Friday, May 07, 2010 12:06 PM
To: OpenSIPS users mailling list
Subject: Re: [OpenSIPS-Users] OpenSIPS Load Balancer of an Asterisk Cluster - REFER Issue

Hello Bogdan,

This seems rather interesting. I will try to setup an development instance of OpenSIPs to give it a try.

Regards,
Paris

-----Original Message-----
From: users-bounces at lists.opensips.org [mailto:users-bounces at lists.opensips.org] On Behalf Of Bogdan-Andrei Iancu
Sent: Wednesday, May 05, 2010 6:52 PM
To: OpenSIPS users mailling list
Subject: Re: [OpenSIPS-Users] OpenSIPS Load Balancer of an Asterisk Cluster - REFER Issue

Hi Stan,

Have you seen - 
http://lists.opensips.org/pipermail/users/2010-April/012414.html - this 
it about attended transfer when doing balancing for Asterisk.

Regards,
Bogdan

Stanisław Pitucha wrote:
> On 05.05.2010 11:50, Paris Stamatopoulos wrote:
>   
>> Has anyone experience this before? Do you have any working solutions?
>>     
>
> Yes and yes. Short version: It's impossible without hacking asterisk.
>
> Long version:
> First we tried routing all related calls to the same destination using
> the dialog module. It would work, but only in the most trivial cases. It
> will work only if you can always match the destination or the source
> number to an existing call. If you use call forking / huntgroups /
> queues / redirection on your asterisk - forget about easy transfers -
> you will get calls which don't match on any field, but are still going
> to the same phone.
>
> Now - theoretically transfers should work between asterisks based on the
> information in refer-to - it already includes the host which handles the
> call and in the transfer context you can extract that address and force
> a Dial() to that destination. I never discovered why it doesn't quite
> work. Half of the calls failed and sometimes I got deadlocks (still
> using 1.4 - maybe 1.6 is better here).
> AFAIK there's also no real possibility to set the callerid in that case
> to figure out who initiated the transfer.
>
> But we've got a working solution now:
> - The first part is a custom res_cluster module which will publish for
> each call (hooked into the Dial() command) the callid, ftag, ttag and
> the ip of the local asterisk into a shared mysql database.
> - The second part is activated on refer. It does some magic in
> handle_refer() (or something like that) and then magicks the call to
> magically know the correct callerid, customer id, checks whether the
> transfer is allowed and dials the destination asterisk with correct
> refer-to headers. (destination comes from the database)
>
> It could be much simpler if you don't have to handle different customers
> and bill them separately.
>
> Maybe I missed some other option... but that's the solution we got to
> after ~3 months of testing different methods, annoying asterisk mailing
> list and their IRC. And it works just fine so far.
>
> I'm not sure I can release all the needed patches, but if you want them,
> let me know.
>
> Stan
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>   


-- 
Bogdan-Andrei Iancu
www.voice-system.ro


_______________________________________________
Users mailing list
Users at lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
Users at lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


More information about the Users mailing list