Hi Bogdan,
It seems like a bug for me.
I'm trying to implement a tech prefix for IP authentication. I was using the function check_src_addr() and tried also with check_addr.
Problem #1: Pseudo variables are not parsed for patterns
Jan 16 06:48:40 ip-208-109-122-193 /sbin/opensips[20900]: DBG:permissions:check_addr_6: Looking for : <0, 189.34.0.243, udp, 5062, $rU>
Problem #2: Even passing as a text param it does not match
Jan 16 07:14:35 ip-208-109-122-193 /sbin/opensips[22437]: DBG:permissions:check_addr_6: Looking for : <0, 189.34.0.243, udp, 5062, 85000>
Database entry
| 1827001 | 30000 | 189.34.0.243 | 32 | 5062 | any | ^85000 | method=techprefix;username=600000;domain=sippulse.com;digits=5;techprefix=85000 | sippulse.com | techprefix |
Thanks
Flavio E. Goncalves
Hi Flavio,
For the 2 cases, could you exactly copy here how you call the function from the script ?
Regards,
Bogdan
The command used was:
check_address("0","$si","$sp","$proto","$avp(context)","$rU")
The second way is:
check_address("0","$si","$sp","$proto","$avp(context)","85000")
First command:
the "pattern" param is not supposed to accept variables (see the REAME :
* pattern
This argument is a string to be matched with the regular
expression pattern field from the cached address table.
This argument is optional.
YOu can open a feature request to have this if you want.
Second command:
the pattern you have in db for the rule does not match the pattern param.
Regards,
Bogdan
Bogdan,
85000 matches the expression ^85000. I have used two Regex testers and it matches. I don't get it.
pattern uses fnmatch-like matching not regexp-like matching.
So ^85000 (regexp like) is 85000* (fn like).
fn = File Name matching (like in shell for file names)