]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
cleanup whitespace and add some logging
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 23 Apr 2010 20:53:30 +0000 (15:53 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 23 Apr 2010 20:53:30 +0000 (15:53 -0500)
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/sofia_glue.c

index 1930454ebc148fcbd3ef37f62acaadba9789491f..12a69d000dd0db22c5b7b1f31e1ba7fb1875d7cc 100644 (file)
@@ -160,22 +160,29 @@ static switch_status_t sofia_on_reset(switch_core_session_t *session)
 
 
        if (sofia_test_flag(tech_pvt, TFLAG_RECOVERING_BRIDGE)) {
-               switch_core_session_t *other_session;
+               switch_core_session_t *other_session = NULL;
                const char *uuid = switch_core_session_get_uuid(session);
 
                if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
                        const char *other_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
+                       int x = 0;
 
-                       if (other_uuid && (other_session = switch_core_session_locate(other_uuid))) {
-                               switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
+                       if (other_uuid) {
+                               for(x = 0; other_session == NULL && x < 5; x++) {
+                                       other_session = switch_core_session_locate(other_uuid);
+                                       switch_yield(100000);
+                               }
+                       }
 
+                       if (other_session) {
+                               switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
                                switch_channel_clear_flag(channel, CF_BRIDGE_ORIGINATOR);
                                switch_channel_wait_for_state_timeout(other_channel, CS_RESET, 5000);
                                switch_channel_wait_for_flag(channel, CF_REQ_MEDIA, SWITCH_FALSE, 10000, NULL);
                                switch_channel_wait_for_flag(channel, CF_MEDIA_ACK, SWITCH_TRUE, 10000, NULL);
                                switch_channel_wait_for_flag(other_channel, CF_REQ_MEDIA, SWITCH_FALSE, 10000, NULL);
                                switch_channel_wait_for_flag(other_channel, CF_MEDIA_ACK, SWITCH_TRUE, 10000, NULL);
-
+                               
                                if (switch_channel_test_flag(channel, CF_PROXY_MODE) && switch_channel_test_flag(other_channel, CF_PROXY_MODE)) {
                                        switch_ivr_signal_bridge(session, other_session);
                                } else {
index 77b82b06656497fdced879c82c1f91ddfadc3917..193001fe1f6d096b5d9fb05858507c8f10a52548 100644 (file)
@@ -3571,6 +3571,18 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
                                        match = 0;
                                        got_audio = 0;
                                }
+                               
+                               for (map = m->m_rtpmaps; map; map = map->rm_next) {
+                                       if ((zstr(map->rm_encoding) || (tech_pvt->profile->ndlb & PFLAG_NDLB_ALLOW_BAD_IANANAME)) && map->rm_pt < 96) {
+                                               match = (map->rm_pt == tech_pvt->agreed_pt) ? 1 : 0;
+                                       } else {
+                                               match = strcasecmp(map->rm_encoding, tech_pvt->rm_encoding) ? 0 : 1;
+                                       }                                       
+                               }
+
+                               if (match) {
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Existing codec is already acceptable, using that.\n");
+                               }
                        }
 
                        for (map = m->m_rtpmaps; map; map = map->rm_next) {
@@ -4247,7 +4259,7 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName
                        }
 
                        if ((tmp = switch_channel_get_variable(channel, "sip_use_pt"))) {
-                               tech_pvt->agreed_pt = atoi(tmp);
+                               tech_pvt->pt = tech_pvt->agreed_pt = atoi(tmp);
                        }
 
                        sofia_glue_tech_set_codec(tech_pvt, 1);