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

Jock McKechnie jock.mckechnie at gmail.com
Tue Mar 16 16:25:31 CET 2010


On Tue, Mar 16, 2010 at 10:20 AM, Bogdan-Andrei Iancu <
bogdan at voice-system.ro> wrote:

> 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.
>
>
Ah!!

And it works like a charm, fantastic, thank you, Bogdan.

 - JP


> 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
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20100316/fba4a11b/attachment-0001.htm 


More information about the Users mailing list