Hi,
I guess it has something to do with "use_domain" being "1". Does it
work
when you change it to "0"?
Regards,
Andreas
nick wrote:
I'm attaching my config file with the hopes that
someone can point out
where I'm going wrong:
I have problems registering with X-Lite and several ATAs, while
Grandstream Budget Tone 200 phones have no problems at all...
The only difference I have found is that Grandstream Phones don't have a
Domain field like The ATAs and X-Lite does (just a proxy and sip server
field), I've tried changing the domain in X-Lite to be the same as the
proxy without any luck, and I really need to figure this out.
I have a config that works just fine with X-Lite and the ATAs but it
won't work with the Grandstreams (it has other problems though). I'd
really prefer not to have an either/or situation here.
nick wrote:
pre_auth(): Credentials with given realm not
found
After looking around google it seems to be based on the fact that the
first sip: value doesn't contain the userid (if I understand
correctly...)
I can't figure out exactly why the RURI is coming in this fashion..
Should I be changing something in the clients, or my config??
These worked on an older config, now with this section, they just
don't get accepted. I've tried it with and without
sipserver.mobilia.it in the realm.
-----------------------------------------------------------------------
Mar 29 12:07:40 sipserver
/usr/local/sbin/openser[22732]: New request
- M=REGISTER RURI=sip:mobilia.it F=sip:rice@mobilia.it
T=sip:rice@mobilia.it IP=x.x.x.105 ID=fmq-17240(a)x.x.x.105
Mar 29 12:07:40 sipserver /usr/local/sbin/openser[22732]:
parse_headers: flags=100
Mar 29 12:07:40 sipserver /usr/local/sbin/openser[22732]:
get_hdr_field: cseq <CSeq>: <100> <REGISTER>
Mar 29 12:07:40 sipserver /usr/local/sbin/openser[22732]:
DEBUG:maxfwd:is_maxfwd_present: value = 70
Mar 29 12:07:40 sipserver /usr/local/sbin/openser[22732]:
parse_headers: flags=200
Mar 29 12:07:40 sipserver /usr/local/sbin/openser[22732]: DEBUG:
get_hdr_body : content_length=0
Mar 29 12:07:40 sipserver /usr/local/sbin/openser[22732]: found end of
header
Mar 29 12:07:40 sipserver /usr/local/sbin/openser[22732]:
find_first_route: No Route headers found
Mar 29 12:07:40 sipserver /usr/local/sbin/openser[22732]: loose_route:
There is no Route HF
Mar 29 12:07:40 sipserver /usr/local/sbin/openser[22732]:
parse_headers: flags=ffffffffffffffff
Mar 29 12:07:40 sipserver /usr/local/sbin/openser[22732]:
check_via_address(x.x.x.105, x.x.x.105, 0)
Mar 29 12:07:40 sipserver /usr/local/sbin/openser[22732]:
parse_headers: flags=4000
Mar 29 12:07:40 sipserver /usr/local/sbin/openser[22732]: pre_auth():
Credentials with given realm not found
Mar 29 12:07:40 sipserver /usr/local/sbin/openser[22732]: Register
authentication failed - M=REGISTER RURI=sip:mobilia.it
F=sip:rice@mobilia.it T=sip:rice@mobilia.it IP=x.x.x.105
ID=fmq-17240(a)x.x.x.105
Mar 29 12:07:40 sipserver /usr/local/sbin/openser[22732]:
build_auth_hf(): 'WWW-Authenticate: Digest realm="mobilia.it",
nonce="460b9118a6a044d8837a01f924be2a9a3b7e0271", qop="auth"^M '
_______________________________________________
Users mailing list
Users(a)openser.org
http://openser.org/cgi-bin/mailman/listinfo/users
------------------------------------------------------------------------
########################################################################
# This configuration is autogenerated by sip:wizard
# (
http://www.sipwise.com/wizard) on Wed Mar 28 09:46:53 CEST 2007
# for OpenSER 1.1
#
# Copyright (C) 2007 Sipwise (support(a)sipwise.com)
########################################################################
########################################################################
# By obtaining, using, and/or copying this configuration and/or its
# associated documentation, you agree that you have read, understood,
# and will comply with the Terms of Usage provided at
#
http://www.sipwise.com/news/?page_id=6 as well as the following
# additions:
#
# Permission to use, copy, modify, and distribute this configuration and
# its associated documentation for any purpose and without fee is hereby
# granted, provided that the above copyright notice appears in all
# copies, and that both that copyright notice and this permission notice
# appear in supporting documentation, and that the name of Sipwise or
# the author will not be used in advertising or publicity pertaining to
# distribution of the configuration without specific, written prior
# permission.
########################################################################
########################################################################
# Before using this configuration, read the following prerequisites in
# order to gain the designated functionallity:
#
# base:
# You have to insert all locally served domains (i.e.
# "openserctl domain add your.domain.com").
#
# usr-preferences:
# This feature relies on UUID-based provisioning. Thus, you have
# to add the uuid-column to the subscriber table ("alter table
# subscriber add column uuid varchar(64);") and populate it with a
# UUID (unique user identifier) per user, for example an
# auto-incremented id.
#
# offnet-incoming-sip:
# You have to populate the "trusted"-table with rules for
# allowed peering hosts (i.e. src_ip="1.2.3.4", proto="udp",
# from_pattern="^sip:.*@domain.of.peering.host$", tag="1234"). If
the
# feature "usr-preferences" is selected, the tag-value is used as
# caller-uuid for such calls.
#
# offnet-pstn:
# You have to add a routing entry for lcr (i.e. "openserctl lcr
# addroute '' '' 1 1"). Additionally, you have to add your
gateways
# (i.e. "openserctl lcr addgw my-test-gw 1.2.3.4 5060 sip udp 1").
#
# ring-timeout:
# You have to provision the ring-timeout (AVP ringtimeout as
# type 1) for each user in the usr_preferences table (i.e.
# uuid='1234', username='', domain='',
attribute='ringtimeout',
# type=1, value='60'). If no timeout is provisioned, the default
# timeout will be used.
#
# user-aliases:
# You have to add aliases for your users (i.e. "openserctl alias
# add 01234567 sip:bob@yourdomain.com")
#
# cli:
# You have to provision the CLI as full SIP URI (AVP cli as type
# 0) for each user in the usr_preferences table (i.e. uuid='1234',
# username='', domain='', attribute='cli', type=0,
# value='sip:01234567@yourdomain.com').
#
########################################################################
########################################################################
# Configuration 'sip:wizard - Wed Mar 28 09:46:53 CEST 2007'
########################################################################
listen = udp:x.x.x.16:5060
mpath = "/usr/local/lib64/openser/modules"
alias = sipserver.logycs.it
children = 8
debug = 5
fork = yes
disable_tcp = no
log_facility = LOG_LOCAL6
log_stderror = no
tcp_children = 4
fifo = "/tmp/openser_fifo"
fifo_dir = "/tmp/"
fifo_group = "root"
fifo_mode = 0666
fifo_user = "root"
mhomed = no
server_header = "Mobilia SIP Server"
server_signature = yes
sock_mode = 0600
user_agent_header = "Mobilia SIP Server"
reply_to_via = no
sip_warning = no
check_via = no
dns = no
rev_dns = no
syn_branch = yes
disable_core_dump = no
dns_try_ipv6 = no
dns_use_search_list = yes
fifo_db_url="mysql://openser:xxxxxxxx@localhost/openser"
loadmodule "usrloc.so"
modparam("usrloc", "user_column", "username")
modparam("usrloc", "domain_column", "domain")
modparam("usrloc", "contact_column", "contact")
modparam("usrloc", "expires_column", "expires")
modparam("usrloc", "q_column", "q")
modparam("usrloc", "callid_column", "callid")
modparam("usrloc", "cseq_column", "cseq")
modparam("usrloc", "methods_column", "methods")
modparam("usrloc", "flags_column", "flags")
modparam("usrloc", "user_agent_column", "user_agent")
modparam("usrloc", "received_column", "received")
modparam("usrloc", "socket_column", "socket")
modparam("usrloc", "use_domain", 1)
modparam("usrloc", "desc_time_order", 1)
modparam("usrloc", "timer_interval", 60)
modparam("usrloc", "db_url",
"mysql://openser:xxxxxxxx@localhost/openser")
modparam("usrloc", "db_mode", 2)
modparam("usrloc", "matching_mode", 0)
modparam("usrloc", "cseq_delay", 20)
loadmodule "maxfwd.so"
modparam("maxfwd", "max_limit", 256)
loadmodule "rr.so"
modparam("rr", "enable_full_lr", 1)
modparam("rr", "append_fromtag", 1)
modparam("rr", "enable_double_rr", 1)
modparam("rr", "add_username", 0)
loadmodule "tm.so"
modparam("tm", "fr_timer", 30)
modparam("tm", "fr_inv_timer", 120)
modparam("tm", "wt_timer", 5)
modparam("tm", "delete_timer", 2)
modparam("tm", "retr_timer1p1", 1)
modparam("tm", "retr_timer1p2", 2)
modparam("tm", "retr_timer1p3", 4)
modparam("tm", "retr_timer2", 4)
modparam("tm", "noisy_ctimer", 0)
modparam("tm", "ruri_matching", 1)
modparam("tm", "via1_matching", 1)
modparam("tm", "unix_tx_timeout", 2)
modparam("tm", "restart_fr_on_each_reply", 1)
modparam("tm", "fr_timer_avp", "s:callee_fr_timer")
modparam("tm", "fr_inv_timer_avp",
"s:callee_fr_inv_timer")
modparam("tm", "pass_provisional_replies", 0)
loadmodule "xlog.so"
modparam("xlog", "buf_size", 4096)
modparam("xlog", "force_color", 0)
loadmodule "domain.so"
modparam("domain", "db_url",
"mysql://openser:xxxxxxxx@localhost/openser")
modparam("domain", "db_mode", 1)
modparam("domain", "domain_table", "domain")
modparam("domain", "domain_col", "domain")
loadmodule "nathelper.so"
modparam("nathelper", "natping_interval", 10)
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "received_avp", 42)
modparam("nathelper", "rtpproxy_sock",
"unix:/var/run/rtpproxy.sock")
modparam("nathelper", "rtpproxy_disable", 1)
modparam("nathelper", "rtpproxy_disable_tout", 60)
modparam("nathelper", "rtpproxy_tout", 1)
modparam("nathelper", "rtpproxy_retr", 5)
modparam("nathelper", "sipping_method", "OPTIONS")
loadmodule "textops.so"
loadmodule "uri.so"
loadmodule "registrar.so"
modparam("registrar", "default_expires", 1800)
modparam("registrar", "min_expires", 60)
modparam("registrar", "max_expires", 3600)
modparam("registrar", "default_q", 0)
modparam("registrar", "append_branches", 1)
modparam("registrar", "use_domain", 1)
modparam("registrar", "case_sensitive", 0)
modparam("registrar", "desc_time_order", 0)
modparam("registrar", "received_avp", 42)
modparam("registrar", "received_param", "received")
modparam("registrar", "realm_prefix", "sipserver.")
modparam("registrar", "max_contacts", 0)
modparam("registrar", "retry_after", 0)
modparam("registrar", "use_branch_flags", 0)
modparam("registrar", "method_filtering", 0)
modparam("registrar", "path_mode", 1)
modparam("registrar", "path_use_received", 0)
modparam("registrar", "nat_flag", 6)
# modparam("registrar", "use_path", 1)
loadmodule "sl.so"
modparam("sl", "enable_stats", 1)
loadmodule "mysql.so"
modparam("mysql", "ping_interval", 300)
modparam("mysql", "auto_reconnect", 1)
loadmodule "auth.so"
modparam("auth", "nonce_expire", 300)
modparam("auth", "rpid_suffix",
";party=calling;id-type=subscriber;screen=yes")
modparam("auth", "rpid_avp", "s:rpid")
modparam("auth", "realm_prefix", "sipserver.")
loadmodule "auth_db.so"
modparam("auth_db", "db_url",
"mysql://openser:xxxxxxxx@localhost/openser")
modparam("auth_db", "user_column", "username")
modparam("auth_db", "domain_column", "domain")
modparam("auth_db", "password_column", "password")
modparam("auth_db", "password_column_2", "ha1b")
modparam("auth_db", "calculate_ha1", 1)
modparam("auth_db", "use_domain", 1)
modparam("auth_db", "load_credentials",
"rpid;s:caller_uuid=uuid")
loadmodule "uri_db.so"
modparam("uri_db", "db_url",
"mysql://openser:xxxxxxxx@localhost/openser")
modparam("uri_db", "uri_table", "uri")
modparam("uri_db", "uri_user_column", "username")
modparam("uri_db", "uri_domain_column", "domain")
modparam("uri_db", "uri_uriuser_column", "uri_user")
modparam("uri_db", "subscriber_table", "subscriber")
modparam("uri_db", "subscriber_user_column", "username")
modparam("uri_db", "subscriber_domain_column", "domain")
modparam("uri_db", "use_uri_table", 0)
modparam("uri_db", "use_domain", 0)
loadmodule "avpops.so"
modparam("avpops", "db_url",
"mysql://openser:xxxxxxxx@localhost/openser")
modparam("avpops", "avp_table", "usr_preferences")
modparam("avpops", "use_domain", 0)
modparam("avpops", "uuid_column", "uuid")
modparam("avpops", "username_column", "username")
modparam("avpops", "domain_column", "domain")
modparam("avpops", "attribute_column", "attribute")
modparam("avpops", "value_column", "value")
modparam("avpops", "type_column", "type")
loadmodule "enum.so"
modparam("enum", "domain_suffix", "e164.arpa.")
loadmodule "permissions.so"
modparam("permissions", "default_allow_file",
"permissions.allow")
modparam("permissions", "default_deny_file",
"permissions.deny")
modparam("permissions", "check_all_branches", 1)
modparam("permissions", "allow_suffix", ".allow")
modparam("permissions", "deny_suffix", ".deny")
modparam("permissions", "db_url",
"mysql://openser:xxxxxxxx@localhost/openser")
modparam("permissions", "db_mode", 1)
modparam("permissions", "trusted_table", "trusted")
modparam("permissions", "source_col", "src_ip")
modparam("permissions", "proto_col", "proto")
modparam("permissions", "from_col", "from_pattern")
modparam("permissions", "tag_col", "tag")
modparam("permissions", "peer_tag_avp", "s:peer_uuid")
loadmodule "lcr.so"
modparam("lcr", "db_url",
"mysql://openser:xxxxxxxx@localhost/openser")
modparam("lcr", "gw_table", "gw")
modparam("lcr", "gw_name_column", "gw_name")
modparam("lcr", "ip_addr_column", "ip_addr")
modparam("lcr", "port_column", "port")
modparam("lcr", "uri_scheme_column", "uri_scheme")
modparam("lcr", "transport_column", "transport")
modparam("lcr", "grp_id_column", "grp_id")
modparam("lcr", "lcr_table", "lcr")
modparam("lcr", "strip_column", "strip")
modparam("lcr", "prefix_column", "prefix")
modparam("lcr", "from_uri_column", "from_uri")
modparam("lcr", "priority_column", "priority")
modparam("lcr", "gw_uri_avp", "1400")
modparam("lcr", "ruri_user_avp", "1402")
modparam("lcr", "contact_avp", "1401")
modparam("lcr", "fr_inv_timer_avp", "s:fr_inv_timer_avp")
modparam("lcr", "fr_inv_timer", 90)
modparam("lcr", "fr_inv_timer_next", 30)
modparam("lcr", "rpid_avp", "s:rpid")
modparam("lcr", "db_mode", 1)
loadmodule "acc.so"
modparam("acc", "early_media", 0)
modparam("acc", "failed_transaction_flag", 24)
modparam("acc", "report_ack", 0)
modparam("acc", "report_cancels", 0)
modparam("acc", "multi_leg_enabled", 1)
modparam("acc", "src_leg_avp_id", 901)
modparam("acc", "dst_leg_avp_id", 902)
modparam("acc", "log_flag", 0)
modparam("acc", "log_missed_flag", 0)
modparam("acc", "log_level", 2)
modparam("acc", "log_fmt", "miocfs")
modparam("acc", "db_flag", 25)
modparam("acc", "db_missed_flag", 0)
modparam("acc", "db_table_acc", "acc")
modparam("acc", "db_table_missed_calls", "missed_calls")
modparam("acc", "db_url",
"mysql://openser:xxxxxxxx@localhost/openser")
modparam("acc", "db_localtime", 0)
modparam("acc", "acc_sip_from_column", "sip_from")
modparam("acc", "acc_sip_to_column", "sip_to")
modparam("acc", "acc_sip_status_column", "sip_status")
modparam("acc", "acc_sip_method_column", "sip_method")
modparam("acc", "acc_i_uri_column", "i_uri")
modparam("acc", "acc_o_uri_column", "o_uri")
modparam("acc", "acc_sip_callid_column", "sip_callid")
modparam("acc", "acc_user_column", "username")
modparam("acc", "acc_time_column", "time")
modparam("acc", "acc_from_uri_column", "from_uri")
modparam("acc", "acc_to_uri_column", "to_uri")
modparam("acc", "acc_totag_column", "totag")
modparam("acc", "acc_fromtag_column", "fromtag")
modparam("acc", "acc_domain_column", "domain")
modparam("acc", "acc_src_leg_column", "src_leg")
modparam("acc", "acc_dst_leg_column", "dst_leg")
modparam("acc", "detect_direction", 1)
########################################################################
# Request route 'main'
########################################################################
route[0]
{
xlog("L_INFO", "New request - M=$rm RURI=$ru F=$fu T=$tu IP=$si
ID=$ci\n");
force_rport();
if(msg:len > max_len)
{
xlog("L_INFO", "Message too big - M=$rm RURI=$ru F=$fu T=$tu IP=$si
ID=$ci\n");
sl_send_reply("513", "Message Too Big");
exit;
}
if (!mf_process_maxfwd_header("10"))
{
xlog("L_INFO", "Too many hops - M=$rm RURI=$ru F=$fu T=$tu IP=$si
ID=$ci\n");
sl_send_reply("483", "Too Many Hops");
exit;
}
if(!is_method("REGISTER"))
{
if(nat_uac_test("3"))
{
record_route(";nat=yes");
}
else
{
record_route();
}
}
if(loose_route())
{
if(!has_totag())
{
xlog("L_INFO", "Initial loose-routing rejected - M=$rm RURI=$ru F=$fu
T=$tu IP=$si ID=$ci\n");
sl_send_reply("403", "Initial Loose-Routing Rejected");
exit;
}
if(nat_uac_test("19") || search("^Route:.*;nat=yes"))
{
fix_nated_contact();
if(!search("^Content-Length:[ ]*0"))
{
fix_nated_sdp("3");
setflag(6);
}
}
if(is_method("BYE"))
{
setflag(24); # account failed transactions
setflag(25); # account successful transactions
}
# mark as loose-routed for acc
setflag(26);
route(9);
}
if(is_method("REGISTER"))
{
route(8);
}
setflag(24); # account failed transactions
setflag(25); # account successful transactions
if(is_method("INVITE"))
{
route(10);
}
if(is_method("CANCEL") || is_method("ACK"))
{
route(16);
}
route(17);
}
########################################################################
# Request route 'clear-usr-preferences-caller'
########################################################################
route[1]
{
xlog("L_INFO", "Clear caller preferences - M=$rm RURI=$ru F=$fu T=$tu
IP=$si ID=$ci\n");
avp_delete("$avp(s:caller_cli)/g");
avp_delete("$avp(s:clir)/g");
}
########################################################################
# Request route 'clear-usr-preferences-callee'
########################################################################
route[2]
{
xlog("L_INFO", "Clear callee preferences - M=$rm RURI=$ru F=$fu T=$tu
IP=$si ID=$ci\n");
avp_delete("$avp(s:callee_fr_inv_timer)/g");
}
########################################################################
# Request route 'usr-preferences-caller'
########################################################################
route[3]
{
route(1);
xlog("L_INFO", "Load caller preferences for uuid
'$avp(s:caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
# load caller avps
avp_db_load("$avp(s:caller_uuid)", "*");
avp_copy("$avp(s:cli)", "$avp(s:caller_cli)/d");
}
########################################################################
# Request route 'usr-preferences-callee'
########################################################################
route[4]
{
xlog("L_INFO", "Load callee preferences for uuid
'$avp(s:callee_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
# load callee avps
avp_db_load("$avp(s:callee_uuid)", "*");
if(is_avp_set("$avp(s:ringtimeout)/n"))
{
xlog("L_INFO", "Setting ring timeout to $avp(s:ringtimeout) secs - M=$rm
RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
avp_copy("$avp(s:ringtimeout)", "$avp(s:callee_fr_inv_timer)/d");
}
}
########################################################################
# Request route 'acc-caller'
########################################################################
route[5]
{
xlog("L_INFO", "Setting acc source-leg for uuid
'$avp(s:caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
avp_printf("$avp(i:901)", "$avp(s:caller_uuid)|$fU|$fd");
}
########################################################################
# Request route 'acc-callee'
########################################################################
route[6]
{
xlog("L_INFO", "Setting acc destination-leg for uuid
'$avp(s:callee_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
avp_printf("$avp(i:902)", "$avp(s:callee_uuid)|$rU|$rd");
}
########################################################################
# Request route 'acc-failure'
########################################################################
route[7]
{
xlog("L_INFO", "Accounting failed request for uuid
'$avp(s:caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
route(5);
route(6);
resetflag(24);
acc_db_request("404", "acc");
}
########################################################################
# Request route 'base-route-register'
########################################################################
route[8]
{
sl_send_reply("100", "Trying");
if(!www_authorize("sipserver.mobilia.it", "subscriber"))
{
xlog("L_INFO", "Register authentication failed - M=$rm RURI=$ru F=$fu
T=$tu IP=$si ID=$ci\n");
www_challenge("sipserver.mobilia.it", "0");
exit;
}
if(!check_to())
{
xlog("L_INFO", "Spoofed To-URI detected - M=$rm RURI=$ru F=$fu T=$tu
IP=$si ID=$ci\n");
sl_send_reply("403", "Spoofed To-URI Detected");
exit;
}
consume_credentials();
if(!search("^Contact:[ ]*\*") && nat_uac_test("19"))
{
fix_nated_register();
setflag(6);
}
if(!save("location"))
{
xlog("L_ERR", "Saving contact failed - M=$rm RURI=$ru F=$fu T=$tu IP=$si
ID=$ci\n");
sl_reply_error();
}
xlog("L_INFO", "Registration successful - M=$rm RURI=$ru F=$fu T=$tu
IP=$si ID=$ci\n");
exit;
}
########################################################################
# Request route 'base-outbound'
########################################################################
route[9]
{
if(is_present_hf("P-Asserted-Identity"))
{
remove_hf("P-Asserted-Identity");
}
if(is_present_hf("Remote-Party-ID"))
{
remove_hf("Remote-Party-ID");
}
if(is_avp_set("$avp(s:caller_cli)/s"))
{
xlog("L_INFO", "Set caller CLI '$avp(s:caller_cli)' - M=$rm
RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
xlog("L_INFO", "Set caller CLI '$avp(s:caller_cli)' - M=$rm
RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
append_hf("Remote-Party-ID:
<$avp(s:caller_cli)>;party=caller;privacy=none;screen=yes\r\n");
}
if(isflagset(6) && !isflagset(22))
{
setflag(22);
fix_nated_contact();
t_on_reply("2");
}
else
{
t_on_reply("1");
}
xlog("L_INFO", "Request leaving server - M=$rm RURI=$ru F=$fu T=$tu
IP=$si ID=$ci\n");
if(!isflagset(21))
{
t_on_failure("2");
if(!isflagset(26))
{
route(5);
route(6);
}
}
if(!t_relay())
{
sl_reply_error();
}
exit;
}
########################################################################
# Request route 'base-route-invite'
########################################################################
route[10]
{
sl_send_reply("100", "Trying");
if(from_gw())
{
avp_write("s:0", "$avp(s:caller_uuid)");
xlog("L_INFO", "Call from PSTN' - M=$rm RURI=$ru F=$fu T=$tu IP=$si
ID=$ci\n");
setflag(23);
}
else
{
if(allow_trusted())
{
if(is_avp_set("$avp(s:peer_uuid)/s"))
{
# use tag-column from trusted-table as uuid for this caller
avp_copy("$avp(s:peer_uuid)", "$avp(s:caller_uuid)/d");
}
else
{
# if no uuid is set, use "0" as default uuid
avp_write("s:0", "$avp(s:caller_uuid)");
}
xlog("L_INFO", "Call from trusted peer with uuid
'$avp(s:caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
if(!is_domain_local("$ruri"))
{
xlog("L_INFO", "Rejecting peering attempt with non-local request
domain - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
sl_send_reply("403", "Relaying Denied");
exit;
}
setflag(23);
}
else
{
if(!proxy_authorize("", "subscriber"))
{
xlog("L_INFO", "Proxy authentication failed - M=$rm RURI=$ru F=$fu
T=$tu IP=$si ID=$ci\n");
proxy_challenge("", "1");
exit;
}
if(!check_from())
{
xlog("L_INFO", "Spoofed From-URI detected - M=$rm RURI=$ru F=$fu T=$tu
IP=$si ID=$ci\n");
sl_send_reply("403", "Spoofed From-URI Detected");
exit;
}
consume_credentials();
}
}
route(3);
if(nat_uac_test("19"))
{
setflag(6);
}
route(11);
}
########################################################################
# Request route 'invite-find-callee'
########################################################################
route[11]
{
if(lookup("aliases"))
{
xlog("L_INFO", "Callee was aliased - M=$rm RURI=$ru F=$fu T=$tu IP=$si
ID=$ci\n");
}
route(2);
if(!is_domain_local("$ruri"))
{
setflag(20);
avp_write("s:0", "$avp(s:callee_uuid)");
route(13);
}
avp_delete("$avp(s:callee_uuid)");
avp_db_query("select uuid from subscriber where username = '$rU'",
"$avp(s:callee_uuid)");
if(is_avp_set("$avp(s:callee_uuid)/s"))
{
xlog("L_INFO", "Callee is local, uuid='$avp(s:callee_uuid)' -
M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
route(12);
}
else
{
avp_write("s:0", "$avp(s:callee_uuid)");
xlog("L_INFO", "Callee is not local - M=$rm RURI=$ru F=$fu T=$tu IP=$si
ID=$ci\n");
route(13);
}
exit;
}
########################################################################
# Request route 'invite-to-internal'
########################################################################
route[12]
{
route(4);
if(!lookup("location"))
{
xlog("L_INFO", "Local user offline - M=$rm RURI=$ru F=$fu T=$tu IP=$si
ID=$ci\n");
route(7);
sl_send_reply("404", "User Offline");
}
else
{
xlog("L_INFO", "Local user online - M=$rm RURI=$ru F=$fu T=$tu IP=$si
ID=$ci\n");
route(9);
}
exit;
}
########################################################################
# Request route 'invite-to-external'
########################################################################
route[13]
{
if(isflagset(20))
{
xlog("L_INFO", "Call to foreign domain - M=$rm RURI=$ru F=$fu T=$tu
IP=$si ID=$ci\n");
route(9);
exit;
}
route(15);
if(!isflagset(23))
{
# don't allow calls relaying from PSTN to PSTN, if not explicitely forwarded
if(uri =~ "^sip:[0-9]{8,24}+@")
{
if(uri =~ "^sip:[0-9]{8,24}+@.*"){
subst_uri('/INVITE sip:([0-9]+)@(.*)\.it$/INVITE sip:\1@interoute.com;/i');
append_hf("P-hint: outbound to PSTN gateway\r\n");
}
# only route numeric users to PSTN
if(!load_gws())
{
xlog("L_ERR", "Error loading PSTN gateways - M=$rm RURI=$ru F=$fu
T=$tu IP=$si ID=$ci\n");
sl_send_reply("503", "PSTN Termination Currently Unavailable");
exit;
}
if(!next_gw())
{
xlog("L_ERR", "No PSTN gateways available - M=$rm RURI=$ru F=$fu T=$tu
IP=$si ID=$ci\n");
sl_send_reply("503", "PSTN Termination Currently Unavailable");
exit;
}
setflag(21);
t_on_failure("1");
route(9);
}
}
xlog("L_INFO", "Call to unknown user - M=$rm RURI=$ru F=$fu T=$tu IP=$si
ID=$ci\n");
route(7);
sl_send_reply("404", "User Not Found");
exit;
}
########################################################################
# Request route 'normalize-e164'
########################################################################
route[14]
{
# European numbering plans look like this:
# CC = country code (i.e. 43 for Austria)
# NDC = national destination code (i.e. 1 for Vienna)
# SN = subscriber number (i.e. 4001234)
#
# CC + NDC + SN, i.e. 4314001234
#
# Within the same CC+NDC, it can be omitted, so if
# +4314001234 wants to call +4315002345, one can dial
# just 5002345.
#
# Within the same CC, CC can be ommitted and a "0" is prefixed
# to NDC, so if +4314001234 wants to call +4326003456,
# one can dial 026003456.
#
# For international calls, either "00" or + is prefixed, like
# +49123456780 or 0049123456789.
#
avp_delete("$avp(s:orig_callee_user)/g");
avp_write("$rU", "$avp(s:orig_callee_user)");
if(uri =~ "^sip:(\+[1-9])?[0-9]+@")
{
# looks like a PSTN number
if(uri =~ "^sip:0[1-9][0-9]+@")
{
# we have format 0+NDC+SN
#strip(1);
prefix("+39");
}
# looks like a Cell number
if(uri =~ "^sip:3[1-9][0-9]+@")
{
# we have format 0+NDC+SN
#strip(1);
prefix("+39");
}
else if(uri =~ "^sip:00[1-9]+@")
{
# we have format 00 + CC + NDC + SN
strip(2);
prefix("+");
}
else if(!uri =~ "^sip:\+[1-9][0-9]+@")
{
# unknown format, maybe NDC wasn't added before?
xlog("L_INFO", "Not normalized callee
'$avp(s:orig_callee_user)' to E.164 format - M=$rm RURI=$ru F=$fu T=$tu IP=$si
ID=$ci\n");
return(-1);
}
# else we have "+" + CC + NDC + SN
xlog("L_INFO", "Normalized callee '$avp(s:orig_callee_user)' to
E.164 format '$rU' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
return(1);
}
else
{
xlog("L_INFO", "Not normalized callee '$avp(s:orig_callee_user)'
to E.164 format - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
return(-1);
}
}
########################################################################
# Request route 'lookup-enum'
########################################################################
route[15]
{
route(14);
if(retcode == 1)
{
#if(enum_query("e164.org"))
#{
# TODO: do GW fallback (load gws, set failure-route)?
# xlog("L_INFO", "ENUM query succeeded - M=$rm RURI=$ru F=$fu T=$tu
IP=$si ID=$ci\n");
setdsturi("sip:x.x.x.53:5060");
route(9);
exit;
#}
#else
#{
# xlog("L_INFO", "ENUM query failed - M=$rm RURI=$ru F=$fu T=$tu IP=$si
ID=$ci\n");
# ENUM query failed, revert $rU
# avp_pushto("$ru/username", "$avp(s:orig_callee_user)");
#}
}
}
########################################################################
# Request route 'base-route-local'
########################################################################
route[16]
{
t_on_reply("1");
if(t_check_trans())
{
xlog("L_INFO", "Request leaving server - M=$rm RURI=$ru F=$fu T=$tu
IP=$si ID=$ci\n");
if(!t_relay())
{
sl_reply_error();
}
}
else
{
xlog("L_INFO", "Dropping mis-routed request - M=$rm RURI=$ru F=$fu T=$tu
IP=$si ID=$ci\n");
}
exit;
}
########################################################################
# Request route 'base-route-generic'
########################################################################
route[17]
{
xlog("L_INFO", "Method not supported - M=$rm RURI=$ru F=$fu T=$tu IP=$si
ID=$ci\n");
sl_send_reply("501", "Method Not Supported Here");
exit;
}
########################################################################
# Request route 'base-filter-failover'
########################################################################
route[18]
{
if(!t_check_status("408|500|503"))
{
xlog("L_INFO", "No failover routing needed for this response code -
M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
exit;
}
}
########################################################################
# Reply route 'base-standard-reply'
########################################################################
onreply_route[1]
{
xlog("L_INFO", "Reply - S=$rs D=$rr F=$fu T=$tu IP=$si ID=$ci\n");
exit;
}
########################################################################
# Reply route 'base-nat-reply'
########################################################################
onreply_route[2]
{
xlog("L_INFO", "NAT-Reply - S=$rs D=$rr F=$fu T=$tu IP=$si
ID=$ci\n");
if(nat_uac_test("1"))
{
fix_nated_contact();
}
if(isflagset(6) && status=~"(180)|(183)|2[0-9][0-9]")
{
if(!search("^Content-Length:[ ]*0"))
{
fix_nated_sdp("3");
}
}
exit;
}
########################################################################
# Failure route 'pstn-failover'
########################################################################
failure_route[1]
{
xlog("L_INFO", "Failure route for PSTN entered - M=$rm RURI=$ru F=$fu
T=$tu IP=$si ID=$ci\n");
route(18);
if(!next_gw())
{
xlog("L_ERR", "Failed to select next PSTN gateway - M=$rm RURI=$ru F=$fu
T=$tu IP=$si ID=$ci\n");
exit;
}
t_on_failure("1");
route(9);
}
########################################################################
# Failure route 'base-standard-failure'
########################################################################
failure_route[2]
{
route(18);
}
------------------------------------------------------------------------
_______________________________________________
Users mailing list
Users(a)openser.org
http://openser.org/cgi-bin/mailman/listinfo/users
This e-mail is confidential and may well also be legally privileged. If you have received
it in error, you are on notice of its status. Please notify us immediately by reply e-mail
and then delete this message from your system. Please do not copy it or use it for any
purposes, or disclose its contents to any other person: to do so could be a breach of
confidence. Thank you for your cooperation.
Information pursuant to paragraph 14 Austrian Companies Code: UPC Austria GmbH; Registered
Office: Wolfganggasse 58-60, 1120 Vienna Company Register Number: FN 189858d at the
Commercial Court of Vienna