Thu Oct 11 06:37:05 2012

Asterisk developer's documentation


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

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 Documentation

#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().


Enumeration Type Documentation

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 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    /*! T.38 - T.30 Gateway */
00046    AST_FAX_TECH_GATEWAY = (1 << 5),
00047    /*! V21 detection is supported */
00048    AST_FAX_TECH_V21_DETECT = (1 << 6),
00049 };

fax modem capabilities

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

00052                     {
00053    /*! V.17 */
00054    AST_FAX_MODEM_V17 = (1 << 0),
00055    /*! V.27 */
00056    AST_FAX_MODEM_V27 = (1 << 1),
00057    /*! V.29 */
00058    AST_FAX_MODEM_V29 = (1 << 2),
00059    /*! V.34 */
00060    AST_FAX_MODEM_V34 = (1 << 3),
00061 };

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

00082                      {
00083    /*! false/disable configuration override */
00084    AST_FAX_OPTFLAG_FALSE = 0,
00085    /*! true/enable configuration override */
00086    AST_FAX_OPTFLAG_TRUE,
00087    /*! use the configured default */
00088    AST_FAX_OPTFLAG_DEFAULT,
00089 };

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

00064                    {
00065    /*! uninitialized state */
00066    AST_FAX_STATE_UNINITIALIZED = 0,
00067    /*! initialized state */
00068    AST_FAX_STATE_INITIALIZED,
00069    /*! fax resources open state */
00070    AST_FAX_STATE_OPEN,
00071    /*! fax session in progress */
00072    AST_FAX_STATE_ACTIVE,
00073    /*! fax session complete */
00074    AST_FAX_STATE_COMPLETE,
00075    /*! reserved state */
00076    AST_FAX_STATE_RESERVED,
00077    /*! inactive state */
00078    AST_FAX_STATE_INACTIVE,
00079 };


Function Documentation

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

References ast_log(), and ast_log_dynamic_level.

Referenced by spandsp_log().

00818 {
00819    if (fax_logger_level != -1) {
00820       ast_log_dynamic_level(fax_logger_level, "%s", msg);
00821    } else {
00822       ast_log(level, file, line, function, "%s", msg);
00823    }
00824 }

unsigned int ast_fax_maxrate ( void   ) 

get the maxiumum supported fax rate

Definition at line 572 of file res_fax.c.

References get_general_options(), and fax_options::maxrate.

Referenced by acf_faxopt_write().

00573 {
00574    struct fax_options options;
00575    get_general_options(&options);
00576 
00577    return options.maxrate;
00578 }

unsigned int ast_fax_minrate ( void   ) 

get the minimum supported fax rate

Definition at line 580 of file res_fax.c.

References get_general_options(), and fax_options::minrate.

Referenced by acf_faxopt_write().

00581 {
00582    struct fax_options options;
00583    get_general_options(&options);
00584 
00585    return options.minrate;
00586 }

const char* ast_fax_state_to_str ( enum ast_fax_state  state  ) 

convert an ast_fax_state to a string

Definition at line 794 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().

00795 {
00796    switch (state) {
00797    case AST_FAX_STATE_UNINITIALIZED:
00798       return "Uninitialized";
00799    case AST_FAX_STATE_INITIALIZED:
00800       return "Initialized";
00801    case AST_FAX_STATE_OPEN:
00802       return "Open";
00803    case AST_FAX_STATE_ACTIVE:
00804       return "Active";
00805    case AST_FAX_STATE_COMPLETE:
00806       return "Complete";
00807    case AST_FAX_STATE_RESERVED:
00808       return "Reserved";
00809    case AST_FAX_STATE_INACTIVE:
00810       return "Inactive";
00811    default:
00812       ast_log(LOG_WARNING, "unhandled FAX state: %d\n", state);
00813       return "Unknown";
00814    }
00815 }

int ast_fax_tech_register ( struct ast_fax_tech tech  ) 

register a fax technology

Definition at line 753 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().

00754 {
00755    struct fax_module *fax;
00756 
00757    if (!(fax = ast_calloc(1, sizeof(*fax)))) {
00758       return -1;
00759    }
00760    fax->tech = tech;
00761    AST_RWLIST_WRLOCK(&faxmodules);
00762    AST_RWLIST_INSERT_TAIL(&faxmodules, fax, list);
00763    AST_RWLIST_UNLOCK(&faxmodules);
00764    ast_module_ref(ast_module_info->self);
00765 
00766    ast_verb(3, "Registered handler for '%s' (%s)\n", fax->tech->type, fax->tech->description);
00767 
00768    return 0;
00769 }

void ast_fax_tech_unregister ( struct ast_fax_tech tech  ) 

unregister a fax technology

Definition at line 772 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().

00773 {
00774    struct fax_module *fax;
00775 
00776    ast_verb(3, "Unregistering FAX module type '%s'\n", tech->type);
00777 
00778    AST_RWLIST_WRLOCK(&faxmodules);
00779    AST_RWLIST_TRAVERSE_SAFE_BEGIN(&faxmodules, fax, list) {
00780       if (fax->tech != tech) {
00781          continue;
00782       }
00783       AST_RWLIST_REMOVE_CURRENT(list);
00784       ast_module_unref(ast_module_info->self);
00785       ast_free(fax);
00786       ast_verb(4, "Unregistered FAX module type '%s'\n", tech->type);
00787       break;
00788    }
00789    AST_RWLIST_TRAVERSE_SAFE_END;
00790    AST_RWLIST_UNLOCK(&faxmodules);
00791 }


Generated on Thu Oct 11 06:37:06 2012 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6