UniMRCP  1.7.0
Typedefs | Enumerations | Functions
mpf_dtmf_detector.h File Reference

DTMF detector. More...

#include "apr.h"
#include "apr_pools.h"
#include "apt.h"
#include "mpf_frame.h"
#include "mpf_stream.h"
Include dependency graph for mpf_dtmf_detector.h:

Go to the source code of this file.

Typedefs

typedef APT_BEGIN_EXTERN_C enum mpf_dtmf_detector_band_e mpf_dtmf_detector_band_e
 
typedef struct mpf_dtmf_detector_t mpf_dtmf_detector_t
 

Enumerations

enum  mpf_dtmf_detector_band_e { MPF_DTMF_DETECTOR_INBAND = 0x1, MPF_DTMF_DETECTOR_OUTBAND = 0x2, MPF_DTMF_DETECTOR_BOTH = MPF_DTMF_DETECTOR_INBAND | MPF_DTMF_DETECTOR_OUTBAND }
 

Functions

struct mpf_dtmf_detector_tmpf_dtmf_detector_create_ex (const struct mpf_audio_stream_t *stream, enum mpf_dtmf_detector_band_e band, struct apr_pool_t *pool)
 
char mpf_dtmf_detector_digit_get (struct mpf_dtmf_detector_t *detector)
 
apr_size_t mpf_dtmf_detector_digits_lost (const struct mpf_dtmf_detector_t *detector)
 
void mpf_dtmf_detector_reset (struct mpf_dtmf_detector_t *detector)
 
void mpf_dtmf_detector_get_frame (struct mpf_dtmf_detector_t *detector, const struct mpf_frame_t *frame)
 
void mpf_dtmf_detector_destroy (struct mpf_dtmf_detector_t *detector)
 

Detailed Description

DTMF detector.

Detector of DTMF tones sent both out-of-band (RFC4733) and in-band (audio).

Typedef Documentation

◆ mpf_dtmf_detector_band_e

DTMF detector band

◆ mpf_dtmf_detector_t

Opaque MPF DTMF detector structure definition

Enumeration Type Documentation

◆ mpf_dtmf_detector_band_e

DTMF detector band

Enumerator
MPF_DTMF_DETECTOR_INBAND 

Detect tones in-band

MPF_DTMF_DETECTOR_OUTBAND 

Detect named events out-of-band

MPF_DTMF_DETECTOR_BOTH 

Detect both in-band and out-of-band digits

Function Documentation

◆ mpf_dtmf_detector_create_ex()

struct mpf_dtmf_detector_t* mpf_dtmf_detector_create_ex ( const struct mpf_audio_stream_t stream,
enum mpf_dtmf_detector_band_e  band,
struct apr_pool_t *  pool 
)

Create MPF DTMF detector (advanced).

Parameters
streamA stream to get digits from.
bandOne of:
  • MPF_DTMF_DETECTOR_INBAND: detect audible tones only
  • MPF_DTMF_DETECTOR_OUTBAND: detect out-of-band named-events only
  • MPF_DTMF_DETECTOR_BOTH: detect digits in both bands if supported by stream. When out-of-band digit arrives, in-band detection is turned off.
poolMemory pool to allocate DTMF detector from.
Returns
The object or NULL on error.
See also
mpf_dtmf_detector_create

◆ mpf_dtmf_detector_destroy()

void mpf_dtmf_detector_destroy ( struct mpf_dtmf_detector_t detector)

Free all resources associated with the detector.

Parameters
detectorThe detector.

◆ mpf_dtmf_detector_digit_get()

char mpf_dtmf_detector_digit_get ( struct mpf_dtmf_detector_t detector)

Get DTMF digit from buffer of digits detected so far and remove it.

Parameters
detectorThe detector.
Returns
DTMF character [0-9*#A-D] or NUL if the buffer is empty.

◆ mpf_dtmf_detector_digits_lost()

apr_size_t mpf_dtmf_detector_digits_lost ( const struct mpf_dtmf_detector_t detector)

Retrieve how many digits was lost due to full buffer.

Parameters
detectorThe detector.
Returns
Number of lost digits.

◆ mpf_dtmf_detector_get_frame()

void mpf_dtmf_detector_get_frame ( struct mpf_dtmf_detector_t detector,
const struct mpf_frame_t frame 
)

Detect DTMF digits in the frame.

Parameters
detectorThe detector.
frameFrame object passed in stream_write().

◆ mpf_dtmf_detector_reset()

void mpf_dtmf_detector_reset ( struct mpf_dtmf_detector_t detector)

Empty the buffer and reset detection states.

Parameters
detectorThe detector.