[OpenSIPS-Users] SIP messages delayed
Maciej Bylica
mbsip at gazeta.pl
Tue Dec 13 17:43:02 CET 2011
Hello Vlad,
No DB, no radius is configured, so as you've mentioned sth must be
wrong with my config.
Here it is:
--------
debug=3
log_stderror=no
log_facility=LOG_LOCAL0
fork=yes
children=4
port=5060
####### Modules Section ########
#set module path
mpath="/usr/local/lib/opensips/modules/"
/* uncomment next line for MySQL DB support */
#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.so"
loadmodule "acc.so"
#loadmodule "pike.so"
/* uncomment next lines for MySQL based authentication support
NOTE: a DB (like db_mysql) module must be also loaded */
#loadmodule "auth.so"
#loadmodule "auth_db.so"
/* uncomment next line for aliases support
NOTE: a DB (like db_mysql) module must be also loaded */
#loadmodule "alias_db.so"
/* uncomment next line for multi-domain support
NOTE: a DB (like db_mysql) module must be also loaded
NOTE: be sure and enable multi-domain support in all used modules
(see "multi-module params" section ) */
#loadmodule "domain.so"
/* uncomment the next two lines for presence server support
NOTE: a DB (like db_mysql) module must be also loaded */
#loadmodule "presence.so"
#loadmodule "presence_xml.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_full_lr", 1)
# do not append from tag to the RR (no need for this script)
modparam("rr", "append_fromtag", 0)
# ----- registrar params -----
/* uncomment the next line not to allow more than 10 contacts per AOR */
#modparam("registrar", "max_contacts", 10)
# ----- usrloc params -----
#modparam("usrloc", "db_mode", 0)
/* uncomment the following lines if you want to enable DB persistency
for location entries */
#modparam("usrloc", "db_mode", 2)
#modparam("usrloc", "db_url",
# "mysql://opensips:opensipsrw@localhost/opensips")
# ----- uri params -----
modparam("uri", "use_uri_table", 0)
# ----- acc params -----
/* what sepcial events should be accounted ? */
modparam("acc", "early_media", 1)
#modparam("acc", "report_ack", 1)
modparam("acc", "report_cancels", 1)
/* by default ww do not adjust the direct of the sequential requests.
if you enable this parameter, be sure the enable "append_fromtag"
in "rr" module */
modparam("acc", "detect_direction", 0)
/* 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 -----
/* uncomment the following lines if you want to enable the DB based
authentication */
#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", "")
# ----- alias_db params -----
/* uncomment the following lines if you want to enable the DB based
aliases */
#modparam("alias_db", "db_url",
# "mysql://opensips:opensipsrw@localhost/opensips")
# ----- domain params -----
/* uncomment the following lines to enable multi-domain detection
support */
#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("auth_db|usrloc|uri", "use_domain", 1)
# ----- presence params -----
/* uncomment the following lines if you want to enable presence */
#modparam("presence|presence_xml", "db_url",
# "mysql://opensips:opensipsrw@localhost/opensips")
#modparam("presence_xml", "force_active", 1)
#modparam("presence", "server_address", "sip:192.168.1.2:5060")
#------------ pike module -----------
#modparam("pike", "sampling_time_unit", 1)
#modparam("pike", "reqs_density_per_unit", 4)
#modparam("pike", "remove_latency", 1)
#modparam("pike", "pike_log_level", 3)
#------------ ratelimit module -----------
modparam("ratelimit", "timer_interval", 5)
modparam("ratelimit", "queue", "3:INVITE")
modparam("ratelimit", "pipe", "3:RED:30")
modparam("ratelimit", "reply_code", 505)
modparam("ratelimit", "reply_reason", "SBC Limiting")
####### Routing Logic ########
# main request routing logic
route{
xlog("L_INFO","WELCOME");
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit;
}
if (is_method("REGISTER|SUBSCRIBE|MESSAGE|PUBLISH|NOTIFY|OPTIONS"))
{
sl_send_reply("403","Forbidden method");
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 {
/* uncomment the following lines if you want
to enable presence */
##if (is_method("SUBSCRIBE") && $rd ==
"your.server.ip.address") {
## # in-dialog subscribe requests
## route(2);
## exit;
##}
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;
}
}
sl_send_reply("404","Not here");
}
exit;
}
#initial requests
# CANCEL processing
if (is_method("CANCEL"))
{
if (t_check_trans())
t_relay();
exit;
}
t_check_trans();
if (loose_route()) {
xlog("L_ERR",
"Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");
if (!is_method("ACK"))
sl_send_reply("403","Preload Route denied");
exit;
}
if (!is_method("REGISTER|MESSAGE"))
record_route();
route(1);
}
route[1] {
# for INVITEs enable some additional helper routes
# if (is_method("INVITE")) {
# if (!pike_check_req()) {
# if (isflagset(10)){
# xlog("L_INFO","[INFO] ReINVITE, Call-id: $ci");
# }
# else {
# xlog("L_INFO","[DEBUG] Dropping
INVITE, Call-id: $ci, Source IP: $si");
# sl_send_reply ("403","INVITE CPS
limit reached");
# drop();
# exit;
# }
# }
#
# }
if ($si=~"^Y\.Y\.Y\.Y") {
if (!rl_check_pipe("3")) {
xlog("L_INFO","Droping INVITE from IP: $si");
rl_drop();
exit;
};
force_send_socket(udp:X2.X2.X2.X2:5060);
if (is_method("INVITE")) {
xlog("L_INFO","[INFO] incoming INVITE $si");
rewritehost("Z.Z.Z.Z");
insert_hf("X-Access-IP: $si \r\n");
}
}
if (!t_relay()) {
sl_reply_error();
};
exit;
}
branch_route[2] {
xlog("new branch at $ru\n");
}
onreply_route[2] {
xlog("incoming reply\n");
}
failure_route[1] {
if (t_was_cancelled()) {
exit;
}
}
As you may see there is modparams regarding PIKE and RATELIMIT.
This script should act as a call limiter towards Y.Y.Y.Y plus a kind
of topology hiding.
That's why i am using force_send_socket plus one of two call limiting
mechanisms RateLimit (already enabled) or PIKE (#).
Turning off RateLimit or Pike does not improve anything - sip messages
are still delayed.
Regards,
Maciej
> Hello,
>
> Seems your processes get stuck in something, thus the high amount of time
> needed to process a single message.
> From the stats, OpenSIPS says the load is 100% but if the CPU load was low,
> then it means the OpenSIPS was stuck in an IO blocking operation. If you are
> using mysql, please check out the exec_query_threshold parameter I mentioned
> in the previous emails.
>
> If no DB is involved in your cfg, can you please examine your CFG for other
> sources of IO blocking operations ( Radius, external scripts execution, etc
> ) ?
> Maybe paste the CFG here or send it to me personally so I can take a look as
> well.
>
>
> Regards,
>
> Vlad Paiu
> OpenSIPS Developer
>
>
> On 12/12/2011 06:33 PM, Maciej Bylica wrote:
>>
>> Hello,
>>
>> Here is an output from opensips.log file
>> =rtpmap:0 PCMU/8000 087637 IN IP4 127.0.0.16SIPpTag002:
>> WARNING:core:log_expiry: threshold exceeded : msg processing took too
>> long - 309013 us.Source : INVITE sip:222221133 at X1.X1.X1.X1:5060
>> SIP/2.0
>> =rtpmap:0 PCMU/8000 087637 IN IP4 127.0.0.16SIPpTag0017
>> WARNING:core:log_expiry: threshold exceeded : msg processing took too
>> long - 927067 us.Source : INVITE sip:222221133 at X1.X1.X1.X1:5060
>> SIP/2.0
>> =rtpmap:0 PCMU/8000 087637 IN IP4 127.0.0.16SIPpTag0013
>> WARNING:core:log_expiry: threshold exceeded : msg processing took too
>> long - 300760 us.Source : INVITE sip:222221133 at X1.X1.X1.X1:5060
>> SIP/2.0
>> =rtpmap:0 PCMU/8000 087637 IN IP4 127.0.0.16SIPpTag003:
>> WARNING:core:log_expiry: threshold exceeded : msg processing took too
>> long - 267328 us.Source : INVITE sip:222221133 at X1.X1.X1.X1:5060
>> SIP/2.0
>> =rtpmap:0 PCMU/8000 087637 IN IP4 127.0.0.16SIPpTag0018
>> WARNING:core:log_expiry: threshold exceeded : msg processing took too
>> long - 860686 us.Source : INVITE sip:222221133 at X1.X1.X1.X1:5060
>> SIP/2.0
>> =rtpmap:0 PCMU/8000 087637 IN IP4 127.0.0.16SIPpTag0014
>> WARNING:core:log_expiry: threshold exceeded : msg processing took too
>> long - 284254 us.Source : INVITE sip:222221133 at X1.X1.X1.X1:5060
>> SIP/2.0
>>
>> Core parameters were as follows:
>> exec_dns_threshold=60000
>> exec_msg_threshold=60000
>>
>> What is more number of awaken processes were as below:
>> opensipsctl fifo get_statistics udp:X1.X1.X1.X1:5060-load
>> load:udp:X1.X1.X1.X1:5060-load = 100
>> opensipsctl fifo get_statistics udp:X1.X1.X1.X1:5060-load
>> load:udp:X1.X1.X1.X14:5060-load = 100
>> opensipsctl fifo get_statistics udp:X1.X1.X1.X1:5060-load
>> load:udp:X1.X1.X1.X1:5060-load = 100
>> opensipsctl fifo get_statistics udp:X1.X1.X1.X1:5060-load
>> load:udp:X1.X1.X1.X1:5060-load = 100
>> opensipsctl fifo get_statistics udp:X1.X1.X1.X1:5060-load
>> load:udp:X1.X1.X1.X1:5060-load = 25
>> opensipsctl fifo get_statistics udp:X1.X1.X1.X1:5060-load
>> load:udp:X1.X1.X1.X1:5060-load = 0
>>
>> CPS was more less four, so quite low.
>>
>> Where the problem might be located? :(
>>
>> Thanks,
>> Maciej
>>
>>> Hello,
>>>
>>> First of all, i am sorry for long delay - i was unable to keep on
>>> working on this.
>>> Thank You for your replies.
>>>
>>> Logan: there is no DB back end at all in my configuration.
>>> It is not necessery for me and as you mentioned could cause delays.
>>>
>>> Vlad: i was trying to specify only IP addresses and omit dns names,
>>> the after effect was exactly the same.
>>> But i am about to proceed with core parameters as you described and
>>> give you feedback here.
>>>
>>> Thanks,
>>> Maciej
>>>
>>>> Hello,
>>>>
>>>> Try to use the exec_dns_threshold [1] and the exec_msg_threshold [2]
>>>> core
>>>> parameters, as well as the exec_query_threshold parameter in the
>>>> db_mysql
>>>> module to try and see which component is determining the delay ( whether
>>>> it's the DNS, MySQL or some other things in your config ).
>>>>
>>>> [1] http://www.opensips.org/Resources/DocsCoreFcn#toc49
>>>> [2] http://www.opensips.org/Resources/DocsCoreFcn#toc50
>>>> [3]
>>>> http://www.opensips.org/html/docs/modules/devel/db_mysql.html#id249058
>>>>
>>>> Regards,
>>>>
>>>> Vlad Paiu
>>>> OpenSIPS Developer
>>>>
>>>>
>>>>
>>>> On 12/02/2011 09:13 PM, logan wrote:
>>>>>
>>>>> Are you using a DB back end for ACC? If so which one? I've seen
>>>>> instances
>>>>> where using MySQL under heavy load w/o optimizing your mysql config can
>>>>> cause messages to hang in OpenSIPs while it's waiting for a mysql
>>>>> resource
>>>>> to write down its existing ACC or Missed_Call records.
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>>
>>>>> http://opensips-open-sip-server.1449251.n2.nabble.com/SIP-messages-delayed-tp7054793p7055831.html
>>>>> Sent from the OpenSIPS - Users mailing list archive at Nabble.com.
>>>>>
>>>>> _______________________________________________
>>>>> Users mailing list
>>>>> Users at lists.opensips.org
>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>
>>>>
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at lists.opensips.org
>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
More information about the Users
mailing list