[OpenSIPS-Users] 回复: why 483 too many Hops

toasterisk at gmail.com toasterisk at gmail.com
Fri May 23 16:57:53 CEST 2014


hello: all of users:
from opensips debug info, there are few bugs with no totag:
:47:17 [2915] DBG:core:parse_via_param: found param type 232, <branch> = <z9hG4bK-d87543-e049e36a4d0d0d08-1--d87543->; state=6 
May 23 22:47:17 [2915] DBG:core:parse_via_param: found param type 235, <rport> = <7147>; state=16 
May 23 22:47:17 [2915] DBG:core:parse_via: end of header reached, state=5 
May 23 22:47:17 [2915] DBG:core:parse_headers: via found, flags=100 
May 23 22:47:17 [2915] DBG:maxfwd:is_maxfwd_present: value = 17 
May 23 22:47:17 [2915] DBG:core:parse_headers: flags=8 
May 23 22:47:17 [2915] DBG:core:parse_to: end of header reached, state=10 
May 23 22:47:17 [2915] DBG:core:parse_to: display={"alice"}, ruri={sip:alice at 192.168.1.104} 
May 23 22:47:17 [2915] DBG:core:get_hdr_field: <To> [34]; uri=[sip:alice at 192.168.1.104] 
May 23 22:47:17 [2915] DBG:core:get_hdr_field: to body ["alice"<sip:alice at 192.168.1.104> 
] 
May 23 22:47:17 [2915] DBG:uri:has_totag: no totag 
May 23 22:47:17 [2915] DBG:core:parse_headers: flags=78 
May 23 22:47:17 [2915] DBG:core:get_hdr_field: cseq <CSeq>: <1> <REGISTER> 
May 23 22:47:17 [2915] DBG:tm:t_lookup_request: start searching: hash=39923, isACK=0 
May 23 22:47:17 [2915] DBG:tm:matching_3261: RFC3261 transaction matched, tid=3fb9.febcd94.0 
May 23 22:47:17 [2915] DBG:tm:t_lookup_request: REF_UNSAFE:[0xb50e3a50] after is 1 
May 23 22:47:17 [2915] DBG:tm:t_lookup_request: transaction found (T=0xb50e3a50) 
May 23 22:47:17 [2915] DBG:tm:t_retransmit_reply: nothing to retransmit 
May 23 22:47:17 [2915] DBG:tm:t_check_trans: UNREF_UNSAFE: [0xb50e3a50] after is 0 
May 23 22:47:17 [2915] DBG:core:destroy_avp_list: destroying list (nil) 
May 23 22:47:17 [2915] DBG:core:receive_msg: cleaning up 
---------------my cfg-opensips-1.8.2 ---------------------------
#
# $Id: opensips.cfg 8758 2012-02-29 11:59:26Z vladut-paiu $
#
# OpenSIPS residential configuration script
# by OpenSIPS Solutions <team at opensips-solutions.com>
#
# This script was generated via "make menuconfig", from
# the "Residential" scenario.
# You can enable / disable more features / functionalities by
# re-generating the scenario with different options.#
#
# Please refer to the Core CookBook at:
# http://www.opensips.org/Resources/DocsCookbooks
# for a explanation of possible statements, functions and parameters.
#


####### Global Parameters #########

debug=3
log_stderror=yes
log_facility=LOG_LOCAL0

fork=yes
children=4

/* uncomment the following lines to enable debugging */
#debug=6
#fork=no
#log_stderror=yes

/* uncomment the next line to enable the auto temporary blacklisting of 
not available destinations (default disabled) */
disable_dns_blacklist=yes

/* uncomment the next line to enable IPv6 lookup after IPv4 dns 
lookup failures (default disabled) */
#dns_try_ipv6=yes

/* comment the next line to enable the auto discovery of local aliases
based on revers DNS on IPs */
auto_aliases=yes
alias=test.com

listen=udp:192.168.1.104:5060 # CUSTOMIZE ME


disable_tcp=yes

# disable_tls=yes


####### Modules Section ########

#set module path
mpath="/usr/local/lib/opensips/modules/"

loadmodule "db_mysql.so"
loadmodule "signaling.so"
loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"
loadmodule "textops.so"
loadmodule "mi_fifo.so"
#loadmodule "uri_db.so"
loadmodule "uri.so"
#loadmodule "xlog.so"
loadmodule "acc.so"
loadmodule "auth.so"
loadmodule "auth_db.so"
loadmodule "sipmsgops.so"
loadmodule "domain.so"



# ----------------- setting module-specific parameters ---------------


# ----- mi_fifo params -----
modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")

# ----- rr params -----
# add value to ;lr param to cope with most of the UAs
modparam("rr", "enable_double_rr", 1)
# do not append from tag to the RR (no need for this script)
modparam("rr", "append_fromtag", 0)

# ----- usrloc params -----
modparam("usrloc", "db_mode", 2)
modparam("usrloc", "db_url",
"mysql://opensips:opensipsrw@localhost/opensips")

