Browse Source

dispatcher extensions

- distribute also Register and Subscribes to groups 20 and 30
  respectively
- for Invites introduce a backup group 2 to be used in case in group 1
  there are less than 3 available gateways
3.17
Anca Vamanu 12 years ago
parent
commit
267d3472eb
1 changed files with 41 additions and 4 deletions
  1. +41
    -4
      kamailio/dispatcher-role.cfg

+ 41
- 4
kamailio/dispatcher-role.cfg View File

@ -40,12 +40,49 @@ route[DISPATCHER_FIND_ROUTES]
return; return;
} }
if (!ds_select_dst("1", "0")) {
xlog("L_ERR", "$ci|end|no servers avaliable");
if (is_method("SUBSCRIBE")) {
$var(ds_group) = 20;
} else
if (is_method("REGISTER")) {
$var(ds_group) = 30;
} else {
$var(ds_group) = 1;
}
if (!ds_select_dst("$var(ds_group)", "0")) {
xlog("L_ERR", "$ci|end|no servers avaliable in group $var(ds_group)");
# if we selected from group 1, try again in group 2
if ($var(ds_group) == 1 ) {
if (!ds_select_dst("2", "0")) {
xlog("L_ERR", "$ci|end|no servers avaliable in group 2");
sl_send_reply("480", "All servers busy");
exit;
}
} else {
sl_send_reply("480", "All servers busy");
exit;
sl_send_reply("480", "All servers busy");
}
} else {
# if we selected from group 1 and there are less than 3 available servers, choose from group 2
if ($var(ds_group) == 1 && $var(ds_cnt)< 3) {
# clear $avp(ds_dst) and search in group 2
$(avp(ds_dst)[*]) = $null;
if (!ds_select_dst("2", "0")) {
xlog("L_ERR", "$ci|end|no servers avaliable in group 2");
sl_send_reply("480", "All servers busy");
exit;
}
}
exit;
} }
$var(contact_uri) = $(ct{tobody.user}) + "@" + $(ct{tobody.host}); $var(contact_uri) = $(ct{tobody.user}) + "@" + $(ct{tobody.host});


Loading…
Cancel
Save