#include <inttypes.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <memory.h>
#include <strings.h>
#include <ctype.h>
#include <math.h>
#include <assert.h>
#include "spandsp/telephony.h"
#include "spandsp/logging.h"
#include "spandsp/queue.h"
#include "spandsp/power_meter.h"
#include "spandsp/complex.h"
#include "spandsp/tone_generate.h"
#include "spandsp/async.h"
#include "spandsp/hdlc.h"
#include "spandsp/fsk.h"
#include "spandsp/v29rx.h"
#include "spandsp/v29tx.h"
#include "spandsp/v27ter_rx.h"
#include "spandsp/v27ter_tx.h"
#include "spandsp/t31.h"
Classes | |
struct | at_cmd_item_t |
Defines | |
#define | ms_to_samples(t) (((t)*SAMPLE_RATE)/1000) |
#define | ETX 0x03 |
#define | DLE 0x10 |
#define | SUB 0x1A |
Typedefs | |
typedef const char *(*) | at_cmd_service_t (t31_state_t *s, const char *cmd) |
Enumerations | |
enum | { ASCII_RESULT_CODES = 1, NUMERIC_RESULT_CODES, NO_RESULT_CODES } |
enum | { T31_SILENCE, T31_CED_TONE, T31_CNG_TONE, T31_V21_TX, T31_V17_TX, T31_V27TER_TX, T31_V29_TX, T31_V21_RX, T31_V17_RX, T31_V27TER_RX, T31_V29_RX } |
enum | { RESPONSE_CODE_OK = 0, RESPONSE_CODE_CONNECT, RESPONSE_CODE_RING, RESPONSE_CODE_NO_CARRIER, RESPONSE_CODE_ERROR, RESPONSE_CODE_XXX, RESPONSE_CODE_NO_DIALTONE, RESPONSE_CODE_BUSY, RESPONSE_CODE_NO_ANSWER, RESPONSE_CODE_FCERROR, RESPONSE_CODE_FRH3 } |
Functions | |
void | t31_v21_rx (t31_state_t *s) |
const char * | s_reg_handler (t31_state_t *s, const char *t, int reg) |
void | t31_call_event (t31_state_t *s, int event) |
int | t31_at_rx (t31_state_t *s, const char *t, int len) |
int | t31_rx (t31_state_t *s, int16_t *buf, int len) |
Process a block of received T.31 modem audio samples. | |
int | t31_tx (t31_state_t *s, int16_t *buf, int max_len) |
Generate a block of T.31 modem audio samples. | |
int | t31_init (t31_state_t *s, t31_at_tx_handler_t *at_tx_handler, void *at_tx_user_data, t31_modem_control_handler_t *modem_control_handler, void *modem_control_user_data) |
Initialise a T.31 context. | |
Variables | |
t31_profile_t | profiles [3] |
const char * | response_codes [] |
at_cmd_item_t | at_commands [] |
int t31_init | ( | t31_state_t * | s, | |
t31_at_tx_handler_t * | at_tx_handler, | |||
void * | at_tx_user_data, | |||
t31_modem_control_handler_t * | modem_control_handler, | |||
void * | modem_control_user_data | |||
) |
Initialise a T.31 context.
Initialise a T.31 context. This must be called before the first use of the context, to initialise its contents.
s | The T.31 context. | |
at_tx_handler | ???. | |
at_tx_user_data | ???. | |
modem_control_handler | ???. | |
modem_control_user_data | ???. |
int t31_rx | ( | t31_state_t * | s, | |
int16_t * | buf, | |||
int | len | |||
) |
Process a block of received T.31 modem audio samples.
Process a block of received T.31 modem audio samples.
s | The T.31 modem context. | |
amp | The audio sample buffer. | |
len | The number of samples in the buffer. |
int t31_tx | ( | t31_state_t * | s, | |
int16_t * | buf, | |||
int | max_len | |||
) |
Generate a block of T.31 modem audio samples.
Generate a block of T.31 modem audio samples.
s | The T.31 modem context. | |
amp | The audio sample buffer. | |
max_len | The number of samples to be generated. |
t31_profile_t profiles[3] |
Initial value:
{ { .echo = TRUE, .verbose = TRUE, .result_code_format = ASCII_RESULT_CODES, .pulse_dial = FALSE, .double_escape = FALSE, .adaptive_receive = FALSE, .s_regs[0] = 0, .s_regs[3] = '\r', .s_regs[4] = '\n', .s_regs[5] = '\b', .s_regs[6] = 1, .s_regs[7] = 60, .s_regs[8] = 5, .s_regs[10] = 0 } }
const char* response_codes[] |
Initial value:
{ "OK", "CONNECT", "RING", "NO CARRIER", "ERROR", "???", "NO DIALTONE", "BUSY", "NO ANSWER", "+FCERROR", "+FRH:3" }