# ----- uri_db params -----
#modparam("uri_db", "use_uri_table", 0)
#modparam("uri_db", "db_url", "")

# ----- acc params -----
/* what sepcial events should be accounted ? */
modparam("acc", "early_media", 1)
#modparam("acc", "report_ack", 1)
modparam("acc", "report_cancels", 1)
/* account triggers (flags) */
modparam("acc", "failed_transaction_flag", 3)
modparam("acc", "log_flag", 1)
modparam("acc", "log_missed_flag", 2)
/* uncomment the following lines to enable DB accounting also */
modparam("acc", "db_flag", 1)
modparam("acc", "db_missed_flag", 2)

# ----- auth_db params -----
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
modparam("auth_db", "db_url",
"mysql://opensips:opensipsrw@localhost/opensips")
modparam("auth_db", "load_credentials", "")

# ----- domain params -----
modparam("domain", "db_url",
"mysql://opensips:opensipsrw@localhost/opensips")
modparam("domain", "db_mode", 1) # Use caching

# ----- multi-module params -----
/* uncomment the following line if you want to enable multi-domain support
in the modules (dafault off) */
modparam("alias_db|auth_db|usrloc|uri_db", "use_domain", 1)


####### Routing Logic ########


# main request routing logic

route{

if (!mf_process_maxfwd_header("10")) {
send_reply("483","Too Many Hops");
exit;
}

if (has_totag()) {
# sequential request withing a dialog should
# take the path determined by record-routing
if (loose_route()) {
if (is_method("BYE")) {
setflag(1); # do accounting ...
setflag(3); # ... even if the transaction fails
} else if (is_method("INVITE")) {
# even if in most of the cases is useless, do RR for
# re-INVITEs alos, as some buggy clients do change route set
# during the dialog.
record_route();
}
# route it out to whatever destination was set by loose_route()
# in $du (destination URI).
route(1);
} else {
if ( is_method("ACK") ) {
if ( t_check_trans() ) {
# non loose-route, but stateful ACK; must be an ACK after 
# a 487 or e.g. 404 from upstream server
t_relay();
exit;
} else {
# ACK without matching transaction ->
# ignore and discard
exit;
}
}
send_reply("404","Not here");
}
exit;
}

#initial requests

# CANCEL processing
if (is_method("CANCEL")) {
if (t_check_trans())
t_relay();
exit;
}

t_check_trans();

# authenticate if from local subscriber
if (!(method=="REGISTER") && is_from_local()) {
if (!proxy_authorize("", "subscriber")) {
proxy_challenge("", "0");
exit;
}
if (!db_check_from()) {
send_reply("403","Forbidden auth ID");
exit;
}

consume_credentials();
# caller authenticated
}

# preloaded route checking
if (loose_route()) {
xlog("L_ERR",
"Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");
if (!is_method("ACK"))
send_reply("403","Preload Route denied");
exit;
}

# record routing
if (!is_method("REGISTER|MESSAGE"))
record_route();

# account only INVITEs
if (is_method("INVITE")) {
setflag(1); # do accounting
}

# if not a targetting a local SIP domain, just send it out
# based on DNS (calls to foreign SIP domains)
if (!is_uri_host_local()) {
append_hf("P-hint: outbound\r\n"); 
route(1);
}

# requests for my domain

if (is_method("REGISTER")) {
# authenticate the REGISTER requests
if (!www_authorize("", "subscriber")) {
www_challenge("", "0");
exit;
}
if (!db_check_to()) {
send_reply("403","Forbidden auth ID");
exit;
}

if (!save("location"))
sl_reply_error();

exit;
}

if ($rU==NULL) {
# request with no Username in RURI
send_reply("484","Address Incomplete");
exit;
}

# ASTERISK HOOK - BEGIN
# media service number? (digits starting with *)
if ($rU=~"^\*[1-9]+") {
# we do provide access to media services only to our
# subscribers, who were previously authenticated 
if (!is_from_local()) {
send_reply("403","Forbidden access to media service");
exit;
}
#identify the services and translate to Asterisk extensions
if ($rU=="*1111") {
# access to own voicemail IVR
seturi("sip:VM_pickup at 192.168.1.104:5090");
} else
if ($rU=="*2111") {
# access to the "say time" announcement 
seturi("sip:AN_time at 192.168.1.104:5090");
} else
if ($rU=="*2112") {
# access to the "say date" announcement 
seturi("sip:AN_date at 192.168.1.104:5090");
} else
if ($rU=="*2113") {
# access to the "echo" service
seturi("sip:AN_echo at 192.168.1.104:5090");
} else
if ($rU=~"\*3[0-9]{3}") {
# access to the conference service 
# remove the "*3" prefix and place the "CR_" prefix
strip(2);
prefix("CR_");
rewritehostport("192.168.1.104:5090");
} else {
# unknown service
seturi("sip:AN_notavailable at 192.168.1.104:5090");
}
# after setting the proper RURI (to point to corresponding ASTERISK extension),
# simply forward the call
t_relay();
exit;
}
# ASTERISK HOOK - END

# do lookup
if (!lookup("location")) {
# ASTERISK HOOK - BEGIN
# callee is not registered, so different to Voicemail
# First add the VM recording prefix to the RURI
prefix("VMR_");
# forward to the call to Asterisk (replace below with real IP and port)
rewritehostport("192.168.1.104:5090");
route(1);
# ASTERISK HOOK - END
exit;
}

# when routing via usrloc, log the missed calls also
setflag(2);

# arm a failure route in order to catch failed calls
# targeting local subscribers; if we fail to deliver
# the call to the user, we send the call to voicemail
t_on_failure("1");

route(1);
}


