Hi Again,
Here is an issue with TCP connection being kept for more:
Yesterday, I have discovered that a User-Agent (<Avaya IP Phone 1120E
(SIP1120e.04.04.30.00)> tried to register a lot. It was sending REGISTER
over new established TCP socket *every 2 seconds*.
All the REGISTER was rejected with 401. (may be the device was
misconfigured? or not receiving any of my answer? I can't tell)
NOTE: You can see the expires header was very large: 86400, ie: 24 hours...
I was checking the TCP/TLS connections on my server and discovered more
than 1000 TCP established connection to that user/ip, and thus, I have
tried to understand what happened.
Checking the logs, I received 4855 REGISTER from this device from "Mar 25
03:47:09" to "Mar 25 07:56:13" which is a rate of approx one new TCP
connection every 2.5 seconds...
Today, I decided to check it again around 11am.
jack@sip:~$ sudo kamctl stats tcp
{
"jsonrpc": "2.0",
"result": [
"tcp:con_reset = 1857",
"tcp:con_timeout = 35927",
"tcp:connect_failed = 25",
"tcp:connect_success = 2",
"tcp:current_opened_connections = 2291",
"tcp:current_write_queue_size = 0",
"tcp:established = 80778",
"tcp:local_reject = 0",
"tcp:passive_open = 80776",
"tcp:send_timeout = 2",
"tcp:sendq_full = 0"
],
"id": 7305
}
There was still A LOT of established connections. And the connections have
been established more than 24 hours ago.
At 11H16:
$> lsof -n -l | grep kamailio | grep TCP | grep 41.234.242.69 | grep ESTA |
wc -l
1161
At 11H22:
$> lsof -n -l | grep kamailio | grep TCP | grep 41.234.242.69 | grep ESTA |
wc -l
1018
At 11H35:
$> lsof -n -l | grep kamailio | grep TCP | grep 41.234.242.69 | grep ESTA |
wc -l
655
At 13H
$> lsof -n -l | grep kamailio | grep TCP | grep 41.234.242.69 | grep ESTA |
wc -l
0
So the established connections are all gone now.
Between 11h16 and 11H35, I was seeing the server regularly sending [FIN,
ACK] over each TCP established connection, with retransmissions for all of
them. (no incoming trafic)
I do not have numbers/capture/stats, but I think that kamailio was already
closing some
connection yesterday. I don't know when kamailio started to try closing
those connections.
I'm now back with this status:
At 13pm:
jack@sip:~$ sudo kamctl stats tcp
{
"jsonrpc": "2.0",
"result": [
"tcp:con_reset = 1896",
"tcp:con_timeout = 38042",
"tcp:connect_failed = 26",
"tcp:connect_success = 2",
"tcp:current_opened_connections = 939",
"tcp:current_write_queue_size = 0",
"tcp:established = 81950",
"tcp:local_reject = 0",
"tcp:passive_open = 81948",
"tcp:send_timeout = 2",
"tcp:sendq_full = 0"
],
"id": 12734
}
With around 155 registration entries using TCP and TLS in my location
database.
As you can see, tcp:current_opened_connections = 939 is still pretty high
compared to
my currently registred users.
I have "modparam("registrar", "max_expires", 86400)", because I'm keeping
contact entries (even with TCP connection down) for push notifications.
I have "tcp_connection_lifetime=3600" configured.
Question 1
With "tcp_connection_lifetime=3600", I would expect kamailio to close the
established connection after 3600 seconds without traffic. It is pretty
obvious that no data has been exchanged over the 4855 established
connection during a day.
Despite the issue with the Avaya phones is solved automatically after a
day, I guess similar stuff or happening, at a different rate, for other
users as well. (because current_opened_connections is way higher than
registred TCP/TLS users)
Question 2
I can list TLS connection with "kamctl rpc tls.list"
Can I get a similar list for TCP? (lsof returns a lot of duplicates...)
Tks
Aymeric
--
Antisip - http://www.antisip.com
Hello,
I am currently debugging a strange issue related to the usage of
uac_replace_from/to() after msg_apply_changes(). It works all fine, but in a
Re-INVITE case it inserts the wrong headers for the 100 - Trying case. The
calle side gets then a reply with wrong From/To. This happens all the time
with this particular cfg.
I already checked for the usual issues:
- msg_apply_changes() called several times
- msg_apply_changes() called after transactions created/async processing etc..
Any ideas what else could be the problem?
The msg_apply_changes() is needed for some SDP filtering logic in the cfg.
Thanks and regards,
Henning
--
Henning Westerholt - https://skalatan.de/blog/
Kamailio services - https://skalatan.de/services
Hi all, i was using kamailio 4.2.1 located in 2 networks
> listen = tcp:MY_ADDR:5060 advertise MY_ADDR:5060
> listen = tls:MY_ADDR:5061 advertise PUBLIC_NAT_ADDR:5061
when the call made from the inside network to out side, running
`record_route()` resulted in 2 Record-Route headers added
(enable_double_rr=1)
Record-Route: PUBLIC_NAT_ADDR:5061;transport=tls;lr
> Record-Route: MY_ADDR;transport=tcp;lr
That was totally fine omitting the port in the first Record-Route when
using tcp (or udp) on the first realm, but when i start switching to tls,
it caused trouble
Record-Route: PUBLIC_NAT_ADDR:5061;transport=tls;lr
> Record-Route: MY_ADDR;transport=tls;lr
The client is then told to send ACK/BYE to `MY_ADDR;transport=tls` located
at `MY_ADDR:5061` as per rfc3263, then the call would failed.
I had another try with
`record_route_preset("PUBLIC_NAT_ADDR:5061;transport=tls",
"MY_ADDR:5060;transport=tls");`, it really did add what i want with
explicit 5060 port on RR, `ACK/BYE` travel on the correct path, but
`loose_route()` only consumes the local `Route` header (it should consume
2). So my assumption is to stick with `record_route()` function to make
`loose_route()` work properly.
I tried using another port on the local realm, e.g: 5062 and the port is
explicitly added to the Record-Route header `MY_ADDR:5062;transport=tls;lr`
So is `5060` couldn't be explicitly added to the inbound Record-Route, or i
just missed something?
Any help will be appreciated.
P/S: I also tried 4.4.7 and it still omit my 5060 port in the RR.
rgds,
Loi Dang Thanh
Phone : +84. 774.735.448
Email : loi.dangthanh(a)gmail.com
To whom can be of assistance,
I’m am working towards enabling presence on my Kamailio proxy but have hit a bit of a brick wall. I’m seeing dialogues being created and persisted to the database, subscriptions are being handled and rows are being written to the active_watchers table but no PUBLISH is ever being received by the server to kickoff the sending of NOTIFY to the active watchers. Further, I’m never seeing a row in the watchers table though I don’t know that this isn’t expect behavior. I’ve attached my current config for review. Any help will be greatly appreciated!
Thank in advance!
Hello,
We are working on a project that's using two active-active Kamailio 5.2
instances that redirect traffic to several Asterisk 15.4 instances.
Kamailio is acting as a registrar and should store the location information
of the registered terminals. The backend database is db_redis.
Phone terminals get registered and the information gets looked up from the
subscriber schema in redis (That's cool) but we are having problems with
the locations. This is the related code:
modparam("db_redis", "keys",
"location=entry:ruid&usrdom:username,domain&timer:partition,keepalive")
if(ds_is_from_list("1", "2", "sip:$fd:5080")) {
record_route();
route(INVITE_ASTERISK);
exit;
}
route[INVITE_ASTERISK] {
xlog("L_INFO", "[R-INVITE-RESOLVER:$ci] Entering ASTERISK INVITE
resolver\n");
if (!lookup("location")) {
sl_send_reply("404", "User Not Found");
return;
}
route(INVITE_POSTROUTE);
}
route[INVITE_POSTROUTE] {
rtpproxy_manage();
t_on_reply("MAIN_REPLY");
if(!t_relay())
sl_reply_error();
}
When looking up the location schema this errors appear:
9(39) WARNING: db_redis [redis_dbase.c:1098]: db_redis_perform_query():
performing full table scan on table 'location' while performing query
9(39) WARNING: db_redis [redis_dbase.c:1101]: db_redis_perform_query():
scan key 0 is 'expires'
9(39) WARNING: db_redis [redis_dbase.c:1101]: db_redis_perform_query():
scan key 1 is 'expires'
9(39) ERROR: <core> [db_ut.c:92]: db_str2int(): Unexpected characters:
[-03-29 18:16:36]
9(39) ERROR: <core> [db_val.c:76]: db_str2val(): error while converting
integer value from string
9(39) ERROR: db_redis [redis_dbase.c:1062]: db_redis_convert_row(): Failed
to convert redis column 'expires' to db value
9(39) ERROR: db_redis [redis_dbase.c:1231]: db_redis_perform_query():
Failed to convert redis reply for row
9(39) ERROR: db_redis [redis_dbase.c:1243]: db_redis_perform_query():
failed to perform the query
9(39) ERROR: db_redis [redis_dbase.c:1829]: db_redis_query(): failed to do
the query
9(39) ERROR: usrloc [udomain.c:981]: udomain_contact_expired_cb():
db_query failed
Any hints?
Thanks and regards,
Hi kamailios,
I meet a problem with the " kamctl alias add" command in the 5.2 version, I
saw that the module used to add an alias had changed, and now the command
result with an error :
[kamailio]# kamctl alias add XXXX@XXXX sip:XXXXX@XXXX
{
"jsonrpc": "2.0",
"error": {
"code": 500,
"message": "Not enough parameters or wrong format"
},
"id": XXXXX
}
I read the function who return this message " static void ul_rpc_add(rpc_t*
rpc, void* ctx)" in the ul_rpc.c in the usr_loc module.
I tried to pass the command with two more parameters :
# kamctl alias add 0175951068(a)trunk7.bornsip.fr
sip:0175951068@trunk7.bornsip.fr NULL NULL
{
"jsonrpc": "2.0",
"result": {
},
"id": 29200
}
And this time it works correctly, but I saw thaht the test prameters was in
the field "path" , do you know why we have to indicate a path ?
Are we obliged to indicate this two more parameters ?
What is the utility of this field ?
Thank you in advance,
Igor
recently i wrote a portion of my cfg file but i found that
i based my code in other sources and results of try/tach experiments
i cannot found the documents for the languaje of the core
i only found the link: https://www.kamailio.org/wiki/cookbooks/devel/core
but in that link there's no references about languaje per see
only about how to write portions of the file and sections..
maybe i wrong or the document are wrote in different way?
by example how to evaluate the output of a custom function/section?
Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com
h have this for a custom rule agains spoecific messages:
sl_send_reply("200", "OK");
drop();
exit;
my question are if that rules are correct:
i want to drop but send firts to client a ok response..
i mean client receive "all are ok dont worry" and then drop the rest
packets..
that's correct?
Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com
Hello guys, i'm trying to configure rtpengine, but when starting kamailio
(with an empty table) i'm getting
```build_rtpp_socks(): no more pkg memory for rtpp_socks```
Can anyone help?
Regards,
David Villasmil
email: david.villasmil.work(a)gmail.com
phone: +34669448337