SER has a stateless load balancer called dispatcher. A more detailed discussion about this module is available here:
http://www.kamailio.net/docs/modules/1.5.x/dispatcher.html
Here are relevant entries on your kamailio.cfg or openser.cfg in order to use SER as load balancer for OpenSBC:
a. include dispatcher module
loadmodule "dispatcher.so"
b. declare dispatcher parameters
--dispatcher params --
modparam("dispatcher", "list_file", "/usr/local/kamailo/etc/kamailio/dispatcher.list")
modparam("rr", "enable_full_lr", 1)
c. sample content of main route logic:
route {
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483", "Too Many Hops");
exit;
};
if (msg:len > max_len) {
sl_send_reply("513", "Message Overflow");
exit;
};
if (loose_route()) {
append_hf("P-hint: rr-enforced\r\n");
record_route();
route(2);
exit;
};
if (method=="INVITE") {
route(1);
xlog("Forward to <$ru> with CID
$ci\n");
}
};
if (method=="REGISTER") {
append_to_reply("Contact: $ct\r\n");
sl_send_reply("200", "OK");
exit;
};
if ( (method=="CANCEL") || (method=="ACK") ) {
record_route();
route(2);
xlog("Forward to <$ru> with CID
$ci\n");
exit;
};
#if stateless LB
route[1]
{
ds_select_domain("2", "4");
record_route();
t_relay();
}
route[2]
{
if (!t_relay()) {
sl_reply_error();
};
}
d. sample content of dispatcher.list with IPs of OSBC
2 sip:10.10.10.1:5060
2 sip:10.10.10.2:5060
2 sip:10.10.10.3:5060
2 sip:10.10.10.4:5060
where '2' denotes the ID of the gateways as declared in ' ds_select_domain("2", "4");' while 4 is the algorithm for round robin