From 3bb2a91cd86e26ee254ed3d013c27e7689c87ef2 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 23 May 2013 10:25:21 +0200 Subject: [PATCH] dtmf: Add tone detection to the event handling We get a trap for detected tones and then need to query them. Print the detected characters for now and do not forward them yet. --- src/mgcp_ss7.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/mgcp_ss7.c b/src/mgcp_ss7.c index 017bb8e..c4a1d34 100644 --- a/src/mgcp_ss7.c +++ b/src/mgcp_ss7.c @@ -273,6 +273,10 @@ static int uniporte_events(unsigned long port, EventTypeT event, } dtmf_state_played(&endp->dtmf_state); play_pending_tones(endp); + } else if (info->trapId == Trap_TONES_DETECTED) { + sprintf(text, "TONE DETECTED on #%ld", port); + puts(text); + MtnSaGetMOB(port, ChannelType_PORT, PredefMob_S_TONE_DETECTION, 1, 1); } } else if ( event == Event_MANAGED_OBJECT_SET_COMPLETE ) { @@ -299,6 +303,16 @@ static int uniporte_events(unsigned long port, EventTypeT event, sprintf( text, "Mob ID %d status %d", info->MOBId, info->status ); puts(text); check_exit(text, info->status); + + if (info->MOBId == PredefMob_S_TONE_DETECTION) { + int i; + ToneDetectionPtr tones; + + tones = (ToneDetectionPtr)info->buffer; + for (i = 0; i < tones->count; ++i) + printf("Port %ld detected tone '%c'\n", + port, tones->list[i]); + } } else if (event == Event_CONNECT) {