Asterisk - The Open Source Telephony Project
18.5.0
|
TTY/TDD Generation support. More...
#include "asterisk.h"
#include <time.h>
#include <math.h>
#include <ctype.h>
#include "asterisk/logger.h"
#include "asterisk/ulaw.h"
#include "asterisk/tdd.h"
#include "asterisk/fskmodem.h"
#include "asterisk/utils.h"
#include "ecdisa.h"
Go to the source code of this file.
Data Structures | |
struct | tdd_state |
Macros | |
#define | PUT_AUDIO_SAMPLE(y) |
#define | PUT_BYTE(a) |
#define | PUT_TDD(byte) |
#define | PUT_TDD_BAUD(bit) |
#define | PUT_TDD_MARKMS |
#define | PUT_TDD_STOP |
#define | TDD_MARK 1400.0 /* 1400 hz for "1" */ |
#define | TDD_SPACE 1800.0 /* 1800 hz for "0" */ |
Functions | |
int | ast_tdd_gen_ecdisa (unsigned char *outbuf, int len) |
static int | tdd_decode_baudot (struct tdd_state *tdd, unsigned char data) |
int | tdd_feed (struct tdd_state *tdd, unsigned char *ubuf, int len) |
void | tdd_free (struct tdd_state *tdd) |
int | tdd_gen_holdtone (unsigned char *buf) |
int | tdd_generate (struct tdd_state *tdd, unsigned char *buf, const char *str) |
static float | tdd_getcarrier (float *cr, float *ci, int bit) |
void | tdd_init (void) |
struct tdd_state * | tdd_new (void) |
Variables | |
static float | di [4] |
static float | dr [4] |
static float | tddsb = 176.0 |
TTY/TDD Generation support.
Definition in file tdd.c.
#define PUT_AUDIO_SAMPLE | ( | y | ) |
Definition at line 242 of file tdd.c.
Referenced by tdd_gen_holdtone().
#define PUT_BYTE | ( | a | ) |
#define PUT_TDD | ( | byte | ) |
Definition at line 271 of file tdd.c.
Referenced by tdd_generate().
#define PUT_TDD_MARKMS |
#define TDD_MARK 1400.0 /* 1400 hz for "1" */ |
Definition at line 62 of file tdd.c.
Referenced by tdd_init().
#define TDD_SPACE 1800.0 /* 1800 hz for "0" */ |
Definition at line 61 of file tdd.c.
Referenced by tdd_init().
int ast_tdd_gen_ecdisa | ( | unsigned char * | outbuf, |
int | len | ||
) |
Generate Echo Canceller disable tone (2100HZ)
outbuf | This is the buffer to receive the tone data |
len | This is the length (in samples) of the tone data to generate Returns 0 if no error, and -1 if error. |
Definition at line 148 of file tdd.c.
References ecdisa, len(), and tdd_state::pos.
Referenced by dahdi_setoption().
|
static |
int tdd_feed | ( | struct tdd_state * | tdd, |
unsigned char * | ubuf, | ||
int | samples | ||
) |
Read samples into the state machine, and return character (if any).
tdd | Which state machine to act upon |
ubuf | containing your samples |
samples | number of samples contained within the buffer. |
Send received audio to the TDD demodulator. Returns -1 on error, 0 for "needs more samples", and > 0 (the character) if reception of a character is complete.
Definition at line 161 of file tdd.c.
References ast_calloc, ast_free, ast_log, AST_MULAW, b, buf, c, fsk_serial(), tdd_state::fskd, len(), LOG_ERROR, LOG_NOTICE, LOG_WARNING, tdd_state::mode, tdd_state::oldlen, tdd_state::oldstuff, and tdd_decode_baudot().
Referenced by dahdi_read().
void tdd_free | ( | struct tdd_state * | tdd | ) |
Free a TDD state machine
Definition at line 218 of file tdd.c.
References ast_free.
Referenced by dahdi_setoption().
int tdd_gen_holdtone | ( | unsigned char * | buf | ) |
Generate TDD hold tone
outbuf,buf | Result buffer |
Definition at line 286 of file tdd.c.
References PUT_AUDIO_SAMPLE, tdd_getcarrier(), and tddsb.
int tdd_generate | ( | struct tdd_state * | tdd, |
unsigned char * | buf, | ||
const char * | string | ||
) |
Generates a CallerID FSK stream in ulaw format suitable for transmission.
tdd | tdd structure |
buf | Buffer to use. This needs to be large enough to accomodate all the generated samples. |
string | This is the string to send. This function creates a stream of TDD data in ulaw format. It returns the size (in bytes) of the data (if it returns a size of 0, there is probably an error) |
Baudot letters
Baudot figures
Definition at line 297 of file tdd.c.
References c, tdd_state::charnum, tdd_state::mode, and PUT_TDD.
Referenced by dahdi_sendtext().
|
inlinestatic |
void tdd_init | ( | void | ) |
struct tdd_state* tdd_new | ( | void | ) |
Create a TDD state machine This function returns a malloc'd instance of the tdd_state data structure. Returns a pointer to a malloc'd tdd_state structure, or NULL on error.
Definition at line 103 of file tdd.c.
References ast_calloc, ast_log, fsk_data::bw, tdd_state::charnum, fsk_data::cont, fsk_data::f_mark_idx, fsk_data::f_space_idx, tdd_state::fskd, fskmodem_init(), fsk_data::hdlc, fsk_data::instop, fsk_data::ispb, LOG_WARNING, tdd_state::mode, fsk_data::nbit, fsk_data::nstop, fsk_data::parity, fsk_data::pcola, fsk_data::pllids, fsk_data::pllispb, fsk_data::pllispb2, tdd_state::pos, fsk_data::spb, fsk_data::state, fsk_data::x0, and fsk_data::xi0.
Referenced by dahdi_setoption().
|
static |
Definition at line 58 of file tdd.c.
Referenced by destroy_callback(), detect_callback(), detect_read(), detect_write(), P4(), tdd_getcarrier(), and tdd_init().
|
static |
Definition at line 58 of file tdd.c.
Referenced by append_transaction(), dundi_prop_precache(), tdd_getcarrier(), and tdd_init().
|
static |
Definition at line 59 of file tdd.c.
Referenced by tdd_gen_holdtone().