]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-3688 revert
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 18 Nov 2011 23:00:30 +0000 (17:00 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 18 Nov 2011 23:00:30 +0000 (17:00 -0600)
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c

index 4cd0868be0d96d9d71bfe9b5b427adfc336f6793..1e1f3dacbf387a169d28d14c215982c879ae275e 100644 (file)
@@ -508,7 +508,6 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
                        }
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Sending BYE to %s\n", switch_channel_get_name(channel));
                        if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
-                               switch_ivr_parse_all_signal_data(session);
                                nua_bye(tech_pvt->nh,
                                                TAG_IF(!zstr(reason), SIPTAG_REASON_STR(reason)),
                                                TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
@@ -522,7 +521,6 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
                                        switch_channel_set_variable(channel, "sip_hangup_disposition", "send_cancel");
                                }
                                if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
-                                       switch_ivr_parse_all_signal_data(session);
                                        nua_cancel(tech_pvt->nh,
                                                           TAG_IF(!zstr(reason), SIPTAG_REASON_STR(reason)), TAG_IF(!zstr(bye_headers), SIPTAG_HEADER_STR(bye_headers)), TAG_END());
                                }
@@ -1415,7 +1413,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                if (switch_core_session_in_thread(session)) {
                        de->session = session;
                }
-               sofia_process_dispatch_event(&de, SWITCH_TRUE);
+               sofia_process_dispatch_event(&de);
                switch_mutex_unlock(tech_pvt->sofia_mutex);
                goto end;
        }
@@ -1907,6 +1905,12 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
 
        case SWITCH_MESSAGE_INDICATE_PHONE_EVENT:
                {
+
+                       switch_channel_set_flag(channel, CF_REQ_MEDIA);
+                       sofia_glue_do_invite(session);
+
+
+#if 0
                        const char *event = "talk";
 
                        if (!zstr(msg->string_arg) && strcasecmp(msg->string_arg, event)) {
@@ -1923,6 +1927,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                        } else { 
                                nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), NUTAG_SUBSTATE(nua_substate_active), SIPTAG_EVENT_STR(event), TAG_END());
                        }
+#endif
                }
                break;
        case SWITCH_MESSAGE_INDICATE_SIMPLIFY:
index cf01b1d7c4fc48f114c49bf65522e21cf90140ce..edd58babf149ab7c08468bed6309c30b192602ee 100644 (file)
@@ -1138,5 +1138,5 @@ void sofia_glue_check_dtmf_type(private_object_t *tech_pvt);
 void sofia_glue_parse_rtp_bugs(switch_rtp_bug_flag_t *flag_pole, const char *str);
 char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, sofia_dispatch_event_t *de, sofia_nat_parse_t *np);
 void sofia_glue_pause_jitterbuffer(switch_core_session_t *session, switch_bool_t on);
-void sofia_process_dispatch_event(sofia_dispatch_event_t **dep, switch_bool_t do_callback);
+void sofia_process_dispatch_event(sofia_dispatch_event_t **dep);
 
index a7539a73117fa3649cbcb7999ca9278f7c8b54fb..197891d6a902f3bc91249a3534c84e513eb4be67 100644 (file)
@@ -870,7 +870,7 @@ static void our_sofia_event_callback(nua_event_t event,
        if (sofia_private && sofia_private->is_call && sofia_private->de) {
                sofia_dispatch_event_t *qde = sofia_private->de;
                sofia_private->de = NULL;
-               sofia_process_dispatch_event(&qde, SWITCH_TRUE);
+               sofia_process_dispatch_event(&qde);
        }
 
        profile->last_sip_event = switch_time_now();
@@ -1192,28 +1192,17 @@ static void our_sofia_event_callback(nua_event_t event,
        }
 }
 
-void sofia_process_dispatch_event(sofia_dispatch_event_t **dep, switch_bool_t do_callback)
+void sofia_process_dispatch_event(sofia_dispatch_event_t **dep)
 {
        sofia_dispatch_event_t *de = *dep;
        nua_handle_t *nh = de->nh;
        nua_t *nua = de->nua;
        sofia_profile_t *profile = de->profile;
-       nua_event_t event;
-       *dep = NULL;
-
-       event = de->data->e_event;
 
-       if (de->session && switch_channel_down_nosig(switch_core_session_get_channel(de->session))) {
-               if (event == nua_i_invite) {
-                       nua_respond(nh, 481, "Channel Hanging Up", TAG_END());
-               }
-               do_callback = SWITCH_FALSE;
-       }
+       *dep = NULL;
 
-       if (do_callback) {
-               our_sofia_event_callback(de->data->e_event, de->data->e_status, de->data->e_phrase, de->nua, de->profile, 
-                                                                de->nh, nua_handle_magic(de->nh), de->sip, de, (tagi_t *) de->data->e_tags);
-       }
+       our_sofia_event_callback(de->data->e_event, de->data->e_status, de->data->e_phrase, de->nua, de->profile, 
+                                                        de->nh, nua_handle_magic(de->nh), de->sip, de, (tagi_t *) de->data->e_tags);
 
        nua_destroy_event(de->event);   
        su_free(nh->nh_home, de);
@@ -1237,7 +1226,7 @@ void *SWITCH_THREAD_FUNC sofia_msg_thread_run(switch_thread_t *thread, void *obj
 
        while(switch_queue_pop(q, &pop) == SWITCH_STATUS_SUCCESS && pop) {
                sofia_dispatch_event_t *de = (sofia_dispatch_event_t *) pop;
-               sofia_process_dispatch_event(&de, SWITCH_TRUE);
+               sofia_process_dispatch_event(&de);
                switch_cond_next();
        }
 
@@ -1288,7 +1277,7 @@ static void sofia_queue_message(sofia_dispatch_event_t *de)
        int idx = 0;
 
        if (mod_sofia_globals.running == 0) {
-               sofia_process_dispatch_event(&de, SWITCH_TRUE);
+               sofia_process_dispatch_event(&de);
                return;
        }
 
@@ -1351,7 +1340,7 @@ void sofia_event_callback(nua_event_t event,
                switch_core_session_t *session;
 
                if (!zstr(sofia_private->uuid)) {
-                       if ((session = switch_core_session_force_locate(sofia_private->uuid))) {
+                       if ((session = switch_core_session_locate(sofia_private->uuid))) {
                                if (switch_core_session_running(session)) {
                                        switch_core_session_queue_signal_data(session, de);
                                } else {
@@ -7194,6 +7183,8 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
        char sip_acl_authed_by[512] = "";
        char sip_acl_token[512] = "";
 
+       profile->ib_calls++;
+
        if (sess_count >= sess_max || !sofia_test_pflag(profile, PFLAG_RUNNING)) {
                nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
                goto fail;
@@ -8257,8 +8248,6 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Setting NAT mode based on %s\n", is_nat);
                        switch_channel_set_variable(channel, "sip_nat_detected", "true");
                }
-
-               profile->ib_calls++;
                return;
        }