[Users] Problem with avp_check
Bogdan-Andrei Iancu
bogdan at voice-system.ro
Thu Dec 21 17:54:00 CET 2006
Hi Jose,
I think your regexp is not correct - you need to force the end of
string, otherwise only a substring (prefix) will be matched.
try avp_check("$fU","re/^[0-9]{10}$/g")
regards,
bogdan
Jose Gil Navarrete wrote:
> Hi thanks Andrei, I tried with your recomendation but I obtain the
> same result, if $fu is: 012345678901, then "To-username
> -012345678901-" is inserted
>
> if(avp_check("$fU","re/^[0-9]{10}/g")) {
> insert_hf("To-username: -$rU- \r\n", "Call-ID");
> } else {
> sl_send_reply("400", "Peticion Erronea, numero
> invalido");
> };
>
>
> */Bogdan-Andrei Iancu <bogdan at voice-system.ro>/* escribió:
>
> 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
> >
> >
>
>
> __________________________________________________
> Correo Yahoo!
> Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
> Regístrate ya - http://correo.yahoo.com.mx/
>
More information about the Users
mailing list