62 #define TDD_SPACE 1800.0
63 #define TDD_MARK 1400.0
67 static char ltrs[32] = {
'<',
'E',
'\n',
'A',
' ',
'S',
'I',
'U',
68 '\n',
'D',
'R',
'J',
'N',
'F',
'C',
'K',
69 'T',
'Z',
'L',
'W',
'H',
'Y',
'P',
'Q',
70 'O',
'B',
'G',
'^',
'M',
'X',
'V',
'^' };
71 static char figs[32] = {
'<',
'3',
'\n',
'-',
' ',
'\'',
'8',
'7',
72 '\n',
'$',
'4',
'\'',
',',
'!',
':',
'(',
73 '5',
'\"',
')',
'2',
'=',
'6',
'0',
'1',
74 '9',
'?',
'+',
'^',
'.',
'/',
';',
'^' };
107 tdd =
calloc(1,
sizeof(*tdd));
109 #ifdef INTEGER_CALLERID
155 memcpy(outbuf + pos,
ecdisa, cnt);
177 for (x = 0; x <
len; x++)
180 while (mylen >= 1320) {
184 ast_log(
LOG_ERROR,
"fsk_serial made mylen < 0 (%d) (olen was %d)\n", mylen, olen);
188 buf += (olen - mylen);
199 if ((c < 1) || (c > 126))
205 memcpy(tdd->
oldstuff, buf, mylen * 2);
228 t = *cr * dr[bit] - *ci * di[bit];
229 *ci = *cr * di[bit] + *ci * dr[bit];
232 t = 2.0 - (*cr * *cr + *ci * *ci);
238 #define PUT_BYTE(a) do { \
243 #define PUT_AUDIO_SAMPLE(y) do { \
244 int __pas_idx = (short)(rint(8192.0 * (y))); \
245 *(buf++) = AST_LIN2MU(__pas_idx); \
249 #define PUT_TDD_MARKMS do { \
251 for (x = 0; x < 8; x++) \
252 PUT_AUDIO_SAMPLE(tdd_getcarrier(&cr, &ci, 1)); \
255 #define PUT_TDD_BAUD(bit) do { \
256 while (scont < tddsb) { \
257 PUT_AUDIO_SAMPLE(tdd_getcarrier(&cr, &ci, bit)); \
263 #define PUT_TDD_STOP do { \
264 while (scont < (tddsb * 1.5)) { \
265 PUT_AUDIO_SAMPLE(tdd_getcarrier(&cr, &ci, 1)); \
268 scont -= (tddsb * 1.5); \
272 #define PUT_TDD(byte) do { \
274 unsigned char b = (byte); \
276 for (z = 0; z < 5; z++) { \
277 PUT_TDD_BAUD(b & 1); \
289 float scont = 0.0, cr = 1.0, ci=0.0;
290 while (scont < tddsb * 10.0) {
303 static unsigned char lstr[31] =
"\000E\nA SIU\rDRJNFCKTZLWHYPQOBG\000MXV";
305 static unsigned char fstr[31] =
"\0003\n- \00787\r$4',!:(5\")2\0006019?+\000./;";
311 for(x = 0; str[x]; x++) {
313 if ( (tdd->
charnum++) % 72 == 0)
318 printf(
"%c",c); fflush(stdout);
337 for (i = 0; i < 31; i++) {
349 for (i = 0; i < 31; i++) {
354 if (tdd->
mode != 1) {
Asterisk main include file. File version handling, generic pbx functions.
#define PUT_AUDIO_SAMPLE(y)
int fskmodem_init(fsk_data *fskd)
int tdd_gen_holdtone(unsigned char *outbuf)
u-Law to Signed linear conversion
int ast_tdd_gen_ecdisa(unsigned char *outbuf, int len)
static float tdd_getcarrier(float *cr, float *ci, int bit)
static unsigned char ecdisa[80]
struct tdd_state * tdd_new(void)
TTY/TDD Generation support.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
static int tdd_decode_baudot(struct tdd_state *tdd, unsigned char data)
Support for logging to various files, console and syslog Configuration in file logger.conf.
int tdd_generate(struct tdd_state *tdd, unsigned char *buf, const char *string)
void tdd_free(struct tdd_state *tdd)
int fsk_serial(fsk_data *fskd, short *buffer, int *len, int *outbyte)
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.
int tdd_feed(struct tdd_state *tdd, unsigned char *ubuf, int samples)