[Kamailio-Users] Can't get allow_trusted to work
Daniel-Constantin Mierla
miconda at gmail.com
Tue May 26 18:53:18 CEST 2009
Hello,
On 05/26/2009 07:46 PM, Saúl Ibarra wrote:
> Hi all,
>
> I'm a little stuck here :-/ I can't get allow_trusted function from
> the premissions module to word. I'm receiving the following error:
>
> May 26 18:36:24 [18825] DBG:core:parse_msg: method: <PUBLISH>
> May 26 18:36:24 [18825] DBG:core:parse_msg: uri:
> <sip:saghul at 10.69.69.1:5070>
> May 26 18:36:24 [18825] DBG:core:parse_msg: version: <SIP/2.0>
> May 26 18:36:24 [18825] DBG:core:parse_headers: flags=2
> May 26 18:36:24 [18825] DBG:core:parse_via_param: found param type
> 232, <branch> = <z9hG4bK1f7d.e63e45e5.0>; state=16
> May 26 18:36:24 [18825] DBG:core:parse_via: end of header reached,
> state=5
> May 26 18:36:24 [18825] DBG:core:parse_headers: via found, flags=2
> May 26 18:36:24 [18825] DBG:core:parse_headers: this is the first via
> May 26 18:36:24 [18825] DBG:core:receive_msg: After parse_msg...
> May 26 18:36:24 [18825] DBG:core:receive_msg: preparing to run routing
> scripts...
> May 26 18:36:24 [18825] DBG:core:parse_headers: flags=100
> May 26 18:36:24 [18825] DBG:core:parse_via_param: found param type
> 234, <received> = <10.69.69.2>; state=6
> May 26 18:36:24 [18825] DBG:core:parse_via_param: found param type
> 235, <rport> = <5060>; state=6
> May 26 18:36:24 [18825] DBG:core:parse_via_param: found param type
> 232, <branch> = <z9hG4bKqtsklyyn>; state=16
> May 26 18:36:24 [18825] DBG:core:parse_via: end of header reached,
> state=5
> May 26 18:36:24 [18825] DBG:core:parse_headers: via found, flags=100
> May 26 18:36:24 [18825] DBG:core:parse_headers: parse_headers: this is
> the second via
> May 26 18:36:24 [18825] DBG:maxfwd:is_maxfwd_present: value = 69
> May 26 18:36:24 [18825] ERROR:permissions:allow_trusted_2: unknown
> protocol udp
>
looks like the function accepts only upper case protocol id while the PV
is returning lowercase, try to use transformation:
http://www.kamailio.org/dokuwiki/doku.php/transformations:devel#s.toupper
allow_trusted("$si", "$(proto{s.toupper})")
Cheers,
Daniel
>
> Configuration is realli simple:
>
> modparam("permissions", "db_url", "mysql://...")
> modparam("permissions", "db_mode", 1)
> modparam("permissions", "trusted_table", "trusted")
>
> if (!allow_trusted("$si", "$proto")) {
> xlog("L_INFO","\n\n--NOT trusted! - $si - $proto");
> sl_send_reply("403", "Forbidden");
> exit;
> }
>
> The trusted table seems OK:
>
> mysql> select * from trusted;
> +----+------------+-------+--------------+------+
> | id | src_ip | proto | from_pattern | tag |
> +----+------------+-------+--------------+------+
> | 1 | 10.69.69.1 | any | NULL | NULL |
> +----+------------+-------+--------------+------+
>
>
> What am I doing wrong?
>
>
> Thanks in advance!! Regards,
>
>
>
--
Daniel-Constantin Mierla
http://www.asipto.com/
More information about the sr-users
mailing list