]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-3214 try this patch
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 8 Jun 2011 23:50:21 +0000 (18:50 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 8 Jun 2011 23:50:21 +0000 (18:50 -0500)
src/include/switch_types.h
src/mod/applications/mod_spandsp/mod_spandsp_fax.c
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_glue.c

index 2b2b3de45d4798cb28276ae0313507ec4a95c5ac..bf5d5d88ea655819c3ddabb7b6e290a2b0080492 100644 (file)
@@ -1120,7 +1120,9 @@ typedef enum {
 
 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;
 
 
index 119294f4bd540a67236abf7aeabec2cd13883491..e4457bd5b9365cb352294cdaaa9f81aaff8726a8 100644 (file)
@@ -904,6 +904,7 @@ static t38_mode_t request_t38(pvt_t *pvt)
         
         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__;
@@ -1173,7 +1174,10 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat
         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);
index 69f7b24f30ea467d51e59b7310be187201c97895..86fa14004653e2a8f2284b19e48c30391fa9a5e5 100644 (file)
@@ -524,6 +524,12 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
                                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());
index 12b0280974a75360c7d044f5e0870429d40dadb8..c5efbf63bbb8c77704c757b0442cb03a1fa6a92b 100644 (file)
@@ -4161,6 +4161,16 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
                        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;
@@ -4462,6 +4472,9 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
                                                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);
                                                
index b308b6038e5cc9ceb941a678f99911967fa81114..a0f71a946612d288315f0d0c04c078014085decf 100644 (file)
@@ -4391,6 +4391,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s
                        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 {