diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 79031274b7..0295e8c914 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Wed Nov 2 08:58:40 CDT 2011 +Thu Nov 17 11:43:21 CST 2011 diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c index bc80310f23..7ea7708b96 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c @@ -3801,24 +3801,23 @@ static int nua_bye_client_request(nua_client_request_t *cr, ss = nua_dialog_usage_private(du); reason = ss->ss_reason; - error = nua_base_client_trequest(cr, msg, sip, - SIPTAG_REASON_STR(reason), - TAG_NEXT(tags)); - if (error == 0) { - nua_dialog_usage_reset_refresh(du); - ss->ss_timer->timer_set = 0; - - /* Terminate server transactions associated with session, too. */ - for (sr = du->du_dialog->ds_sr; sr; sr = sr->sr_next) { + nua_dialog_usage_reset_refresh(du); + ss->ss_timer->timer_set = 0; + + /* Terminate server transactions associated with session, too. */ + for (sr = du->du_dialog->ds_sr; sr; sr = sr->sr_next) { if (sr->sr_usage == du && nua_server_request_is_pending(sr) && - sr->sr_method != sip_method_bye) { - sr_status(sr, SIP_486_BUSY_HERE); - nua_server_respond(sr, 0); + sr->sr_method != sip_method_bye) { + sr_status(sr, SIP_486_BUSY_HERE); + nua_server_respond(sr, 0); } - } } - + + error = nua_base_client_trequest(cr, msg, sip, + SIPTAG_REASON_STR(reason), + TAG_NEXT(tags)); + return error; } static int nua_bye_client_response(nua_client_request_t *cr, diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 68aa5096f0..b2f7a97bc1 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -508,6 +508,7 @@ 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)), @@ -521,6 +522,7 @@ 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()); } @@ -955,10 +957,9 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f if (sofia_test_flag(tech_pvt, TFLAG_HUP)) { return SWITCH_STATUS_FALSE; } - - while (!(tech_pvt->read_codec.implementation && switch_rtp_ready(tech_pvt->rtp_session) && !switch_channel_test_flag(channel, CF_REQ_MEDIA))) { + for(;;) { + //while (!(tech_pvt->read_codec.implementation && switch_rtp_ready(tech_pvt->rtp_session) && !switch_channel_test_flag(channel, CF_REQ_MEDIA))) { switch_ivr_parse_all_messages(tech_pvt->session); - if (--sanity && switch_channel_up(channel)) { switch_yield(10000); } else { diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index fb98dab969..2fb1aa3fdf 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1177,9 +1177,18 @@ void sofia_process_dispatch_event(sofia_dispatch_event_t **dep, switch_bool_t do 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; + } + 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); @@ -1323,11 +1332,7 @@ void sofia_event_callback(nua_event_t event, if (!zstr(sofia_private->uuid)) { if ((session = switch_core_session_force_locate(sofia_private->uuid))) { if (switch_core_session_running(session)) { - if (switch_channel_down_nosig(switch_core_session_get_channel(session))) { - sofia_process_dispatch_event(&de, SWITCH_FALSE); - } else { - switch_core_session_queue_signal_data(session, de); - } + switch_core_session_queue_signal_data(session, de); } else { switch_core_session_message_t msg = { 0 }; msg.message_id = SWITCH_MESSAGE_INDICATE_SIGNAL_DATA; @@ -7168,8 +7173,6 @@ 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; @@ -8233,6 +8236,8 @@ 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; }