Script for Load Balancing of PSTN calls on Asterisk Servers

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Script for Load Balancing of PSTN calls on Asterisk Servers

Faisal Rehman
Hi Everyone,

I want to do load balancing of two asterisk servers which are dealing with PSTN calls only, the script that I found on OpenSIPS website is a little complex and not my requirement. Let's say I have two asterisk boxes to be load balanced & whose IP addresses with allocated resources are added in the load_balancer table like:

+----+----------+-------------------------+-----------+------------+-------------+
| id | group_id | dst_uri                 | resources | probe_mode | description |
+----+----------+-------------------------+-----------+------------+-------------+
|  1 |        1 | sip:1.1.1.1:1111        |    pstn=32 |          0 |             |
|  2 |        1 | sip:2.2.2.2:2222   |    pstn=50|          0 |             |
+----+----------+-------------------------+-----------+------------+-------------+
 

So what will be the possible changes for load balancing script or will the below simple load balancing script/function will work for me:

load_balance("1","pstn");


Thanks in Advance!!

 
With Best Regards,

Faisal Rehman

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Script for Load Balancing of PSTN calls on Asterisk Servers

SamyGo
yup..seems good enough

if (load_balance("1","pstn")) {
	# dst URI points to the new destination
	xlog("sending call to $du\n");
	t_relay();
	exit;
}
else{
xlog("Load Balancer Failed\n");
sl_send_reply("503","Something Bad happened to Load Balancer");
exit();
}


On Fri, Sep 23, 2011 at 11:57 AM, Faisal Rehman <[hidden email]> wrote:
Hi Everyone,

I want to do load balancing of two asterisk servers which are dealing with PSTN calls only, the script that I found on OpenSIPS website is a little complex and not my requirement. Let's say I have two asterisk boxes to be load balanced & whose IP addresses with allocated resources are added in the load_balancer table like:

+----+----------+-------------------------+-----------+------------+-------------+
| id | group_id | dst_uri                 | resources | probe_mode | description |
+----+----------+-------------------------+-----------+------------+-------------+
|  1 |        1 | sip:1.1.1.1:1111        |    pstn=32 |          0 |             |
|  2 |        1 | sip:2.2.2.2:2222   |    pstn=50|          0 |             |
+----+----------+-------------------------+-----------+------------+-------------+
 

So what will be the possible changes for load balancing script or will the below simple load balancing script/function will work for me:

load_balance("1","pstn");


Thanks in Advance!!

 
With Best Regards,

Faisal Rehman

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Script for Load Balancing of PSTN calls on Asterisk Servers

Faisal Rehman
Hi Sam,

Okay I will surely try it.
 
With Best Regards,

Faisal Rehman

From: Sam Govind <[hidden email]>
To: Faisal Rehman <[hidden email]>; OpenSIPS users mailling list <[hidden email]>
Sent: Friday, September 23, 2011 12:11 PM
Subject: Re: [OpenSIPS-Users] Script for Load Balancing of PSTN calls on Asterisk Servers

yup..seems good enough

if (load_balance("1","pstn")) {
	# dst URI points to the new destination
	xlog("sending call to $du\n");
	t_relay();
	exit;
}
else{
xlog("Load Balancer Failed\n");
sl_send_reply("503","Something Bad happened to Load Balancer");
exit();
}


On Fri, Sep 23, 2011 at 11:57 AM, Faisal Rehman <[hidden email]> wrote:
Hi Everyone,

I want to do load balancing of two asterisk servers which are dealing with PSTN calls only, the script that I found on OpenSIPS website is a little complex and not my requirement. Let's say I have two asterisk boxes to be load balanced & whose IP addresses with allocated resources are added in the load_balancer table like:

+----+----------+-------------------------+-----------+------------+-------------+
| id | group_id | dst_uri                 | resources | probe_mode | description |
+----+----------+-------------------------+-----------+------------+-------------+
|  1 |        1 | sip:1.1.1.1:1111        |    pstn=32 |          0 |             |
|  2 |        1 | sip:2.2.2.2:2222   |    pstn=50|          0 |             |
+----+----------+-------------------------+-----------+------------+-------------+
 

So what will be the possible changes for load balancing script or will the below simple load balancing script/function will work for me:

load_balance("1","pstn");


Thanks in Advance!!

 
With Best Regards,

Faisal Rehman

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users





_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users