diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2013-05-23 10:25:21 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2013-06-04 13:43:30 +0200 |
commit | 3bb2a91cd86e26ee254ed3d013c27e7689c87ef2 (patch) | |
tree | 68150257f29ad6a77e0864598e3c78d78d140fc5 /src | |
parent | a26e6173b106b9430a847ae1e64c45dc5b5c0d78 (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/mgcp_ss7.c | 14 |
1 files changed, 14 insertions, 0 deletions
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) { |