From c0849e1a401138b5ef4f7ec57bc62310caa2169b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 28 Aug 2006 23:50:10 +0000 Subject: [PATCH] fix stupidness git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2419 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/mod_sofia.c | 25 +++++++++++++++++++++---- src/switch_ivr.c | 2 +- src/switch_rtp.c | 2 +- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 50516b78ad..6cdcead083 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -723,7 +723,6 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session) set_local_sdp(tech_pvt); activate_rtp(tech_pvt); if (tech_pvt->nh) { - tech_pvt->contact = sip_contact_create(tech_pvt->home, URL_STRING_MAKE("sip:1000@208.64.200.40"), NULL); nua_respond(tech_pvt->nh, SIP_200_OK, SIPTAG_CONTACT(tech_pvt->contact), SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), TAG_END()); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Local SDP:\n%s\n", tech_pvt->local_sdp_str); } @@ -995,10 +994,12 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi if (!switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) { switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Asked to send early media by %s\n", msg->from); + /* Transmit 183 Progress with SDP */ tech_choose_port(tech_pvt); set_local_sdp(tech_pvt); activate_rtp(tech_pvt); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "183 SDP:\n%s\n", tech_pvt->local_sdp_str); nua_respond(tech_pvt->nh, SIP_183_SESSION_PROGRESS, SIPTAG_CONTACT(tech_pvt->contact), SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), TAG_END()); //nua_respond(tech_pvt->nh, SIP_200_OK, SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), TAG_END()); } @@ -1251,6 +1252,9 @@ static void sip_i_state(int status, uint8_t match = 0; + tech_pvt->contact = sip_contact_create(tech_pvt->home, URL_STRING_MAKE("sip:1000@208.64.200.40"), NULL); + + if (tech_pvt->num_codecs) { if ((sdp = sdp_session(parser))) { match = negotiate_sdp(session, sdp); @@ -1267,7 +1271,7 @@ static void sip_i_state(int status, switch_channel_set_state(channel, CS_INIT); switch_set_flag_locked(tech_pvt, TFLAG_READY); switch_core_session_thread_launch(session); - //nua_respond(nh, SIP_180_RINGING, TAG_END()); + //nua_respond(nh, SIP_100_TRYING, SIPTAG_CONTACT(tech_pvt->contact), TAG_END()); return; } } @@ -1531,10 +1535,15 @@ static void *SWITCH_THREAD_FUNC profile_thread_run(switch_thread_t *thread, void event_callback, /* Callback for processing events */ profile, /* Additional data to pass to callback */ NUTAG_URL(profile->url), - NUTAG_EARLY_MEDIA(1), - SIPTAG_SUPPORTED_STR("100rel, precondition"), TAG_END()); /* Last tag should always finish the sequence */ + nua_set_params(profile->nua, + NUTAG_EARLY_MEDIA(1), + SIPTAG_SUPPORTED_STR("100rel, precondition"), + NUTAG_AUTOANSWER(0), + NUTAG_AUTOALERT(0)); + + for (node = profile->aliases; node; node = node->next) { node->nua = nua_create(profile->s_root, /* Event loop */ event_callback, /* Callback for processing events */ @@ -1542,8 +1551,16 @@ static void *SWITCH_THREAD_FUNC profile_thread_run(switch_thread_t *thread, void NUTAG_URL(node->url), NUTAG_EARLY_MEDIA(1), SIPTAG_SUPPORTED_STR("100rel, precondition"), + NUTAG_AUTOANSWER(0), + NUTAG_AUTOALERT(0), TAG_END()); /* Last tag should always finish the sequence */ + nua_set_params(node->nua, + NUTAG_EARLY_MEDIA(1), + SIPTAG_SUPPORTED_STR("100rel, precondition"), + NUTAG_AUTOANSWER(0), + NUTAG_AUTOALERT(0)); + } su_root_run(profile->s_root); diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 0704117d77..58b4f583f3 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -1678,7 +1678,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses this_audio_thread->running = 2; - if (!switch_channel_test_flag(peer_channel, CF_TRANSFER)) { + if (!switch_channel_test_flag(peer_channel, CF_TRANSFER) && switch_channel_get_state(peer_channel) < CS_HANGUP) { switch_core_session_kill_channel(peer_session, SWITCH_SIG_KILL); switch_channel_hangup(peer_channel, SWITCH_CAUSE_NORMAL_CLEARING); } diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 68f810ac29..fb9f3d948b 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -547,7 +547,7 @@ SWITCH_DECLARE(void) switch_rtp_kill_socket(switch_rtp_t *rtp_session) SWITCH_DECLARE(uint8_t) switch_rtp_ready(switch_rtp_t *rtp_session) { - return switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO) ? 1 : 0; + return (rtp_session != NULL && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO)) ? 1 : 0; } SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session)