Asterisk - The Open Source Telephony Project GIT-master-b023714
Loading...
Searching...
No Matches
Data Structures | Macros | Enumerations | Functions
res_fax.h File Reference
#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"
#include "asterisk/manager.h"
Include dependency graph for res_fax.h:
This graph shows which files directly or indirectly include this file:

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...
 

Macros

#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_V27TER = (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_session_operation_str (struct ast_fax_session *s)
 get string representation of a FAX session's operation
 
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
 

Macro Definition Documentation

◆ AST_FAX_FRFLAG_GATEWAY

#define AST_FAX_FRFLAG_GATEWAY   (1 << 13)

Definition at line 232 of file res_fax.h.

Enumeration Type Documentation

◆ ast_fax_capabilities

capabilities for res_fax to locate a fax technology module

Enumerator
AST_FAX_TECH_SEND 

SendFax is supported

AST_FAX_TECH_RECEIVE 

ReceiveFax is supported

AST_FAX_TECH_AUDIO 

Audio FAX session supported

AST_FAX_TECH_T38 

T.38 FAX session supported

AST_FAX_TECH_MULTI_DOC 

sending mulitple documents supported

AST_FAX_TECH_GATEWAY 

T.38 - T.30 Gateway

AST_FAX_TECH_V21_DETECT 

V21 detection is supported

Definition at line 35 of file res_fax.h.

35 {
36 /*! SendFax is supported */
37 AST_FAX_TECH_SEND = (1 << 0),
38 /*! ReceiveFax is supported */
39 AST_FAX_TECH_RECEIVE = (1 << 1),
40 /*! Audio FAX session supported */
41 AST_FAX_TECH_AUDIO = (1 << 2),
42 /*! T.38 FAX session supported */
43 AST_FAX_TECH_T38 = (1 << 3),
44 /*! sending mulitple documents supported */
45 AST_FAX_TECH_MULTI_DOC = (1 << 4),
46 /*! T.38 - T.30 Gateway */
47 AST_FAX_TECH_GATEWAY = (1 << 5),
48 /*! V21 detection is supported */
49 AST_FAX_TECH_V21_DETECT = (1 << 6),
50};
@ AST_FAX_TECH_T38
Definition res_fax.h:43
@ AST_FAX_TECH_AUDIO
Definition res_fax.h:41
@ AST_FAX_TECH_RECEIVE
Definition res_fax.h:39
@ AST_FAX_TECH_V21_DETECT
Definition res_fax.h:49
@ AST_FAX_TECH_MULTI_DOC
Definition res_fax.h:45
@ AST_FAX_TECH_SEND
Definition res_fax.h:37
@ AST_FAX_TECH_GATEWAY
Definition res_fax.h:47

◆ ast_fax_modems

fax modem capabilities

Enumerator
AST_FAX_MODEM_V17 

V.17

AST_FAX_MODEM_V27TER 

V.27ter

AST_FAX_MODEM_V29 

V.29

AST_FAX_MODEM_V34 

V.34

Definition at line 53 of file res_fax.h.

53 {
54 /*! V.17 */
55 AST_FAX_MODEM_V17 = (1 << 0),
56 /*! V.27ter */
57 AST_FAX_MODEM_V27TER = (1 << 1),
58 /*! V.29 */
59 AST_FAX_MODEM_V29 = (1 << 2),
60 /*! V.34 */
61 AST_FAX_MODEM_V34 = (1 << 3),
62};
@ AST_FAX_MODEM_V17
Definition res_fax.h:55
@ AST_FAX_MODEM_V29
Definition res_fax.h:59
@ AST_FAX_MODEM_V27TER
Definition res_fax.h:57
@ AST_FAX_MODEM_V34
Definition res_fax.h:61

◆ ast_fax_optflag

fax session options

Enumerator
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 83 of file res_fax.h.

83 {
84 /*! false/disable configuration override */
86 /*! true/enable configuration override */
88 /*! use the configured default */
90};
@ AST_FAX_OPTFLAG_DEFAULT
Definition res_fax.h:89
@ AST_FAX_OPTFLAG_FALSE
Definition res_fax.h:85
@ AST_FAX_OPTFLAG_TRUE
Definition res_fax.h:87

◆ ast_fax_state

current state of a fax session

Enumerator
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 65 of file res_fax.h.

65 {
66 /*! uninitialized state */
68 /*! initialized state */
70 /*! fax resources open state */
72 /*! fax session in progress */
74 /*! fax session complete */
76 /*! reserved state */
78 /*! inactive state */
80};
@ AST_FAX_STATE_INITIALIZED
Definition res_fax.h:69
@ AST_FAX_STATE_INACTIVE
Definition res_fax.h:79
@ AST_FAX_STATE_ACTIVE
Definition res_fax.h:73
@ AST_FAX_STATE_COMPLETE
Definition res_fax.h:75
@ AST_FAX_STATE_OPEN
Definition res_fax.h:71
@ AST_FAX_STATE_UNINITIALIZED
Definition res_fax.h:67
@ AST_FAX_STATE_RESERVED
Definition res_fax.h:77

Function Documentation

◆ ast_fax_log()

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 1137 of file res_fax.c.

