From 4af04f8205ce4d41980e1604c89fa00982ef2a9b Mon Sep 17 00:00:00 2001
From: Anthony Minessale <anthony.minessale@gmail.com>
Date: Fri, 7 Mar 2008 00:34:26 +0000
Subject: [PATCH] update

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7805 d0543943-73ff-0310-b7d9-9358b9ac24b2
---
 src/mod/endpoints/mod_sofia/sofia.c      | 9 +++++++--
 src/mod/endpoints/mod_sofia/sofia_glue.c | 3 ++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c
index aa2c8dbade..56206c66c6 100644
--- a/src/mod/endpoints/mod_sofia/sofia.c
+++ b/src/mod/endpoints/mod_sofia/sofia.c
@@ -1427,7 +1427,9 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
 					msg.pointer_arg = switch_core_session_strdup(other_session, r_sdp);
 					msg.pointer_arg_size = strlen(r_sdp);
 				}
-				switch_core_session_receive_message(other_session, &msg);
+				if (switch_core_session_receive_message(other_session, &msg) != SWITCH_STATUS_SUCCESS) {
+					nua_respond(tech_pvt->nh, 488, "Hangup in progress", TAG_END());
+				}
 				switch_core_session_rwunlock(other_session);
 			}
 			return;
@@ -1768,10 +1770,13 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
 						msg.from = __FILE__;
 						msg.string_arg = (char *) r_sdp;
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Passing SDP to other leg.\n%s\n", r_sdp);
-						switch_core_session_receive_message(other_session, &msg);
+						if (switch_core_session_receive_message(other_session, &msg) != SWITCH_STATUS_SUCCESS) {
+							nua_respond(tech_pvt->nh, 488, "Hangup in progress", TAG_END());
+						}					
 						switch_core_session_rwunlock(other_session);
 					} else {
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Re-INVITE to a no-media channel that is not in a bridge.\n");
+						switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 					}
 					goto done;
 				} else {
diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c
index 770fa47c86..57bfa58bfb 100644
--- a/src/mod/endpoints/mod_sofia/sofia_glue.c
+++ b/src/mod/endpoints/mod_sofia/sofia_glue.c
@@ -777,7 +777,8 @@ void sofia_glue_tech_patch_sdp(private_object_t *tech_pvt)
 	}
 	
 	if (!(ip_ptr && port_ptr)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s SDP Error! [%s]\n", switch_channel_get_name(tech_pvt->channel), tech_pvt->local_sdp_str);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SDP has no audio in it.\n%s\n", 
+						  switch_channel_get_name(tech_pvt->channel), tech_pvt->local_sdp_str);
 		return;
 	}