How to configure kamailio server with load balancing and asterisk? [closed]

﹥>﹥吖頭↗ 提交于 2019-12-03 00:45:16
dougBTV

You'll want to use the Kamailio dispatcher module.

You'll have a dispatcher.list like:

# group  sip addresses of your asterisk boxen
1 sip:10.1.2.3:5060
1 sip:10.1.2.4:5060
1 sip:10.1.2.5:5060

And a kamailio.cfg configured like so:

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();
}

Additionally, kamailio has an example in their wiki. And you can also find more about the dispatcher for Kamailio 4.3 in the docs.

p.s. Stackexchange tip: You'll get more replies if you're willing to document the steps you've tried, and posting your specific configurations and explaining what did and didn't work, as opposed to a general overview.


Checking the health of dispatched Asterisk boxes. To route-advance when an Asterisk box is down. You should check the health of the boxes. You can also do this using the dispatcher. This should also a take a box out of rotation when issue a command such as core shutdown gracefully which will make asterisk start responding with a 'not available' response.

modparam("dispatcher", "ds_probing_mode", 1)
modparam("dispatcher", "ds_ping_interval", 15)
modparam("dispatcher", "ds_probing_threshold", 1)
modparam("dispatcher", "ds_ping_reply_codes", "class=2;class=3;class=4")

Add four records per asterisk server to your DNS: asterisk A 10.1.1.1 asterisk A 10.1.1.2 asterisk A 10.1.1.3 asterisk A 10.1.1.4 Setup your kamalio to use DNS asterisk.localdomain as address of asterisk trunk. DNS server will use "round robin" algorithm - next A address for each request.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!