memcache -> avp -> drouting failure

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

memcache -> avp -> drouting failure

Brett Nemeroff
Hey All,
I've got this problem, that I imagine has something to do with datatypes. So I pull from cache (cache_fetch) the group_id to pass to drouting kinda like:
cache_fetch("local","trunk2group_$si",$avp(s:group_temp))

Then for scripting reasons (I promise, there is a good reason) I do:
$avp(s:routegroup) = $avp(s:group_temp);

Then I pass it to do_routing like:
do_routing("$avp(s:routegroup)");

and then I get:
ERROR:drouting:do_routing: failed to get group id 

I've printed out the value of $avp(s:routegroup) and it's perfectly valid.. 

So I take my cache bits out, and instead I populate $avp(s:group_temp) direct from  avp_db_query. The field comes from MySQL and is an int(11). This works perfectly every time (and returns the same value (which is the number 5).


So any idea what the problem might be? I've tried casting to int ie:
do_routing("$(avp(s:routegroup){s.int}))

but that doesn't seem to make anything better.

any ideas? Right now I'm having to bypass my cache or it just won't work.

Thanks,
Brett


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: memcache -> avp -> drouting failure

Bogdan-Andrei Iancu
Hi Brett,

A simple answer - the cache works only for strings, so it is not able to
store numerical values (only in string representation) .

Before do_routing(), try to do avp_print() to get the list with AVPS.,
types and vals - just to double check.

Regards,
Bogdan

Brett Nemeroff wrote:

> Hey All,
> I've got this problem, that I imagine has something to do with
> datatypes. So I pull from cache (cache_fetch) the group_id to pass to
> drouting kinda like:
> cache_fetch("local","trunk2group_$si",$avp(s:group_temp))
>
> Then for scripting reasons (I promise, there is a good reason) I do:
> $avp(s:routegroup) = $avp(s:group_temp);
>
> Then I pass it to do_routing like:
> do_routing("$avp(s:routegroup)");
>
> and then I get:
> ERROR:drouting:do_routing: failed to get group id
>
> I've printed out the value of $avp(s:routegroup) and it's perfectly
> valid..
>
> So I take my cache bits out, and instead I populate $avp(s:group_temp)
> direct from  avp_db_query. The field comes from MySQL and is an
> int(11). This works perfectly every time (and returns the same value
> (which is the number 5).
>
>
> So any idea what the problem might be? I've tried casting to int ie:
> do_routing("$(avp(s:routegroup){s.int <http://s.int>}))
>
> but that doesn't seem to make anything better.
>
> any ideas? Right now I'm having to bypass my cache or it just won't work.
>
> Thanks,
> Brett
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>  


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: memcache -> avp -> drouting failure

Brett Nemeroff
Bogdan,
But I did:
do_routing("$(avp(s:routegroup){s.int})") 

as well. Shouldn't that have worked?

maybe I need to:
$avp(s:routegroup) = $(avp(s:group_temp){s.int});
do_routing("$avp(s:routegroup)")

What do you think?
Thanks,
-Brett

On Fri, May 22, 2009 at 11:13 AM, Bogdan-Andrei Iancu <[hidden email]> wrote:
Hi Brett,

A simple answer - the cache works only for strings, so it is not able to store numerical values (only in string representation) .

Before do_routing(), try to do avp_print() to get the list with AVPS., types and vals - just to double check.

Regards,
Bogdan

Brett Nemeroff wrote:
Hey All,
I've got this problem, that I imagine has something to do with datatypes. So I pull from cache (cache_fetch) the group_id to pass to drouting kinda like:
cache_fetch("local","trunk2group_$si",$avp(s:group_temp))

Then for scripting reasons (I promise, there is a good reason) I do:
$avp(s:routegroup) = $avp(s:group_temp);

Then I pass it to do_routing like:
do_routing("$avp(s:routegroup)");

and then I get:
ERROR:drouting:do_routing: failed to get group id
I've printed out the value of $avp(s:routegroup) and it's perfectly valid..
So I take my cache bits out, and instead I populate $avp(s:group_temp) direct from  avp_db_query. The field comes from MySQL and is an int(11). This works perfectly every time (and returns the same value (which is the number 5).


So any idea what the problem might be? I've tried casting to int ie:
do_routing("$(avp(s:routegroup){s.int <http://s.int>}))


but that doesn't seem to make anything better.

any ideas? Right now I'm having to bypass my cache or it just won't work.

Thanks,
Brett

------------------------------------------------------------------------

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
 



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: memcache -> avp -> drouting failure

Bogdan-Andrei Iancu
Hi Brett,

do_routing expects a simple AVP (without transformation), the first
format will not help, but the second should

Regards,
Bogdan

Brett Nemeroff wrote:

> Bogdan,
> But I did:
> do_routing("$(avp(s:routegroup){s.int <http://s.int>})")
>
> as well. Shouldn't that have worked?
>
> maybe I need to:
> $avp(s:routegroup) = $(avp(s:group_temp){s.int <http://s.int>});
> do_routing("$avp(s:routegroup)")
>
> What do you think?
> Thanks,
> -Brett
>
> On Fri, May 22, 2009 at 11:13 AM, Bogdan-Andrei Iancu
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     Hi Brett,
>
>     A simple answer - the cache works only for strings, so it is not
>     able to store numerical values (only in string representation) .
>
>     Before do_routing(), try to do avp_print() to get the list with
>     AVPS., types and vals - just to double check.
>
>     Regards,
>     Bogdan
>
>     Brett Nemeroff wrote:
>
>         Hey All,
>         I've got this problem, that I imagine has something to do with
>         datatypes. So I pull from cache (cache_fetch) the group_id to
>         pass to drouting kinda like:
>         cache_fetch("local","trunk2group_$si",$avp(s:group_temp))
>
>         Then for scripting reasons (I promise, there is a good reason)
>         I do:
>         $avp(s:routegroup) = $avp(s:group_temp);
>
>         Then I pass it to do_routing like:
>         do_routing("$avp(s:routegroup)");
>
>         and then I get:
>         ERROR:drouting:do_routing: failed to get group id
>         I've printed out the value of $avp(s:routegroup) and it's
>         perfectly valid..
>         So I take my cache bits out, and instead I populate
>         $avp(s:group_temp) direct from  avp_db_query. The field comes
>         from MySQL and is an int(11). This works perfectly every time
>         (and returns the same value (which is the number 5).
>
>
>         So any idea what the problem might be? I've tried casting to
>         int ie:
>         do_routing("$(avp(s:routegroup){s.int <http://s.int>
>         <http://s.int>}))
>
>
>         but that doesn't seem to make anything better.
>
>         any ideas? Right now I'm having to bypass my cache or it just
>         won't work.
>
>         Thanks,
>         Brett
>
>         ------------------------------------------------------------------------
>
>         _______________________________________________
>         Users mailing list
>         [hidden email] <mailto:[hidden email]>
>         http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>          
>
>
>


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: memcache -> avp -> drouting failure

Brett Nemeroff
Perfect... Thank you very much. 

BTW, Is this true for many modules? That'd be good to include in the transformation docs.


On Fri, May 22, 2009 at 11:20 AM, Bogdan-Andrei Iancu <[hidden email]> wrote:
Hi Brett,

do_routing expects a simple AVP (without transformation), the first format will not help, but the second should


Regards,
Bogdan

Brett Nemeroff wrote:
Bogdan,
But I did:
do_routing("$(avp(s:routegroup){s.int <http://s.int>})")
as well. Shouldn't that have worked?

maybe I need to:
$avp(s:routegroup) = $(avp(s:group_temp){s.int <http://s.int>});

do_routing("$avp(s:routegroup)")

What do you think?
Thanks,
-Brett

On Fri, May 22, 2009 at 11:13 AM, Bogdan-Andrei Iancu <[hidden email] <mailto:[hidden email]>> wrote:

   Hi Brett,

   A simple answer - the cache works only for strings, so it is not
   able to store numerical values (only in string representation) .

   Before do_routing(), try to do avp_print() to get the list with
   AVPS., types and vals - just to double check.

   Regards,
   Bogdan

   Brett Nemeroff wrote:

       Hey All,
       I've got this problem, that I imagine has something to do with
       datatypes. So I pull from cache (cache_fetch) the group_id to
       pass to drouting kinda like:
       cache_fetch("local","trunk2group_$si",$avp(s:group_temp))

       Then for scripting reasons (I promise, there is a good reason)
       I do:
       $avp(s:routegroup) = $avp(s:group_temp);

       Then I pass it to do_routing like:
       do_routing("$avp(s:routegroup)");

       and then I get:
       ERROR:drouting:do_routing: failed to get group id
       I've printed out the value of $avp(s:routegroup) and it's
       perfectly valid..
       So I take my cache bits out, and instead I populate
       $avp(s:group_temp) direct from  avp_db_query. The field comes
       from MySQL and is an int(11). This works perfectly every time
       (and returns the same value (which is the number 5).


       So any idea what the problem might be? I've tried casting to
       int ie:
       do_routing("$(avp(s:routegroup){s.int <http://s.int>
       <http://s.int>}))


       but that doesn't seem to make anything better.

       any ideas? Right now I'm having to bypass my cache or it just
       won't work.

       Thanks,
       Brett

       ------------------------------------------------------------------------

       _______________________________________________
       Users mailing list
       [hidden email] <mailto:[hidden email]>



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: memcache -> avp -> drouting failure

Bogdan-Andrei Iancu
Hi Brett,

Brett Nemeroff wrote:
> Perfect... Thank you very much.
>
> BTW, Is this true for many modules? That'd be good to include in the
> transformation docs.
it is true for all modules that do expect as param an AVP and not a
pseudo-variable (including transformations)... AFAIK, those module do
test is the var is an AVP, but they do not test if the AVP has a
trailing transformation.

Regards,
Bogdan

>
>
> On Fri, May 22, 2009 at 11:20 AM, Bogdan-Andrei Iancu
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     Hi Brett,
>
>     do_routing expects a simple AVP (without transformation), the
>     first format will not help, but the second should
>
>
>     Regards,
>     Bogdan
>
>     Brett Nemeroff wrote:
>
>         Bogdan,
>         But I did:
>         do_routing("$(avp(s:routegroup){s.int <http://s.int>
>         <http://s.int>})")
>         as well. Shouldn't that have worked?
>
>         maybe I need to:
>         $avp(s:routegroup) = $(avp(s:group_temp){s.int <http://s.int>
>         <http://s.int>});
>
>         do_routing("$avp(s:routegroup)")
>
>         What do you think?
>         Thanks,
>         -Brett
>
>         On Fri, May 22, 2009 at 11:13 AM, Bogdan-Andrei Iancu
>         <[hidden email] <mailto:[hidden email]>
>         <mailto:[hidden email]
>         <mailto:[hidden email]>>> wrote:
>
>            Hi Brett,
>
>            A simple answer - the cache works only for strings, so it
>         is not
>            able to store numerical values (only in string
>         representation) .
>
>            Before do_routing(), try to do avp_print() to get the list with
>            AVPS., types and vals - just to double check.
>
>            Regards,
>            Bogdan
>
>            Brett Nemeroff wrote:
>
>                Hey All,
>                I've got this problem, that I imagine has something to
>         do with
>                datatypes. So I pull from cache (cache_fetch) the
>         group_id to
>                pass to drouting kinda like:
>                cache_fetch("local","trunk2group_$si",$avp(s:group_temp))
>
>                Then for scripting reasons (I promise, there is a good
>         reason)
>                I do:
>                $avp(s:routegroup) = $avp(s:group_temp);
>
>                Then I pass it to do_routing like:
>                do_routing("$avp(s:routegroup)");
>
>                and then I get:
>                ERROR:drouting:do_routing: failed to get group id
>                I've printed out the value of $avp(s:routegroup) and it's
>                perfectly valid..
>                So I take my cache bits out, and instead I populate
>                $avp(s:group_temp) direct from  avp_db_query. The field
>         comes
>                from MySQL and is an int(11). This works perfectly
>         every time
>                (and returns the same value (which is the number 5).
>
>
>                So any idea what the problem might be? I've tried
>         casting to
>                int ie:
>                do_routing("$(avp(s:routegroup){s.int <http://s.int>
>         <http://s.int>
>                <http://s.int>}))
>
>
>                but that doesn't seem to make anything better.
>
>                any ideas? Right now I'm having to bypass my cache or
>         it just
>                won't work.
>
>                Thanks,
>                Brett
>
>              
>          ------------------------------------------------------------------------
>
>                _______________________________________________
>                Users mailing list
>                [hidden email]
>         <mailto:[hidden email]>
>         <mailto:[hidden email]
>         <mailto:[hidden email]>>
>
>                http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>                
>
>
>
>


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users