aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-05-21 17:14:12 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2013-05-21 17:14:12 +0200
commit68d5114638ff4d89bc9c8e4b4280e16bfb1bb9e8 (patch)
treecef3d3e0aabe44ee835253ff704d4559435d5642
parent72793ec0a9e2f79b5caf2a4af37f47cc127db55a (diff)
dtmf: Improve the log message and print the number of messages queued
Print the number of log messages that are queued in the error message.
-rw-r--r--include/dtmf_scheduler.h2
-rw-r--r--src/dtmf_scheduler.c5
-rw-r--r--src/mgcp_ss7.c10
3 files changed, 13 insertions, 4 deletions
diff --git a/include/dtmf_scheduler.h b/include/dtmf_scheduler.h
index 22a4e55..a902466 100644
--- a/include/dtmf_scheduler.h
+++ b/include/dtmf_scheduler.h
@@ -22,4 +22,6 @@ void dtmf_state_get_pending(struct dtmf_state *state, char *tones);
/* call when the playout is done */
void dtmf_state_played(struct dtmf_state *state);
+unsigned int dtmf_tones_queued(struct dtmf_state *state);
+
#endif
diff --git a/src/dtmf_scheduler.c b/src/dtmf_scheduler.c
index 26dc090..a344e76 100644
--- a/src/dtmf_scheduler.c
+++ b/src/dtmf_scheduler.c
@@ -57,3 +57,8 @@ void dtmf_state_played(struct dtmf_state *state)
{
state->playing = 0;
}
+
+unsigned int dtmf_tones_queued(struct dtmf_state *state)
+{
+ return state->size;
+}
diff --git a/src/mgcp_ss7.c b/src/mgcp_ss7.c
index f23dab5..e4d8799 100644
--- a/src/mgcp_ss7.c
+++ b/src/mgcp_ss7.c
@@ -97,10 +97,12 @@ static void send_dtmf(struct mgcp_endpoint *mgw_endp, int ascii_tone)
int rc;
rc = dtmf_state_add(&mgw_endp->dtmf_state, ascii_tone);
if (rc != 0) {
- fprintf(stderr, "DTMF queue too long on 0x%x\n",
- ENDPOINT_NUMBER(mgw_endp));
- syslog(LOG_ERR, "DTMF queue too long on 0x%x\n",
- ENDPOINT_NUMBER(mgw_endp));
+ fprintf(stderr, "DTMF queue too long on 0x%x with %u tones\n",
+ ENDPOINT_NUMBER(mgw_endp),
+ dtmf_tones_queued(&mgw_endp->dtmf_state));
+ syslog(LOG_ERR, "DTMF queue too long on 0x%x with %u tones\n",
+ ENDPOINT_NUMBER(mgw_endp),
+ dtmf_tones_queued(&mgw_endp->dtmf_state));
return;
}