[Kamailio-Users] Dispatcher module question

DJB djbinter at yahoo.com
Thu Nov 5 23:14:26 CET 2009


Thank you, Robert.

You are correct.  I overlooked at the return value. It's working now.  




----- Original Message ----
From: Robert McGilvray <rmcgilvr at globeop.com>
To: Alex Balashov <abalashov at evaristesys.com>; DJB <djbinter at yahoo.com>
Cc: users at lists.kamailio.org
Sent: Thu, November 5, 2009 1:35:25 PM
Subject: RE: [Kamailio-Users] Dispatcher module question


From: users-bounces at lists.kamailio.org
[mailto:users-bounces at lists.kamailio.org] On Behalf Of Robert McGilvray
Sent: Thursday, November 05, 2009 4:31 PM
To: Alex Balashov; DJB
Cc: users at lists.kamailio.org
Subject: Re: [Kamailio-Users] Dispatcher module question


From: users-bounces at lists.kamailio.org
[mailto:users-bounces at lists.kamailio.org] On Behalf Of Alex Balashov
Sent: Thursday, November 05, 2009 4:18 PM
To: DJB
Cc: users at lists.kamailio.org
Subject: Re: [Kamailio-Users] Dispatcher module question

DJB wrote:

> Is there a way that I can pass variable into ds_select_dst(set, alg)
on the 
> set parameter so I can query from database table for setid; for
instance, 
> ds_select_dst("avp(customer_setid)", "4"). I've tried, but it did not 
> work. Please advise.

A look in modules/dispatcher/dispatcher.c reveals that ds_*() 
functions do not parse pseudovariables, which is a problem with a lot 
of existing Kamailio code.  Any arguments you pass to it will be 
interpreted as literal strings.

In short, you can't do that.  You may wish to put in a feature request 
to update these functions to take pseudovariables.

-- 

I haven't looked at the code but I'm using the ds_select functions in
more or less the same way in kam 1.5. I pull the setid from a match in
the dialplan module instead of a db. 

if (ds_select_domain("$avp(s:dpattr)", "0")) {
    if ($avp(s:dispatcher-cnt) > 1) {
        # If there is more than one entry returned for the group
arm the failure route
        t_on_failure("ROUTE_DP_FAILURE");
    }

    route(ROUTE_RELAY);

} else {
    xlog("L_WARN", "KAM_HOST: ($ci) $pr $mi route[$rm][0] $fu -> $ru
- No dst gateways found\n");
    sl_send_reply("404", "No destination gateways found\n");
    exit;
}


OP - Did you try it? 

Bob

--

My bad, somehow I ignored the part of your email that stated you had
already tried it. The problem your having is most likely that you're
getting a string from your DB instead of an int. 

Here's a workaround I came up with, you may also be able to cast it in
your sql query.

$avp(s:dpattr) = $(avp(s:dpattr){s.int}); # dpattr returned from mysql
is a string. It needs to be an INT

Bob


--------------------------------------------------------------------------
This email with all information contained herein or attached hereto may contain confidential and/or privileged information intended for the addressee(s) only. If you have received this email in error, please contact the sender and immediately delete this email in its entirety and any attachments thereto.



      




More information about the sr-users mailing list