Hello,
On 13/03/15 08:52, Markus wrote:
Hi list,
I'm new here, also to Kamailio. My goal is to achieve the "standard solution": Kamailio for load balancing and high availability of several Asterisk servers.
For starters, I've set it up with Kamailio+dispatcher+permissions acting as a proxy and it was working fine, but I'd like to try to keep it much more simple. For these reasons:
- I'd like to maintain different peer settings in Asterisk (DTMF,
codecs).
- I don't want/need a database for Kamailio. I think it is mandatory
for permissions module + IP auth. So, let's do Asterisk the authentication, it's already there.
You can use here db_text or db_sqlite, which don't require a heavy mysql server. You can also have static rules in kamailio, like:
if(src_ip==asterisk_ip1 || src_ip==asterisk_ip1 || ...)
Or, if asterisk servers are in the same subnet, you can have:
if(src_ip==asterisk_net/24)
As you use dispatcher, another alternative is to use ds_is_from_list() function, which will match if the request was sent by one of addresses in the dispatcher lists.
- Accounting. I'm using a software where it's really useful for
accounting purposes if every peer/user has its own entry in Asterisk's sip.conf / in realtime table.
Long story short, my config now looks like this and it seems to be working fine for me:
request_route { route(DISPATCHER); }
route[DISPATCHER] {
if ( method=="REGISTER") { ds_select_domain("1","4"); sl_send_reply("300","Redirect"); exit; }
if ( method=="INVITE" ) { ds_select_domain("1","4"); sl_send_reply("300","Redirect"); exit; }
if ( method=="SUBSCRIBE" ) { ds_select_domain("1","4"); sl_send_reply("300","Redirect"); exit; }
}
My questions:
- There are other approaches to the DTMF+codecs issue. Like this
thread from 2013: http://lists.kamailio.org/pipermail/sr-users/2013-January/076379.html
- but I have dozens of changing PSTN peers, so
authentication/accounting based on port would be cumbersome. Are there new/alternative ways?
- I searched the archive and the Web but did not find many questions
about a "I-don't-want-Kamailio-to-show-as-the-only-peer-to-Asterisk" solution. Therefore I'm wondering: Is everyone a) running such homogeneous setups that they can survive with the same codec + DTMF settings in Asterisk for all their peers + users? Or b) doing some rewriting magic within Kamailio to deal with it? Or c) I'm overlooking a simple solution. Which one is it? :)
Can asterisk make some decision on headers? IIRC, someone was mentioning at some point to use Remote-Party-ID (could be now P-Asserted-Identity) header to match on a specific profile.
- And the biggest question: Everywhere I read basically "Redirect
server for LB + HA is not recommended, better use proxy". Is this still true, and if so, what are the reasons? Because I should be worried that not all clients/gateways out there respect a SIP 300 Redirect? Other reasons?
I think this is something specific for your environment. Kamailio doesn't have any issues sending redirect replies. A proxy might be required in case of natted endpoints when they cannot communicate each other. But otherwise, if you don't want the new INVITE to pass again via LB, then you can send 3xx.
Cheers, Daniel