Asterisk - The Open Source Telephony Project  21.4.1
Data Structures | Enumerations | Functions | Variables
res_tonedetect.c File Reference

Tone detection module. More...

#include "asterisk.h"
#include <math.h>
#include "asterisk/module.h"
#include "asterisk/frame.h"
#include "asterisk/format_cache.h"
#include "asterisk/channel.h"
#include "asterisk/dsp.h"
#include "asterisk/pbx.h"
#include "asterisk/audiohook.h"
#include "asterisk/app.h"
#include "asterisk/indications.h"
#include "asterisk/conversions.h"

Go to the source code of this file.

Data Structures

struct  detect_information
 

Enumerations

enum  {
  OPT_ARG_DECIBEL, OPT_ARG_GOTO_RX, OPT_ARG_GOTO_TX, OPT_ARG_HITS_REQ,
  OPT_ARG_ARRAY_SIZE
}
 
enum  { OPT_APP_DECIBEL = (1 << 0), OPT_APP_SQUELCH = (1 << 1) }
 
enum  { OPT_APP_ARG_DECIBEL, OPT_APP_ARG_ARRAY_SIZE }
 
enum  td_opts {
  OPT_TX = (1 << 1), OPT_RX = (1 << 2), OPT_END_FILTER = (1 << 3), OPT_GOTO_RX = (1 << 4),
  OPT_GOTO_TX = (1 << 5), OPT_DECIBEL = (1 << 6), OPT_SQUELCH = (1 << 7), OPT_HITS_REQ = (1 << 8),
  OPT_SIT = (1 << 9), OPT_BUSY = (1 << 10), OPT_DIALTONE = (1 << 11), OPT_RINGING = (1 << 12)
}
 

Functions

 AST_MODULE_INFO_STANDARD_EXTENDED (ASTERISK_GPL_KEY,"Tone detection module")
 
static void destroy_callback (void *data)
 
static int detect_callback (struct ast_audiohook *audiohook, struct ast_channel *chan, struct ast_frame *frame, enum ast_audiohook_direction direction)
 
static int detect_read (struct ast_channel *chan, const char *cmd, char *data, char *buffer, size_t buflen)
 
static int detect_write (struct ast_channel *chan, const char *cmd, char *data, const char *value)
 
static int freq_parser (char *freqs, int *freq1, int *freq2)
 
static char * goto_parser (struct ast_channel *chan, char *loc)
 
static int load_module (void)
 
static int parse_signal_features (struct ast_flags *flags)
 
static int remove_detect (struct ast_channel *chan)
 
static int scan_exec (struct ast_channel *chan, const char *data)
 
static int unload_module (void)
 
static int wait_exec (struct ast_channel *chan, const char *data)
 

Variables

static const struct ast_datastore_info detect_datastore
 
static struct ast_custom_function detect_function
 
static char * scanapp = "ToneScan"
 
static const struct ast_app_option td_opts [128] = { [ 'a' ] = { .flag = OPT_SIT }, [ 'b' ] = { .flag = OPT_BUSY }, [ 'c' ] = { .flag = OPT_DIALTONE }, [ 'd' ] = { .flag = OPT_DECIBEL , .arg_index = OPT_ARG_DECIBEL + 1 }, [ 'g' ] = { .flag = OPT_GOTO_RX , .arg_index = OPT_ARG_GOTO_RX + 1 }, [ 'h' ] = { .flag = OPT_GOTO_TX , .arg_index = OPT_ARG_GOTO_TX + 1 }, [ 'n' ] = { .flag = OPT_HITS_REQ , .arg_index = OPT_ARG_HITS_REQ + 1 }, [ 'p' ] = { .flag = OPT_RINGING }, [ 's' ] = { .flag = OPT_SQUELCH }, [ 't' ] = { .flag = OPT_TX }, [ 'r' ] = { .flag = OPT_RX }, [ 'x' ] = { .flag = OPT_END_FILTER }, }
 
static const struct ast_app_option wait_exec_options [128] = { [ 'd' ] = { .flag = OPT_APP_DECIBEL , .arg_index = OPT_APP_ARG_DECIBEL + 1 }, [ 's' ] = { .flag = OPT_APP_SQUELCH }, }
 
static char * waitapp = "WaitForTone"
 

Detailed Description

Tone detection module.

Author
Naveen Albert aster.nosp@m.isk@.nosp@m.phrea.nosp@m.knet.nosp@m..org

Definition in file res_tonedetect.c.

Variable Documentation

const struct ast_datastore_info detect_datastore
static
Initial value:
= {
.type = "detect",
.destroy = destroy_callback
}
static void destroy_callback(void *data)
Helper function used by datastores to destroy the speech structure upon hangup.

Definition at line 349 of file res_tonedetect.c.

struct ast_custom_function detect_function
static
Initial value:
= {
.name = "TONE_DETECT",
.read = detect_read,
.write = detect_write,
}

Definition at line 1032 of file res_tonedetect.c.