[SR-Users] Dispatcher - ds_select_dst based on attribute value

rainolf rainolf at gmail.com
Fri May 15 14:42:41 CEST 2020


Hi everyone,
Let's say i want to add additional attribute in every dispatcher database
entry in form of:
*Example:*
extension_set=100-199;branch=NewYork

Let's say also i have more than one entry in dispatcher database with these
attributes and same priority.

*EX:*
IP=192.168.1.1;priority=1;attr=extension_set=100-199;branch=NewYork;Descrioption=PBX
Production
IP=192.168.1.2;priority=1;attr=extension_set=100-199;branch=NewYork;Descrioption=PBX
Backup

What i want to achieve is to select multiple destination with ds_select and
algorithm 8(priority) based on dialed extension.
I can get attributes with: $(xavp(_dsdst_=>attrs) but, off course, this may
be possible only after destination selection has been made by dispatcher.

Currently i've create a switch statement in order set statically a variable
with the right priority like:
# dial number selection
        switch($rU) {
                case /"^[1][0-9][0-9]$":
                        # starting with 1XX
                         xlog("L_NOTICE","THE DIALED NUMBER IS: $rU ...
Searching for available destinations!!!\n");
                        $var(ds_priority) = 1;

                break;
                default:
                        exit;
        }
ds_select_dst($var(ds_priority), 8);    #Get an up destination from
dispatcher with priority 1
                xlog("L_NOTICE","Calling Dispatcher $du -- $siz:$sp with
PARAMETER ATTRIBUTE: (attrs: $xavp(_dsdst_=>attrs))\n");
                xlog("L_NOTICE","THE BRANCH IS SET AS:
$(xavp(_dsdst_=>attrs){param.value,branch})\n");
                xlog("L_NOTICE","THE EXTENSION SET IS:
$(xavp(_dsdst_=>attrs){param.value,extension_set})\n");
                t_on_failure("DISPATCH_FAILURE");

but i would like to achieve something more dynamic which permit me to
create a simple database entry.

Probably there's a better way to do it maybe with the help of other modules
or database tables.

If someone can suggest me the best way or simply pointing me on the right
direction.
Appreciate

Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20200515/19f458e4/attachment.html>


More information about the sr-users mailing list