223#define MF_BETWEEN_MS 50 
  224#define MF_DURATION 55 
  225#define MF_KP_DURATION 120 
  226#define MF_ST_DURATION 65 
  245static int read_mf_digits(
struct ast_channel *chan, 
char *
buf, 
int buflen, 
int timeout, 
int features, 
int laxkp, 
int override, 
int no_kp, 
int no_st, 
int maxdigits) {
 
  248    struct timeval start;
 
  249    int remaining_time = timeout;
 
  251    int is_start_digit = 0;
 
  267    while (timeout == 0 || remaining_time > 0) {
 
  270            if (remaining_time <= 0) {
 
  275        if ((maxdigits && digits_read >= maxdigits) || digits_read >= (buflen - 1)) { 
 
  294                    if (digits_read == 0 && !laxkp && 
result != 
'*') {
 
  295                        ast_debug(1, 
"Received MF digit, but no KP yet, ignoring: %c\n", 
result);
 
  302                        if (
override && digits_read > 0) {
 
  303                            ast_debug(1, 
"Received another KP, starting over\n");
 
  320                    if (!no_st || !is_start_digit) {
 
  325                    if (is_start_digit) {
 
  340    ast_debug(3, 
"channel '%s' - event loop stopped { timeout: %d, remaining_time: %d }\n", 
ast_channel_name(chan), timeout, remaining_time);
 
 
  346#define BUFFER_SIZE 256 
  352    char *argcopy = 
NULL;
 
  353    int res, features = 0, maxdigits = 0;
 
  375        tosec = atof(arglist.timeout);
 
  389        if (maxdigits <= 0) {
 
  415        ast_verb(3, 
"MF digits received: '%s'\n", tmp);
 
  417        ast_verb(3, 
"No MF digits received.\n");
 
 
  426    int dinterval = 0, duration = 0, durationkp = 0, durationst = 0;
 
  469        chan_dest = chan_found;
 
  470        if (chan_found != chan) {
 
  471            chan_autoservice = chan;
 
  479    return chan_autoservice ? 0 : res;
 
 
  502    if (!strcmp(
digit, 
"*"))
 
  508    if (!
ast_strlen_zero(duration) && (sscanf(duration, 
"%30u", &duration_ms) != 1)) {
 
 
static int sendmf_exec(struct ast_channel *chan, const char *vdata)
static const char * readmf_name
static const char sendmf_name[]
static int read_mf_digits(struct ast_channel *chan, char *buf, int buflen, int timeout, int features, int laxkp, int override, int no_kp, int no_st, int maxdigits)
Detects MF digits on channel using DSP, terminated by ST, STP, ST2P, or ST3P.
static int manager_play_mf(struct mansession *s, const struct message *m)
static int load_module(void)
static int unload_module(void)
static int read_mf_exec(struct ast_channel *chan, const char *data)
static const struct ast_app_option read_app_options[128]
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdupa(s)
duplicate a string in memory from the stack
General Asterisk PBX channel definitions.
const char * ast_channel_name(const struct ast_channel *chan)
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
struct ast_channel * ast_channel_get_by_name(const char *search)
Find a channel by name or uniqueid.
#define ast_channel_unref(c)
Decrease channel reference count.
#define ast_channel_cleanup(c)
Cleanup a channel reference.
Conversion utility functions.
Convenient Signal Processing routines.
void ast_dsp_free(struct ast_dsp *dsp)
#define DSP_DIGITMODE_NOQUELCH
#define DSP_DIGITMODE_MUTEMAX
struct ast_frame * ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp, struct ast_frame *inf)
Return AST_FRAME_NULL frames when there is silence, AST_FRAME_BUSY on busies, and call progress,...
#define DSP_FEATURE_DIGIT_DETECT
int ast_dsp_set_digitmode(struct ast_dsp *dsp, int digitmode)
Set digit mode.
#define DSP_DIGITMODE_MUTECONF
void ast_dsp_set_features(struct ast_dsp *dsp, int features)
Select feature set.
struct ast_dsp * ast_dsp_new(void)
Allocates a new dsp, assumes 8khz for internal sample rate.
#define DSP_DIGITMODE_RELAXDTMF
Generic File Format Support. Should be included by clients of the file handling routines....
void astman_send_error(struct mansession *s, const struct message *m, char *error)
Send error in manager transaction.
void astman_send_ack(struct mansession *s, const struct message *m, char *msg)
Send ack in manager transaction.
const char * astman_get_header(const struct message *m, char *var)
Get header from manager transaction.
int ast_manager_unregister(const char *action)
Unregister a registered manager command.
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
int ast_app_parse_timelen(const char *timestr, int *result, enum ast_timelen defunit)
Common routine to parse time lengths, with optional time unit specifier.
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
#define AST_APP_OPTION_ARG(option, flagno, argno)
Declares an application option that accepts an argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define AST_APP_OPTION(option, flagno)
Declares an application option that does not accept an argument.
int ast_mf_stream(struct ast_channel *chan, struct ast_channel *peer, struct ast_channel *chan2, const char *digits, int between, unsigned int duration, unsigned int durationkp, unsigned int durationst, int is_external)
Send a string of MF digits to a channel.
int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
#define ast_debug(level,...)
Log a DEBUG message.
#define ast_verb(level,...)
#define ast_manager_register_xml(action, authority, func)
Register a manager callback using XML documentation to describe the manager.
Asterisk module definitions.
#define ASTERISK_GPL_KEY
The text the key() function should return.
int ast_unregister_application(const char *app)
Unregister an application.
#define AST_MODULE_INFO_STANDARD_EXTENDED(keystr, desc)
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Core PBX routines and definitions.
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Main Channel structure associated with a channel.
Structure used to handle boolean flags.
Data structure associated with a single frame of data.
struct ast_frame_subclass subclass
enum ast_frame_type frametype
In case you didn't read that giant block of text above the mansession_session struct,...
int ast_remaining_ms(struct timeval start, int max_ms)
Calculate remaining milliseconds given a starting timestamp and upper bound.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
#define ast_test_flag(p, flag)