blob: 6958556b8e50168b807312f4545af17b5363c97f [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001#ifndef _DTMF_H_
2#define _DTMF_H_
3
4#include <stdio.h>
5#include <stdlib.h>
6#include <string.h>
7#include <assert.h>
8#include <unistd.h>
9#include <errno.h>
10#include <getopt.h>
11#include <pthread.h>
12
13//#include <glib.h>
14#include <gst/gst.h>
15
16#define DTMF_MIN_LENGTH 150 //unit: millisecond
17
18typedef void *DTMF_HANDLE;
19
20typedef struct {
21 gint output; //0-pulsesink; 1-filesink
22 char *path; //only used while output is filesink
23} DTMF_EXTRA;
24
25/**
26 * dtmf_start:
27 * @num: the event number, [0, 15]
28 * @time_ms: the length of time of the dtmf tone, must be "==0" or ">=150" (unit: millisecond)
29 * @volume: the power level of the dtmf tone, [0, 36] indicate 0~-36 dBm0
30 * @extra_info: set the extra info for dtmf library, refer to DTMF_EXTRA
31 *
32 * Start to generate DTMF tone packet and output to pulse audio.
33 * If time_ms==0; dtmf tone will not stop until dtmf_stop() API being called
34 * If time_ms>0; dtmf tone will stop automatically when the time is up.
35 *
36 * Returns: the dtmf handle
37 *
38 */
39DTMF_HANDLE dtmf_start(gint num, gint time_ms, gint volume, DTMF_EXTRA *extra);
40
41/**
42 * dtmf_stop:
43 * @handle: the dtmf handle which is got from dtmf_start() API
44 *
45 * Stop generating DTMF tone packet.
46 *
47 * Returns: N/A
48 *
49 */
50int dtmf_stop(DTMF_HANDLE handle);
51
52#endif