]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
avoid races in super high volume of no media calls
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 9 Mar 2007 20:37:30 +0000 (20:37 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 9 Mar 2007 20:37:30 +0000 (20:37 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4493 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_types.h
src/mod/endpoints/mod_sofia/mod_sofia.c
src/switch_core.c

index ab2b10b024f4d5046b003c8afefc1ab6d334fa66..43d450305a4a608105083ca4f87ba501917c5a23 100644 (file)
@@ -145,6 +145,7 @@ SWITCH_BEGIN_EXTERN_C
 #define SWITCH_B_SDP_VARIABLE "switch_m_sdp"
 #define SWITCH_BRIDGE_VARIABLE "bridge_to"
 #define SWITCH_SIGNAL_BRIDGE_VARIABLE "signal_bridge_to"
+#define SWITCH_SIGNAL_BOND_VARIABLE "signal_bond"
 #define SWITCH_ORIGINATOR_VARIABLE "originator"
 #define SWITCH_ORIGINATOR_CODEC_VARIABLE "originator_codec"
 #define SWITCH_LOCAL_MEDIA_IP_VARIABLE "local_media_ip"
index 407f8b4eaf0ff3c47bc576870f92f82f0bb1174a..b323490d8c800e9f453b342289d019fe2a0b7b6b 100644 (file)
@@ -2041,7 +2041,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
 
                switch_set_flag_locked(tech_pvt, TFLAG_NOMEDIA);
                tech_pvt->local_sdp_str = NULL;
-               if ((uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
+               if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
                        other_channel = switch_core_session_get_channel(other_session);
                        ip = switch_channel_get_variable(other_channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE);
                        port = switch_channel_get_variable(other_channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE);
@@ -2816,7 +2816,7 @@ static void pass_sdp(private_object_t *tech_pvt, char *sdp)
        channel = switch_core_session_get_channel(tech_pvt->session);
        assert(channel != NULL);
        
-       if ((val = switch_channel_get_variable(channel, SWITCH_ORIGINATOR_VARIABLE)) && (other_session = switch_core_session_locate(val))) {
+       if ((val = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(val))) {
                other_channel = switch_core_session_get_channel(other_session);
                assert(other_channel != NULL);
                if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) {
@@ -2922,7 +2922,7 @@ static void sip_i_state(int status,
                                switch_channel_mark_ring_ready(channel);
                                if (!switch_channel_test_flag(channel, CF_GEN_RINGBACK)) {
                                        if (switch_test_flag(tech_pvt, TFLAG_NOMEDIA)) {
-                                               if ((uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
+                                               if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
                                                        switch_core_session_message_t msg;
                                                        msg.message_id = SWITCH_MESSAGE_INDICATE_RINGING;
                                                        msg.from = __FILE__;
@@ -2941,7 +2941,7 @@ static void sip_i_state(int status,
                                        switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
                     switch_channel_mark_pre_answered(channel);
                                        if (!switch_channel_test_flag(channel, CF_GEN_RINGBACK) && 
-                                               (uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
+                                               (uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
                                                other_channel = switch_core_session_get_channel(other_session);
                                                if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) {
                                                        switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, r_sdp);
@@ -3015,7 +3015,7 @@ static void sip_i_state(int status,
                                                        }
 
                                                        if ((b_private = nua_handle_magic(bnh))) {
-                                                               char *br_b = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE);
+                                                               char *br_b = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
                                                                char *br_a = b_private->uuid;
 
                                                                if (br_b) {
@@ -3092,7 +3092,7 @@ static void sip_i_state(int status,
                        if (switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
                                switch_set_flag_locked(tech_pvt, TFLAG_ANS);
                 switch_channel_mark_answered(channel);
-                if ((uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
+                if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
                     other_channel = switch_core_session_get_channel(other_session);
                     switch_channel_answer(other_channel);
                     switch_core_session_rwunlock(other_session);
@@ -3107,7 +3107,7 @@ static void sip_i_state(int status,
                                if (switch_test_flag(tech_pvt, TFLAG_NOMEDIA)) {
                                        switch_set_flag_locked(tech_pvt, TFLAG_ANS);
                     switch_channel_mark_answered(channel);
-                                       if ((uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
+                                       if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
                                                other_channel = switch_core_session_get_channel(other_session);
                                                if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) {
                                                        switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, r_sdp);
@@ -3995,8 +3995,8 @@ static void sip_i_refer(nua_t *nua,
                         b_tech_pvt = (private_object_t *) switch_core_session_get_private(b_session);
                         channel_b = switch_core_session_get_channel(b_session);
                                
-                        br_a = switch_channel_get_variable(channel_a, SWITCH_BRIDGE_VARIABLE);
-                        br_b = switch_channel_get_variable(channel_b, SWITCH_BRIDGE_VARIABLE);
+                        br_a = switch_channel_get_variable(channel_a, SWITCH_SIGNAL_BOND_VARIABLE);
+                        br_b = switch_channel_get_variable(channel_b, SWITCH_SIGNAL_BOND_VARIABLE);
 
                         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Attended Transfer [%s][%s]\n", br_a, br_b);
                             
@@ -4059,7 +4059,7 @@ static void sip_i_refer(nua_t *nua,
                     }
                     nua_handle_unref(bnh);
                 } else { /* the other channel is on a different box, we have to go find them */
-                    if (exten && (br_a = switch_channel_get_variable(channel_a, SWITCH_BRIDGE_VARIABLE))) {
+                    if (exten && (br_a = switch_channel_get_variable(channel_a, SWITCH_SIGNAL_BOND_VARIABLE))) {
                         switch_core_session_t *a_session;
                         switch_channel_t *channel = switch_core_session_get_channel(session);
                                                        
@@ -4137,7 +4137,7 @@ static void sip_i_refer(nua_t *nua,
         switch_channel_t *channel = switch_core_session_get_channel(session);
         char *br;
                                
-        if ((br = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE))) {
+        if ((br = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
             switch_core_session_t *b_session;
                                
             if ((b_session = switch_core_session_locate(br))) {
index 38148e1a894c680dd12cc62fac3d45ff39a0cb9f..05df61e818d6ca0cdb554633e1082ffb077c6e6d 100644 (file)
@@ -1705,7 +1705,9 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_
                 switch_channel_set_variable(peer_channel, SWITCH_ORIGINATOR_CODEC_VARIABLE, tmp);
             }
 
-                       switch_channel_set_variable(peer_channel, SWITCH_ORIGINATOR_VARIABLE, switch_core_session_get_uuid(session));            
+                       switch_channel_set_variable(peer_channel, SWITCH_ORIGINATOR_VARIABLE, switch_core_session_get_uuid(session));
+                       switch_channel_set_variable(peer_channel, SWITCH_SIGNAL_BOND_VARIABLE, switch_core_session_get_uuid(session));
+                       switch_channel_set_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE, switch_core_session_get_uuid(*new_session));
 
             /* A comma (,) separated list of variable names that should ne propagated from originator to originatee */
                        if ((export_vars = switch_channel_get_variable(channel, SWITCH_EXPORT_VARS_VARIABLE))) {