#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
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 651 of file res_fax.c.
References ast_log(), and ast_log_dynamic_level.
Referenced by spandsp_log().
00652 { 00653 if (fax_logger_level != -1) { 00654 ast_log_dynamic_level(fax_logger_level, "%s", msg); 00655 } else { 00656 ast_log(level, file, line, function, "%s", msg); 00657 } 00658 }
unsigned int ast_fax_maxrate | ( | void | ) |
get the maxiumum supported fax rate
Definition at line 425 of file res_fax.c.
References general_options.
Referenced by acf_faxopt_write().
00426 { 00427 return general_options.maxrate; 00428 }
unsigned int ast_fax_minrate | ( | void | ) |
get the minimum supported fax rate
Definition at line 430 of file res_fax.c.
References general_options.
Referenced by acf_faxopt_write().
00431 { 00432 return general_options.minrate; 00433 }
const char* ast_fax_state_to_str | ( | enum ast_fax_state | state | ) |
convert an ast_fax_state to a string
Definition at line 628 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().
00629 { 00630 switch (state) { 00631 case AST_FAX_STATE_UNINITIALIZED: 00632 return "Uninitialized"; 00633 case AST_FAX_STATE_INITIALIZED: 00634 return "Initialized"; 00635 case AST_FAX_STATE_OPEN: 00636 return "Open"; 00637 case AST_FAX_STATE_ACTIVE: 00638 return "Active"; 00639 case AST_FAX_STATE_COMPLETE: 00640 return "Complete"; 00641 case AST_FAX_STATE_RESERVED: 00642 return "Reserved"; 00643 case AST_FAX_STATE_INACTIVE: 00644 return "Inactive"; 00645 default: 00646 ast_log(LOG_WARNING, "unhandled FAX state: %d\n", state); 00647 return "Unknown"; 00648 } 00649 }
int ast_fax_tech_register | ( | struct ast_fax_tech * | tech | ) |
register a fax technology
Definition at line 587 of file res_fax.c.
References ast_calloc, ast_module_ref(), AST_RWLIST_INSERT_TAIL, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb, fax_module::list, and fax_module::tech.
Referenced by load_module().
00588 { 00589 struct fax_module *fax; 00590 00591 if (!(fax = ast_calloc(1, sizeof(*fax)))) { 00592 return -1; 00593 } 00594 fax->tech = tech; 00595 AST_RWLIST_WRLOCK(&faxmodules); 00596 AST_RWLIST_INSERT_TAIL(&faxmodules, fax, list); 00597 AST_RWLIST_UNLOCK(&faxmodules); 00598 ast_module_ref(ast_module_info->self); 00599 00600 ast_verb(3, "Registered handler for '%s' (%s)\n", fax->tech->type, fax->tech->description); 00601 00602 return 0; 00603 }
void ast_fax_tech_unregister | ( | struct ast_fax_tech * | tech | ) |
unregister a fax technology
Definition at line 606 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::list, fax_module::tech, and ast_fax_tech::type.
Referenced by unload_module().
00607 { 00608 struct fax_module *fax; 00609 00610 ast_verb(3, "Unregistering FAX module type '%s'\n", tech->type); 00611 00612 AST_RWLIST_WRLOCK(&faxmodules); 00613 AST_RWLIST_TRAVERSE_SAFE_BEGIN(&faxmodules, fax, list) { 00614 if (fax->tech != tech) { 00615 continue; 00616 } 00617 AST_RWLIST_REMOVE_CURRENT(list); 00618 ast_module_unref(ast_module_info->self); 00619 ast_free(fax); 00620 ast_verb(4, "Unregistered FAX module type '%s'\n", tech->type); 00621 break; 00622 } 00623 AST_RWLIST_TRAVERSE_SAFE_END; 00624 AST_RWLIST_UNLOCK(&faxmodules); 00625 }