Mon Jun 27 16:50:57 2011

Asterisk developer's documentation


tdd.h

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (C) 1999 - 2005, Digium, Inc.
00005  *
00006  * Mark Spencer <markster@digium.com>
00007  *
00008  * See http://www.asterisk.org for more information about
00009  * the Asterisk project. Please do not directly contact
00010  * any of the maintainers of this project for assistance;
00011  * the project provides a web site, mailing lists and IRC
00012  * channels for your use.
00013  *
00014  * This program is free software, distributed under the terms of
00015  * the GNU General Public License Version 2. See the LICENSE file
00016  * at the top of the source tree.
00017  */
00018 
00019 /*! \file
00020  * \brief TTY/TDD Generation support
00021  * \note Includes code and algorithms from the Zapata library.
00022  */
00023 
00024 #ifndef _ASTERISK_TDD_H
00025 #define _ASTERISK_TDD_H
00026 
00027 #define  TDD_BYTES_PER_CHAR   2700
00028 
00029 struct tdd_state;
00030 typedef struct tdd_state TDDSTATE;
00031 
00032 /*! CallerID Initialization 
00033  * Initializes the TDD system.  Mostly stuff for inverse FFT
00034  */
00035 void tdd_init(void);
00036 
00037 /*! Generates a CallerID FSK stream in ulaw format suitable for transmission.
00038  * \param tdd tdd structure
00039  * \param buf Buffer to use. This needs to be large enough to accomodate all the generated samples.
00040  * \param string This is the string to send.
00041  * This function creates a stream of TDD data in ulaw format. It returns the size
00042  * (in bytes) of the data (if it returns a size of 0, there is probably an error)
00043 */
00044 int tdd_generate(struct tdd_state *tdd, unsigned char *buf, const char *string);
00045 
00046 /*! Create a TDD state machine 
00047  * This function returns a malloc'd instance of the tdd_state data structure.
00048  * Returns a pointer to a malloc'd tdd_state structure, or NULL on error.
00049  */
00050 struct tdd_state *tdd_new(void);
00051 
00052 /*! Read samples into the state machine, and return character (if any).
00053  * \param tdd Which state machine to act upon
00054  * \param ubuf containing your samples
00055  * \param samples number of samples contained within the buffer.
00056  *
00057  * Send received audio to the TDD demodulator.
00058  * Returns -1 on error, 0 for "needs more samples",
00059  * and > 0 (the character) if reception of a character is complete.
00060  */
00061 int tdd_feed(struct tdd_state *tdd, unsigned char *ubuf, int samples);
00062 
00063 /*! Free a TDD state machine 
00064  * \param tdd This is the tdd_state state machine to free
00065  * This function frees tdd_state tdd.
00066  */
00067 void tdd_free(struct tdd_state *tdd);
00068 
00069 /*! Generate Echo Canceller disable tone (2100HZ) 
00070  * \param outbuf This is the buffer to receive the tone data
00071  * \param len This is the length (in samples) of the tone data to generate
00072  * Returns 0 if no error, and -1 if error.
00073  */
00074 int ast_tdd_gen_ecdisa(unsigned char *outbuf, int len);
00075 
00076 
00077 /*! Generate hold tone 
00078  * \param outbuf This is the buffer to receive the tone data
00079 */
00080 int tdd_gen_holdtone(unsigned char* outbuf);
00081 
00082 #endif /* _ASTERISK_TDD_H */

Generated on Mon Jun 27 16:50:57 2011 for Asterisk - The Open Source Telephony Project by  doxygen 1.4.7