typedef enum {
CF_APP_TAGGED = (1 << 0),
- CF_APP_T38 = (1 << 1)
+ CF_APP_T38 = (1 << 1),
+ CF_APP_T38_REQ = (1 << 2),
+ CF_APP_T38_FAIL = (1 << 3)
} switch_channel_app_flag_t;
switch_channel_set_private(channel, "t38_options", t38_options);
pvt->t38_mode = T38_MODE_REQUESTED;
+ switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_REQ);
/* This will send a request for t.38 mode */
msg.from = __FILE__;
switch (pvt->t38_mode) {
case T38_MODE_REQUESTED:
{
- if (switch_channel_test_app_flag_key("T38", channel, CF_APP_T38)) {
+ if (switch_channel_test_app_flag_key("T38", channel, CF_APP_T38_FAIL)) {
+ pvt->t38_mode = T38_MODE_REFUSED;
+ continue;
+ } else if (switch_channel_test_app_flag_key("T38", channel, CF_APP_T38)) {
switch_core_session_message_t msg = { 0 };
pvt->t38_mode = T38_MODE_NEGOTIATED;
spanfax_init(pvt, T38_MODE);
if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
char *cid = generate_pai_str(tech_pvt);
+ if (sip_cause > 299) {
+ switch_channel_clear_app_flag_key("T38", tech_pvt->channel, CF_APP_T38);
+ switch_channel_clear_app_flag_key("T38", tech_pvt->channel, CF_APP_T38_REQ);
+ switch_channel_set_app_flag_key("T38", tech_pvt->channel, CF_APP_T38_FAIL);
+ }
+
nua_respond(tech_pvt->nh, sip_cause, sip_status_phrase(sip_cause),
TAG_IF(!zstr(reason), SIPTAG_REASON_STR(reason)),
TAG_IF(cid, SIPTAG_HEADER_STR(cid)), TAG_IF(!zstr(bye_headers), SIPTAG_HEADER_STR(bye_headers)), TAG_END());
tech_pvt->last_sdp_str = switch_core_session_strdup(session, sip->sip_payload->pl_data);
}
+
+ if (status > 299 && switch_channel_test_app_flag_key("T38", tech_pvt->channel, CF_APP_T38_REQ)) {
+ switch_channel_set_private(channel, "t38_options", NULL);
+ switch_channel_clear_app_flag_key("T38", tech_pvt->channel, CF_APP_T38);
+ switch_channel_clear_app_flag_key("T38", tech_pvt->channel, CF_APP_T38_REQ);
+ switch_channel_set_app_flag_key("T38", tech_pvt->channel, CF_APP_T38_FAIL);
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s T38 invite failed\n", switch_channel_get_name(tech_pvt->channel));
+ }
+
+
if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) {
if (channel && sip->sip_call_info) {
char *p;
switch_channel_set_private(other_channel, "t38_options", NULL);
sofia_clear_flag(tech_pvt, TFLAG_T38_PASSTHRU);
sofia_clear_flag(other_tech_pvt, TFLAG_T38_PASSTHRU);
+ switch_channel_clear_app_flag_key("T38", tech_pvt->channel, CF_APP_T38);
+ switch_channel_clear_app_flag_key("T38", tech_pvt->channel, CF_APP_T38_REQ);
+ switch_channel_set_app_flag_key("T38", tech_pvt->channel, CF_APP_T38_FAIL);
} else if (status == 200 && sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU) && has_t38 && sip->sip_payload && sip->sip_payload->pl_data) {
switch_t38_options_t *t38_options = sofia_glue_extract_t38_options(session, sip->sip_payload->pl_data);
switch_t38_options_t *t38_options = tech_process_udptl(tech_pvt, sdp, m);
if (switch_true(switch_channel_get_variable(channel, "refuse_t38"))) {
+ switch_channel_clear_app_flag_key("T38", tech_pvt->channel, CF_APP_T38);
match = 0;
goto done;
} else {