– Kamailio SIP Server –

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
asterisk:load-balancing-and-ha [2012/03/24 10:39]
121.54.125.194
asterisk:load-balancing-and-ha [2012/03/26 18:13] (current)
kenny removed spam
Line 1: Line 1:
 +====== Asterisk Load balancing and High Availability with Kamailio (OpenSER) ======
 +
 +Kamailio coupled with Asterisk are implemented in many huge installations.
 +
 +The simplest way to set up load balancing is to use the dispatcher module.
 +
 +The dispatcher.list file should be set up like:
 +
 +<code>
 +# group  sip addresses of your * units
 +1 sip:10.1.2.3:5060
 +1 sip:10.1.2.4:5060
 +1 sip:10.1.2.5:5060
 +</code>
 +
 +the basic kamailio.cfg should be like:
 +
 +<code>
 +
 +loadmodule("dispatcher.so")
 +
 +...
 +
 +if ( method=="INVITE" ) {
 +# dst_select( "GROUP", "HASH METHOD")
 +  ds_select_dst("1","4");
 +  sl_send_reply("100","Trying");
 +  forward();#uri:host, uri:port);
 +  exit();
 +}
 +
 +</code>
 +
 +If you are interested in using the dispatcher to do 300 Redirect, you can do the following:
 +
 +<code>
 +if ( method=="INVITE" ) {
 +  dst_select_domain("1","4");
 +  # you can also add prefixes, if you need to send account codes
 +  # like:
 +  # prefix("123456");
 +  sl_send_reply("300","Redirect");
 +  exit;
 +}
 +</code>
 +in this fashion, you can put in a very inexpensive Kamailio SIP server installation to use as a load-balancer for your * units.
 +
 +
 +====SRV Records====
 +
 +Another option is to use SRV records for your asterisk server group and forward the message to the domain.