view mgw/dtmf_table.c @ 128:5685412bd6aa

sip-in: pass DTMF start & stop to themwi-mgw
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 01 Oct 2022 23:07:01 -0800
parents 815e4c59162e
children
line wrap: on
line source

/*
 * This module holds the table of all possible DTMF tones we can generate.
 */

#include <math.h>
#include <stdint.h>
#include "dtmf_defs.h"

#define	FREQ_697	(M_PI * 697.0 / 4000.0)
#define	FREQ_770	(M_PI * 770.0 / 4000.0)
#define	FREQ_852	(M_PI * 852.0 / 4000.0)
#define	FREQ_941	(M_PI * 941.0 / 4000.0)
#define	FREQ_1209	(M_PI * 1209.0 / 4000.0)
#define	FREQ_1336	(M_PI * 1336.0 / 4000.0)
#define	FREQ_1477	(M_PI * 1477.0 / 4000.0)
#define	FREQ_1633	(M_PI * 1633.0 / 4000.0)

struct dtmf_desc dtmf_table[] = {
	{'1', FREQ_697, FREQ_1209},
	{'2', FREQ_697, FREQ_1336},
	{'3', FREQ_697, FREQ_1477},
	{'A', FREQ_697, FREQ_1633},
	{'4', FREQ_770, FREQ_1209},
	{'5', FREQ_770, FREQ_1336},
	{'6', FREQ_770, FREQ_1477},
	{'B', FREQ_770, FREQ_1633},
	{'7', FREQ_852, FREQ_1209},
	{'8', FREQ_852, FREQ_1336},
	{'9', FREQ_852, FREQ_1477},
	{'C', FREQ_852, FREQ_1633},
	{'*', FREQ_941, FREQ_1209},
	{'0', FREQ_941, FREQ_1336},
	{'#', FREQ_941, FREQ_1477},
	{'D', FREQ_941, FREQ_1633},
	/* table search terminator */
	{0, 0, 0}
};