load balancing based on source IP

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

load balancing based on source IP

Matt Hamilton
I am planning to use opensips to load balance/direct traffic to asterisk servers. We have about 40 locations (will have many more) with 5 phones each, and we would like to have all the traffic coming from a location to go to the same asterisk server; i.e., if the first SIP message from location 1 is sent to Server A, we would like the other messages coming from there also sent to A. Is this possible? Traffic from each location will be more or less the same, so can opensips do the load balancing maybe in a round robin style (I guess via dispatcher) taking the source IP into consideration; e.g. location 1 goes to server A, location 2 goes to server B, location 3 goes to server C, location 4 goes to server A, etc.?

The reason I want to do this is to keep the device state information for each location on the same Asterisk server (I'm not sure if asterisk can store device state data in a database for realtime updates and lookups) and maybe avoid extra messaging (e.g. openais) betwen asterisk servers to distribute the device state data.

 I'm very new to opensips and asterisk...

Thanks,
Matt

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

Re: load balancing based on source IP

Vlad Paiu
Hello,

You can use the dispatcher module to accomplish this. Please check the hash_pvar param [1] and the ds_select_dst() func [2] with the 7th algorithm.

So what you need to do is put the $si ( source IP ) in the hash_pvar AVP, and then call ds_select_dst("1","7"). This will lead to having calls from the same IP to be routed to the same Asterisk server.


[1] http://www.opensips.org/html/docs/modules/devel/dispatcher.html#id250265
[2] http://www.opensips.org/html/docs/modules/devel/dispatcher.html#id292791

Regards,
Vlad Paiu
OpenSIPS Developer

On 11/11/2011 02:51 AM, Mistral 66 wrote:
I am planning to use opensips to load balance/direct traffic to asterisk servers. We have about 40 locations (will have many more) with 5 phones each, and we would like to have all the traffic coming from a location to go to the same asterisk server; i.e., if the first SIP message from location 1 is sent to Server A, we would like the other messages coming from there also sent to A. Is this possible? Traffic from each location will be more or less the same, so can opensips do the load balancing maybe in a round robin style (I guess via dispatcher) taking the source IP into consideration; e.g. location 1 goes to server A, location 2 goes to server B, location 3 goes to server C, location 4 goes to server A, etc.?

The reason I want to do this is to keep the device state information for each location on the same Asterisk server (I'm not sure if asterisk can store device state data in a database for realtime updates and lookups) and maybe avoid extra messaging (e.g. openais) betwen asterisk servers to distribute the device state data.

 I'm very new to opensips and asterisk...

Thanks,
Matt
_______________________________________________ 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: load balancing based on source IP

Matt Hamilton
Thanks Vlad!


Date: Fri, 11 Nov 2011 10:59:40 +0200
From: [hidden email]
To: [hidden email]
Subject: Re: [OpenSIPS-Users] load balancing based on source IP

Hello,

You can use the dispatcher module to accomplish this. Please check the hash_pvar param [1] and the ds_select_dst() func [2] with the 7th algorithm.

So what you need to do is put the $si ( source IP ) in the hash_pvar AVP, and then call ds_select_dst("1","7"). This will lead to having calls from the same IP to be routed to the same Asterisk server.


[1] http://www.opensips.org/html/docs/modules/devel/dispatcher.html#id250265
[2] http://www.opensips.org/html/docs/modules/devel/dispatcher.html#id292791

Regards,
Vlad Paiu
OpenSIPS Developer



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

intermittent one-way audio

Matt Hamilton
In reply to this post by Matt Hamilton
We are using Opensips as a load balancer/dispatcher for Asterisk servers. All these servers are in a DMZ and have public IPs. SIP traffic goes thru Opensips, but RTP is between Asterisk servers and UACs.

All the UACs are behind NAT, and there are two kinds based on nat_uac_test (in our case set to 18):

1. The ones for which flag 2 (the "received" test) applies (address in Via is compared against source IP address of signaling). These are mostly behind firewalls, and source and via ports are the same - 5060.

2. The ones for which flag 16 applies (if the source port is different from the port in Via). These phones are directly connected to a Cisco router thru a switch.


We are having intermittent one-way audio problems for the clients in 2 in an environment where a client puts a call on hold and the other one picks up. The phones work properly without audio issues for 10-15 minutes, then one way-audio happens. We can't find anything out of the ordinary in the SDP fields; all the IPs seem to be correct.

BTW, phones in 1 above work fine (all the time), and all the phones are exactly the same (for both 1 and 2 - same brand, firmware, configuration).

Has anyone experienced such intermittent one-way audio issues? Can the router cause this somehow (which is configured by our provider)?

Thanks a lot,
Matt

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

Re: intermittent one-way audio

SamyGo
Hi,
Can you track the call with one-way audio. That could be a big deal if there are alot of servers in your asterisk farm. If you can trace which asterisk server it happens and verify its sip settings "externip" - also "rtp set debug on" for a brief time interval can tell you the story. 
Yes router can be an issue where Inbound network traffic is ACL restricted and outbound traffic from server is almost never ACL-ed - so that can be one case.
Up till here I'm assuming that SDPs are all well negotiated between phones and servers.

Now,
 The phones work properly without audio issues for 10-15 minutes, then one way-audio happens

Do you see any re-INVITES exchanging between the phones and maybe both the A & B parties trying to directly communicate with each other !!? 
Do you've any CISCO PIX/ASAthingie in your network ? Maybe it times-out/expires the connection stream due to inactivity !?

These are few things I could think of troubleshooting such an issue. Maybe some other hints or details from you can help focus in one particular area.

Regards,
Sammy

On Thu, Mar 29, 2012 at 5:23 AM, Matt Hamilton <[hidden email]> wrote:
We are using Opensips as a load balancer/dispatcher for Asterisk servers. All these servers are in a DMZ and have public IPs. SIP traffic goes thru Opensips, but RTP is between Asterisk servers and UACs.

All the UACs are behind NAT, and there are two kinds based on nat_uac_test (in our case set to 18):

1. The ones for which flag 2 (the "received" test) applies (address in Via is compared against source IP address of signaling). These are mostly behind firewalls, and source and via ports are the same - 5060.

2. The ones for which flag 16 applies (if the source port is different from the port in Via). These phones are directly connected to a Cisco router thru a switch.


We are having intermittent one-way audio problems for the clients in 2 in an environment where a client puts a call on hold and the other one picks up. The phones work properly without audio issues for 10-15 minutes, then one way-audio happens. We can't find anything out of the ordinary in the SDP fields; all the IPs seem to be correct.

BTW, phones in 1 above work fine (all the time), and all the phones are exactly the same (for both 1 and 2 - same brand, firmware, configuration).

Has anyone experienced such intermittent one-way audio issues? Can the router cause this somehow (which is configured by our provider)?

Thanks a lot,
Matt

_______________________________________________
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: intermittent one-way audio

Matt Hamilton
Sammy, thanks a lot for your suggestions.


>Can you track the call with one-way audio. That could be a big deal if there are alot of servers in your asterisk farm. If you can trace which asterisk server it happens >and verify its sip settings "externip" - also "rtp set debug on" for a brief time interval can tell you the story.

It happens on all of them, but then they are all configured the same way. All servers have public IPs, and both outboundproxy and bindaddr are set to the public ip. externip is not set (commented out), but Asterisk sets SDP (c) field correctly, and SDPs seem to be negotiated well. As I said, this happens only for phones behind Cisco routers and it happens intermittently - they work ok for 10-15 minutes, then we see the problem. I can't see any abnormal/incorrect SDP data while the problem is happening. I haven't done "rtp set debug on" yet (I'll do that next), but wireshark shows the RTP packets are sent to the correct IP (how the Cisco router handles them might be causing the problem of course).

I will ask our provider to see if there are any ACL restrictions on the router and especially if there is anything in between that might cause a timeout as you suggested.

> Do you see any re-INVITES exchanging between the phones and maybe both the A & B parties trying to directly communicate with each other !!?

All the re-INVITES seem to be going thru Opensips and Asterisk, but I will try to capture the traffic between the phone and the router in our branch to see if there are anything going on between UACs.

Regards,
Matt



>Do you've any CISCO PIX/ASAthingie in your network ? Maybe it times-out/expires the connection stream due to inactivity !?
>These are few things I could think of troubleshooting such an issue. Maybe some other hints or details from you can help focus in one particular area.

>Regards,
>Sammy


On Thu, Mar 29, 2012 at 5:23 AM, Matt Hamilton <[hidden email]> wrote:
We are using Opensips as a load balancer/dispatcher for Asterisk servers. All these servers are in a DMZ and have public IPs. SIP traffic goes thru Opensips, but RTP is between Asterisk servers and UACs.

All the UACs are behind NAT, and there are two kinds based on nat_uac_test (in our case set to 18):

1. The ones for which flag 2 (the "received" test) applies (address in Via is compared against source IP address of signaling). These are mostly behind firewalls, and source and via ports are the same - 5060.

2. The ones for which flag 16 applies (if the source port is different from the port in Via). These phones are directly connected to a Cisco router thru a switch.


We are having intermittent one-way audio problems for the clients in 2 in an environment where a client puts a call on hold and the other one picks up. The phones work properly without audio issues for 10-15 minutes, then one way-audio happens. We can't find anything out of the ordinary in the SDP fields; all the IPs seem to be correct.

BTW, phones in 1 above work fine (all the time), and all the phones are exactly the same (for both 1 and 2 - same brand, firmware, configuration).

Has anyone experienced such intermittent one-way audio issues? Can the router cause this somehow (which is configured by our provider)?

Thanks a lot,
Matt

_______________________________________________
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

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