]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add patch to fix stun issue
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 1 Mar 2007 16:11:08 +0000 (16:11 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 1 Mar 2007 16:11:08 +0000 (16:11 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4418 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/mod_sofia.c
src/switch_ivr.c

index dcac2d0d9b165756f2c674758b27543933a5dcf9..944169ecda5630d488f79143e4db47762c07f624 100644 (file)
@@ -365,7 +365,7 @@ static void terminate_session(switch_core_session_t **session, switch_call_cause
 
 static switch_status_t tech_choose_port(private_object_t *tech_pvt);
 
-static void do_invite(switch_core_session_t *session);
+static switch_status_t do_invite(switch_core_session_t *session);
 
 static uint8_t negotiate_sdp(switch_core_session_t *session, sdp_session_t *sdp);
 
@@ -889,7 +889,7 @@ static void terminate_session(switch_core_session_t **session, switch_call_cause
                tech_pvt = switch_core_session_get_private(*session);
 
                if (tech_pvt) {
-                       if (state > CS_INIT && state < CS_HANGUP) {
+                       if (state < CS_HANGUP) {
                                switch_channel_hangup(channel, cause);
                        }
                        
@@ -960,7 +960,7 @@ static switch_status_t tech_choose_port(private_object_t *tech_pvt)
        return SWITCH_STATUS_SUCCESS;
 }
 
-static void do_invite(switch_core_session_t *session)
+static switch_status_t do_invite(switch_core_session_t *session)
 {
        char rpid[1024] = { 0 };
        char alert_info[1024] = { 0 };
@@ -979,6 +979,7 @@ static void do_invite(switch_core_session_t *session)
        void *vval;
        char *extra_headers = NULL;
        const void *vvar;
+       switch_status_t status = SWITCH_STATUS_FALSE;
 
     channel = switch_core_session_get_channel(session);
     assert(channel != NULL);
@@ -1010,7 +1011,7 @@ static void do_invite(switch_core_session_t *session)
                }
 
                if (tech_choose_port(tech_pvt) != SWITCH_STATUS_SUCCESS) {
-            return;
+            return status;
         }
         
                set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
@@ -1108,9 +1109,12 @@ static void do_invite(switch_core_session_t *session)
                                   TAG_END());
                
                switch_safe_free(stream.data);
+               status = SWITCH_STATUS_SUCCESS;
        } else {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
        }
+
+       return status;
        
 }
 
@@ -1230,7 +1234,9 @@ static switch_status_t sofia_on_init(switch_core_session_t *session)
        }
 
        if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
-               do_invite(session);
+               if (do_invite(session) != SWITCH_STATUS_SUCCESS) {
+                       return SWITCH_STATUS_FALSE;
+               }
        }
        
        /* Move Channel's State Machine to RING */
index 245d223fea76551fc1bcf59cb153eb61b5926a68..4b3159d868762a5355da3aba9892305da3d47947 100644 (file)
@@ -2795,7 +2795,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                valid_channels++;
                                state = switch_channel_get_state(peer_channels[i]);
                        
-                               if (state >= CS_RING) {
+                               if (state >= CS_HANGUP) {
+                                       goto notready;
+                               } else if (state >= CS_RING) {
                                        goto endfor1;
                                }