aboutsummaryrefslogtreecommitdiffstats
path: root/src/mgcp_ss7.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-05-21 17:16:24 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2013-05-21 17:51:31 +0200
commit5d76e957fe8916d234e68ec2786febf13b4dde47 (patch)
tree5fa09e2481adec787ebe331fe1833ea0dac75266 /src/mgcp_ss7.c
parent68d5114638ff4d89bc9c8e4b4280e16bfb1bb9e8 (diff)
dtmf: Make the API more robust and avoid inconsistencies
Because of the issue parsing the MGCP request a '\0' was added to the queue. This lead to the dtmf scheduler believing that a play was in progress while the playing code didn't play anything. This lead to the queue to be stuck and nothing being played at all. Return the number of tones that should be played and stop using strlen on the tones.
Diffstat (limited to 'src/mgcp_ss7.c')
-rw-r--r--src/mgcp_ss7.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mgcp_ss7.c b/src/mgcp_ss7.c
index e4d8799..3490a9a 100644
--- a/src/mgcp_ss7.c
+++ b/src/mgcp_ss7.c
@@ -74,18 +74,19 @@ static void play_pending_tones(struct mgcp_endpoint *endp)
{
ToneGenerationT toneGeneration;
char tones[25];
+ size_t len;
/* Check if we need to play anything? */
- dtmf_state_get_pending(&endp->dtmf_state, tones);
+ len = dtmf_state_get_pending(&endp->dtmf_state, tones);
/* nothing to play? */
- if (strlen(tones) == 0)
+ if (len == 0)
return;
/* fill out the data now */
osmo_static_assert(sizeof(tones) <= sizeof(toneGeneration.list), Enough_space_for_tones);
memset(&toneGeneration, 0, sizeof(toneGeneration));
- toneGeneration.count = strlen(tones);
+ toneGeneration.count = len;
strcpy(toneGeneration.list, tones);
MtnSaSetMOB(endp->audio_port, ChannelType_PORT,
PredefMob_C_TONE_GENERATION, (char *) &toneGeneration,