route[1] {
if (!t_relay()) {
sl_reply_error();
};
exit;
}


failure_route[1] {
if (t_was_cancelled()) {
exit;
}

# if the failure code is "408 - timeout" or "486 - busy",
# forward the calls to voicemail recording
if (t_check_status("486|408")) {
# ASTERISK HOOK - BEGIN
# First revert the RURI to get the original user in RURI
# Then add the VM recording prefix to the RURI
revert_uri();
prefix("VMR_");
# forward to the call to Asterisk (replace below with real IP and port)
rewritehostport("192.168.1.104:5090");
t_relay();
# ASTERISK HOOK - END
exit;
}
}




Cheers!
 
发件人: toasterisk at gmail.com
发送时间: 2014-05-23 22:23
收件人: opensips
主题: why 483 too many Hops
hello:
I install opensips-1.8.2 and asterisk together at my vmware. but when I register the SIP phone or physical
Phone, the clients always show 483 too many Hops. I disable the fireware and use:
 ngrep -d lo -qt -W byline port 5060, the debug info is this:
Via: SIP/2.0/UDP 192.168.1.104;branch=z9hG4bKda41.4fd0d422.0. 
Via: SIP/2.0/UDP 192.168.1.104;branch=z9hG4bKda41.3fd0d422.0. 
Via: SIP/2.0/UDP 192.168.1.104;branch=z9hG4bKda41.2fd0d422.0. 
Via: SIP/2.0/UDP 192.168.1.104;branch=z9hG4bKda41.1fd0d422.0. 
Via: SIP/2.0/UDP 192.168.1.104;branch=z9hG4bKda41.0fd0d422.0. 
Via: SIP/2.0/UDP 192.168.1.104;branch=z9hG4bKda41.fed0d422.0. 
Via: SIP/2.0/UDP 192.168.1.104;branch=z9hG4bKda41.eed0d422.0. 
Via: SIP/2.0/UDP 192.168.1.104;branch=z9hG4bKda41.ded0d422.0. 
Via: SIP/2.0/UDP 192.168.1.104;branch=z9hG4bKda41.ced0d422.0. 
Via: SIP/2.0/UDP 192.168.1.104;branch=z9hG4bKda41.bed0d422.0. 
Via: SIP/2.0/UDP 192.168.1.104;branch=z9hG4bKda41.aed0d422.0. 
Via: SIP/2.0/UDP 192.168.1.104;branch=z9hG4bKda41.9ed0d422.0. 
Via: SIP/2.0/UDP 192.168.1.104;branch=z9hG4bKda41.8ed0d422.0. 
Via: SIP/2.0/UDP 192.168.1.104;branch=z9hG4bKda41.7ed0d422.0. 
Via: SIP/2.0/UDP 192.168.1.104;branch=z9hG4bKda41.6ed0d422.0. 
Via: SIP/2.0/UDP 192.168.1.104;branch=z9hG4bKda41.5ed0d422.0. 
Via: SIP/2.0/UDP 192.168.1.103:5060;received=192.168.1.103;branch=z9hG4bK176606475;rport=5060. 
From: <sip:bob at 192.168.1.104>;tag=1356181947. 
To: <sip:bob at 192.168.1.104>. 
Call-ID: 2124473842-5060-1 at BJC.BGI.B.BAD. 
CSeq: 2029 REGISTER. 
Contact: <sip:bob at 192.168.1.103:5060>;reg-id=1;+sip.instance="<urn:uuid:00000000-0000-1000-8000-000B824017A0>". 
X-Grandstream-PBX: true. 
Max-Forwards: 26. 
User-Agent: Grandstream GXP2124 1.0.4.10. 
Supported: path. 
Expires: 480. 
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE. 
Content-Length: 0. 
P-hint: outbound. 
P-hint: outbound. 
P-hint: outbound. 
P-hint: outbound. 
P-hint: outbound. 
P-hint: outbound. 
P-hint: outbound. 
P-hint: outbound. 
=================================================================
anyone knows this problem? 
 



Cheers!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20140523/8a58265a/attachment-0001.htm>


More information about the Users mailing list