mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 11:25:35 +00:00
Merge "res_fax: wrap v21 detected Asterisk initiated negotiation with config option" into 16
This commit is contained in:
7
doc/CHANGES-staging/res_fax_negotiate_both
Normal file
7
doc/CHANGES-staging/res_fax_negotiate_both
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
Subject: res_fax
|
||||||
|
|
||||||
|
Added configuration option "negotiate_both". This option is only used
|
||||||
|
when a gateway is enabled, and a v21 preamble is detected. If this option
|
||||||
|
is enabled, once a preamble is detected Asterisk will initiate negotiation
|
||||||
|
requests to both T.38 enabled endpoint versus waiting, and forwarding a
|
||||||
|
request from an initiating endpoint. Defaults to disabled.
|
@@ -189,6 +189,9 @@ struct ast_fax_session_details {
|
|||||||
int faxdetect_flags;
|
int faxdetect_flags;
|
||||||
/*! Non-zero if T.38 is negotiated */
|
/*! Non-zero if T.38 is negotiated */
|
||||||
int is_t38_negotiated;
|
int is_t38_negotiated;
|
||||||
|
/*! Upon v21 detection the gateway sends negotiation requests to both
|
||||||
|
T.38 endpoints, and do not wait on the "other" side to initiate */
|
||||||
|
int negotiate_both;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ast_fax_tech;
|
struct ast_fax_tech;
|
||||||
|
@@ -226,6 +226,9 @@
|
|||||||
<enum name="t38timeout">
|
<enum name="t38timeout">
|
||||||
<para>R/W The timeout used for T.38 negotiation.</para>
|
<para>R/W The timeout used for T.38 negotiation.</para>
|
||||||
</enum>
|
</enum>
|
||||||
|
<enum name="negotiate_both">
|
||||||
|
<para>R/W Upon v21 detection allow gateway to send negotiation requests to both T.38 endpoints, and do not wait on the "other" side to initiate (yes|no)</para>
|
||||||
|
</enum>
|
||||||
</enumlist>
|
</enumlist>
|
||||||
</parameter>
|
</parameter>
|
||||||
</syntax>
|
</syntax>
|
||||||
@@ -722,6 +725,7 @@ static struct ast_fax_session_details *session_details_new(void)
|
|||||||
d->gateway_id = -1;
|
d->gateway_id = -1;
|
||||||
d->faxdetect_id = -1;
|
d->faxdetect_id = -1;
|
||||||
d->gateway_timeout = 0;
|
d->gateway_timeout = 0;
|
||||||
|
d->negotiate_both = 0;
|
||||||
|
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
@@ -3023,6 +3027,22 @@ static struct ast_frame *fax_gateway_detect_v21(struct fax_gateway *gateway, str
|
|||||||
enum ast_t38_state state_other;
|
enum ast_t38_state state_other;
|
||||||
enum ast_t38_state state_active;
|
enum ast_t38_state state_active;
|
||||||
struct ast_frame *fp;
|
struct ast_frame *fp;
|
||||||
|
struct ast_fax_session_details *details;
|
||||||
|
int negotiate_both = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The default behavior is to wait for the active endpoint to initiate negotiation.
|
||||||
|
* Find out if this has been overridden. If so, instead of waiting have Asterisk
|
||||||
|
* initiate the negotiation requests out to both endpoints.
|
||||||
|
*/
|
||||||
|
details = find_or_create_details(active);
|
||||||
|
if (details) {
|
||||||
|
negotiate_both = details->negotiate_both;
|
||||||
|
ao2_ref(details, -1);
|
||||||
|
} else {
|
||||||
|
ast_log(LOG_WARNING, "Detect v21 - no session details for channel '%s'\n",
|
||||||
|
ast_channel_name(chan));
|
||||||
|
}
|
||||||
|
|
||||||
destroy_v21_sessions(gateway);
|
destroy_v21_sessions(gateway);
|
||||||
|
|
||||||
@@ -3039,7 +3059,7 @@ static struct ast_frame *fax_gateway_detect_v21(struct fax_gateway *gateway, str
|
|||||||
}
|
}
|
||||||
/* May be called endpoint is improperly configured to rely on the calling endpoint
|
/* May be called endpoint is improperly configured to rely on the calling endpoint
|
||||||
* to initiate T.38 re-INVITEs, send T.38 negotiation request to called endpoint */
|
* to initiate T.38 re-INVITEs, send T.38 negotiation request to called endpoint */
|
||||||
if (state_active == T38_STATE_UNKNOWN) {
|
if (negotiate_both && state_active == T38_STATE_UNKNOWN) {
|
||||||
ast_debug(1, "sending T.38 negotiation request to %s\n", ast_channel_name(active));
|
ast_debug(1, "sending T.38 negotiation request to %s\n", ast_channel_name(active));
|
||||||
if (active == chan) {
|
if (active == chan) {
|
||||||
ast_channel_unlock(chan);
|
ast_channel_unlock(chan);
|
||||||
@@ -4557,6 +4577,8 @@ static int acf_faxopt_read(struct ast_channel *chan, const char *cmd, char *data
|
|||||||
ast_fax_modem_to_str(details->modems, buf, len);
|
ast_fax_modem_to_str(details->modems, buf, len);
|
||||||
} else if (!strcasecmp(data, "t38timeout")) {
|
} else if (!strcasecmp(data, "t38timeout")) {
|
||||||
snprintf(buf, len, "%u", details->t38timeout);
|
snprintf(buf, len, "%u", details->t38timeout);
|
||||||
|
} else if (!strcasecmp(data, "negotiate_both")) {
|
||||||
|
ast_copy_string(buf, details->negotiate_both != -1 ? "yes" : "no", len);
|
||||||
} else {
|
} else {
|
||||||
ast_log(LOG_WARNING, "channel '%s' can't read FAXOPT(%s) because it is unhandled!\n", ast_channel_name(chan), data);
|
ast_log(LOG_WARNING, "channel '%s' can't read FAXOPT(%s) because it is unhandled!\n", ast_channel_name(chan), data);
|
||||||
res = -1;
|
res = -1;
|
||||||
@@ -4695,6 +4717,8 @@ static int acf_faxopt_write(struct ast_channel *chan, const char *cmd, char *dat
|
|||||||
}
|
}
|
||||||
} else if ((!strcasecmp(data, "modem")) || (!strcasecmp(data, "modems"))) {
|
} else if ((!strcasecmp(data, "modem")) || (!strcasecmp(data, "modems"))) {
|
||||||
update_modem_bits(&details->modems, value);
|
update_modem_bits(&details->modems, value);
|
||||||
|
} else if (!strcasecmp(data, "negotiate_both")) {
|
||||||
|
details->negotiate_both = ast_true(ast_skip_blanks(value));
|
||||||
} else {
|
} else {
|
||||||
ast_log(LOG_WARNING, "channel '%s' set FAXOPT(%s) to '%s' is unhandled!\n", ast_channel_name(chan), data, value);
|
ast_log(LOG_WARNING, "channel '%s' set FAXOPT(%s) to '%s' is unhandled!\n", ast_channel_name(chan), data, value);
|
||||||
res = -1;
|
res = -1;
|
||||||
|
Reference in New Issue
Block a user