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/
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@openser.org http://openser.org/cgi-bin/mailman/listinfo/users