Hello,
normally ds_select_dst() should be used inside request_route and
ds_next_dst() in the failure_route. As you do the former also in the
failure_route, you keep selecting the destination from the group and add
them to the list of possible next hops.
Look at the readme of dispatcher module, it has a complete sample config
how to use the two functions.
Cheers,
Daniel
On 26.09.23 22:02, geoff.goas--- via sr-users wrote:
> 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.
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
> To unsubscribe send an email to [email protected]
> Important: keep the mailing list in the recipients, do not reply only to the
> sender!
> Edit mailing list options or unsubscribe:
--
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy - Training Services -- asipto.com
Kamailio World Conference - kamailioworld.com
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the
sender!
Edit mailing list options or unsubscribe: