Mon Mar 19 11:30:53 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>

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


Enumeration Type Documentation

enum 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

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

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

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

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 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 };


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

References ast_log(), and ast_log_dynamic_level.

Referenced by spandsp_log().

00653 {
00654    if (fax_logger_level != -1) {
00655       ast_log_dynamic_level(fax_logger_level, "%s", msg);
00656    } else {
00657       ast_log(level, file, line, function, "%s", msg);
00658    }
00659 }

unsigned int ast_fax_maxrate ( void   ) 

get the maxiumum supported fax rate

Definition at line 426 of file res_fax.c.

References general_options.

Referenced by acf_faxopt_write().

00427 {
00428    return general_options.maxrate;
00429 }

unsigned int ast_fax_minrate ( void   ) 

get the minimum supported fax rate

Definition at line 431 of file res_fax.c.

References general_options.

Referenced by acf_faxopt_write().

00432 {
00433    return general_options.minrate;
00434 }

const char* ast_fax_state_to_str ( enum ast_fax_state  state  ) 

convert an ast_fax_state to a string

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

00630 {
00631    switch (state) {
00632    case AST_FAX_STATE_UNINITIALIZED:
00633       return "Uninitialized";
00634    case AST_FAX_STATE_INITIALIZED:
00635       return "Initialized";
00636    case AST_FAX_STATE_OPEN:
00637       return "Open";
00638    case AST_FAX_STATE_ACTIVE:
00639       return "Active";
00640    case AST_FAX_STATE_COMPLETE:
00641       return "Complete";
00642    case AST_FAX_STATE_RESERVED:
00643       return "Reserved";
00644    case AST_FAX_STATE_INACTIVE:
00645       return "Inactive";
00646    default:
00647       ast_log(LOG_WARNING, "unhandled FAX state: %d\n", state);
00648       return "Unknown";
00649    }
00650 }

int ast_fax_tech_register ( struct ast_fax_tech tech  ) 

register a fax technology

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

00589 {
00590    struct fax_module *fax;
00591 
00592    if (!(fax = ast_calloc(1, sizeof(*fax)))) {
00593       return -1;
00594    }
00595    fax->tech = tech;
00596    AST_RWLIST_WRLOCK(&faxmodules);
00597    AST_RWLIST_INSERT_TAIL(&faxmodules, fax, list);
00598    AST_RWLIST_UNLOCK(&faxmodules);
00599    ast_module_ref(ast_module_info->self);
00600 
00601    ast_verb(3, "Registered handler for '%s' (%s)\n", fax->tech->type, fax->tech->description);
00602 
00603    return 0;
00604 }

void ast_fax_tech_unregister ( struct ast_fax_tech tech  ) 

unregister a fax technology

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

00608 {
00609    struct fax_module *fax;
00610 
00611    ast_verb(3, "Unregistering FAX module type '%s'\n", tech->type);
00612 
00613    AST_RWLIST_WRLOCK(&faxmodules);
00614    AST_RWLIST_TRAVERSE_SAFE_BEGIN(&faxmodules, fax, list) {
00615       if (fax->tech != tech) {
00616          continue;
00617       }
00618       AST_RWLIST_REMOVE_CURRENT(list);
00619       ast_module_unref(ast_module_info->self);
00620       ast_free(fax);
00621       ast_verb(4, "Unregistered FAX module type '%s'\n", tech->type);
00622       break;   
00623    }
00624    AST_RWLIST_TRAVERSE_SAFE_END;
00625    AST_RWLIST_UNLOCK(&faxmodules);
00626 }


Generated on Mon Mar 19 11:30:53 2012 for Asterisk - The Open Source Telephony Project by  doxygen 1.4.7