| Asterisk - The Open Source Telephony Project GIT-master-27fb039
    | 
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.
| #define PUT_BYTE | ( | a | ) | 
| #define PUT_TDD | ( | byte | ) | 
| #define PUT_TDD_BAUD | ( | bit | ) | 
Definition at line 254 of file tdd.c.
| #define PUT_TDD_MARKMS | 
Definition at line 248 of file tdd.c.
| #define PUT_TDD_STOP | 
Definition at line 262 of file tdd.c.
| 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 | 
Definition at line 64 of file tdd.c.
References d, and tdd_state::modo.
Referenced by tdd_feed().
| 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 | ) | 
| int tdd_gen_holdtone | ( | unsigned char * | buf | ) | 
Generate TDD hold tone
Definition at line 285 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 296 of file tdd.c.
References c, tdd_state::charnum, tdd_state::mode, PUT_TDD, and str.
Referenced by dahdi_sendtext().
| 
 | inlinestatic | 
Definition at line 223 of file tdd.c.
Referenced by tdd_gen_holdtone().
| 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 abort_request(), append_transaction(), build_transactions(), cancel_request(), check_request(), discover_transactions(), dundi_do_lookup(), dundi_lookup_internal(), dundi_lookup_local(), dundi_lookup_thread(), dundi_precache_internal(), dundi_prop_precache(), dundi_query_eid_internal(), dundifunc_read(), mbl_load_adapter(), optimize_transactions(), precache_trans(), precache_transactions(), query_transactions(), register_request(), tdd_getcarrier(), tdd_init(), and unregister_request().
| 
 | static | 
Definition at line 59 of file tdd.c.
Referenced by tdd_gen_holdtone().