Hi,
I'm trying to setup Kamailio to act as a load-balancer in front of asterisk servers.
I want it to do the following: - The UA sends an invite to Kamailio - Kamailio sends a 30x redirect to the UA (dispatcher) - The UA sends it's invite to the asterisk server
I've seen a couple of examples, but doesn't seem to work for me.
Here's the relevant config:
route{
if (method=="REGISTER") { [...clip...] }; if (method=="INVITE") { ds_select_domain("2","8"); #ds_select_dst("2","8"); sl_send_reply("300","Redirect"); exit; }; }
What seems to happen is that Kamailio does send the redirect, but with no indication of where to go. ds_select_domain (or ds_select_dst ... I having trouble understanding the difference like many people it seems) I'm guessing selects an appropriate uri, but doesn't put it the contact for the redirect.
Is there anyway to see what was set by the ds_select_dst? what pv would have this value? What do I need to set prior to sending a redirect reply for it to be properly forwarded?
BTW: using Kamailio 3.0.1
Thank you,
2010/4/15 Benjamin Lawetz benjaminlawetz@gmail.com:
Hi,
I'm trying to setup Kamailio to act as a load-balancer in front of asterisk servers.
I want it to do the following:
- The UA sends an invite to Kamailio
- Kamailio sends a 30x redirect to the UA (dispatcher)
- The UA sends it's invite to the asterisk server
I strongly suggest not to do that. Instead:
- The UA sends an invite to Kamailio - Kamailio uses LCR module to randomly select asterik-1 or asterisk-2. - Kamailio sends the request to the selected asterisk. - If there is a failure (to inspect in failure_route) Kamailio uses next_ge() (LCR module) and routes the INVITE to the other asterisk.
This will work really better.
it's ok. This is just an issue we found, you can do it anytime you are available.
kaiser 在 2010/4/16 上午5:44 時, Iñaki Baz Castillo 寫到:
2010/4/15 Benjamin Lawetz benjaminlawetz@gmail.com:
Hi,
I'm trying to setup Kamailio to act as a load-balancer in front of asterisk servers.
I want it to do the following:
- The UA sends an invite to Kamailio
- Kamailio sends a 30x redirect to the UA (dispatcher)
- The UA sends it's invite to the asterisk server
I strongly suggest not to do that. Instead:
- The UA sends an invite to Kamailio
- Kamailio uses LCR module to randomly select asterik-1 or asterisk-2.
- Kamailio sends the request to the selected asterisk.
- If there is a failure (to inspect in failure_route) Kamailio uses
next_ge() (LCR module) and routes the INVITE to the other asterisk.
This will work really better.
-- Iñaki Baz Castillo ibc@aliax.net
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
it's ok. This is just an issue we found, you can do it anytime you are available.
kaiser 在 2010/4/16 上午5:44 時, Iñaki Baz Castillo 寫到:
2010/4/15 Benjamin Lawetz benjaminlawetz@gmail.com:
Hi,
I'm trying to setup Kamailio to act as a load-balancer in front of asterisk servers.
I want it to do the following:
- The UA sends an invite to Kamailio
- Kamailio sends a 30x redirect to the UA (dispatcher)
- The UA sends it's invite to the asterisk server
I strongly suggest not to do that. Instead:
- The UA sends an invite to Kamailio
- Kamailio uses LCR module to randomly select asterik-1 or asterisk-2.
- Kamailio sends the request to the selected asterisk.
- If there is a failure (to inspect in failure_route) Kamailio uses
next_ge() (LCR module) and routes the INVITE to the other asterisk.
This will work really better.
-- Iñaki Baz Castillo ibc@aliax.net
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Hello,
On 4/15/10 11:04 PM, Benjamin Lawetz wrote:
[...] ds_select_domain (or ds_select_dst ... I having trouble understanding the difference like many people it seems)
- ds_select_domain() updates the domain part of R-URI, therefore the address selected from dispatcher table is visible in forwarded message - ds_select_dst() udpates the destination URI, which is an attribute inside Kamailio which specifies the outbound proxy address (i.e., where to send the sip request). The sip message itself won't contain that address.
Cheers, Daniel
Thanks for your help guys.. starting to get a clearer picture
On Fri, Apr 16, 2010 at 5:20 AM, Daniel-Constantin Mierla miconda@gmail.com wrote:
- ds_select_domain() updates the domain part of R-URI, therefore the address
selected from dispatcher table is visible in forwarded message
- ds_select_dst() udpates the destination URI, which is an attribute inside
Kamailio which specifies the outbound proxy address (i.e., where to send the sip request). The sip message itself won't contain that address.
So if we go with an example with the dispatcher list set to sip:10.10.10.1:5060 sip:10.10.10.2:5060
If I receive a destination of jane@10.10.10.3:5060 And I call dst_select_domain() it will rewrite it as jane@10.10.10.1:5060 If I call dst_select_dst() it will send jane@10.10.10.3:5060 to the IP 10.10.10.1
Is this correct?
Thanks,
2010/4/16 Benjamin Lawetz benjaminlawetz@gmail.com:
So if we go with an example with the dispatcher list set to sip:10.10.10.1:5060 sip:10.10.10.2:5060
If I receive a destination of jane@10.10.10.3:5060 And I call dst_select_domain() it will rewrite it as jane@10.10.10.1:5060 If I call dst_select_dst() it will send jane@10.10.10.3:5060 to the IP 10.10.10.1
Is this correct?
Right.
Also, if an Asterisk is down you will get into failure route with a locally generated 408 "Timeout" (check also "is_local_replied()" function). Then in failure_route you can call ds_next_dst() or ds_next_domain() so the other asterisk will be selected and Kamailio will send it the INVITE (this is failover).