61 #define TDD_SPACE 1800.0 62 #define TDD_MARK 1400.0 66 static char ltrs[32] = {
'<',
'E',
'\n',
'A',
' ',
'S',
'I',
'U',
67 '\n',
'D',
'R',
'J',
'N',
'F',
'C',
'K',
68 'T',
'Z',
'L',
'W',
'H',
'Y',
'P',
'Q',
69 'O',
'B',
'G',
'^',
'M',
'X',
'V',
'^' };
70 static char figs[32] = {
'<',
'3',
'\n',
'-',
' ',
'\'',
'8',
'7',
71 '\n',
'$',
'4',
'\'',
',',
'!',
':',
'(',
72 '5',
'\"',
')',
'2',
'=',
'6',
'0',
'1',
73 '9',
'?',
'+',
'^',
'.',
'/',
';',
'^' };
108 #ifdef INTEGER_CALLERID 154 memcpy(outbuf + pos,
ecdisa, cnt);
176 for (x = 0; x <
len; x++)
179 while (mylen >= 1320) {
183 ast_log(
LOG_ERROR,
"fsk_serial made mylen < 0 (%d) (olen was %d)\n", mylen, olen);
187 buf += (olen - mylen);
198 if ((c < 1) || (c > 126))
204 memcpy(tdd->
oldstuff, buf, mylen * 2);
227 t = *cr *
dr[bit] - *ci *
di[bit];
228 *ci = *cr * di[bit] + *ci *
dr[bit];
231 t = 2.0 - (*cr * *cr + *ci * *ci);
237 #define PUT_BYTE(a) do { \ 242 #define PUT_AUDIO_SAMPLE(y) do { \ 243 int __pas_idx = (short)(rint(8192.0 * (y))); \ 244 *(buf++) = AST_LIN2MU(__pas_idx); \ 248 #define PUT_TDD_MARKMS do { \ 250 for (x = 0; x < 8; x++) \ 251 PUT_AUDIO_SAMPLE(tdd_getcarrier(&cr, &ci, 1)); \ 254 #define PUT_TDD_BAUD(bit) do { \ 255 while (scont < tddsb) { \ 256 PUT_AUDIO_SAMPLE(tdd_getcarrier(&cr, &ci, bit)); \ 262 #define PUT_TDD_STOP do { \ 263 while (scont < (tddsb * 1.5)) { \ 264 PUT_AUDIO_SAMPLE(tdd_getcarrier(&cr, &ci, 1)); \ 267 scont -= (tddsb * 1.5); \ 271 #define PUT_TDD(byte) do { \ 273 unsigned char b = (byte); \ 275 for (z = 0; z < 5; z++) { \ 276 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) {
void tdd_free(struct tdd_state *tdd)
Asterisk main include file. File version handling, generic pbx functions.
int tdd_gen_holdtone(unsigned char *buf)
Time-related functions and macros.
#define PUT_AUDIO_SAMPLE(y)
int tdd_feed(struct tdd_state *tdd, unsigned char *ubuf, int len)
int fskmodem_init(fsk_data *fskd)
int ast_tdd_gen_ecdisa(unsigned char *outbuf, int len)
u-Law to Signed linear conversion
static float tdd_getcarrier(float *cr, float *ci, int bit)
static unsigned char ecdisa[80]
TTY/TDD Generation support.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
int tdd_generate(struct tdd_state *tdd, unsigned char *buf, const char *str)
static int tdd_decode_baudot(struct tdd_state *tdd, unsigned char data)
#define ast_calloc(num, len)
A wrapper for calloc()
Support for logging to various files, console and syslog Configuration in file logger.conf.
struct tdd_state * tdd_new(void)
int fsk_serial(fsk_data *fskd, short *buffer, int *len, int *outbyte)