Hello all,

I have a trouble that is related to the way of usage of dispatcher module.

I am working with Kamailio 5.3.2 and using dispatcher module as load balancer to route calls to the media gateways.

My dispatching routes are below as simply,

route[DISPATCH] {
        if(ds_select_domain("2""4")) {
                route(MYRELAY);
        } else {
                send_reply("503","Service Unavailable - No MGW");
                exit;
        }
}
route[MYRELAY] {
        t_on_failure("MYFAILURE");
        if(!t_relay()) {
                sl_reply_error();
        }
        exit;
}
failure_route[MYFAILURE] {
        route(NATMANAGE);
        revert_uri();
        if (t_is_canceled()) {
                exit;
        }
        if ($T_reply_code == 408 || $T_reply_code == 503) {
                if(ds_next_domain()) {
                        route(MYRELAY);
                } else {
                        send_reply("503","Service Unavailable");
                        exit;
                }
        } else {
                if(ds_select_domain("6""4")) {
                        route(MYVMRELAY);
                } else {
                        send_reply(486,"Busy");
                        exit;
                }
        }
}
route[MYVMRELAY] {
        t_on_failure("MYVMFAILURE");
        if(!t_relay()) {
                sl_reply_error();
        }
        exit;
}
failure_route[MYVMFAILURE] {
        route(NATMANAGE);
        revert_uri();
        if (t_is_canceled()) {
                exit;
        }
        if(ds_next_domain()) {
                route(MYVMRELAY);
        } else {
                send_reply("503","Service Unavailable");
                exit;
        }
}


I have multiple media gateways(setid=2) and voicemail servers(setid=6). As can be seen from the configuration,
after first routing, for transaction reply code except 408 or 503, I am routing call to the voicemail server using dispatcher.
In that phase, dispatcher module is remembering previously loaded destinations that come from first ds_select_domain
and module try to route these destinations in the case that all voicemail servers are unavailable.
So basically, I want to unload all destinations comes from previous ds_select_domain.

From the documentation, i tried ds_load_update and ds_load_unset methods but not worked for me.

Is there any way to overcome that problem or any right usages of these methods.

Thank you,

Serdar