<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-9">
<META content="MSHTML 6.00.2900.2180" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi,<BR>I am trying to use permissions module. At
configuration side everything seems ok. when an invite comes to ser, gets the
source ip of the invite and select a query from the trusted table. But every
time, when correlates the from_pattern and proto, they mismatch ( I SUPPOSE ).
Is there any trick at from_pattern ? I have tried so many values like<BR>.* ,
sip:.*,empty,^sip:.* and etc. Here is my ser.cfg,
logs.<BR><BR>Hakan.<BR><BR>loadmodule
"/usr/local/lib/ser/modules/permissions.so"<BR># -- permissions parameters --
#<BR><BR>modparam("permissions", "db_url",
"postgres://xxxxx:xxxx@ip_address/xxxxx")<BR>modparam("permissions", "db_mode",
0)<BR>modparam("permissions", "trusted_table",
"trusted")<BR>modparam("permissions", "source_col",
"src_ip")<BR>modparam("permissions", "proto_col",
"proto")<BR>modparam("permissions", "from_col", "from_pattern")<BR><BR>if
(method=="INVITE") {<BR>if (!allow_trusted()) {<BR>log("THE IP ADDRESS IS NOT
ALLOWED");<BR>sl_send_reply("403","ONLY REGISTERED USERS ALLOWED
");<BR>break;<BR>}<BR><BR><BR><BR>########### SER LOG
#############<BR><BR>2(69289) SIP Request:<BR>2(69289) method:
<INVITE><BR>2(69289) uri: <SIP:02124440111@GI.COM.TR;USER=PHONE><BR>2(69289)
version: <SIP 2.0><BR>2(69289) parse_headers: flags=1<BR>2(69289) Found param
type 232, <BRANCH>= <Z9HG4BKACCQKWRLG>; state=16<BR>2(69289) end of header
reached, state=5<BR>2(69289) parse_headers: Via found, flags=1<BR>2(69289)
parse_headers: this is the first via<BR>2(69289) After parse_msg...<BR>2(69289)
preparing to run routing scripts...<BR>2(69289) parse_headers:
flags=128<BR>2(69289) DEBUG:maxfwd:is_maxfwd_present: value = 70<BR>2(69289)
DBG:maxfwd:process_maxfwd_header: value 70 decreased to 16<BR>2(69289)
parse_headers: flags=8<BR>2(69289) DEBUG: add_param: tag=1c681629589<BR>2(69289)
end of header reached, state=29<BR>2(69289) grep_sock_info - checking if
host==us: 9==10 && [gi.com.tr] == [84.51.32.8]<BR>2(69289)
grep_sock_info - checking if port 5060 matches port 5060<BR>2(69289)
grep_sock_info - checking if host==us: 9==9 && [gi.com.tr] ==
[127.0.0.1]<BR>2(69289) grep_sock_info - checking if port 5060 matches port
5060<BR>2(69289) grep_sock_info - checking if host==us: 9==10 &&
[gi.com.tr] == [84.51.32.8]<BR>2(69289) grep_sock_info - checking if port 5060
matches port 5060<BR>2(69289) grep_sock_info - checking if host==us: 9==9
&& [gi.com.tr] == [127.0.0.1]<BR>2(69289) grep_sock_info - checking if
port 5060 matches port 5060<BR>2(69289) val2str(): converting 84.51.32.26,
11<BR>2(69289) PG[217] str2valp got string udp<BR>2(69289) PG[217] str2valp got
string sip:90224765321@gi.com.tr<BR>2(69289) NOT TRUSTED IP 2(69289)
parse_headers: flags=4<BR>2(69289) end of header reached, state=9<BR>2(69289)
DEBUG: get_hdr_field: <TO>[40];
uri=[sip:02124440111@gi.com.tr;user=phone]<BR>2(69289) DEBUG: to body
[<SIP:02124440111@GI.COM.TR;USER=PHONE><BR>]<BR>2(69289) parse_headers:
flags=-1<BR>2(69289) get_hdr_field: cseq <CSEQ>: <1> <INVITE><BR>2(69289)
DEBUG: get_hdr_body : content_length=267<BR>2(69289) found end of
header<BR>2(69289) check_via_address(84.51.32.26, 84.51.32.26, 1)<BR>2(69289)
DEBUG:destroy_avp_list: destroying list 0x0<BR>2(69289) receive_msg: cleaning
up<BR>3(69290) SIP Request:<BR>3(69290) method: <ACK><BR>3(69290) uri:
<SIP:02124440111@GI.COM.TR;USER=PHONE><BR>3(69290) version: <SIP
2.0><BR>3(69290) parse_headers: flags=1<BR>3(69290) Found param type 232,
<BRANCH>= <Z9HG4BKACCQKWRLG>; state=16<BR>3(69290) end of header reached,
state=5<BR>3(69290) parse_headers: Via found, flags=1<BR>3(69290) parse_headers:
this is the first via<BR>3(69290) After parse_msg...<BR>3(69290) preparing to
run routing scripts...<BR>3(69290) parse_headers: flags=4<BR>3(69290) DEBUG:
add_param: tag=26a82380ee921ee699cdfa26683b3165.bcf6<BR>3(69290) end of header
reached, state=29<BR>3(69290) DEBUG: get_hdr_field: <TO>[82];
uri=[sip:02124440111@gi.com.tr;user=phone]<BR>3(69290) DEBUG: to body
[<SIP:02124440111@GI.COM.TR;USER=PHONE>]<BR>3(69290) DEBUG: sl_filter_ACK :
local ACK found -> dropping it!<BR>3(69290) DEBUG:destroy_avp_list:
destroying list 0x0<BR>3(69290) receive_msg: cleaning
up<BR><BR><BR><BR><BR>######### NGREP LOGS ################<BR><BR>U
84.51.32.26:5060 -> 84.51.32.8:5060<BR>INVITE
sip:02124440111@gi.com.tr;user=phone SIP/2.0.<BR>Via: SIP/2.0/UDP
84.51.32.26;branch=z9hG4bKaccQkWrLg.<BR>Max-Forwards: 70.<BR>From:
"902247654321" <SIP:902247654321@GI.COM.TR>;tag=1c681629589.<BR>To:
<SIP:02124440111@GI.COM.TR;USER=PHONE>.<BR>Call-ID: <A
href="mailto:395527579dNhC@84.51.32.26."><STRONG><FONT
color=#666666>395527579dNhC@84.51.32.26.</FONT></STRONG></A><BR>CSeq: 1
INVITE.<BR>Contact: <SIP:902247654321@84.51.32.26>.<BR>Supported:
em,100rel,timer,replaces,path.<BR>Allow:
REGISTER,OPTIONS,INVITE,ACK,CANCEL,BYE,NOTIFY,PRACK,REFER,INFO,SUBSCRIBE,UPDATE.<BR>Session-Expires:
3600.<BR>Min-SE: 90.<BR>User-Agent: Audiocodes-Sip-Gateway-MP-104
FXS/v.4.40.200.371.<BR>Content-Type: application/sdp.<BR>Content-Length:
267.<BR>.<BR>v=0.<BR>o=AudiocodesGW 440639 653740 IN IP4
84.51.32.26.<BR>s=Phone-Call.<BR>c=IN IP4 84.51.32.26.<BR>t=0 0.<BR>m=audio 4010
RTP/AVP 18 8 96.<BR>a=rtpmap:18 g729/8000.<BR>a=fmtp:18 annexb=no.<BR>a=rtpmap:8
pcma/8000.<BR>a=rtpmap:96 telephone-event/8000.<BR>a=fmtp:96
0-15.<BR>a=ptime:40.<BR>a=sendrecv.<BR><BR>#<BR>U 84.51.32.8:5060 ->
84.51.32.26:5060<BR>SIP/2.0 403 ONLY REGISTERED USERS.....<BR>Via: SIP/2.0/UDP
84.51.32.26;branch=z9hG4bKaccQkWrLg.<BR>From: "902247654321"
<SIP:902247654321@GI.COM.TR>;tag=1c681629589.<BR>To:
<SIP:02124440111@GI.COM.TR;USER=PHONE>;tag=26a82380ee921ee699cdfa26683b3165.bcf6.<BR>Call-ID:
<A href="mailto:395527579dNhC@84.51.32.26."><STRONG><FONT
color=#666666>395527579dNhC@84.51.32.26.</FONT></STRONG></A><BR>CSeq: 1
INVITE.<BR>Server: Sip EXpress router (0.9.3 (i386/freebsd)).<BR>Content-Length:
0.<BR>Warning: 392 84.51.32.8:5060 "Noisy feedback tells: pid=69289
req_src_ip=84.51.32.26 req_src_port=5060
in_uri=sip:02124440111@gi.com.tr;user=phone
out_uri=sip:02124440111@gi.com.tr;user=phone via_cnt==1".<BR>.<BR><BR>#<BR>U
84.51.32.26:5060 -> 84.51.32.8:5060<BR>ACK
sip:02124440111@gi.com.tr;user=phone SIP/2.0.<BR>Via: SIP/2.0/UDP
84.51.32.26;branch=z9hG4bKaccQkWrLg.<BR>Max-Forwards: 70.<BR>From:
"902247654321" <SIP:902247654321@GI.COM.TR>;tag=1c681629589.<BR>To:
<SIP:02124440111@GI.COM.TR;USER=PHONE>;tag=26a82380ee921ee699cdfa26683b3165.bcf6.<BR>Call-ID:
<A href="mailto:395527579dNhC@84.51.32.26."><STRONG><FONT
color=#666666>395527579dNhC@84.51.32.26.</FONT></STRONG></A><BR>CSeq: 1
ACK.<BR>Contact: <SIP:902247654321@84.51.32.26>.<BR>Supported:
em,timer,replaces,path.<BR>Allow:
REGISTER,OPTIONS,INVITE,ACK,CANCEL,BYE,NOTIFY,PRACK,REFER,INFO,SUBSCRIBE,UPDATE.<BR>User-Agent:
Audiocodes-Sip-Gateway-MP-104 FXS/v.4.40.200.371.<BR>Content-Length:
0.<BR><BR>#################################<BR>Tried another value for
from_pattern...<BR><BR>3(69290) val2str(): converting 84.51.32.26,
11<BR>3(69290) PG[217] str2valp got string udp<BR>3(69290) PG[217] str2valp got
string "90224765321"<BR><BR><BR><BR>select * from trusted;<BR>src_ip | proto |
from_pattern<BR>-------------+-------+---------------<BR>84.51.32.25 | udp |
"90224765321"<BR>84.51.32.26 | udp | "90224765321"<BR>(2
rows)<BR>.<BR></SIP:902247654321@84.51.32.26></SIP:02124440111@GI.COM.TR;USER=PHONE></SIP:902247654321@GI.COM.TR></SIP:02124440111@GI.COM.TR;USER=PHONE></SIP:902247654321@GI.COM.TR></SIP:902247654321@84.51.32.26></SIP:02124440111@GI.COM.TR;USER=PHONE></SIP:902247654321@GI.COM.TR></SIP:02124440111@GI.COM.TR;USER=PHONE></SIP:02124440111@GI.COM.TR;USER=PHONE></SIP:02124440111@GI.COM.TR;USER=PHONE></SIP:02124440111@GI.COM.TR;USER=PHONE></FONT></DIV></BODY></HTML>