some more log statements

This commit is contained in:
Harald Welte 2022-10-16 18:35:42 +02:00
parent 246242822c
commit 86f3a66089
2 changed files with 18 additions and 3 deletions

View File

@ -319,11 +319,16 @@ static int isdntap_q931_rx(struct isdntap_line *line, bool net2user, const uint8
/* now we know the exact B channel used */
/* start B-channel capturing */
ts_b = get_bchan_ts(line, &cstate->chan_id);
if (!ts_b)
if (!ts_b) {
LOGPLI(line, DITAP, LOGL_ERROR,
"Cannot resolve TS for Channel ID\n");
break;
}
rc = line->driver->ts_open(ts_b);
if (rc < 0)
if (rc < 0) {
LOGPTS(ts_b, DITAP, LOGL_ERROR, "Cannot open B-channel\n");
break;
}
char strbuf[256];
gen_chan_label(strbuf, sizeof(strbuf), cstate);
@ -396,6 +401,7 @@ int isdntap_ts_rx_dchan(struct isdntap_ts *ts, const uint8_t *buf, size_t len, b
(is_rx && !ts->line->local_side_is_network))
net2user = true;
LOGPTS(ts, DLINP, LOGL_DEBUG, "%s %s\n", is_rx ? "Rx" : "Tx", osmo_hexdump(buf, len));
isdntap_q921_rx(ts->line, net2user, buf, len);
return 0;
}
@ -438,7 +444,7 @@ static int isdntap_open_file(struct isdntap_ts *ts, const char *call_label, cons
return rc;
}
LOGP(DITAP, LOGL_INFO, "Opened file %s\n", buf);
LOGPTS(ts, DITAP, LOGL_INFO, "Opened file %s\n", buf);
return rc;
}
@ -446,6 +452,8 @@ int isdntap_ts_start_bchan(struct isdntap_ts *ts, const char *call_label)
{
int fd_rx, fd_tx;
LOGPTS(ts, DITAP, LOGL_INFO, "Starting B-channel recording %s\n", call_label);
osmo_wqueue_init(&ts->output.file.tx, 100);
fd_tx = isdntap_open_file(ts, call_label, "tx");
if (fd_tx < 0)
@ -472,6 +480,7 @@ out_cleanup_tx:
void isdntap_ts_stop_bchan(struct isdntap_ts *ts)
{
LOGPTS(ts, DITAP, LOGL_INFO, "Stopping B-channel recording\n");
/* FIXME: ideally we'd make sure that the write queues are both fully flushed first */
if (ts->output.file.tx.bfd.fd >= 0) {

View File

@ -32,3 +32,9 @@ enum {
};
extern const struct log_info log_info;
#define LOGPLI(li, ss, lvl, fmt, args...) \
LOGP(ss, lvl, "(%s) " fmt, (li)->name, ## args)
#define LOGPTS(ts, ss, lvl, fmt, args...) \
LOGP(ss, lvl, "(%s:%u) " fmt, (ts)->line->name, (ts)->num, ## args)