The client uses the TLS protocol registered and TCP Connection established . There is a
problem now, sending message KSR.uac.uac_req_send() from the kamilio server to client
failed sometimes,and the error is as follows:
“2023-09-04T17:22:01.515763+08:00 (3429) ERROR: tm [../../core/forward.h:292]:
msg_send_buffer(): tcp_send failed
2023-09-04T17:22:01.515763+08:00 (3429) ERROR: tm [uac.c:678]:
send_prepared_request_impl(): Attempt to send to precreated request failed ”. meantime,
the client sending message to Kamalio server succeded, and the register status and tcp
connection is normal.
After 30s, obtained the $uac_req(evcode) from the event_route[uac:reply] is 408.After
this error appears, all the messages sent to this client are 408.
"
2023-08-29T03:48:43.738152+08:00 (3349) NOTICE: <script>: ===uac reply received,
callid = 0B6ECB534AE24281AED9BBBC56B140A6`yangwang2`1693252093, code is: 408
2023-08-29T03:48:43.738825+08:00 (3349) NOTICE: <script>: ===uac reply received,
callid = 0B6ECB534AE24281AED9BBBC56B140A6`yangwang2`1693252093, code is: 408
"
But from other information, the TCP connection is normal. Because from Kamailio to
querying this user's Location, it has not changed all day. The client sends messages
is also normal. That is, the user's registration and sending messages can receive 200
OK.
We use netstat commands to view the user's TCP connection information on the client
and server, and the connection status is also normal.The status of the corresponding port
of the TCP connection is ESTABLISHED.
client:
netstat -ano | findstr 49957
"172. 17. 47.125:49957 XXX.96.XXX.XXX:5061 ESTABLISHED 10516"
server:
"tcp 0 0 10.11.xx.xx:5061 xxx.xxx.xxx.xxx:49957 ESTABLISHED 3467/kamailio"
This client is normal after logging in, and the problem that occurs after a period of
use (maybe some hours), and once it occurs, it fails until the user creates a new
connection and logs back in. Not all users will appear.
Why is this the case? The socket connection is fine, but uac_req_send () get an ERROR?
I found a problem from the log file. Is it caused by duplicate callids pushed to the
same user at the same second?
Looking forward to your answer, thank you very much
Script information that may be required
kamailio.cfg : tm mode
# ----- tm params -----
# auto-discard branches from previous serial forking leg
modparam("tm", "failure_reply_mode", 3)
# default retransmission timeout: 30sec
modparam("tm", "fr_timer", 30000)
# default invite retransmission timeout after 1xx: 120sec
modparam("tm", "fr_inv_timer", 120000)
modparam("tm", "auto_inv_100", 1)
kamalio.lua uac_req_send()
" --uac_req_send 推送给终端
KSR.pv.sets("$uac_req(hdrs)", hdrs)
KSR.pv.sets("$uac_req(method)", "MESSAGE")
KSR.pv.sets("$uac_req(ruri)", "sip:" .. to .. "@" ..
KAM_DOMAIN)
KSR.pv.sets("$uac_req(furi)", "sip:" .. from .. "@" ..
KAM_DOMAIN)
KSR.pv.sets("$uac_req(turi)", "sip:" .. to .. "@" ..
KAM_DOMAIN)
KSR.pv.seti("$uac_req(evroute)", 1)
KSR.pv.sets("$uac_req(body)", content)
local ouri = (row.received ~= "" and row.received) or row.contact
KSR.pv.sets("$uac_req(ouri)", ouri)
local callid = rows[i].clientid .. "`" .. rows[i].username .. "`" ..
os.time()
KSR.pv.sets("$uac_req(callid)", callid)
KSR.uac.uac_req_send()