Hello,
Consider the following Kamailio script:
route { .... route(DISPATCH);
route(RELAY); }
route[DISPATCH] { ds_select_domain("1", "8"); return; }
Dispatcher Table SetID
Destination
1
192.168.1.10
1
192.168.1.11
Algorithm 8 uses the first destination, but if it's not available, it uses the next one. Does the ds_select_domain function send the SIP request to the first destination or is it the responsibility of the RELAY route to do this? I believe it's the latter, according to the documentation.
Assuming the above (message is relayed in the RELAY route). When Kamailio can't reach the first destination, how does it internally handle the failover? Because once the SIP request has been relayed to the host, the script doesn't have any instructions anymore.
On 08/06/2013 09:00 AM, Grant Bagdasarian wrote:
Hello,
Consider the following Kamailio script:
route {
…. route(DISPATCH); route(RELAY);
}
route[DISPATCH] {
ds_select_domain("1", "8");
return;
}
Dispatcher Table
SetID
Destination
1
192.168.1.10
1
192.168.1.11
Algorithm 8 uses the first destination, but if it’s not available, it uses the next one.
Does the ds_select_domain function send the SIP request to the first destination or is it the responsibility of the RELAY route to do this? I believe it’s the latter, according to the documentation.
All the ds_select_domain() function does is change the domain part of the Request URI ($rd). It's still up to you to take that modified SIP request, perform any additional processing, and relay/forward it as desired. When you do this, t_relay() will consume the domain part of the request URI, in the absence of an overriding destination set ($du, as would be the case if you used ds_select_dst()).
When Kamailio can’t reach the first destination, how does it internally handle the failover? Because once the SIP request has been relayed to the host, the script doesn’t have any instructions anymore.
You must arm a failure_route before t_relay(), and call ds_select_domain() again to advance through the gateways in the dispatcher set.
Example:
route[DISPATCHER_INITIAL] { xlog("L_INFO", "[R-DISPATCHER-INITIAL:$ci] Entering dispatcher selection route\n");
if(!ds_select_domain("1", "4")) { # This should only happen if the route set is empty.
sl_send_reply("503", "Out of Gateways");
xlog("L_ERR", "[R-DISPATCHER-INITIAL:$ci] !> " "No gateways available!\n"); exit; }
xlog("L_INFO", "[R-DISPATCHER-INITIAL:$ci] -> " "Selected gateway: $rd:$rp\n");
t_on_failure("DISPATCHER_ROLLOVER");
t_relay() etc blah blah; }
failure_route[DISPATCHER_ROLLOVER] { xlog("L_INFO", "[R-DISPATCHER-ROLLOVER:$ci] " "Relay to dispatcher-selected gateway failed\n");
if(t_is_expired()) { xlog("L_INFO", "[R-DISPATCHER-ROLLOVER:$ci] !> " "Transaction expired - aborting\n"); exit; }
if(t_is_canceled()) { xlog("L_INFO", "[R-DISPATCHER-ROLLOVER:$ci] !> " "Transaction cancelled - aborting\n"); exit; }
if(!ds_next_domain()) { # This should happen when we are out of gateways/have tried # the last one in the route set.
xlog("L_ERR", "[R-DISPATCHER-ROLLOVER:$ci] !> " "No more gateways in route set\n");
t_reply("503", "Out of gateways"); exit; }
xlog("L_INFO", "[R-DISPATCHER-ROLLOVER:$ci] -> " "Attempting relay to new gateway: $rd:$rp\n");
t_on_failure("DISPATCHER_ROLLOVER"); t_relay(); }
-- Alex
Ahh, right! Got it.
Thanks!
-----Original Message----- From: sr-users-bounces@lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Alex Balashov Sent: Tuesday, August 6, 2013 3:40 PM To: sr-users@lists.sip-router.org Subject: Re: [SR-Users] Workings of the kamailio dispatcher module
On 08/06/2013 09:00 AM, Grant Bagdasarian wrote:
Hello,
Consider the following Kamailio script:
route {
.... route(DISPATCH); route(RELAY);
}
route[DISPATCH] {
ds_select_domain("1", "8");
return;
}
Dispatcher Table
SetID
Destination
1
192.168.1.10
1
192.168.1.11
Algorithm 8 uses the first destination, but if it's not available, it uses the next one.
Does the ds_select_domain function send the SIP request to the first destination or is it the responsibility of the RELAY route to do this? I believe it's the latter, according to the documentation.
All the ds_select_domain() function does is change the domain part of the Request URI ($rd). It's still up to you to take that modified SIP request, perform any additional processing, and relay/forward it as desired. When you do this, t_relay() will consume the domain part of the request URI, in the absence of an overriding destination set ($du, as would be the case if you used ds_select_dst()).
When Kamailio can't reach the first destination, how does it internally handle the failover? Because once the SIP request has been relayed to the host, the script doesn't have any instructions anymore.
You must arm a failure_route before t_relay(), and call ds_select_domain() again to advance through the gateways in the dispatcher set.
Example:
route[DISPATCHER_INITIAL] { xlog("L_INFO", "[R-DISPATCHER-INITIAL:$ci] Entering dispatcher selection route\n");
if(!ds_select_domain("1", "4")) { # This should only happen if the route set is empty.
sl_send_reply("503", "Out of Gateways");
xlog("L_ERR", "[R-DISPATCHER-INITIAL:$ci] !> " "No gateways available!\n"); exit; }
xlog("L_INFO", "[R-DISPATCHER-INITIAL:$ci] -> " "Selected gateway: $rd:$rp\n");
t_on_failure("DISPATCHER_ROLLOVER");
t_relay() etc blah blah; }
failure_route[DISPATCHER_ROLLOVER] { xlog("L_INFO", "[R-DISPATCHER-ROLLOVER:$ci] " "Relay to dispatcher-selected gateway failed\n");
if(t_is_expired()) { xlog("L_INFO", "[R-DISPATCHER-ROLLOVER:$ci] !> " "Transaction expired - aborting\n"); exit; }
if(t_is_canceled()) { xlog("L_INFO", "[R-DISPATCHER-ROLLOVER:$ci] !> " "Transaction cancelled - aborting\n"); exit; }
if(!ds_next_domain()) { # This should happen when we are out of gateways/have tried # the last one in the route set.
xlog("L_ERR", "[R-DISPATCHER-ROLLOVER:$ci] !> " "No more gateways in route set\n");
t_reply("503", "Out of gateways"); exit; }
xlog("L_INFO", "[R-DISPATCHER-ROLLOVER:$ci] -> " "Attempting relay to new gateway: $rd:$rp\n");
t_on_failure("DISPATCHER_ROLLOVER"); t_relay(); }
-- Alex -- Alex Balashov - Principal Evariste Systems LLC 235 E Ponce de Leon Ave Suite 106 Decatur, GA 30030 United States Tel: +1-678-954-0670 Web: http://www.evaristesys.com/, http://www.alexbalashov.com/
_______________________________________________ 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
How does the dispatcher module handle the priorities in the dispatcher table? For example:
ID;Set;Destination;Priority
1;1;192.168.16.10;1 2;1;192.168.16.11;2
Which one will be chosen first? I would assume, the higher the priority number, the higher the priority, right?
Regards,
Grant
-----Original Message----- From: sr-users-bounces@lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Grant Bagdasarian Sent: Tuesday, August 6, 2013 3:49 PM To: Kamailio (SER) - Users Mailing List Subject: Re: [SR-Users] Workings of the kamailio dispatcher module
Ahh, right! Got it.
Thanks!
-----Original Message----- From: sr-users-bounces@lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Alex Balashov Sent: Tuesday, August 6, 2013 3:40 PM To: sr-users@lists.sip-router.org Subject: Re: [SR-Users] Workings of the kamailio dispatcher module
On 08/06/2013 09:00 AM, Grant Bagdasarian wrote:
Hello,
Consider the following Kamailio script:
route {
.... route(DISPATCH); route(RELAY);
}
route[DISPATCH] {
ds_select_domain("1", "8");
return;
}
Dispatcher Table
SetID
Destination
1
192.168.1.10
1
192.168.1.11
Algorithm 8 uses the first destination, but if it's not available, it uses the next one.
Does the ds_select_domain function send the SIP request to the first destination or is it the responsibility of the RELAY route to do this? I believe it's the latter, according to the documentation.
All the ds_select_domain() function does is change the domain part of the Request URI ($rd). It's still up to you to take that modified SIP request, perform any additional processing, and relay/forward it as desired. When you do this, t_relay() will consume the domain part of the request URI, in the absence of an overriding destination set ($du, as would be the case if you used ds_select_dst()).
When Kamailio can't reach the first destination, how does it internally handle the failover? Because once the SIP request has been relayed to the host, the script doesn't have any instructions anymore.
You must arm a failure_route before t_relay(), and call ds_select_domain() again to advance through the gateways in the dispatcher set.
Example:
route[DISPATCHER_INITIAL] { xlog("L_INFO", "[R-DISPATCHER-INITIAL:$ci] Entering dispatcher selection route\n");
if(!ds_select_domain("1", "4")) { # This should only happen if the route set is empty.
sl_send_reply("503", "Out of Gateways");
xlog("L_ERR", "[R-DISPATCHER-INITIAL:$ci] !> " "No gateways available!\n"); exit; }
xlog("L_INFO", "[R-DISPATCHER-INITIAL:$ci] -> " "Selected gateway: $rd:$rp\n");
t_on_failure("DISPATCHER_ROLLOVER");
t_relay() etc blah blah; }
failure_route[DISPATCHER_ROLLOVER] { xlog("L_INFO", "[R-DISPATCHER-ROLLOVER:$ci] " "Relay to dispatcher-selected gateway failed\n");
if(t_is_expired()) { xlog("L_INFO", "[R-DISPATCHER-ROLLOVER:$ci] !> " "Transaction expired - aborting\n"); exit; }
if(t_is_canceled()) { xlog("L_INFO", "[R-DISPATCHER-ROLLOVER:$ci] !> " "Transaction cancelled - aborting\n"); exit; }
if(!ds_next_domain()) { # This should happen when we are out of gateways/have tried # the last one in the route set.
xlog("L_ERR", "[R-DISPATCHER-ROLLOVER:$ci] !> " "No more gateways in route set\n");
t_reply("503", "Out of gateways"); exit; }
xlog("L_INFO", "[R-DISPATCHER-ROLLOVER:$ci] -> " "Attempting relay to new gateway: $rd:$rp\n");
t_on_failure("DISPATCHER_ROLLOVER"); t_relay(); }
-- Alex -- Alex Balashov - Principal Evariste Systems LLC 235 E Ponce de Leon Ave Suite 106 Decatur, GA 30030 United States Tel: +1-678-954-0670 Web: http://www.evaristesys.com/, http://www.alexbalashov.com/
_______________________________________________ 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
_______________________________________________ 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
Grant,
On 08/07/2013 05:00 AM, Grant Bagdasarian wrote:
How does the dispatcher module handle the priorities in the dispatcher table? For example:
ID;Set;Destination;Priority
1;1;192.168.16.10;1 2;1;192.168.16.11;2
Which one will be chosen first? I would assume, the higher the priority number, the higher the priority, right?
Actually, it is the opposite -- the lower the priority number, the higher the priority (1 is first, 2 is second, etc.)
Initial ordering of the gateways inside the destination set is done by priority. If the priorities are the same, it is done by the order in which the gateways appear in the dispatcher.list or the database table.
-- Alex
Alright, thanks!
-----Original Message----- From: sr-users-bounces@lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Alex Balashov Sent: Wednesday, August 7, 2013 12:27 PM To: Kamailio (SER) - Users Mailing List Subject: Re: [SR-Users] Workings of the kamailio dispatcher module
Grant,
On 08/07/2013 05:00 AM, Grant Bagdasarian wrote:
How does the dispatcher module handle the priorities in the dispatcher table? For example:
ID;Set;Destination;Priority
1;1;192.168.16.10;1 2;1;192.168.16.11;2
Which one will be chosen first? I would assume, the higher the priority number, the higher the priority, right?
Actually, it is the opposite -- the lower the priority number, the higher the priority (1 is first, 2 is second, etc.)
Initial ordering of the gateways inside the destination set is done by priority. If the priorities are the same, it is done by the order in which the gateways appear in the dispatcher.list or the database table.
-- Alex
-- Alex Balashov - Principal Evariste Systems LLC 235 E Ponce de Leon Ave Suite 106 Decatur, GA 30030 United States Tel: +1-678-954-0670 Web: http://www.evaristesys.com/, http://www.alexbalashov.com/
_______________________________________________ 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