[OpenSIPS-Users] Using dispatcher's ds_select_domain with a variable

Bogdan-Andrei Iancu bogdan at voice-system.ro
Tue Mar 16 16:20:43 CET 2010


Hi Jock,

The ds_select_domain() function expects to receive (as set id) and 
integer value (directly or via a pv).

In your case $var(beep) contains a string and not a number. Try:
    $var(beep) = $(ru{s.substr,27,4}{s.int});

to force the value as number.

Regards,
Bogdan

Jock McKechnie wrote:
> Good morning;
>
> I've been fiddling with dispatcher and I would like to maintain 
> several dispatcher sets that get selected based on the $ru. The $ru 
> would be parsed, a dispatcher set placed in a variable, and then 
> ds_select_domain() would be called upon the variable... except 
> ds_select_domain() doesn't appear to work with being called using 
> variables... or perhaps I'm doing something wrong.
>
> The $ru would look something like this: "+12125551212 at dispatcher1001", 
> which I'm using the following directives to handle:
>
> if ($ru =~ "dispatcher") {
>     $var(beep) = $(ru{s.substr,27,4});
>
>     xlog("L_INFO", "[$Tf] Found dispatcher, set: $var(beep)\n");
>
>     if (!ds_select_domain("$var(beep)","4")) {
>         t_reply("503", "Unable to location dispatcher set requested");
>         return;
>         }
>
>     route(1);
>     return;
>     }
>
> The $var(beep) is being parsed out correctly (The xlog() messages show 
> as such), but get the following:
> ERROR:core:fixup_get_ivalue: no valid PV value found (error in scripts)
> ERROR:dispatcher:w_ds_select_domain: no dst set value
> ERROR:tm:w_t_reply: failed to send a t_reply to a message for which no 
> transaction-state has been established
>
> I suspect the important one in the list above is the first, where the 
> get_ivalue is failing, but I'm not sure. I suspect if it can tell it's 
> a variable then I probably am doing something amiss, but I sure would 
> appreciate if some learned soul could tell me what I'm doing wrong.
>
> My thanks;
>
>  - Jock
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>   


-- 
Bogdan-Andrei Iancu
www.voice-system.ro




More information about the Users mailing list