1138{
1139 if (fax_logger_level != -1) {
1141 } else {
1142 ast_log(level, file, line, function, "%s", msg);
1143 }
1144}
#define ast_log
Definition astobj2.c:42
#define ast_log_dynamic_level(level,...)
Send a log message to a dynamically registered log level.
static int fax_logger_level
Definition res_fax.c:588

References ast_log, ast_log_dynamic_level, and fax_logger_level.

Referenced by spandsp_log().

◆ ast_fax_maxrate()

unsigned int ast_fax_maxrate ( void  )

get the maxiumum supported fax rate

Definition at line 897 of file res_fax.c.

898{
899 struct fax_options options;
901
902 return options.maxrate;
903}
static void get_general_options(struct fax_options *options)
Definition res_fax.c:4498
static struct test_options options

References get_general_options(), and options.

Referenced by acf_faxopt_write().

◆ ast_fax_minrate()

unsigned int ast_fax_minrate ( void  )

get the minimum supported fax rate

Definition at line 905 of file res_fax.c.

906{
907 struct fax_options options;
909
910 return options.minrate;
911}

References get_general_options(), and options.

Referenced by acf_faxopt_write().

◆ ast_fax_session_operation_str()

const char * ast_fax_session_operation_str ( struct ast_fax_session s)

get string representation of a FAX session's operation

Definition at line 4355 of file res_fax.c.

4356{
4357 if (s->details->caps & AST_FAX_TECH_GATEWAY) {
4358 return "gateway";
4359 }
4360 if (s->details->caps & AST_FAX_TECH_SEND) {
4361 return "send";
4362 }
4363 if (s->details->caps & AST_FAX_TECH_RECEIVE) {
4364 return "receive";
4365 }
4367 return "V.21";
4368 }
4369
4370 return "none";
4371}
enum ast_fax_capabilities caps
Definition res_fax.h:113
struct ast_fax_session_details * details
Definition res_fax.h:208

References AST_FAX_TECH_GATEWAY, AST_FAX_TECH_RECEIVE, AST_FAX_TECH_SEND, AST_FAX_TECH_V21_DETECT, ast_fax_session_details::caps, and ast_fax_session::details.

Referenced by cli_fax_show_sessions(), manager_fax_sessions_entry(), and spandsp_manager_fax_session().

◆ ast_fax_state_to_str()

const char * ast_fax_state_to_str ( enum ast_fax_state  state)

convert an ast_fax_state to a string

convert an ast_fax_state to a string

Definition at line 1114 of file res_fax.c.

1115{
1116 switch (state) {
1118 return "Uninitialized";
1120 return "Initialized";
1121 case AST_FAX_STATE_OPEN:
1122 return "Open";
1124 return "Active";
1126 return "Complete";
1128 return "Reserved";
1130 return "Inactive";
1131 default:
1132 ast_log(LOG_WARNING, "unhandled FAX state: %u\n", state);
1133 return "Unknown";
1134 }
1135}
#define LOG_WARNING

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(), manager_fax_sessions_entry(), spandsp_fax_cli_show_session(), spandsp_fax_write(), and spandsp_manager_fax_session().

◆ ast_fax_tech_register()

int ast_fax_tech_register ( struct ast_fax_tech tech)

register a fax technology

register a fax technology

Definition at line 1075 of file res_fax.c.

1076{
1077 struct fax_module *fax;
1078
1079 if (!(fax = ast_calloc(1, sizeof(*fax)))) {
1080 return -1;
1081 }
1082 fax->tech = tech;
1086
1087 ast_verb(3, "Registered handler for '%s' (%s)\n", fax->tech->type, fax->tech->description);
1088
1089 return 0;
1090}
#define ast_calloc(num, len)
A wrapper for calloc()
Definition astmm.h:202
#define ast_verb(level,...)
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
Definition linkedlists.h:52
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
#define AST_RWLIST_INSERT_TAIL
const char *const type
Definition res_fax.h:237
const char *const description
Definition res_fax.h:239
registered FAX technology modules are put into this list
Definition res_fax.c:617
const struct ast_fax_tech * tech
Definition res_fax.c:618
struct fax_module::@473 list

References ast_calloc, AST_RWLIST_INSERT_TAIL, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb, ast_fax_tech::description, fax_module::list, fax_module::tech, and ast_fax_tech::type.

Referenced by load_module().

◆ ast_fax_tech_unregister()

void ast_fax_tech_unregister ( struct ast_fax_tech tech)

unregister a fax technology

unregister a fax technology

Definition at line 1093 of file res_fax.c.

1094{
1095 struct fax_module *fax;
1096
1097 ast_verb(3, "Unregistering FAX module type '%s'\n", tech->type);
1098
1101 if (fax->tech != tech) {
1102 continue;
1103 }
1105 ast_free(fax);
1106 ast_verb(4, "Unregistered FAX module type '%s'\n", tech->type);
1107 break;
1108 }
1111}
#define ast_free(a)
Definition astmm.h:180
#define AST_RWLIST_REMOVE_CURRENT
#define AST_RWLIST_TRAVERSE_SAFE_BEGIN
#define AST_RWLIST_TRAVERSE_SAFE_END

References ast_free, 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().