#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 } |
| 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 74 of file res_fax.h.
00074 { 00075 /*! false/disable configuration override */ 00076 AST_FAX_OPTFLAG_FALSE = 0, 00077 /*! true/enable configuration override */ 00078 AST_FAX_OPTFLAG_TRUE, 00079 /*! use the configured default */ 00080 AST_FAX_OPTFLAG_DEFAULT, 00081 };
| 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 |
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 };
| 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 600 of file res_fax.c.
References ast_log(), and ast_log_dynamic_level.
Referenced by spandsp_log().
00601 { 00602 if (fax_logger_level != -1) { 00603 ast_log_dynamic_level(fax_logger_level, "%s", msg); 00604 } else { 00605 ast_log(level, file, line, function, "%s", msg); 00606 } 00607 }
| unsigned int ast_fax_maxrate | ( | void | ) |
get the maxiumum supported fax rate
Definition at line 423 of file res_fax.c.
References general_options.
Referenced by acf_faxopt_write().
00424 { 00425 return general_options.maxrate; 00426 }
| unsigned int ast_fax_minrate | ( | void | ) |
get the minimum supported fax rate
Definition at line 428 of file res_fax.c.
References general_options.
Referenced by acf_faxopt_write().
00429 { 00430 return general_options.minrate; 00431 }
| const char* ast_fax_state_to_str | ( | enum ast_fax_state | state | ) |
convert an ast_fax_state to a string
Definition at line 581 of file res_fax.c.
References AST_FAX_STATE_ACTIVE, AST_FAX_STATE_COMPLETE, AST_FAX_STATE_INITIALIZED, AST_FAX_STATE_OPEN, AST_FAX_STATE_UNINITIALIZED, ast_log(), and LOG_WARNING.
Referenced by cli_fax_show_sessions(), spandsp_fax_cli_show_session(), and spandsp_fax_write().
00582 { 00583 switch (state) { 00584 case AST_FAX_STATE_UNINITIALIZED: 00585 return "Uninitialized"; 00586 case AST_FAX_STATE_INITIALIZED: 00587 return "Initialized"; 00588 case AST_FAX_STATE_OPEN: 00589 return "Open"; 00590 case AST_FAX_STATE_ACTIVE: 00591 return "Active"; 00592 case AST_FAX_STATE_COMPLETE: 00593 return "Complete"; 00594 default: 00595 ast_log(LOG_WARNING, "unhandled FAX state: %d\n", state); 00596 return "Unknown"; 00597 } 00598 }
| int ast_fax_tech_register | ( | struct ast_fax_tech * | tech | ) |
register a fax technology
Definition at line 540 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().
00541 { 00542 struct fax_module *fax; 00543 00544 if (!(fax = ast_calloc(1, sizeof(*fax)))) { 00545 return -1; 00546 } 00547 fax->tech = tech; 00548 AST_RWLIST_WRLOCK(&faxmodules); 00549 AST_RWLIST_INSERT_TAIL(&faxmodules, fax, list); 00550 AST_RWLIST_UNLOCK(&faxmodules); 00551 ast_module_ref(ast_module_info->self); 00552 00553 ast_verb(3, "Registered handler for '%s' (%s)\n", fax->tech->type, fax->tech->description); 00554 00555 return 0; 00556 }
| void ast_fax_tech_unregister | ( | struct ast_fax_tech * | tech | ) |
unregister a fax technology
Definition at line 559 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().
00560 { 00561 struct fax_module *fax; 00562 00563 ast_verb(3, "Unregistering FAX module type '%s'\n", tech->type); 00564 00565 AST_RWLIST_WRLOCK(&faxmodules); 00566 AST_RWLIST_TRAVERSE_SAFE_BEGIN(&faxmodules, fax, list) { 00567 if (fax->tech != tech) { 00568 continue; 00569 } 00570 AST_RWLIST_REMOVE_CURRENT(list); 00571 ast_module_unref(ast_module_info->self); 00572 ast_free(fax); 00573 ast_verb(4, "Unregistered FAX module type '%s'\n", tech->type); 00574 break; 00575 } 00576 AST_RWLIST_TRAVERSE_SAFE_END; 00577 AST_RWLIST_UNLOCK(&faxmodules); 00578 }
1.5.9