#include <asterisk.h>#include <asterisk/lock.h>#include <asterisk/linkedlists.h>#include <asterisk/module.h>#include <asterisk/utils.h>#include <asterisk/options.h>#include <asterisk/frame.h>#include <asterisk/cli.h>#include <asterisk/stringfields.h>

Go to the source code of this file.
Data Structures | |
| struct | ast_fax_document |
| struct | ast_fax_documents |
| struct | ast_fax_session |
| The data required to handle a fax session. More... | |
| struct | ast_fax_session_details |
| The data communicated between the high level applications and the generic fax function. More... | |
| struct | ast_fax_t38_parameters |
| struct | ast_fax_tech |
| used to register a FAX technology module with res_fax More... | |
Defines | |
| #define | AST_FAX_FRFLAG_GATEWAY (1 << 13) |
Enumerations | |
| enum | ast_fax_capabilities { AST_FAX_TECH_SEND = (1 << 0), AST_FAX_TECH_RECEIVE = (1 << 1), AST_FAX_TECH_AUDIO = (1 << 2), AST_FAX_TECH_T38 = (1 << 3), AST_FAX_TECH_MULTI_DOC = (1 << 4), AST_FAX_TECH_GATEWAY = (1 << 5), AST_FAX_TECH_V21_DETECT = (1 << 6) } |
| capabilities for res_fax to locate a fax technology module More... | |
| enum | ast_fax_modems { AST_FAX_MODEM_V17 = (1 << 0), AST_FAX_MODEM_V27 = (1 << 1), AST_FAX_MODEM_V29 = (1 << 2), AST_FAX_MODEM_V34 = (1 << 3) } |
| fax modem capabilities More... | |
| enum | ast_fax_optflag { AST_FAX_OPTFLAG_FALSE = 0, AST_FAX_OPTFLAG_TRUE, AST_FAX_OPTFLAG_DEFAULT } |
| fax session options More... | |
| enum | ast_fax_state { AST_FAX_STATE_UNINITIALIZED = 0, AST_FAX_STATE_INITIALIZED, AST_FAX_STATE_OPEN, AST_FAX_STATE_ACTIVE, AST_FAX_STATE_COMPLETE, AST_FAX_STATE_RESERVED, AST_FAX_STATE_INACTIVE } |
| current state of a fax session More... | |
Functions | |
| void | ast_fax_log (int level, const char *file, const int line, const char *function, const char *msg) |
| Log message at FAX or recommended level. | |
| unsigned int | ast_fax_maxrate (void) |
| get the maxiumum supported fax rate | |
| unsigned int | ast_fax_minrate (void) |
| get the minimum supported fax rate | |
| const char * | ast_fax_state_to_str (enum ast_fax_state state) |
| convert an ast_fax_state to a string | |
| int | ast_fax_tech_register (struct ast_fax_tech *tech) |
| register a fax technology | |
| void | ast_fax_tech_unregister (struct ast_fax_tech *tech) |
| unregister a fax technology | |
| #define AST_FAX_FRFLAG_GATEWAY (1 << 13) |
Definition at line 220 of file res_fax.h.
Referenced by fax_gateway_framehook(), spandsp_fax_gw_t30_gen(), and t38_tx_packet_handler().
| enum ast_fax_capabilities |
capabilities for res_fax to locate a fax technology module
Definition at line 34 of file res_fax.h.
{
/*! SendFax is supported */
AST_FAX_TECH_SEND = (1 << 0),
/*! ReceiveFax is supported */
AST_FAX_TECH_RECEIVE = (1 << 1),
/*! Audio FAX session supported */
AST_FAX_TECH_AUDIO = (1 << 2),
/*! T.38 FAX session supported */
AST_FAX_TECH_T38 = (1 << 3),
/*! sending mulitple documents supported */
AST_FAX_TECH_MULTI_DOC = (1 << 4),
/*! T.38 - T.30 Gateway */
AST_FAX_TECH_GATEWAY = (1 << 5),
/*! V21 detection is supported */
AST_FAX_TECH_V21_DETECT = (1 << 6),
};
| enum ast_fax_modems |
fax modem capabilities
| AST_FAX_MODEM_V17 |
V.17 |
| AST_FAX_MODEM_V27 |
V.27 |
| AST_FAX_MODEM_V29 |
V.29 |
| AST_FAX_MODEM_V34 |
V.34 |
Definition at line 52 of file res_fax.h.
{
/*! V.17 */
AST_FAX_MODEM_V17 = (1 << 0),
/*! V.27 */
AST_FAX_MODEM_V27 = (1 << 1),
/*! V.29 */
AST_FAX_MODEM_V29 = (1 << 2),
/*! V.34 */
AST_FAX_MODEM_V34 = (1 << 3),
};
| enum ast_fax_optflag |
fax session options
| AST_FAX_OPTFLAG_FALSE |
false/disable configuration override |
| AST_FAX_OPTFLAG_TRUE |
true/enable configuration override |
| AST_FAX_OPTFLAG_DEFAULT |
use the configured default |
Definition at line 82 of file res_fax.h.
{
/*! false/disable configuration override */
AST_FAX_OPTFLAG_FALSE = 0,
/*! true/enable configuration override */
AST_FAX_OPTFLAG_TRUE,
/*! use the configured default */
AST_FAX_OPTFLAG_DEFAULT,
};
| enum ast_fax_state |
current state of a fax session
Definition at line 64 of file res_fax.h.
{
/*! uninitialized state */
AST_FAX_STATE_UNINITIALIZED = 0,
/*! initialized state */
AST_FAX_STATE_INITIALIZED,
/*! fax resources open state */
AST_FAX_STATE_OPEN,
/*! fax session in progress */
AST_FAX_STATE_ACTIVE,
/*! fax session complete */
AST_FAX_STATE_COMPLETE,
/*! reserved state */
AST_FAX_STATE_RESERVED,
/*! inactive state */
AST_FAX_STATE_INACTIVE,
};
| void ast_fax_log | ( | int | level, |
| const char * | file, | ||
| const int | line, | ||
| const char * | function, | ||
| const char * | msg | ||
| ) |
Log message at FAX or recommended level.
The first four parameters can be represented with Asterisk's LOG_* levels. In other words, this function may be called like
ast_fax_log(LOG_DEBUG, msg);
Definition at line 811 of file res_fax.c.
References ast_log(), and ast_log_dynamic_level.
Referenced by spandsp_log().
{
if (fax_logger_level != -1) {
ast_log_dynamic_level(fax_logger_level, "%s", msg);
} else {
ast_log(level, file, line, function, "%s", msg);
}
}
| unsigned int ast_fax_maxrate | ( | void | ) |
get the maxiumum supported fax rate
Definition at line 562 of file res_fax.c.
References get_general_options(), and fax_options::maxrate.
Referenced by acf_faxopt_write().
{
struct fax_options options;
get_general_options(&options);
return options.maxrate;
}
| unsigned int ast_fax_minrate | ( | void | ) |
get the minimum supported fax rate
Definition at line 570 of file res_fax.c.
References get_general_options(), and fax_options::minrate.
Referenced by acf_faxopt_write().
{
struct fax_options options;
get_general_options(&options);
return options.minrate;
}
| const char* ast_fax_state_to_str | ( | enum ast_fax_state | state | ) |
convert an ast_fax_state to a string
Definition at line 788 of file res_fax.c.
References AST_FAX_STATE_ACTIVE, AST_FAX_STATE_COMPLETE, AST_FAX_STATE_INACTIVE, AST_FAX_STATE_INITIALIZED, AST_FAX_STATE_OPEN, AST_FAX_STATE_RESERVED, AST_FAX_STATE_UNINITIALIZED, ast_log(), and LOG_WARNING.
Referenced by cli_fax_show_sessions(), spandsp_fax_cli_show_session(), and spandsp_fax_write().
{
switch (state) {
case AST_FAX_STATE_UNINITIALIZED:
return "Uninitialized";
case AST_FAX_STATE_INITIALIZED:
return "Initialized";
case AST_FAX_STATE_OPEN:
return "Open";
case AST_FAX_STATE_ACTIVE:
return "Active";
case AST_FAX_STATE_COMPLETE:
return "Complete";
case AST_FAX_STATE_RESERVED:
return "Reserved";
case AST_FAX_STATE_INACTIVE:
return "Inactive";
default:
ast_log(LOG_WARNING, "unhandled FAX state: %d\n", state);
return "Unknown";
}
}
| int ast_fax_tech_register | ( | struct ast_fax_tech * | tech | ) |
register a fax technology
Definition at line 747 of file res_fax.c.
References ast_calloc, ast_module_ref(), AST_RWLIST_INSERT_TAIL, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb, ast_fax_tech::description, ast_module_info::self, fax_module::tech, and ast_fax_tech::type.
Referenced by load_module().
{
struct fax_module *fax;
if (!(fax = ast_calloc(1, sizeof(*fax)))) {
return -1;
}
fax->tech = tech;
AST_RWLIST_WRLOCK(&faxmodules);
AST_RWLIST_INSERT_TAIL(&faxmodules, fax, list);
AST_RWLIST_UNLOCK(&faxmodules);
ast_module_ref(ast_module_info->self);
ast_verb(3, "Registered handler for '%s' (%s)\n", fax->tech->type, fax->tech->description);
return 0;
}
| void ast_fax_tech_unregister | ( | struct ast_fax_tech * | tech | ) |
unregister a fax technology
Definition at line 766 of file res_fax.c.
References ast_free, ast_module_unref(), AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb, ast_module_info::self, fax_module::tech, and ast_fax_tech::type.
Referenced by unload_module().
{
struct fax_module *fax;
ast_verb(3, "Unregistering FAX module type '%s'\n", tech->type);
AST_RWLIST_WRLOCK(&faxmodules);
AST_RWLIST_TRAVERSE_SAFE_BEGIN(&faxmodules, fax, list) {
if (fax->tech != tech) {
continue;
}
AST_RWLIST_REMOVE_CURRENT(list);
ast_module_unref(ast_module_info->self);
ast_free(fax);
ast_verb(4, "Unregistered FAX module type '%s'\n", tech->type);
break;
}
AST_RWLIST_TRAVERSE_SAFE_END;
AST_RWLIST_UNLOCK(&faxmodules);
}