[Freeswitch-svn] [commit] r3964 - freeswitch/trunk/src/mod/endpoints/mod_sofia

Freeswitch SVN anthm at freeswitch.org
Mon Jan 15 11:59:42 EST 2007


Author: anthm
Date: Mon Jan 15 11:59:42 2007
New Revision: 3964

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c

Log:
heed the advice of tech_choose_port

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	Mon Jan 15 11:59:42 2007
@@ -945,7 +945,10 @@
 			snprintf(alert_info, sizeof(alert_info) - 1, "Alert-Info: %s", alertbuf);
 		}
 
-		tech_choose_port(tech_pvt);
+		if (tech_choose_port(tech_pvt) != SWITCH_STATUS_SUCCESS) {
+            return;
+        }
+        
 		set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
 
 		switch_set_flag_locked(tech_pvt, TFLAG_READY);
@@ -1495,7 +1498,8 @@
 {
 	private_object_t *tech_pvt;
 	switch_channel_t *channel = NULL;
-	
+	switch_status_t status;
+
 	assert(session != NULL);
 
 	channel = switch_core_session_get_channel(session);
@@ -1513,7 +1517,10 @@
 		switch_set_flag_locked(tech_pvt, TFLAG_ANS);
 
 
-		tech_choose_port(tech_pvt);
+		if ((status = tech_choose_port(tech_pvt)) != SWITCH_STATUS_SUCCESS) {
+            return status;
+        }
+
 		set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
 		activate_rtp(tech_pvt);
 		
@@ -1790,7 +1797,8 @@
 {
 	switch_channel_t *channel;
 	private_object_t *tech_pvt;
-			
+    switch_status_t status;
+
 	channel = switch_core_session_get_channel(session);
 	assert(channel != NULL);
 			
@@ -1827,7 +1835,9 @@
 		tech_pvt->local_sdp_str = NULL;
 		if (!switch_rtp_ready(tech_pvt->rtp_session)) {
 			tech_set_codecs(tech_pvt);
-			tech_choose_port(tech_pvt);
+			if ((status=tech_choose_port(tech_pvt)) != SWITCH_STATUS_SUCCESS) {
+                return status;
+            }
 		}
 		set_local_sdp(tech_pvt, NULL, 0, NULL, 1);
 		do_invite(session);
@@ -1915,7 +1925,9 @@
 			}
 
 			/* Transmit 183 Progress with SDP */
-			tech_choose_port(tech_pvt);
+			if ((status=tech_choose_port(tech_pvt)) != SWITCH_STATUS_SUCCESS) {
+                return status;
+            }
 			set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
 			activate_rtp(tech_pvt);
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Ring SDP:\n%s\n", tech_pvt->local_sdp_str);
@@ -2620,7 +2632,9 @@
 					}
 
 					if (match) {
-						tech_choose_port(tech_pvt);
+						if (tech_choose_port(tech_pvt) != SWITCH_STATUS_SUCCESS) {
+                            goto done;
+                        }
 						activate_rtp(tech_pvt);
 						switch_channel_set_variable(channel, "endpoint_disposition", "EARLY MEDIA");
 						switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
@@ -2730,7 +2744,9 @@
 						}
 					}
 					if (match) {
-						tech_choose_port(tech_pvt);
+						if (tech_choose_port(tech_pvt) != SWITCH_STATUS_SUCCESS) {
+                            goto done;
+                        }
 						set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
 						switch_set_flag_locked(tech_pvt, TFLAG_REINVITE);
 						activate_rtp(tech_pvt);
@@ -2749,8 +2765,9 @@
 			switch_set_flag_locked(tech_pvt, TFLAG_REINVITE);
 			tech_pvt->nh = tech_pvt->nh2;
 			tech_pvt->nh2 = NULL;
-			tech_choose_port(tech_pvt);
-			activate_rtp(tech_pvt);
+			if (tech_choose_port(tech_pvt) == SWITCH_STATUS_SUCCESS) {
+                activate_rtp(tech_pvt);
+            }
 			goto done;
 		}
 
@@ -2784,10 +2801,11 @@
 					if (match) {
 						switch_set_flag_locked(tech_pvt, TFLAG_ANS);
 						switch_channel_set_variable(channel, "endpoint_disposition", "ANSWER");
-						tech_choose_port(tech_pvt);
-						activate_rtp(tech_pvt);
-                        switch_channel_mark_answered(channel);
-						goto done;
+						if (tech_choose_port(tech_pvt) == SWITCH_STATUS_SUCCESS) {
+                            activate_rtp(tech_pvt);
+                            switch_channel_mark_answered(channel);
+                            goto done;
+                        }
 					}
 					
 					switch_channel_set_variable(channel, "endpoint_disposition", "NO CODECS");



More information about the Freeswitch-svn mailing list