Hello,
I have some questions about dispatcher's behavior. I noticed that when I first
ds_select_dst() a specific dispatcher group ID, ds_next_dst() will cycle through the
active destinations in that group. When it reaches the end of the destinations in the
group, it does not return "false", instead it starts to return destinations that
are not a part of that group, ie. those destinations which are listed prior to the
selected group in the dispatcher.list file. Is this the expected behavior? I've
observed it on kamailio 5.3 and 5.5 releases.
My dispatcher.list:
# Group 1
1 sip:127.0.0.1:5071;transport=udp 8 0
# Group 2
2 sip:127.0.0.1:5072;transport=udp 8 0
# Group 3
3 sip:127.0.0.1:7010;transport=udp 8 0
3 sip:127.0.0.1:7011;transport=udp 8 0
3 sip:127.0.0.1:7012;transport=udp 8 0
# Group 4
4 sip:127.0.0.1:5071;transport=udp 8 0
4 sip:127.0.0.1:5072;transport=udp 8 0
I have the following in failure_route (excerpt):
$var(dsFoundDestination) = 0;
if (t_any_replied())
{
xavp_params_implode("_dsdst_",
"$var(dsDestinations)");
xlog("L_INFO", "FAILURE ROUTE: Already have
replies on this transaction. Selecting next destination from:
[$var(dsDestinations)]");
if (ds_next_dst())
{
xavp_params_implode("_dsdst_",
"$var(dsDestinations)");
xlog("L_INFO", "FAILURE ROUTE: Next
destination selected: [$du] from [$var(dsDestinations)]");
$var(dsFoundDestination) = 1;
}
}
else if (ds_select_dst("3", "8")) //
Dispatcher Group 3
{
xlog("L_INFO", "FAILURE ROUTE: Did not find any
replies on this transaction. Selected destination: [$du]");
$var(dsFoundDestination) = 1;
}
if ($var(dsFoundDestination))
{
$var(logString) = "FAILURE ROUTE: Relayed to [" +
$du + "]";
if (t_relay())
{
xlog("L_INFO", "$var(logString)");
}
}
Produces the following logs:
FAILURE ROUTE: Did not find any replies on this transaction. Selected destination:
[sip:127.0.0.1:7012;transport=udp]
FAILURE ROUTE: Relayed to [sip:127.0.0.1:7012;transport=udp]
FAILURE ROUTE: Already have replies on this transaction. Selecting next destination from:
[grp=3;uri=sip:127.0.0.1:7012;transport=udp;]
FAILURE ROUTE: Next destination selected: [sip:127.0.0.1:7011;transport=udp] from
[grp=3;uri=sip:127.0.0.1:7011;transport=udp;]
FAILURE ROUTE: Relayed to [sip:127.0.0.1:7011;transport=udp]
FAILURE ROUTE: Already have replies on this transaction. Selecting next destination from:
[grp=3;uri=sip:127.0.0.1:7011;transport=udp;]
FAILURE ROUTE: Next destination selected: [sip:127.0.0.1:7010;transport=udp] from
[grp=3;uri=sip:127.0.0.1:7010;transport=udp;]
FAILURE ROUTE: Relayed to [sip:127.0.0.1:7010;transport=udp]
FAILURE ROUTE: Already have replies on this transaction. Selecting next destination from:
[grp=3;uri=sip:127.0.0.1:7010;transport=udp;]
FAILURE ROUTE: Next destination selected: [sip:127.0.0.1:5072;transport=udp] from
[grp=2;uri=sip:127.0.0.1:5072;transport=udp;]
FAILURE ROUTE: Relayed to [sip:127.0.0.1:5072;transport=udp]
FAILURE ROUTE: Already have replies on this transaction. Selecting next destination from:
[grp=2;uri=sip:127.0.0.1:5072;transport=udp;]
FAILURE ROUTE: Next destination selected: [sip:127.0.0.1:5072;transport=udp] from
[grp=2;uri=sip:127.0.0.1:5072;transport=udp;]
FAILURE ROUTE: Relayed to [sip:127.0.0.1:5072;transport=udp]
FAILURE ROUTE: Already have replies on this transaction. Selecting next destination from:
[grp=2;uri=sip:127.0.0.1:5072;transport=udp;]
FAILURE ROUTE: Next destination selected: [sip:127.0.0.1:5071;transport=udp] from
[grp=1;uri=sip:127.0.0.1:5071;transport=udp;]
FAILURE ROUTE: Relayed to [sip:127.0.0.1:5071;transport=udp]
I want to stop the loop once there are no more active destinations in group 3. Is the
solution simply to check that the selected destination is part of the desired group and
stop processing if it is not?
Thanks for your time.