[Users] avp question

Jeremy George jeremy at georgeco.us
Tue May 15 02:40:57 CEST 2007


  A touch of elegance certainly never hurt :)  Thanks.

- Jeremy


-----Original Message-----
From: Daniel-Constantin Mierla [mailto:daniel at voice-system.ro] 
Sent: Monday, May 14, 2007 5:10 PM
To: Jeremy George
Cc: 'Bogdan-Andrei Iancu'; users at openser.org
Subject: Re: [Users] avp question

Just to underline a nicer scripting form, since it seems that 
$avp(s:anonreject) is single value (not an array) you can have the 
checking like:

if($avp(s:anonreject)=="y" && $hdr(from)=~"(a|A)nonymous ") {

$avp(s:anonreject)=null;


}

instead of:

     if (avp_check("$avp(s:anonreject)", "eq/y/i)") &&
       search("^(f|F)rom:.*(a|A)nonymous")) {

       avp_delete("$avp(s:anonreject)");
    };

The string comparison of script variables is ignore case.

Cheers,
Daniel


On 05/13/07 19:30, Jeremy George wrote:
> Bogdan,
>
>   Thank you very much.  I'm a step closer, but I've still got something
> wrong.  This code:
>
> modparam("avpops", "avp_url", "mysql://openser:<XXX>@localhost/openser2")
> modparam("avpops", "avp_table", "usr_preferences")
>
> route {
>
>    if (avp_db_load("$ru/username", "$avp(s:anonreject)")) {
>
>      if (avp_check("$avp(s:anonreject)", "eq/y/i)") &&
>        search("^(f|F)rom:.*(a|A)nonymous")) {
>
>        avp_delete("$avp(s:anonreject)");
>     };
>   };
> }
>
> yields these error messages:
>
> WARNING: no fork mode 
>  0(3491) init_tcp: using epoll_lt as the io watch method (auto detected)
>  0(0) INFO: statistics manager successfully initialized
>  0(0) StateLess module - initializing
>  0(0) TM - initializing...
>  0(0) ACC - initializing
>  0(0) Maxfwd module- initializing
>  0(0) INFO:ul_init_locks: locks array size 512
>  0(0) AUTH module - initializing
>  0(0) AUTH_DB module - initializing
>  0(0) TextOPS - initializing
>  0(0) EXEC - initializing
>  0(0) AVPops - initializing
>  0(0) ERROR:avpops:parse_check_value: unknown flag <)>
>  0(0) ERROR:avpops:fixup_check_avp: failed to parse checked value 
>  0(0) ERROR: fix_actions: fixing failed (code=-1) at cfg line 74
>  0(0) ERROR: fix_expr : fix_actions error
> ERROR: error -1 while trying to fix configuration
>  0(0) INFO:mi_fifo:mi_destroy: process hasn't been created -> nothing to
> kill
>
>   Thanks for the help; I appreciate it.
>
> - Jeremy
>
>
> -----Original Message-----
> From: Bogdan-Andrei Iancu [mailto:bogdan at voice-system.ro] 
> Sent: Thursday, May 10, 2007 12:05 PM
> To: Jeremy George
> Cc: users at openser.org
> Subject: Re: [Users] avp question
>
> Hi Jeremy,
>
> For openser 1.2 it will be:
>
>         if (avp_db_load("$ru/username", "$avp(s:anonreject)")) {
>            if (avp_check("$avp(s:anonreject)", "eq/y/i)") &&
> search("^(f|F)rom:.*(a|A)nonymous")) {
>               avp_delete("$avp(s:anonreject)");
>
>
> regards,
> bogdan
>
> PS: see http://www.openser.org/docs/modules/1.2.x/avpops.html
>
> Jeremy George wrote:
>   
>>   Can someone help me with translating this ser config snippet to
openser?
>> Thanks.
>>
>>         if (avp_db_load("$ruri/username", "s:anonreject")) {
>>            if (avp_check("s:anonreject", "eq/y/i)") &&
>> search("^(f|F)rom:.*(a|A)nonymous")) {
>>               avp_delete("$avp(s:anonreject)");
>>
>> - Jeremy
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at openser.org
>> http://openser.org/cgi-bin/mailman/listinfo/users
>>
>>   
>>     
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at openser.org
> http://openser.org/cgi-bin/mailman/listinfo/users
>
>   






More information about the sr-users mailing list