584#define FAX_DETECT_MODE_CNG (1 << 0) 
  585#define FAX_DETECT_MODE_T38 (1 << 1) 
  586#define FAX_DETECT_MODE_BOTH    (FAX_DETECT_MODE_CNG | FAX_DETECT_MODE_T38) 
  591#define FAX_MAXBUCKETS 10 
  593#define RES_FAX_TIMEOUT 10000 
  594#define FAX_GATEWAY_TIMEOUT RES_FAX_TIMEOUT 
  623#define RES_FAX_MINRATE 4800 
  624#define RES_FAX_MAXRATE 14400 
  625#define RES_FAX_STATUSEVENTS 0 
  626#define RES_FAX_MODEM (AST_FAX_MODEM_V17 | AST_FAX_MODEM_V27TER | AST_FAX_MODEM_V29) 
  627#define RES_FAX_T38TIMEOUT 5000 
  654static const char *
config = 
"res_fax.conf";
 
  682    unsigned int last_consec_frames, last_consec_ms;
 
  683    unsigned char wassil;
 
  692    history->
silence = (dspsilence != 0) ? 1 : 0;
 
  693    if (history->
silence != wassil) {
 
  699        if ((last_consec_frames != 0)) {
 
  700            ast_verb(0, 
"Channel '%s' fax session '%u', [ %.3ld.%.6ld ], %s sent %u frames (%u ms) of %s.\n",
 
  701                 s->
channame, s->
id, (
long) diff.tv_sec, (
long int) diff.tv_usec,
 
  702                 (c2s) ? 
"channel" : 
"stack", last_consec_frames, last_consec_ms,
 
  703                 (wassil) ? 
"silence" : 
"energy");
 
 
  773    if (!(details = datastore->
data)) {
 
 
  821    d->option.statusevents = 
options.statusevents;
 
  827    d->faxdetect_id = -1;
 
  828    d->gateway_timeout = 0;
 
  829    d->negotiate_both = 0;
 
 
  884    datastore->
data = details;
 
 
  915    char *m[5], *tok, *v = (
char *) 
value, *rest;
 
  918    if (!strchr(v, 
',')) {
 
  922        tok = strtok_r(v, 
", ", &rest);
 
  925            tok = strtok_r(
NULL, 
", ", &rest);
 
  931    for (j = 0; j < i; j++) {
 
  932        if (!strcasecmp(m[j], 
"v17")) {
 
  934        } 
else if (!strcasecmp(m[j], 
"v27")) {
 
  936        } 
else if (!strcasecmp(m[j], 
"v29")) {
 
  938        } 
else if (!strcasecmp(m[j], 
"v34")) {
 
  941            ast_log(
LOG_WARNING, 
"ignoring invalid modem setting: '%s', valid options {v17 | v27 | v29 | v34}\n", m[j]);
 
 
  950    size_t size = bufsize;
 
 
 1011        strcat(tbuf, 
"V17");
 
 1018        strcat(tbuf, 
"V27");
 
 1025        strcat(tbuf, 
"V29");
 
 1032        strcat(tbuf, 
"V34");
 
 
 1118        return "Uninitialized";
 
 1120        return "Initialized";
 
 
 1137void ast_fax_log(
int level, 
const char *file, 
const int line, 
const char *function, 
const char *msg)
 
 1142        ast_log(level, file, line, function, 
"%s", msg);
 
 
 1151    if (sscanf(ratestr, 
"%d", &rate) != 1) {
 
 1166        ast_log(
LOG_WARNING, 
"ignoring invalid rate '%s'.  Valid options are {2400 | 4800 | 7200 | 9600 | 12000 | 14400 | 28800 | 33600}\n", ratestr);
 
 
 1278        char caps[128] = 
"";
 
 
 1402            char caps[128] = 
"";
 
 
 1436    if (!details || !json_array) {
 
 
 1473    char *filenames, *
c;
 
 1485        size += strlen(separator) + strlen(
prefix) + strlen(doc->
filename);
 
 
 1519    if (!json_filenames) {
 
 1523    json_object = 
ast_json_pack(
"{s: s, s: s, s: s, s: s, s: o}",
 
 1530        "filenames", json_filenames);
 
 
 1570#define GENERIC_FAX_EXEC_SET_VARS(fax, chan, errorstr, reason) \ 
 1572        if (ast_strlen_zero(fax->details->result)) \ 
 1573            ast_string_field_set(fax->details, result, "FAILED"); \ 
 1574        if (ast_strlen_zero(fax->details->resultstr)) \ 
 1575            ast_string_field_set(fax->details, resultstr, reason); \ 
 1576        if (ast_strlen_zero(fax->details->error)) \ 
 1577            ast_string_field_set(fax->details, error, errorstr); \ 
 1578        set_channel_variables(chan, fax->details); \ 
 
 1581#define GENERIC_FAX_EXEC_ERROR_QUIET(fax, chan, errorstr, reason) \ 
 1583        GENERIC_FAX_EXEC_SET_VARS(fax, chan, errorstr, reason); \ 
 
 1586#define GENERIC_FAX_EXEC_ERROR(fax, chan, errorstr, reason) \ 
 1588        ast_log(LOG_ERROR, "channel '%s' FAX session '%u' failure, reason: '%s' (%s)\n", ast_channel_name(chan), fax->id, reason, errorstr); \ 
 1589        GENERIC_FAX_EXEC_ERROR_QUIET(fax, chan, errorstr, reason); \ 
 
 1633    struct timeval start;
 
 1661            (frame->
datalen == 
sizeof(t38_parameters))) {
 
 
 1696    unsigned int expected_frametype = -1;
 
 1700    const char *tempvar;
 
 1707    struct timeval start;
 
 1712    if (t38negotiated) {
 
 1788    remaining_time = timeout;
 
 1790    while (remaining_time > 0) {
 
 1817                (frame->
datalen == 
sizeof(t38_parameters))) {
 
 1818                unsigned int was_t38 = t38negotiated;
 
 1843                if (t38negotiated && !was_t38) {
 
 1848                    details->
caps &= ~AST_FAX_TECH_AUDIO;
 
 1890        } 
else if (ofd == fax->
fd) {
 
 1893            if (!(frame = fax->
tech->
read(fax))) {
 
 1906            if (ms && (ofd < 0)) {
 
 1909                    if (remaining_time <= 0)
 
 1920                if (remaining_time <= 0) {
 
 1927    ast_debug(3, 
"channel '%s' - event loop stopped { timeout: %d, remaining_time: %d }\n", 
ast_channel_name(chan), timeout, remaining_time);
 
 1932    if (!strcasecmp(details->
result, 
"FAILED")) {
 
 1945        if (orig_read_format) {
 
 1948        if (orig_write_format) {
 
 
 1962    struct timeval start;
 
 1996                (frame->
datalen == 
sizeof(t38_parameters))) {
 
 2012                    details->
caps &= ~AST_FAX_TECH_AUDIO;
 
 2054            details->
caps &= ~AST_FAX_TECH_T38;
 
 2065                (frame->
datalen == 
sizeof(t38_parameters))) {
 
 2077                details->
caps &= ~AST_FAX_TECH_AUDIO;
 
 2083                details->
caps &= ~AST_FAX_TECH_T38;
 
 2088                details->
caps &= ~AST_FAX_TECH_T38;
 
 
 2126    if (!json_array || !json_filename) {
 
 2133        const char *remote_station_id;
 
 2134        const char *local_station_id;
 
 2135        const char *fax_pages;
 
 2136        const char *fax_resolution;
 
 2137        const char *fax_bitrate;
 
 2142            remote_station_id = 
ast_strdupa(remote_station_id);
 
 2161        json_object = 
ast_json_pack(
"{s: s, s: s, s: s, s: s, s: s, s: s, s: o}",
 
 2163                "remote_station_id", 
S_OR(remote_station_id, 
""),
 
 2164                "local_station_id", 
S_OR(local_station_id, 
""),
 
 2165                "fax_pages", 
S_OR(fax_pages, 
""),
 
 2166                "fax_resolution", 
S_OR(fax_resolution, 
""),
 
 2167                "fax_bitrate", 
S_OR(fax_bitrate, 
""),
 
 
 2185    char *parse, modems[128] = 
"";
 
 2189    struct ast_fax_tech_token *token = 
NULL;
 
 2211        ast_log(
LOG_ERROR, 
"System cannot provide memory for session requirements.\n");
 
 2220    if (details->gateway_id > 0) {
 
 2221        ast_string_field_set(details, resultstr, 
"can't receive a fax on a channel with a T.38 gateway");
 
 2223        ast_log(
LOG_ERROR, 
"executing ReceiveFAX on a channel with a T.38 Gateway is not supported\n");
 
 2227    if (details->maxrate < details->minrate) {
 
 2231        ast_log(
LOG_ERROR, 
"maxrate %u is less than minrate %u\n", details->maxrate, details->minrate);
 
 2237        ast_log(
LOG_ERROR, 
"'modems' setting '%s' is incompatible with 'minrate' setting %u\n", modems, details->minrate);
 
 2246        ast_log(
LOG_ERROR, 
"'modems' setting '%s' is incompatible with 'maxrate' setting %u\n", modems, details->maxrate);
 
 2292    if (!(doc = 
ast_calloc(1, 
sizeof(*doc) + strlen(
args.filename) + 1))) {
 
 2296        ast_log(
LOG_ERROR, 
"System cannot provide memory for session requirements.\n");
 
 2381    return (!channel_alive) ? -1 : 0;
 
 
 2389    struct timeval start;
 
 2402        if (
ast_playtones_start(chan, 1024, 
"!1100/500,!0/3000,!1100/500,!0/3000,!1100/500,!0/3000", 1)) {
 
 2431                (frame->
datalen == 
sizeof(t38_parameters))) {
 
 2447                details->
caps &= ~AST_FAX_TECH_AUDIO;
 
 2492                details->
caps &= ~AST_FAX_TECH_T38;
 
 2503                    (frame->
datalen == 
sizeof(t38_parameters))) {
 
 2515                    details->
caps &= ~AST_FAX_TECH_AUDIO;
 
 2521                    details->
caps &= ~AST_FAX_TECH_T38;
 
 2526                    details->
caps &= ~AST_FAX_TECH_T38;
 
 2573                        (frame->
datalen == 
sizeof(t38_parameters))) {
 
 2589                        details->
caps &= ~AST_FAX_TECH_AUDIO;
 
 
 2635    if (!json_filenames) {
 
 2640        const char *remote_station_id;
 
 2641        const char *local_station_id;
 
 2642        const char *fax_pages;
 
 2643        const char *fax_resolution;
 
 2644        const char *fax_bitrate;
 
 2649            remote_station_id = 
ast_strdupa(remote_station_id);
 
 2667        json_obj = 
ast_json_pack(
"{s: s, s: s, s: s, s: s, s: s, s: s, s: o}",
 
 2669                "remote_station_id", 
S_OR(remote_station_id, 
""),
 
 2670                "local_station_id", 
S_OR(local_station_id, 
""),
 
 2671                "fax_pages", 
S_OR(fax_pages, 
""),
 
 2672                "fax_resolution", 
S_OR(fax_resolution, 
""),
 
 2673                "fax_bitrate", 
S_OR(fax_bitrate, 
""),
 
 2674                "filenames", json_filenames);
 
 
 2693    char *parse, *filenames, *
c, modems[128] = 
"";
 
 2694    int channel_alive, file_count;
 
 2697    struct ast_fax_tech_token *token = 
NULL;
 
 2719        ast_log(
LOG_ERROR, 
"System cannot provide memory for session requirements.\n");
 
 2728    if (details->gateway_id > 0) {
 
 2731        ast_log(
LOG_ERROR, 
"executing SendFAX on a channel with a T.38 Gateway is not supported\n");
 
 2735    if (details->maxrate < details->minrate) {
 
 2739        ast_log(
LOG_ERROR, 
"maxrate %u is less than minrate %u\n", details->maxrate, details->minrate);
 
 2745        ast_log(
LOG_ERROR, 
"'modems' setting '%s' is incompatible with 'minrate' setting %u\n", modems, details->minrate);
 
 2754        ast_log(
LOG_ERROR, 
"'modems' setting '%s' is incompatible with 'maxrate' setting %u\n", modems, details->maxrate);
 
 2799    filenames = 
args.filenames;
 
 2800    while ((
c = 
strsep(&filenames, 
"&"))) {
 
 2805            ast_log(
LOG_ERROR, 
"access failure.  Verify '%s' exists and check permissions.\n", 
args.filenames);
 
 2809        if (!(doc = 
ast_calloc(1, 
sizeof(*doc) + strlen(
c) + 1))) {
 
 2813            ast_log(
LOG_ERROR, 
"System cannot provide memory for session requirements.\n");
 
 2829    if (file_count > 1) {
 
 2894        details->option.send_cng = 1;
 
 2909        return (!channel_alive) ? -1 : 0;
 
 2918    return (!channel_alive) ? -1 : 0;
 
 
 2998        details->
caps &= ~AST_FAX_TECH_GATEWAY;
 
 2999        ast_log(
LOG_ERROR, 
"Can't reserve a FAX session, gateway attempt failed.\n");
 
 
 3041        ast_log(
LOG_ERROR, 
"Can't create a FAX session, gateway attempt failed.\n");
 
 3055    if (start_res < 0) {
 
 
 3082        .datalen = 
sizeof(t38_parameters),
 
 3084        .data.ptr = &t38_parameters,
 
 
 3115    struct ast_channel *other = (active == chan) ? peer : chan;
 
 3122    if (active_v21_session->
tech->
write(active_v21_session, f) == 0 &&
 
 3165                if (active == chan) {
 
 3169                if (active == chan) {
 
 
 3188    if (active == chan) {
 
 
 3213    struct ast_channel *other = (active == chan) ? peer : chan;
 
 3295            ast_debug(1, 
"%s is attempting to negotiate T.38 after we already sent a negotiation request based on v21 preamble detection\n", 
ast_channel_name(active));
 
 
 3451        switch (gateway->
s->
state) {
 
 
 3552        if (chan_is_hungup || peer_is_hungup) {
 
 3565            details->gateway_id = -1;
 
 3570            details->is_t38_negotiated = 0;
 
 3575        if (details->gateway_timeout) {
 
 3610            details->gateway_id = -1;
 
 3615            details->is_t38_negotiated = 0;
 
 3707                .data.ptr = silence_buf,
 
 3709                .datalen = 
sizeof(silence_buf),
 
 3711            memset(silence_buf, 0, 
sizeof(silence_buf));
 
 
 3734        .disable_inheritance = 1, 
 
 3758    fr_hook.
data = gateway;
 
 
 3781    if (faxdetect->
dsp) {
 
 
 3813        if (!faxdetect->
dsp) {
 
 
 3910        if (!faxdetect->
dsp) {
 
 3948        const char *target_context;
 
 3960                ast_verb(2, 
"Redirecting '%s' to fax extension due to %s detection\n",
 
 3968                    (
result == 
'f') ? 
"CNG" : 
"T38", target_context);
 
 
 4001        ast_log(
LOG_ERROR, 
"System cannot provide memory for session requirements.\n");
 
 4012    fr_hook.
data = faxdetect;
 
 
 4057    tklen = strlen(
a->word);
 
 4060        snprintf(tbuf, 
sizeof(tbuf), 
"%u", s->
id);
 
 4061        if (!strncasecmp(
a->word, tbuf, tklen) && ++wordnum > 
a->n) {
 
 
 4078        e->
command = 
"fax show version";
 
 4080            "Usage: fax show version\n" 
 4081            "       Show versions of FAX For Asterisk components.\n";
 
 4091    ast_cli(
a->fd, 
"FAX For Asterisk Components:\n");
 
 
 4111        e->
command = 
"fax set debug {on|off}";
 
 4113            "Usage: fax set debug { on | off }\n" 
 4114            "       Enable/Disable FAX debugging on new FAX sessions.  The basic FAX debugging will result in\n" 
 4115            "       additional events sent to manager sessions with 'call' class permissions.  When\n" 
 4116            "       verbosity is greater than '5' events will be displayed to the console and audio versus\n" 
 4117            "       energy analysis will be performed and displayed to the console.\n";
 
 4123    what = 
a->argv[e->
args-1];      
 
 4124    if (!strcasecmp(what, 
"on")) {
 
 4126    } 
else if (!strcasecmp(what, 
"off")) {
 
 4133    ast_cli(
a->fd, 
"\n\nFAX Debug %s\n\n", (
flag) ? 
"Enabled" : 
"Disabled");
 
 
 4142    unsigned int num_modules = 0;
 
 4146        e->
command = 
"fax show capabilities";
 
 4148            "Usage: fax show capabilities\n" 
 4149            "       Shows the capabilities of the registered FAX technology modules\n";
 
 4155    ast_cli(
a->fd, 
"\n\nRegistered FAX Technology Modules:\n\n");
 
 4163    ast_cli(
a->fd, 
"%u registered modules\n\n", num_modules);
 
 
 4172    char modems[128] = 
"";
 
 4177        e->
command = 
"fax show settings";
 
 4179            "Usage: fax show settings\n" 
 4180            "       Show the global settings and defaults of both the FAX core and technology modules\n";
 
 4188    ast_cli(
a->fd, 
"FAX For Asterisk Settings:\n");
 
 4190    ast_cli(
a->fd, 
"\tStatus Events: %s\n",  
options.statusevents ? 
"On" : 
"Off");
 
 4195    ast_cli(
a->fd, 
"\tT.38 Negotiation Timeout: %u\n", 
options.t38timeout);
 
 4196    ast_cli(
a->fd, 
"\n\nFAX Technology Modules:\n\n");
 
 
 4214        e->
command = 
"fax show session";
 
 4216            "Usage: fax show session <session number>\n" 
 4217            "       Shows status of the named FAX session\n";
 
 4227    if (sscanf(
a->argv[3], 
"%u", &tmp.
id) != 1) {
 
 4232    ast_cli(
a->fd, 
"\nFAX Session Details:\n--------------------\n\n");
 
 
 4248    char id_text[256] = 
"";
 
 4252    if (sscanf(session_number, 
"%30u", &
find_session.id) != 1) {
 
 4263    if (!
session->tech->manager_fax_session) {
 
 4264        astman_send_error(s, m, 
"Fax technology doesn't provide a handler for FAXSession");
 
 4270        snprintf(id_text, 
sizeof(id_text), 
"ActionID: %s\r\n", action_id);
 
 
 4288        e->
command = 
"fax show stats";
 
 4290            "Usage: fax show stats\n" 
 4291            "       Shows a statistical summary of FAX transmissions\n";
 
 4297    ast_cli(
a->fd, 
"\nFAX Statistics:\n---------------\n\n");
 
 
 4318    char id_text[256] = 
"";
 
 4323        snprintf(id_text, 
sizeof(id_text), 
"ActionID: %s\r\n", action_id);
 
 4328        "CurrentSessions: %d\r\n" 
 4329        "ReservedSessions: %d\r\n" 
 4330        "TransmitAttempts: %d\r\n" 
 4331        "ReceiveAttempts: %d\r\n" 
 4332        "CompletedFAXes: %d\r\n" 
 4333        "FailedFAXes: %d\r\n" 
 
 4383        e->
command = 
"fax show sessions";
 
 4385            "Usage: fax show sessions\n" 
 4386            "       Shows the current FAX sessions\n";
 
 4392    ast_cli(
a->fd, 
"\nCurrent FAX Sessions:\n\n");
 
 4393    ast_cli(
a->fd, 
"%-30.30s %-10.10s %-10.10s %-5.5s %-10.10s %-15.15s %-30.30s\n",
 
 4394        "Channel", 
"Tech", 
"FAXID", 
"Type", 
"Operation", 
"State", 
"File(s)");
 
 4401        ast_cli(
a->fd, 
"%-30.30s %-10.10s %-10u %-5.5s %-10.10s %-15.15s %-30s\n",
 
 
 4435        "Technology: %s\r\n"  
 4436        "SessionNumber: %u\r\n"  
 4437        "SessionType: %s\r\n"  
 
 4460        snprintf(id_text, 
sizeof(id_text), 
"ActionID: %s\r\n", action_id);
 
 
 4507    unsigned int timeout;
 
 4509    if (sscanf(
value, 
"%u", &timeout) != 1) {
 
 4512    } 
else if (timeout) {
 
 4513        *t38timeout = timeout;
 
 
 4528    char modems[128] = 
"";
 
 4568        if (!strcasecmp(v->
name, 
"minrate")) {
 
 4569            ast_debug(3, 
"reading minrate '%s' from configuration file\n", v->
value);
 
 4575        } 
else if (!strcasecmp(v->
name, 
"maxrate")) {
 
 4576            ast_debug(3, 
"reading maxrate '%s' from configuration file\n", v->
value);
 
 4582        } 
else if (!strcasecmp(v->
name, 
"statusevents")) {
 
 4583            ast_debug(3, 
"reading statusevents '%s' from configuration file\n", v->
value);
 
 4585        } 
else if (!strcasecmp(v->
name, 
"ecm")) {
 
 4586            ast_debug(3, 
"reading ecm '%s' from configuration file\n", v->
value);
 
 4588        } 
else if ((!strcasecmp(v->
name, 
"modem")) || (!strcasecmp(v->
name, 
"modems"))) {
 
 4591        } 
else if (!strcasecmp(v->
name, 
"t38timeout")) {
 
 
 4637    if (!strcasecmp(data, 
"ecm")) {
 
 4639    } 
else if (!strcasecmp(data, 
"t38gateway") || !strcasecmp(data, 
"gateway") ||
 
 4640           !strcasecmp(data, 
"t38_gateway") || !strcasecmp(data, 
"faxgateway")) {
 
 4642    } 
else if (!strcasecmp(data, 
"faxdetect")) {
 
 4644    } 
else if (!strcasecmp(data, 
"error")) {
 
 4646    } 
else if (!strcasecmp(data, 
"filename")) {
 
 4653    } 
else if (!strcasecmp(data, 
"filenames")) {
 
 4664    } 
else if (!strcasecmp(data, 
"headerinfo")) {
 
 4666    } 
else if (!strcasecmp(data, 
"localstationid")) {
 
 4668    } 
else if (!strcasecmp(data, 
"maxrate")) {
 
 4670    } 
else if (!strcasecmp(data, 
"minrate")) {
 
 4672    } 
else if (!strcasecmp(data, 
"pages")) {
 
 4674    } 
else if (!strcasecmp(data, 
"rate")) {
 
 4676    } 
else if (!strcasecmp(data, 
"remotestationid")) {
 
 4678    } 
else if (!strcasecmp(data, 
"resolution")) {
 
 4680    } 
else if (!strcasecmp(data, 
"sessionid")) {
 
 4681        snprintf(
buf, 
len, 
"%u", details->
id);
 
 4682    } 
else if (!strcasecmp(data, 
"status")) {
 
 4684    } 
else if (!strcasecmp(data, 
"statusstr")) {
 
 4686    } 
else if ((!strcasecmp(data, 
"modem")) || (!strcasecmp(data, 
"modems"))) {
 
 4688    } 
else if (!strcasecmp(data, 
"t38timeout")) {
 
 4690    } 
else if (!strcasecmp(data, 
"negotiate_both")) {
 
 
 4713    if (!strcasecmp(data, 
"ecm")) {
 
 4722    } 
else if (!strcasecmp(data, 
"t38gateway") || !strcasecmp(data, 
"gateway") ||
 
 4723           !strcasecmp(data, 
"t38_gateway") || !strcasecmp(data, 
"faxgateway")) {
 
 4725        char *timeout = strchr(
val, 
',');
 
 4735                    unsigned int gwtimeout;
 
 4737                    if (sscanf(timeout, 
"%30u", &gwtimeout) == 1) {
 
 4740                        ast_log(
LOG_WARNING, 
"Unsupported timeout '%s' passed to FAXOPT(%s).\n", timeout, data);
 
 4762    } 
else if (!strcasecmp(data, 
"faxdetect")) {
 
 4764        char *timeout = strchr(
val, 
',');
 
 4776                    if (sscanf(timeout, 
"%30u", &
fdtimeout) == 1) {
 
 4784                if (!strcasecmp(
val, 
"t38")) {
 
 4786                } 
else if (!strcasecmp(
val, 
"cng")) {
 
 4793                if (faxdetect < 0) {
 
 4810    } 
else if (!strcasecmp(data, 
"headerinfo")) {
 
 4812    } 
else if (!strcasecmp(data, 
"localstationid")) {
 
 4814    } 
else if (!strcasecmp(data, 
"maxrate")) {
 
 4819    } 
else if (!strcasecmp(data, 
"minrate")) {
 
 4824    } 
else if (!strcasecmp(data, 
"t38timeout")) {
 
 4828    } 
else if ((!strcasecmp(data, 
"modem")) || (!strcasecmp(data, 
"modems"))) {
 
 4830    } 
else if (!strcasecmp(data, 
"negotiate_both")) {
 
 
void ast_cli_unregister_multiple(void)
struct sla_ringing_trunk * first
Asterisk version information.
const char * ast_get_version(void)
Retrieve the Asterisk version string.
char * strsep(char **str, const char *delims)
Asterisk main include file. File version handling, generic pbx functions.
static struct ast_mansession session
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ast_calloc(num, len)
A wrapper for calloc()
#define ast_malloc(len)
A wrapper for malloc()
#define ao2_iterator_next(iter)
#define ao2_link(container, obj)
Add an object to a container.
@ AO2_ALLOC_OPT_LOCK_MUTEX
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
#define ao2_unlink(container, obj)
Remove an object from a container.
#define ao2_find(container, arg, flags)
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
#define ao2_replace(dst, src)
Replace one object reference with another cleaning up the original.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
#define ao2_alloc(data_size, destructor_fn)
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
Allocate and initialize a hash container with the desired number of buckets.
General Asterisk PBX channel definitions.
const char * ast_channel_name(const struct ast_channel *chan)
struct ast_channel * ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds, int nfds, int *exception, int *outfd, int *ms)
Waits for activity on a group of channels.
static enum ast_t38_state ast_channel_get_t38_state(struct ast_channel *chan)
Retrieves the current T38 state of a channel.
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore)
Remove a datastore from a channel.
struct ast_channel * ast_channel_bridge_peer(struct ast_channel *chan)
Get the channel's bridge peer only if the bridge is two-party.
struct stasis_topic * ast_channel_topic(struct ast_channel *chan)
A topic which publishes the events for a particular channel.
#define ast_channel_lock(chan)
struct ast_trans_pvt * ast_channel_readtrans(const struct ast_channel *chan)
int ast_channel_make_compatible(struct ast_channel *chan, struct ast_channel *peer)
Make the frame formats of two channels compatible.
ast_t38_state
Possible T38 states on channels.
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
#define ast_channel_lock_both(chan1, chan2)
Lock two channels.
const char * ast_channel_uniqueid(const struct ast_channel *chan)
const char * ast_channel_context(const struct ast_channel *chan)
int ast_write(struct ast_channel *chan, struct ast_frame *frame)
Write a frame to a channel This function writes the given frame to the indicated channel.
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
int ast_queue_control_data(struct ast_channel *chan, enum ast_control_frame_type control, const void *data, size_t datalen)
Queue a control frame with payload.
int ast_set_read_format(struct ast_channel *chan, struct ast_format *format)
Sets read format on channel chan.
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
int ast_indicate_data(struct ast_channel *chan, int condition, const void *data, size_t datalen)
Indicates condition of channel, with payload.
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
int ast_set_write_format(struct ast_channel *chan, struct ast_format *format)
Sets write format on channel chan.
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
int ast_answer(struct ast_channel *chan)
Answer a channel.
const char * ast_channel_exten(const struct ast_channel *chan)
#define ast_channel_unlock(chan)
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
ast_channel_state
ast_channel states
Standard Command Line Interface.
#define AST_CLI_DEFINE(fn, txt,...)
void ast_cli(int fd, const char *fmt,...)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
#define ast_datastore_alloc(info, uid)
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
Convenient Signal Processing routines.
void ast_dsp_set_threshold(struct ast_dsp *dsp, int threshold)
Set the minimum average magnitude threshold to determine talking by the DSP.
void ast_dsp_free(struct ast_dsp *dsp)
int ast_dsp_silence(struct ast_dsp *dsp, struct ast_frame *f, int *totalsilence)
Process the audio frame for silence.
void ast_dsp_reset(struct ast_dsp *dsp)
Reset total silence count.
struct ast_frame * ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp, struct ast_frame *inf)
Return AST_FRAME_NULL frames when there is silence, AST_FRAME_BUSY on busies, and call progress,...
#define DSP_FEATURE_FAX_DETECT
#define DSP_FAXMODE_DETECT_SQUELCH
#define DSP_FAXMODE_DETECT_CNG
int ast_dsp_set_faxmode(struct ast_dsp *dsp, int faxmode)
Set fax mode.
void ast_dsp_set_features(struct ast_dsp *dsp, int features)
Select feature set.
struct ast_dsp * ast_dsp_new(void)
Allocates a new dsp, assumes 8khz for internal sample rate.
Generic File Format Support. Should be included by clients of the file handling routines....
int ast_framehook_attach(struct ast_channel *chan, struct ast_framehook_interface *i)
Attach an framehook onto a channel for frame interception.
ast_framehook_event
These are the types of events that the framehook's event callback can receive.
@ AST_FRAMEHOOK_EVENT_ATTACHED
@ AST_FRAMEHOOK_EVENT_DETACHED
@ AST_FRAMEHOOK_EVENT_WRITE
@ AST_FRAMEHOOK_EVENT_READ
int ast_framehook_detach(struct ast_channel *chan, int framehook_id)
Detach an framehook from a channel.
#define AST_FRAMEHOOK_INTERFACE_VERSION
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
void astman_send_listack(struct mansession *s, const struct message *m, char *msg, char *listflag)
Send ack in manager transaction to begin a list.
void astman_send_error(struct mansession *s, const struct message *m, char *error)
Send error in manager transaction.
void astman_send_list_complete_start(struct mansession *s, const struct message *m, const char *event_name, int count)
Start the list complete event.
void astman_send_ack(struct mansession *s, const struct message *m, char *msg)
Send ack in manager transaction.
const char * astman_get_header(const struct message *m, char *var)
Get header from manager transaction.
void astman_send_list_complete_end(struct mansession *s)
End the list complete event.
void astman_append(struct mansession *s, const char *fmt,...)
int ast_manager_unregister(const char *action)
Unregister a registered manager command.
struct stasis_message * ast_channel_blob_create_from_cache(const char *uniqueid, struct stasis_message_type *type, struct ast_json *blob)
Create a ast_channel_blob message, pulling channel state from the cache.
struct stasis_message_type * ast_channel_fax_type(void)
Message type for a fax operation.
static char prefix[MAX_PREFIX]
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define AST_APP_OPTION(option, flagno)
Declares an application option that does not accept an argument.
int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
Configuration File Parser.
struct ast_config * ast_config_load2(const char *filename, const char *who_asked, struct ast_flags flags)
Load a config file.
#define CONFIG_STATUS_FILEUNCHANGED
#define CONFIG_STATUS_FILEINVALID
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
@ CONFIG_FLAG_FILEUNCHANGED
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
@ AST_T38_REQUEST_TERMINATE
@ AST_T38_REQUEST_NEGOTIATE
#define ast_frisolate(fr)
Makes a frame independent of any static storage.
@ AST_T38_RATE_MANAGEMENT_TRANSFERRED_TCF
@ AST_CONTROL_T38_PARAMETERS
struct ast_frame ast_null_frame
Support for logging to various files, console and syslog Configuration in file logger....
#define ast_debug(level,...)
Log a DEBUG message.
#define ast_log_dynamic_level(level,...)
Send a log message to a dynamically registered log level.
int ast_logger_register_level(const char *name)
Register a new logger level.
#define ast_verb(level,...)
void ast_logger_unregister_level(const char *name)
Unregister a previously registered logger level.
int ast_playtones_start(struct ast_channel *chan, int vol, const char *tonelist, int interruptible)
Start playing a list of tones on a channel.
void ast_playtones_stop(struct ast_channel *chan)
Stop playing tones on a channel.
I/O Management (derived from Cheops-NG)
struct ast_json * ast_json_string_create(const char *value)
Construct a JSON string from value.
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
int ast_json_array_append(struct ast_json *array, struct ast_json *value)
Append to an array.
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
struct ast_json * ast_json_array_create(void)
Create a empty JSON array.
struct ast_json * ast_json_ref(struct ast_json *value)
Increase refcount on value.
#define AST_JSON_UTF8_VALIDATE(str)
Check str for UTF-8 and replace with an empty string if fails the check.
#define AST_RWLIST_REMOVE_CURRENT
#define AST_RWLIST_RDLOCK(head)
Read locks a list.
#define AST_LIST_HEAD_INIT_NOLOCK(head)
Initializes a list head structure.
#define AST_RWLIST_TRAVERSE_SAFE_BEGIN
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_RWLIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a read/write list of specified type, statically initialized.
#define AST_LIST_EMPTY(head)
Checks whether the specified list contains any entries.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
#define AST_RWLIST_TRAVERSE_SAFE_END
#define AST_RWLIST_TRAVERSE
#define AST_RWLIST_INSERT_TAIL
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
Asterisk locking-related definitions:
#define ast_rwlock_wrlock(a)
#define ast_rwlock_rdlock(a)
#define AST_RWLOCK_DEFINE_STATIC(rwlock)
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return the previous value of *p.
#define SCOPED_CHANNELLOCK(varname, chan)
scoped lock specialization for channels.
#define ast_rwlock_unlock(a)
static struct mansession_session * find_session(uint32_t ident, int incinuse)
#define EVENT_FLAG_REPORTING
#define ast_manager_register_xml(action, authority, func)
Register a manager callback using XML documentation to describe the manager.
Asterisk module definitions.
@ AST_MODFLAG_GLOBAL_SYMBOLS
#define ast_module_unref(mod)
Release a reference to the module.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
int ast_unregister_application(const char *app)
Unregister an application.
#define ast_module_running_ref(mod)
Hold a reference to the module if it is running.
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Options provided by main asterisk program.
Core PBX routines and definitions.
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name.
#define ast_custom_function_register(acf)
Register a custom function.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
int ast_async_goto(struct ast_channel *chan, const char *context, const char *exten, int priority)
Set the channel to next execute the specified dialplan location.
void ast_fax_tech_unregister(struct ast_fax_tech *tech)
unregister a FAX technology module
static void fax_session_release(struct ast_fax_session *s, struct ast_fax_tech_token *token)
Release a session token.
static int session_cmp_cb(void *obj, void *arg, int flags)
compare callback for ao2
static int manager_fax_sessions_entry(struct mansession *s, struct ast_fax_session *session, const char *id_text)
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.
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 int session_hash_cb(const void *obj, const int flags)
hash callback for ao2
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 struct ast_fax_session_details * session_details_new(void)
create a FAX session details structure
unsigned int ast_fax_minrate(void)
get the minimum supported fax rate
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 * fax_session_reserve(struct ast_fax_session_details *details, struct ast_fax_tech_token **token)
Reserve a fax session.
static int update_modem_bits(enum ast_fax_modems *bits, const char *value)
static void set_general_options(const struct fax_options *options)
static void fax_gateway_indicate_t38(struct ast_channel *chan, struct ast_channel *active, struct ast_control_t38_parameters *control_params)
#define FAX_DETECT_MODE_BOTH
static int receivefax_t38_init(struct ast_channel *chan, struct ast_fax_session_details *details)
static const struct ast_app_option fax_exec_options[128]
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 void destroy_gateway(void *data)
destroy a FAX gateway session structure
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 const char app_receivefax[]
static void destroy_v21_sessions(struct fax_gateway *gateway)
destroy the v21 detection parts of a fax gateway session
static int fax_logger_level
static char * cli_fax_show_stats(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
display fax stats
static void destroy_session_details(void *details)
destroy a FAX session details structure
const char * ast_fax_state_to_str(enum ast_fax_state state)
convert a ast_fax_state to a string
static char * ast_fax_caps_to_str(enum ast_fax_capabilities caps, char *buf, size_t bufsize)
static const struct fax_options default_options
static const struct ast_datastore_info fax_datastore
static struct @471 faxregistry
The faxregistry is used to manage information and statistics for all FAX sessions.
static struct ast_custom_function acf_faxopt
FAXOPT dialplan function.
static void fax_detect_framehook_destroy(void *data)
Deref the faxdetect data structure when the faxdetect framehook is detached.
static struct ast_fax_session * fax_v21_session_new(struct ast_channel *chan)
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.
static void t38_parameters_fax_to_ast(struct ast_control_t38_parameters *dst, const struct ast_fax_t38_parameters *src)
static void fixup_callback(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan)
Copies fax detection and gateway framehooks during masquerades.
static const char * config
static int set_t38timeout(const char *value, unsigned int *t38timeout)
static int check_modem_rate(enum ast_fax_modems modems, unsigned int rate)
static int sendfax_exec(struct ast_channel *chan, const char *data)
initiate a send FAX session
static char * fax_session_tab_complete(struct ast_cli_args *a)
fax session tab completion
#define FAX_MAXBUCKETS
maximum buckets for res_fax ao2 containers
static int fax_detect_attach(struct ast_channel *chan, int timeout, int flags)
Attach a faxdetect framehook object to a channel.
static const char * fax_session_type(struct ast_fax_session *s)
static int receivefax_exec(struct ast_channel *chan, const char *data)
initiate a receive FAX session
static ast_rwlock_t options_lock
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 fax_gateway_framehook_destroy(void *data)
Destroy the gateway data structure when the framehook is detached.
static int reload_module(void)
struct ao2_container * container
static struct fax_detect * fax_detect_new(struct ast_channel *chan, int timeout, int flags)
Create a new fax detect object.
static int fax_gateway_attach(struct ast_channel *chan, struct ast_fax_session_details *details)
Attach a gateway framehook object to a channel.
static int set_config(int reload)
configure res_fax
static struct ast_control_t38_parameters our_t38_parameters
static const char app_sendfax[]
static char * cli_fax_show_capabilities(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
display registered FAX capabilities
static int ast_fax_modem_to_str(enum ast_fax_modems bits, char *tbuf, size_t bufsize)
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)
#define FAX_DETECT_MODE_T38
static char * cli_fax_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
display global defaults and settings
const char * ast_fax_session_operation_str(struct ast_fax_session *s)
get string representation of a FAX session's operation
static struct ast_json * generate_filenames_json(struct ast_fax_session_details *details)
unsigned int ast_fax_maxrate(void)
get the maxiumum supported fax rate
int ast_fax_tech_register(struct ast_fax_tech *tech)
register a FAX technology module
static void destroy_session(void *session)
destroy a FAX session structure
static void get_general_options(struct fax_options *options)
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.
static void t38_parameters_ast_to_fax(struct ast_fax_t38_parameters *dst, const struct ast_control_t38_parameters *src)
static int manager_fax_session(struct mansession *s, const struct message *m)
static void debug_check_frame_for_silence(struct ast_fax_session *s, unsigned int c2s, struct ast_frame *frame)
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
static char * cli_fax_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
enable FAX debugging
#define GENERIC_FAX_EXEC_ERROR(fax, chan, errorstr, reason)
#define RES_FAX_STATUSEVENTS
#define RES_FAX_T38TIMEOUT
static int set_fax_t38_caps(struct ast_channel *chan, struct ast_fax_session_details *details)
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.
static void destroy_callback(void *data)
static int manager_fax_stats(struct mansession *s, const struct message *m)
static int load_module(void)
Load the module.
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...
static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_details *details)
#define FAX_GATEWAY_TIMEOUT
#define GENERIC_FAX_EXEC_SET_VARS(fax, chan, errorstr, reason)
static unsigned int fax_rate_str_to_int(const char *ratestr)
convert a rate string to a rate
static char * cli_fax_show_version(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int unload_module(void)
unload res_fax
static struct fax_gateway * fax_gateway_new(struct ast_channel *chan, struct ast_fax_session_details *details)
Create a new fax gateway object.
static void destroy_faxdetect(void *data)
destroy a FAX detect structure
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.
static void set_channel_variables(struct ast_channel *chan, struct ast_fax_session_details *details)
Set fax related channel variables.
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.
static int disable_t38(struct ast_channel *chan)
static char * cli_fax_show_sessions(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
display fax sessions
static struct ast_cli_entry fax_cli[]
static int manager_fax_sessions(struct mansession *s, const struct message *m)
#define FAX_DETECT_MODE_CNG
FAX Detect flags.
static int report_receive_fax_status(struct ast_channel *chan, const char *filename)
Report on the final state of a receive fax operation.
static struct ast_frame * fax_gateway_request_t38(struct fax_gateway *gateway, struct ast_channel *chan)
static int global_fax_debug
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.
static struct fax_options general_options
ast_fax_capabilities
capabilities for res_fax to locate a fax technology module
@ AST_FAX_TECH_V21_DETECT
#define AST_FAX_FRFLAG_GATEWAY
ast_fax_state
current state of a fax session
@ AST_FAX_STATE_INITIALIZED
@ AST_FAX_STATE_UNINITIALIZED
ast_fax_modems
fax modem capabilities
Asterisk internal frame definitions.
void ast_smoother_free(struct ast_smoother *s)
struct ast_frame * ast_smoother_read(struct ast_smoother *s)
#define ast_smoother_feed(s, f)
struct ast_smoother * ast_smoother_new(int bytes)
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
void stasis_publish(struct stasis_topic *topic, struct stasis_message *message)
Publish a message to a topic's subscribers.
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
#define ast_string_field_build(x, field, fmt, args...)
Set a field to a complex (built) value.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
String manipulation functions.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
static force_inline int attribute_pure ast_strlen_zero(const char *s)
int ast_build_string(char **buffer, size_t *space, const char *fmt,...)
Build a string in a buffer, designed to be called repeatedly.
int attribute_pure ast_false(const char *val)
Make sure something is false. Determine if a string containing a boolean value is "false"....
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
char *attribute_pure ast_skip_blanks(const char *str)
Gets a pointer to the first non-whitespace character in a string.
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Main Channel structure associated with a channel.
descriptor for a cli entry.
int args
This gets set in ast_cli_register()
unsigned int transcoding_jbig
enum ast_control_t38_rate rate
unsigned int transcoding_mmr
enum ast_control_t38_rate_management rate_management
enum ast_control_t38 request_response
unsigned int fill_bit_removal
Data structure associated with a custom dialplan function.
Structure for a data store type.
Structure for a data store object.
struct debug_info_history c2s s2c
struct ast_fax_document * next
The data communicated between the high level applications and the generic fax function.
const ast_string_field localstationid
struct ast_fax_t38_parameters their_t38_parameters
struct ast_fax_documents documents
const ast_string_field result
enum ast_fax_modems modems
const ast_string_field headerinfo
struct ast_fax_t38_parameters our_t38_parameters
union ast_fax_session_details::@267 option
const ast_string_field resultstr
const ast_string_field error
unsigned int pages_transferred
const ast_string_field resolution
const ast_string_field remotestationid
const ast_string_field transfer_rate
enum ast_fax_capabilities caps
The data required to handle a fax session.
struct ast_smoother * smoother
const struct ast_fax_tech * tech
unsigned long frames_received
unsigned long frames_sent
struct ast_channel * chan
struct ast_fax_debug_info * debug_info
struct ast_fax_session_details * details
unsigned int transcoding_jbig
enum ast_control_t38_rate rate
unsigned int transcoding_mmr
enum ast_control_t38_rate_management rate_management
unsigned int fill_bit_removal
used to register a FAX technology module with res_fax
void(*const release_token)(struct ast_fax_tech_token *)
void(*const destroy_session)(struct ast_fax_session *)
char *(*const cli_show_settings)(int)
struct ast_frame *(*const read)(struct ast_fax_session *)
int(*const switch_to_t38)(struct ast_fax_session *)
void *(*const new_session)(struct ast_fax_session *, struct ast_fax_tech_token *)
int(*const cancel_session)(struct ast_fax_session *)
int(*const write)(struct ast_fax_session *, const struct ast_frame *)
int(*const generate_silence)(struct ast_fax_session *)
char *(*const cli_show_capabilities)(int)
const char *const version
struct ast_module *struct ast_fax_tech_token *(*const reserve_session)(struct ast_fax_session *)
const char *const description
char *(*const cli_show_stats)(int)
char *(*const cli_show_session)(struct ast_fax_session *, int)
int(*const start_session)(struct ast_fax_session *)
enum ast_fax_capabilities caps
Structure used to handle boolean flags.
struct ast_format * format
Data structure associated with a single frame of data.
struct ast_frame_subclass subclass
enum ast_frame_type frametype
union ast_frame::@239 data
Abstract JSON element (object, array, string, int, ...).
Default structure for translators, with the basic fields and buffers, all allocated as part of the sa...
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next
unsigned int consec_frames
used for fax detect framehook
struct timeval timeout_start
the start of our timeout counter
struct ast_dsp * dsp
DSP Processor.
struct ast_format * orig_format
original audio formats
struct ast_fax_session_details * details
fax session details
used for gateway framehook
struct ast_fax_session * peer_v21_session
struct timeval timeout_start
the start of our timeout counter
enum ast_t38_state t38_state
a flag to track the state of our negotiation
struct ast_format * chan_read_format
original audio formats
struct ast_format * chan_write_format
struct ast_fax_session * chan_v21_session
struct ast_format * peer_write_format
struct ast_format * peer_read_format
struct ast_fax_session * s
FAX Session.
int framehook
framehook used in gateway mode
struct ast_fax_tech_token * token
reserved fax session token
int detected_v21
1 if a v21 preamble has been detected
registered FAX technology modules are put into this list
const struct ast_fax_tech * tech
struct fax_module::@473 list
enum ast_fax_modems modems
In case you didn't read that giant block of text above the mansession_session struct,...
int ast_tvzero(const struct timeval t)
Returns true if the argument is 0,0.
int ast_remaining_ms(struct timeval start, int max_ms)
Calculate remaining milliseconds given a starting timestamp and upper bound.
struct timeval ast_tvsub(struct timeval a, struct timeval b)
Returns the difference of two timevals a - b.
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
Support for translation of data formats. translate.c.
struct ast_frame * ast_translate(struct ast_trans_pvt *tr, struct ast_frame *f, int consume)
translates one or more frames Apply an input frame into the translator and receive zero or one output...
int error(const char *format,...)
#define ast_test_flag(p, flag)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.