[Users] Problem with avp_check

Bogdan-Andrei Iancu bogdan at voice-system.ro
Thu Dec 21 12:29:39 CET 2006


Hi Jose,

the FM operator in avp_check is not for regular expressions - FM is a 
file matching- like operator (like "sip:*@domain). See "man 3 fnmatch".

if you want to check against an regexp, you need to use the RE operator. 
See:
    http://www.openser.org/docs/modules/1.2.x/avpops.html#AEN384

as RE op does not support an AVP as right operand, you should try:
    if(avp_check("$fU","re/^[0-9]{10}/g")) {

regards,
bogdan

Jose Gil Navarrete wrote:

> Hi
> I try to check the username in the URI, this is, if the username do 
> not have ten digits then send a message, I made:
>
> avp_write("^[0-9]{10}","$avp(s:fm_avp)");
> if(avp_check("$fU","fm/$avp(s:fm_avp)/g")) {
>                 insert_hf("To-username: -$fU- \r\n", "Call-ID");
> } else {
>                 sl_send_reply("400", "Bad Request");
>                 exit;
> };
>
> but I ever obtain 400 message.
>
> I try too with:
> if(avp_check("$fU","re/[0-9]{10}$/g")) {
>                 insert_hf("To-username: -$fU- \r\n", "Call-ID");
> else{
>                  sl_send_reply("400", "Bad request");
>                  exit;
> }
>
> But I obtain the same message. Any idea?
>
> __________________________________________________
> Correo Yahoo!
> Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
> Regístrate ya - http://correo.yahoo.com.mx/
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Users mailing list
>Users at openser.org
>http://openser.org/cgi-bin/mailman/listinfo/users
>  
>





More information about the sr-users mailing list