Forum Discussion

wiked_jeeds_131's avatar
wiked_jeeds_131
Icon for Nimbostratus rankNimbostratus
Aug 27, 2013

SIP load balance criteria by call no. using irule

Hi all, I got a requirement to load balancing SIP by call number.

 

for example, when client phone No. 0811234567 calls to No *123 in SIP header [SIP.To] shows *1230811234567 and client phone No. 0817654321 calls to No *456 in SIP header [SIP.To] shows *4560817654321

 

There is two IVR servers in pools for this Virtual server. Once VS get the request, first call must route to IVR server-1 and second call must route to IVR server-2

 

If the client calls to no. *123 Virtual Server must point to IVR server-1 and calls to no *456 must point to IVR Server-2

 

Anyone who familiar with SIP, please suggests

 

Thank you

 

1 Reply

  • Set load balance to round robin. Set persistence to blank Universal with the following iRule

    when SIP_REQUEST {
      persist [string range [SIP::to] 1 3]
    }
    

    This will persist on the first three numeric characters of the destination number to the backend server. If however you want exactly as you specified above then..

    when SIP_REQUEST {
      switch [string range [SIP::to] 1 3] {
        123 { node server1 port1 }
        456 { node server2 port2 }
      }
    }