Asterisk - The Open Source Telephony Project
21.4.1
|
Generic FAX Resource for FAX technology resource modules. More...
#include "asterisk.h"
#include "asterisk/io.h"
#include "asterisk/file.h"
#include "asterisk/logger.h"
#include "asterisk/module.h"
#include "asterisk/app.h"
#include "asterisk/lock.h"
#include "asterisk/options.h"
#include "asterisk/strings.h"
#include "asterisk/cli.h"
#include "asterisk/utils.h"
#include "asterisk/config.h"
#include "asterisk/astobj2.h"
#include "asterisk/res_fax.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/dsp.h"
#include "asterisk/indications.h"
#include "asterisk/ast_version.h"
#include "asterisk/translate.h"
#include "asterisk/stasis.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/smoother.h"
#include "asterisk/format_cache.h"
Go to the source code of this file.
Data Structures | |
struct | ast_fax_debug_info |
struct | debug_info_history |
struct | fax_detect |
used for fax detect framehook More... | |
struct | fax_gateway |
used for gateway framehook More... | |
struct | fax_module |
registered FAX technology modules are put into this list More... | |
struct | fax_options |
struct | faxmodules |
Macros | |
#define | FAX_DETECT_MODE_BOTH (FAX_DETECT_MODE_CNG | FAX_DETECT_MODE_T38) |
#define | FAX_DETECT_MODE_CNG (1 << 0) |
FAX Detect flags. | |
#define | FAX_DETECT_MODE_T38 (1 << 1) |
#define | FAX_GATEWAY_TIMEOUT RES_FAX_TIMEOUT |
#define | FAX_MAXBUCKETS 10 |
maximum buckets for res_fax ao2 containers | |
#define | GENERIC_FAX_EXEC_ERROR(fax, chan, errorstr, reason) |
#define | GENERIC_FAX_EXEC_ERROR_QUIET(fax, chan, errorstr, reason) |
#define | GENERIC_FAX_EXEC_SET_VARS(fax, chan, errorstr, reason) |
#define | RES_FAX_MAXRATE 14400 |
#define | RES_FAX_MINRATE 4800 |
#define | RES_FAX_MODEM (AST_FAX_MODEM_V17 | AST_FAX_MODEM_V27TER | AST_FAX_MODEM_V29) |
#define | RES_FAX_STATUSEVENTS 0 |
#define | RES_FAX_T38TIMEOUT 5000 |
#define | RES_FAX_TIMEOUT 10000 |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | acf_faxopt_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
FAXOPT read function returns the contents of a FAX option. | |
static int | acf_faxopt_write (struct ast_channel *chan, const char *cmd, char *data, const char *value) |
FAXOPT write function modifies the contents of a FAX option. | |
static char * | ast_fax_caps_to_str (enum ast_fax_capabilities caps, char *buf, size_t bufsize) |
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. More... | |
unsigned int | ast_fax_maxrate (void) |
get the maxiumum supported fax rate | |
unsigned int | ast_fax_minrate (void) |
get the minimum supported fax rate | |
static int | ast_fax_modem_to_str (enum ast_fax_modems bits, char *tbuf, size_t bufsize) |
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 a ast_fax_state to a string More... | |
int | ast_fax_tech_register (struct ast_fax_tech *tech) |
register a FAX technology module More... | |
void | ast_fax_tech_unregister (struct ast_fax_tech *tech) |
unregister a FAX technology module More... | |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static int | check_modem_rate (enum ast_fax_modems modems, unsigned int rate) |
static char * | cli_fax_set_debug (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
enable FAX debugging | |
static char * | cli_fax_show_capabilities (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
display registered FAX capabilities | |
static char * | cli_fax_show_session (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
display details of a specified fax session | |
static char * | cli_fax_show_sessions (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
display fax sessions | |
static char * | cli_fax_show_settings (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
display global defaults and settings | |
static char * | cli_fax_show_stats (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
display fax stats | |
static char * | cli_fax_show_version (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static void | debug_check_frame_for_silence (struct ast_fax_session *s, unsigned int c2s, struct ast_frame *frame) |
static void | destroy_callback (void *data) |
static void | destroy_faxdetect (void *data) |
destroy a FAX detect structure | |
static void | destroy_gateway (void *data) |
destroy a FAX gateway session structure | |
static void | destroy_session (void *session) |
destroy a FAX session structure | |
static void | destroy_session_details (void *details) |
destroy a FAX session details structure | |
static void | destroy_v21_sessions (struct fax_gateway *gateway) |
destroy the v21 detection parts of a fax gateway session | |
static int | disable_t38 (struct ast_channel *chan) |
static int | fax_detect_attach (struct ast_channel *chan, int timeout, int flags) |
Attach a faxdetect framehook object to a channel. More... | |
static struct ast_frame * | fax_detect_framehook (struct ast_channel *chan, struct ast_frame *f, enum ast_framehook_event event, void *data) |
Fax Detect Framehook. More... | |
static void | fax_detect_framehook_destroy (void *data) |
Deref the faxdetect data structure when the faxdetect framehook is detached. More... | |
static struct fax_detect * | fax_detect_new (struct ast_channel *chan, int timeout, int flags) |
Create a new fax detect object. More... | |
static int | fax_gateway_attach (struct ast_channel *chan, struct ast_fax_session_details *details) |
Attach a gateway framehook object to a channel. More... | |
static struct ast_frame * | fax_gateway_detect_t38 (struct fax_gateway *gateway, struct ast_channel *chan, struct ast_channel *peer, struct ast_channel *active, struct ast_frame *f) |
T38 Gateway Negotiate t38 parameters. More... | |
static struct ast_frame * | fax_gateway_detect_v21 (struct fax_gateway *gateway, struct ast_channel *chan, struct ast_channel *peer, struct ast_channel *active, struct ast_frame *f) |
static struct ast_frame * | fax_gateway_framehook (struct ast_channel *chan, struct ast_frame *f, enum ast_framehook_event event, void *data) |
T.30<->T.38 gateway framehook. More... | |
static void | fax_gateway_framehook_destroy (void *data) |
Destroy the gateway data structure when the framehook is detached. More... | |
static void | fax_gateway_indicate_t38 (struct ast_channel *chan, struct ast_channel *active, struct ast_control_t38_parameters *control_params) |
static struct fax_gateway * | fax_gateway_new (struct ast_channel *chan, struct ast_fax_session_details *details) |
Create a new fax gateway object. More... | |
static struct ast_frame * | fax_gateway_request_t38 (struct fax_gateway *gateway, struct ast_channel *chan) |
static int | fax_gateway_start (struct fax_gateway *gateway, struct ast_fax_session_details *details, struct ast_channel *chan) |
Create a fax session and start T.30<->T.38 gateway mode. More... | |
static unsigned int | fax_rate_str_to_int (const char *ratestr) |
convert a rate string to a rate | |
static struct ast_fax_session * | fax_session_new (struct ast_fax_session_details *details, struct ast_channel *chan, struct ast_fax_session *reserved, struct ast_fax_tech_token *token) |
create a FAX session More... | |
static void | fax_session_release (struct ast_fax_session *s, struct ast_fax_tech_token *token) |
Release a session token. More... | |
static struct ast_fax_session * | fax_session_reserve (struct ast_fax_session_details *details, struct ast_fax_tech_token **token) |
Reserve a fax session. More... | |
static char * | fax_session_tab_complete (struct ast_cli_args *a) |
fax session tab completion | |
static const char * | fax_session_type (struct ast_fax_session *s) |
static struct ast_fax_session * | fax_v21_session_new (struct ast_channel *chan) |
static struct ast_fax_session_details * | find_details (struct ast_channel *chan) |
returns a reference counted pointer to a fax datastore, if it exists | |
static struct ast_fax_session_details * | find_or_create_details (struct ast_channel *chan) |
returns a reference counted details structure from the channel's fax datastore. If the datastore does not exist it will be created | |
static void | fixup_callback (void *data, struct ast_channel *old_chan, struct ast_channel *new_chan) |
Copies fax detection and gateway framehooks during masquerades. More... | |
static struct ast_json * | generate_filenames_json (struct ast_fax_session_details *details) |
static char * | generate_filenames_string (struct ast_fax_session_details *details, char *prefix, char *separator) |
Generate a string of filenames using the given prefix and separator. More... | |
static int | generic_fax_exec (struct ast_channel *chan, struct ast_fax_session_details *details, struct ast_fax_session *reserved, struct ast_fax_tech_token *token) |
this is the generic FAX session handling function | |
static void | get_general_options (struct fax_options *options) |
static int | load_module (void) |
Load the module. More... | |
static int | manager_fax_session (struct mansession *s, const struct message *m) |
static int | manager_fax_sessions (struct mansession *s, const struct message *m) |
static int | manager_fax_sessions_entry (struct mansession *s, struct ast_fax_session *session, const char *id_text) |
static int | manager_fax_stats (struct mansession *s, const struct message *m) |
static int | receivefax_exec (struct ast_channel *chan, const char *data) |
initiate a receive FAX session | |
static int | receivefax_t38_init (struct ast_channel *chan, struct ast_fax_session_details *details) |
static int | reload_module (void) |
static int | report_fax_status (struct ast_channel *chan, struct ast_fax_session_details *details, const char *status) |
send a FAX status manager event | |
static int | report_receive_fax_status (struct ast_channel *chan, const char *filename) |
Report on the final state of a receive fax operation. More... | |
static int | report_send_fax_status (struct ast_channel *chan, struct ast_fax_session_details *details) |
Report on the status of a completed fax send attempt. More... | |
static int | sendfax_exec (struct ast_channel *chan, const char *data) |
initiate a send FAX session | |
static int | sendfax_t38_init (struct ast_channel *chan, struct ast_fax_session_details *details) |
static int | session_cmp_cb (void *obj, void *arg, int flags) |
compare callback for ao2 | |
static struct ast_fax_session_details * | session_details_new (void) |
create a FAX session details structure | |
static int | session_hash_cb (const void *obj, const int flags) |
hash callback for ao2 | |
static void | set_channel_variables (struct ast_channel *chan, struct ast_fax_session_details *details) |
Set fax related channel variables. | |
static int | set_config (int reload) |
configure res_fax | |
static int | set_fax_t38_caps (struct ast_channel *chan, struct ast_fax_session_details *details) |
static void | set_general_options (const struct fax_options *options) |
static int | set_t38timeout (const char *value, unsigned int *t38timeout) |
static void | t38_parameters_ast_to_fax (struct ast_fax_t38_parameters *dst, const struct ast_control_t38_parameters *src) |
static void | t38_parameters_fax_to_ast (struct ast_control_t38_parameters *dst, const struct ast_fax_t38_parameters *src) |
static int | unload_module (void) |
unload res_fax | |
static int | update_modem_bits (enum ast_fax_modems *bits, const char *value) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER , .description = "Generic FAX Applications" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "da6642af068ee5e6490c5b1d2cc1d238" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .reload = reload_module, .load_pri = AST_MODPRI_APP_DEPEND, } |
static struct ast_custom_function | acf_faxopt |
FAXOPT dialplan function. More... | |
static const char | app_receivefax [] = "ReceiveFAX" |
static const char | app_sendfax [] = "SendFAX" |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static const char * | config = "res_fax.conf" |
static const struct fax_options | default_options |
static struct ast_cli_entry | fax_cli [] |
static const struct ast_datastore_info | fax_datastore |
static const struct ast_app_option | fax_exec_options [128] = { [ 'a' ] = { .flag = OPT_CALLEDMODE }, [ 'c' ] = { .flag = OPT_CALLERMODE }, [ 'd' ] = { .flag = OPT_DEBUG }, [ 'f' ] = { .flag = OPT_ALLOWAUDIO }, [ 'F' ] = { .flag = OPT_FORCE_AUDIO }, [ 's' ] = { .flag = OPT_STATUS }, [ 'z' ] = { .flag = OPT_REQUEST_T38 }, } |
static int | fax_logger_level = -1 |
static struct faxmodules | faxmodules = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
struct { | |
int active_sessions | |
struct ao2_container * container | |
int fax_complete | |
int fax_failures | |
int fax_rx_attempts | |
int fax_tx_attempts | |
int nextsessionname | |
int reserved_sessions | |
} | faxregistry |
The faxregistry is used to manage information and statistics for all FAX sessions. | |
static struct fax_options | general_options |
static int | global_fax_debug = 0 |
static ast_rwlock_t | options_lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } |
static struct ast_control_t38_parameters | our_t38_parameters |
Generic FAX Resource for FAX technology resource modules.
A generic FAX resource module that provides SendFAX and ReceiveFAX applications. This module requires FAX technology modules, like res_fax_spandsp, to register with it so it can use the technology modules to perform the actual FAX transmissions.
Definition in file res_fax.c.
#define GENERIC_FAX_EXEC_ERROR | ( | fax, | |
chan, | |||
errorstr, | |||
reason | |||
) |
#define GENERIC_FAX_EXEC_ERROR_QUIET | ( | fax, | |
chan, | |||
errorstr, | |||
reason | |||
) |
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 1035 of file res_fax.c.
References ast_log_dynamic_level.
Referenced by spandsp_log().
const char* ast_fax_state_to_str | ( | enum ast_fax_state | state | ) |
convert a ast_fax_state to a string
convert an ast_fax_state to a string
Definition at line 1012 of file res_fax.c.
Referenced by cli_fax_show_sessions(), and spandsp_fax_write().
int ast_fax_tech_register | ( | struct ast_fax_tech * | tech | ) |
register a FAX technology module
register a fax technology
Definition at line 973 of file res_fax.c.
References ast_calloc, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_fax_tech::description, and ast_fax_tech::type.
Referenced by load_module().
void ast_fax_tech_unregister | ( | struct ast_fax_tech * | tech | ) |
unregister a FAX technology module
unregister a fax technology
Definition at line 991 of file res_fax.c.
References AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, and ast_fax_tech::type.
Referenced by unload_module().
|
static |
Attach a faxdetect framehook object to a channel.
chan | the channel to attach to |
timeout | in ms to remove framehook in this time if not zero |
flags | required options |
-1 | error |
Definition at line 3888 of file res_fax.c.
References ao2_ref, ast_framehook_attach(), ast_framehook_interface::data, fax_detect::details, fax_detect_framehook(), fax_detect_framehook_destroy(), fax_detect_new(), ast_fax_session_details::faxdetect_flags, ast_fax_session_details::faxdetect_id, ast_fax_session_details::faxdetect_timeout, find_or_create_details(), and ast_framehook_interface::version.
Referenced by acf_faxopt_write(), and fixup_callback().
|
static |
Fax Detect Framehook.
Listen for fax tones in audio path and enable jumping to a extension when detected.
chan | channel |
f | frame to handle may be NULL |
event | framehook event |
data | framehook data (struct fax_detect *) |
Definition at line 3744 of file res_fax.c.
References ao2_ref, ao2_replace, ast_async_goto(), ast_channel_bridge_peer(), ast_channel_make_compatible(), AST_CONTROL_T38_PARAMETERS, ast_debug, ast_dsp_process(), ast_exists_extension(), ast_format_alaw, ast_format_cmp(), AST_FORMAT_CMP_EQUAL, ast_format_slin, ast_format_ulaw, AST_FRAME_CONTROL, AST_FRAME_VOICE, ast_framehook_detach(), AST_FRAMEHOOK_EVENT_ATTACHED, AST_FRAMEHOOK_EVENT_DETACHED, AST_FRAMEHOOK_EVENT_READ, ast_null_frame, ast_set_read_format(), AST_T38_NEGOTIATED, AST_T38_REQUEST_NEGOTIATE, ast_tvdiff_ms(), ast_tvnow(), ast_tvzero(), ast_frame::data, ast_frame::datalen, fax_detect::details, fax_detect::dsp, ast_fax_session_details::faxdetect_id, ast_fax_session_details::faxdetect_timeout, fax_detect::flags, ast_frame_subclass::format, ast_frame::frametype, ast_frame_subclass::integer, fax_detect::orig_format, pbx_builtin_setvar_helper(), RAII_VAR, ast_control_t38_parameters::request_response, S_COR, ast_frame::subclass, and fax_detect::timeout_start.
Referenced by fax_detect_attach().
|
static |
Deref the faxdetect data structure when the faxdetect framehook is detached.
data | framehook data (faxdetect data) |
Definition at line 3726 of file res_fax.c.
References ao2_ref.
Referenced by fax_detect_attach().
|
static |
Create a new fax detect object.
chan | the channel attaching to |
timeout | in ms to remove framehook in this time if not zero |
flags | required options |
Definition at line 3693 of file res_fax.c.
References ao2_ref, ast_dsp_new(), ast_dsp_set_faxmode(), ast_dsp_set_features(), ast_tvnow(), destroy_faxdetect(), fax_detect::dsp, FAX_DETECT_MODE_CNG, fax_detect::flags, and fax_detect::timeout_start.
Referenced by fax_detect_attach().
|
static |
Attach a gateway framehook object to a channel.
chan | the channel to attach to |
details | fax session details |
-1 | error |
Definition at line 3625 of file res_fax.c.
References ao2_ref, ast_framehook_attach(), ast_string_field_set, ast_framehook_interface::data, ast_fax_session_details::debug, fax_gateway_framehook(), fax_gateway_framehook_destroy(), fax_gateway_new(), fax_gateway::framehook, ast_fax_session_details::is_t38_negotiated, ast_fax_session_details::option, report_fax_status(), set_channel_variables(), and ast_framehook_interface::version.
Referenced by acf_faxopt_write(), and fixup_callback().
|
static |
T38 Gateway Negotiate t38 parameters.
gateway | gateway object |
chan | channel running the gateway |
peer | channel im bridged too |
active | channel the frame originated on |
f | the control frame to process |
Definition at line 3108 of file res_fax.c.
References ao2_ref, ast_channel_get_t38_state(), ast_debug, ast_framehook_detach(), ast_null_frame, ast_string_field_set, AST_T38_NEGOTIATED, AST_T38_REFUSED, AST_T38_REQUEST_NEGOTIATE, AST_T38_REQUEST_TERMINATE, AST_T38_TERMINATED, ast_tvnow(), ast_frame::data, ast_frame::datalen, ast_fax_session_details::error, fax_gateway_indicate_t38(), fax_gateway_start(), find_details(), fax_gateway::framehook, ast_fax_session_details::gateway_id, ast_fax_session_details::gateway_timeout, ast_fax_session_details::is_t38_negotiated, ast_fax_session_details::our_t38_parameters, report_fax_status(), ast_control_t38_parameters::request_response, ast_fax_session_details::result, ast_fax_session_details::resultstr, set_channel_variables(), fax_gateway::t38_state, T38_STATE_NEGOTIATED, T38_STATE_NEGOTIATING, T38_STATE_REJECTED, T38_STATE_UNAVAILABLE, T38_STATE_UNKNOWN, ast_fax_session_details::their_t38_parameters, and fax_gateway::timeout_start.
Referenced by fax_gateway_framehook().
|
static |
Definition at line 3011 of file res_fax.c.
References ao2_ref, ast_channel_get_t38_state(), ast_debug, ast_write(), ast_fax_session::chan, destroy_v21_sessions(), ast_fax_session::details, fax_gateway::detected_v21, fax_gateway_request_t38(), find_or_create_details(), ast_fax_session_details::negotiate_both, ast_fax_session_details::option, T38_STATE_UNKNOWN, ast_fax_session::tech, ast_fax_session_details::v21_detected, and ast_fax_tech::write.
Referenced by fax_gateway_framehook().
|
static |
T.30<->T.38 gateway framehook.
Intercept packets on bridged channels and determine if a T.38 gateway is required. If a gateway is required, start a gateway and handle T.38 negotiation if necessary.
chan | channel running the gateway |
f | frame to handle may be NULL |
event | framehook event |
data | framehook data (struct fax_gateway *) |
Definition at line 3382 of file res_fax.c.
References ao2_ref, ao2_replace, ast_channel_bridge_peer(), ast_channel_get_t38_state(), ast_channel_lock_both, ast_channel_make_compatible(), ast_check_hangup(), AST_CONTROL_T38_PARAMETERS, ast_debug, ast_format_alaw, ast_format_cmp(), AST_FORMAT_CMP_EQUAL, ast_format_slin, ast_format_ulaw, AST_FRAME_CONTROL, AST_FRAME_MODEM, AST_FRAME_VOICE, ast_framehook_detach(), AST_FRAMEHOOK_EVENT_ATTACHED, AST_FRAMEHOOK_EVENT_DETACHED, AST_FRAMEHOOK_EVENT_READ, AST_FRAMEHOOK_EVENT_WRITE, ast_frisolate, AST_MODEM_T38, ast_null_frame, ast_set_read_format(), ast_set_write_format(), ast_string_field_build, ast_string_field_set, ast_translate(), ast_tvdiff_ms(), ast_tvnow(), ast_tvzero(), fax_gateway::bridged, fax_gateway::chan_read_format, ast_fax_session::details, fax_gateway::detected_v21, ast_trans_pvt::f, fax_gateway_detect_t38(), fax_gateway_detect_v21(), find_details(), ast_frame_subclass::format, fax_gateway::framehook, ast_frame::frametype, ast_fax_session_details::gateway_id, ast_fax_session_details::gateway_timeout, ast_frame_subclass::integer, ast_fax_session_details::is_t38_negotiated, RAII_VAR, fax_gateway::s, ast_frame::samples, set_channel_variables(), ast_frame::subclass, fax_gateway::t38_state, T38_STATE_NEGOTIATED, T38_STATE_REJECTED, T38_STATE_UNAVAILABLE, ast_fax_session::tech, ast_fax_session::tech_pvt, fax_gateway::timeout_start, and ast_fax_tech::write.
Referenced by fax_gateway_attach().
|
static |
Destroy the gateway data structure when the framehook is detached.
data | framehook data (gateway data) |
Definition at line 3344 of file res_fax.c.
References ao2_ref, ast_fax_tech::cancel_session, fax_gateway::s, ast_fax_session::state, and ast_fax_session::tech.
Referenced by fax_gateway_attach().
|
static |
Definition at line 3084 of file res_fax.c.
References AST_CONTROL_T38_PARAMETERS, ast_indicate_data(), and ast_queue_control_data().
Referenced by fax_gateway_detect_t38().
|
static |
Create a new fax gateway object.
chan | the channel the gateway object will be attached to |
details | the fax session details |
Definition at line 2879 of file res_fax.c.
References ao2_ref, ast_fax_session_details::caps, destroy_gateway(), fax_session_reserve(), fax_gateway::framehook, ast_fax_session_details::gateway_timeout, fax_gateway::s, and fax_gateway::token.
Referenced by fax_gateway_attach().
|
static |
Definition at line 2971 of file res_fax.c.
References ao2_ref, AST_CONTROL_T38_PARAMETERS, ast_debug, AST_FRAME_CONTROL, ast_framehook_detach(), ast_frisolate, AST_T38_REQUEST_NEGOTIATE, ast_tvnow(), find_details(), fax_gateway::framehook, ast_fax_session_details::gateway_timeout, ast_frame_subclass::integer, ast_fax_session_details::is_t38_negotiated, ast_fax_session_details::our_t38_parameters, ast_control_t38_parameters::request_response, ast_frame::src, ast_frame::subclass, fax_gateway::t38_state, T38_STATE_NEGOTIATING, and fax_gateway::timeout_start.
Referenced by fax_gateway_detect_v21().
|
static |
Create a fax session and start T.30<->T.38 gateway mode.
gateway | a fax gateway object |
details | fax session details |
chan | active channel |
Definition at line 2916 of file res_fax.c.
References ao2_ref, ast_string_field_set, destroy_v21_sessions(), fax_session_new(), ast_fax_session_details::is_t38_negotiated, report_fax_status(), fax_gateway::s, set_channel_variables(), ast_fax_tech::start_session, ast_fax_session::state, ast_fax_session::tech, fax_gateway::timeout_start, and fax_gateway::token.
Referenced by fax_gateway_detect_t38().
|
static |
create a FAX session
details | details for the session |
chan | the channel the session will run on |
reserved | a reserved session to base this session on (can be NULL) |
token | the token for a reserved session (can be NULL) |
Create a new fax session based on the given details structure.
Definition at line 1214 of file res_fax.c.
References ao2_link, ao2_ref, ao2_unlink, ast_atomic_fetchadd_int(), ast_calloc, ast_debug, ast_dsp_new(), ast_dsp_set_threshold(), ast_module_running_ref, ast_module_unref, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, ast_strdup, ast_fax_session_details::caps, ast_fax_tech::caps, ast_fax_session::chan, ast_fax_session::chan_uniqueid, ast_fax_session::channame, ast_fax_session_details::debug, ast_fax_session::debug_info, ast_fax_tech::description, destroy_session(), ast_fax_session::details, fax_session_release(), faxregistry, ast_fax_session_details::id, ast_fax_session::id, ast_fax_tech::module, ast_fax_tech::new_session, ast_fax_session_details::option, ast_fax_session::state, ast_fax_session::tech, and ast_fax_session::tech_pvt.
Referenced by fax_gateway_start(), and generic_fax_exec().
|
static |
Release a session token.
s | a session returned from fax_session_reserve() |
token | a token generated from fax_session_reserve() |
This function releases the given token and marks the given session as no longer reserved. It is safe to call on a session that is not actually reserved and with a NULL token. This is so that sessions returned by technologies that do not support reserved sessions don't require extra logic to handle.
Definition at line 1082 of file res_fax.c.
References ast_atomic_fetchadd_int(), faxregistry, ast_fax_tech::release_token, ast_fax_session::state, and ast_fax_session::tech.
Referenced by destroy_gateway(), destroy_session(), fax_session_new(), receivefax_exec(), and sendfax_exec().
|
static |
Reserve a fax session.
details | the fax session details |
token | a pointer to a place to store a token to be passed to fax_session_new() later |
This function reserves a fax session for use later. If the selected fax technology does not support reserving sessions a session will still be returned but token will not be set.
Definition at line 1145 of file res_fax.c.
References ao2_ref, ast_atomic_fetchadd_int(), ast_debug, ast_module_running_ref, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, ast_fax_session_details::caps, ast_fax_tech::caps, ast_fax_tech::description, destroy_session(), ast_fax_session::details, faxregistry, ast_fax_tech::module, ast_fax_tech::reserve_session, ast_fax_session::state, and ast_fax_session::tech.
Referenced by fax_gateway_new(), receivefax_exec(), and sendfax_exec().
|
static |
Copies fax detection and gateway framehooks during masquerades.
Definition at line 635 of file res_fax.c.
References ast_channel_datastore_find(), ast_channel_datastore_remove(), ast_datastore_free(), ast_framehook_detach(), fax_detect_attach(), fax_gateway_attach(), ast_fax_session_details::faxdetect_flags, ast_fax_session_details::faxdetect_id, ast_fax_session_details::faxdetect_timeout, find_or_create_details(), ast_fax_session_details::gateway_id, and ast_fax_session_details::is_t38_negotiated.
|
static |
Generate a string of filenames using the given prefix and separator.
details | the fax session details |
prefix | the prefix to each filename |
separator | the separator between filenames |
This function generates a string of filenames from the given details structure and using the given prefix and separator.
NULL | there was an error generating the string |
Definition at line 1369 of file res_fax.c.
References ast_build_string(), AST_LIST_EMPTY, AST_LIST_FIRST, AST_LIST_TRAVERSE, ast_malloc, ast_strdup, and ast_fax_session_details::documents.
Referenced by acf_faxopt_read(), cli_fax_show_sessions(), and sendfax_exec().
|
static |
Load the module.
Module loading including tests for configuration or dependencies. This function can return AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_DECLINE, or AST_MODULE_LOAD_SUCCESS. If a dependency or environment variable fails tests return AST_MODULE_LOAD_FAILURE. If the module can not load the configuration file or other non-critical problem return AST_MODULE_LOAD_DECLINE. On success return AST_MODULE_LOAD_SUCCESS.
Definition at line 4787 of file res_fax.c.
References AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, ao2_ref, ast_cli_register_multiple, ast_custom_function_register, ast_logger_register_level(), ast_manager_register_xml, ast_manager_unregister(), AST_MODULE_LOAD_DECLINE, ast_register_application_xml, ast_unregister_application(), FAX_MAXBUCKETS, faxregistry, receivefax_exec(), sendfax_exec(), session_cmp_cb(), session_hash_cb(), and set_config().
|
static |
Report on the final state of a receive fax operation.
Definition at line 2017 of file res_fax.c.
References ast_channel_blob_create_from_cache(), ast_channel_fax_type(), ast_channel_topic(), ast_json_array_append(), ast_json_array_create(), ast_json_pack(), ast_json_ref(), ast_json_string_create(), ast_json_unref(), AST_JSON_UTF8_VALIDATE, ast_strdupa, lock, pbx_builtin_getvar_helper(), RAII_VAR, S_OR, SCOPED_CHANNELLOCK, and stasis_publish().
Referenced by receivefax_exec().
|
static |
Report on the status of a completed fax send attempt.
Definition at line 2526 of file res_fax.c.
References ast_channel_blob_create_from_cache(), ast_channel_fax_type(), ast_channel_topic(), ast_json_pack(), ast_json_unref(), AST_JSON_UTF8_VALIDATE, ast_strdupa, lock, pbx_builtin_getvar_helper(), RAII_VAR, S_OR, SCOPED_CHANNELLOCK, and stasis_publish().
Referenced by sendfax_exec().
|
static |
FAXOPT dialplan function.
struct ao2_container* container |
active sessions are astobj2 objects
Definition at line 501 of file res_fax.c.
Referenced by ast_aeap_client_configs_get(), and ast_extension_state_extended().
|
static |