Skip to content

Commit 167d021

Browse files
committed
TELECOM-11605: Add extra logs
1 parent e39ce12 commit 167d021

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

modules/tm/async.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,10 @@ int t_handle_async(struct sip_msg *msg, struct action* a,
320320
}
321321

322322
if (route_type!=REQUEST_ROUTE) {
323-
LM_WARN("async detected in non-request route, switching to sync\n");
323+
LM_WARN("async detected in non-request route, switching to sync (extra debug info: Call-Id: %.*s, User-Agent: %.*s)\n",
324+
(msg->callid ? msg->callid->body.len : 3), (msg->callid ? msg->callid->body.s : "N/A"),
325+
(msg->user_agent ? msg->user_agent->body.len : 3), (msg->user_agent ? msg->user_agent->body.s : "N/A")
326+
);
324327
goto sync;
325328
}
326329

receive.c

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,29 @@ int receive_msg(char* buf, unsigned int len, struct receive_info* rcv_info,
287287
end:
288288
reset_global_context();
289289

290-
__stop_expire_timer( start, execmsgthreshold, "msg processing",
291-
msg->buf, msg->len, 0, slow_msgs);
290+
if (msg) {
291+
const char *fmt = "(extra debug info: Call-Id: %.*s, User-Agent: %.*s)";
292+
293+
int callid_len = (msg->callid ? msg->callid->body.len : 3);
294+
const char *callid_str = (msg->callid ? msg->callid->body.s : "N/A");
295+
296+
int ua_len = (msg->user_agent ? msg->user_agent->body.len : 3);
297+
const char *ua_str = (msg->user_agent ? msg->user_agent->body.s : "N/A");
298+
299+
int size = strlen(fmt) - 8 + callid_len + ua_len + 1;
300+
301+
char *buf = pkg_malloc(size);
302+
if (buf) {
303+
snprintf(buf, size, fmt, callid_len, callid_str, ua_len, ua_str);
304+
__stop_expire_timer(start, execmsgthreshold, "msg processing",
305+
buf, size, 0, slow_msgs);
306+
pkg_free(buf);
307+
} else {
308+
__stop_expire_timer(start, execmsgthreshold, "msg processing",
309+
NULL, 0, 0, slow_msgs);
310+
}
311+
}
312+
292313
reset_longest_action_list(execmsgthreshold);
293314

294315
/* free possible loaded avps -bogdan */

ut.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1370,7 +1370,7 @@ static inline void log_expiry(int time_diff,int expire,
13701370
tcp_timeout_con_get;
13711371
} else
13721372
LM_WARN("threshold exceeded : %s took too long - %d us."
1373-
"Source : %.*s\n",func_info,time_diff,dbg_len,redact_pii(extra_dbg));
1373+
"Source : %.*s\n",func_info,time_diff,dbg_len,(strncmp(func_info, "msg", 3) == 0 ? extra_dbg : redact_pii(extra_dbg)));
13741374

13751375
if (memcmp(func_info,"msg",3) == 0) {
13761376
for (i=0;i<LONGEST_ACTION_SIZE;i++) {

0 commit comments

Comments
 (0)