#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... | |
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) } |
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 |
enum ast_fax_capabilities |
capabilities for res_fax to locate a fax technology module
Definition at line 34 of file res_fax.h.
00034 { 00035 /*! SendFax is supported */ 00036 AST_FAX_TECH_SEND = (1 << 0), 00037 /*! ReceiveFax is supported */ 00038 AST_FAX_TECH_RECEIVE = (1 << 1), 00039 /*! Audio FAX session supported */ 00040 AST_FAX_TECH_AUDIO = (1 << 2), 00041 /*! T.38 FAX session supported */ 00042 AST_FAX_TECH_T38 = (1 << 3), 00043 /*! sending mulitple documents supported */ 00044 AST_FAX_TECH_MULTI_DOC = (1 << 4), 00045 };
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 48 of file res_fax.h.
00048 { 00049 /*! V.17 */ 00050 AST_FAX_MODEM_V17 = (1 << 0), 00051 /*! V.27 */ 00052 AST_FAX_MODEM_V27 = (1 << 1), 00053 /*! V.29 */ 00054 AST_FAX_MODEM_V29 = (1 << 2), 00055 /*! V.34 */ 00056 AST_FAX_MODEM_V34 = (1 << 3), 00057 };
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 78 of file res_fax.h.
00078 { 00079 /*! false/disable configuration override */ 00080 AST_FAX_OPTFLAG_FALSE = 0, 00081 /*! true/enable configuration override */ 00082 AST_FAX_OPTFLAG_TRUE, 00083 /*! use the configured default */ 00084 AST_FAX_OPTFLAG_DEFAULT, 00085 };
enum ast_fax_state |
current state of a fax session
AST_FAX_STATE_UNINITIALIZED |
uninitialized state |
AST_FAX_STATE_INITIALIZED |
initialized state |
AST_FAX_STATE_OPEN |
fax resources open state |
AST_FAX_STATE_ACTIVE |
fax session in progress |
AST_FAX_STATE_COMPLETE |
fax session complete |
AST_FAX_STATE_RESERVED |
reserved state |
AST_FAX_STATE_INACTIVE |
inactive state |
Definition at line 60 of file res_fax.h.
00060 { 00061 /*! uninitialized state */ 00062 AST_FAX_STATE_UNINITIALIZED = 0, 00063 /*! initialized state */ 00064 AST_FAX_STATE_INITIALIZED, 00065 /*! fax resources open state */ 00066 AST_FAX_STATE_OPEN, 00067 /*! fax session in progress */ 00068 AST_FAX_STATE_ACTIVE, 00069 /*! fax session complete */ 00070 AST_FAX_STATE_COMPLETE, 00071 /*! reserved state */ 00072 AST_FAX_STATE_RESERVED, 00073 /*! inactive state */ 00074 AST_FAX_STATE_INACTIVE, 00075 };
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 680 of file res_fax.c.
References ast_log(), and ast_log_dynamic_level.
Referenced by spandsp_log().
00681 { 00682 if (fax_logger_level != -1) { 00683 ast_log_dynamic_level(fax_logger_level, "%s", msg); 00684 } else { 00685 ast_log(level, file, line, function, "%s", msg); 00686 } 00687 }
unsigned int ast_fax_maxrate | ( | void | ) |
get the maxiumum supported fax rate
Definition at line 444 of file res_fax.c.
References get_general_options(), and fax_options::maxrate.
Referenced by acf_faxopt_write().
00445 { 00446 struct fax_options options; 00447 get_general_options(&options); 00448 00449 return options.maxrate; 00450 }
unsigned int ast_fax_minrate | ( | void | ) |
get the minimum supported fax rate
Definition at line 452 of file res_fax.c.
References get_general_options(), and fax_options::minrate.
Referenced by acf_faxopt_write().
00453 { 00454 struct fax_options options; 00455 get_general_options(&options); 00456 00457 return options.minrate; 00458 }
const char* ast_fax_state_to_str | ( | enum ast_fax_state | state | ) |
convert an ast_fax_state to a string
Definition at line 657 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().
00658 { 00659 switch (state) { 00660 case AST_FAX_STATE_UNINITIALIZED: 00661 return "Uninitialized"; 00662 case AST_FAX_STATE_INITIALIZED: 00663 return "Initialized"; 00664 case AST_FAX_STATE_OPEN: 00665 return "Open"; 00666 case AST_FAX_STATE_ACTIVE: 00667 return "Active"; 00668 case AST_FAX_STATE_COMPLETE: 00669 return "Complete"; 00670 case AST_FAX_STATE_RESERVED: 00671 return "Reserved"; 00672 case AST_FAX_STATE_INACTIVE: 00673 return "Inactive"; 00674 default: 00675 ast_log(LOG_WARNING, "unhandled FAX state: %u\n", state); 00676 return "Unknown"; 00677 } 00678 }
int ast_fax_tech_register | ( | struct ast_fax_tech * | tech | ) |
register a fax technology
Definition at line 616 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, fax_module::tech, and ast_fax_tech::type.
Referenced by load_module().
00617 { 00618 struct fax_module *fax; 00619 00620 if (!(fax = ast_calloc(1, sizeof(*fax)))) { 00621 return -1; 00622 } 00623 fax->tech = tech; 00624 AST_RWLIST_WRLOCK(&faxmodules); 00625 AST_RWLIST_INSERT_TAIL(&faxmodules, fax, list); 00626 AST_RWLIST_UNLOCK(&faxmodules); 00627 ast_module_ref(ast_module_info->self); 00628 00629 ast_verb(3, "Registered handler for '%s' (%s)\n", fax->tech->type, fax->tech->description); 00630 00631 return 0; 00632 }
void ast_fax_tech_unregister | ( | struct ast_fax_tech * | tech | ) |
unregister a fax technology
Definition at line 635 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, fax_module::tech, and ast_fax_tech::type.
Referenced by unload_module().
00636 { 00637 struct fax_module *fax; 00638 00639 ast_verb(3, "Unregistering FAX module type '%s'\n", tech->type); 00640 00641 AST_RWLIST_WRLOCK(&faxmodules); 00642 AST_RWLIST_TRAVERSE_SAFE_BEGIN(&faxmodules, fax, list) { 00643 if (fax->tech != tech) { 00644 continue; 00645 } 00646 AST_RWLIST_REMOVE_CURRENT(list); 00647 ast_module_unref(ast_module_info->self); 00648 ast_free(fax); 00649 ast_verb(4, "Unregistered FAX module type '%s'\n", tech->type); 00650 break; 00651 } 00652 AST_RWLIST_TRAVERSE_SAFE_END; 00653 AST_RWLIST_UNLOCK(&faxmodules); 00654 }