]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
update
authorAnthony Minessale <anthony.minessale@gmail.com>
Sat, 15 Apr 2006 05:00:51 +0000 (05:00 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Sat, 15 Apr 2006 05:00:51 +0000 (05:00 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1162 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/libdingaling/src/libdingaling.c
src/mod/endpoints/mod_dingaling/mod_dingaling.c

index 9b1fd0981afe0606bd4651ac3060a245dac5f3e1..18553a35d16ea8a0fac183a794725c924b269a16 100644 (file)
@@ -409,8 +409,9 @@ static int on_presence(void *user_data, ikspak *pak)
                }
        }
 
-       if (resource && strstr(resource, "talk") && (buffer = apr_hash_get(handle->probe_hash, id, APR_HASH_KEY_STRING))) {
+       if (resource && strstr(resource, "talk") && (buffer = apr_hash_get(handle->probe_hash, id, APR_HASH_KEY_STRING))) {
                apr_cpystrn(buffer->buf, from, buffer->len);
+               fflush(stderr);
                buffer->hit = 1;
        }
 
index 8159e050155bda149517d332a23d0e5fac054b85..29235a5da8c520a23de597fe32c7e5aa8b18be2c 100644 (file)
@@ -48,6 +48,7 @@ typedef enum {
        TFLAG_VOICE = (1 << 6),
        TFLAG_RTP_READY = (1 << 7),
        TFLAG_CODEC_READY = (1 << 8),
+       TFLAG_INIT = (1 << 9),
 } TFLAGS;
 
 typedef enum {
@@ -238,12 +239,12 @@ static void *SWITCH_THREAD_FUNC negotiate_thread_run(switch_thread *thread, void
 
        if (!tech_pvt->last_cand) {
                tech_pvt->last_cand = switch_time_now();
-               next_cand = tech_pvt->last_cand;
+               next_cand = tech_pvt->last_cand + DL_CAND_WAIT;
        } else {
                next_cand = tech_pvt->last_cand + DL_CAND_WAIT;
        }
 
-       while(! (switch_test_flag(tech_pvt, TFLAG_CODEC_READY) && switch_test_flag(tech_pvt, TFLAG_RTP_READY))) {
+       while(! (switch_test_flag(tech_pvt, TFLAG_CODEC_READY) && switch_test_flag(tech_pvt, TFLAG_RTP_READY) && switch_test_flag(tech_pvt, TFLAG_INIT))) {
                now = switch_time_now();
                elapsed = (unsigned int)((now - started) / 1000);
 
@@ -329,6 +330,7 @@ static void *SWITCH_THREAD_FUNC negotiate_thread_run(switch_thread *thread, void
                                cand[0].pref = 1;
                                cand[0].protocol = "udp";
                                tech_pvt->cand_id = ldl_session_candidates(tech_pvt->dlsession, cand, 1);
+                               switch_set_flag(tech_pvt, TFLAG_RTP_READY);
                        }
                }
                if (elapsed > 60000) {
@@ -341,7 +343,7 @@ static void *SWITCH_THREAD_FUNC negotiate_thread_run(switch_thread *thread, void
                        return NULL;
                }
                switch_yield(1000);
-               //printf("WAIT %s %d\n", switch_channel_get_name(channel), switch_test_flag(tech_pvt, TFLAG_OUTBOUND));
+               //printf("WAIT %s %d %d %d\n", switch_channel_get_name(channel), switch_test_flag(tech_pvt, TFLAG_OUTBOUND), switch_test_flag(tech_pvt, TFLAG_CODEC_READY), switch_test_flag(tech_pvt, TFLAG_RTP_READY));
        }
 
 
@@ -1210,6 +1212,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
                        ldl_payload_t *payloads;
                        unsigned int len = 0;
 
+                       switch_set_flag(tech_pvt, TFLAG_INIT);
                        if (tech_pvt->codec_index > -1) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Already decided on a codec\n");
                                break;
@@ -1260,7 +1263,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%u candidates\n", len);
                                for(x = 0; x < len; x++) {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "candidates %s:%d\n", candidates[x].address, candidates[x].port);
-                                       if (!strcasecmp(candidates[x].protocol, "udp") && 
+                                       if (!strcasecmp(candidates[x].protocol, "udp") && (!strcasecmp(candidates[x].type, "local") || !strcasecmp(candidates[x].type, "stun")) && 
                                                ((profile->lanaddr && !strncasecmp(candidates[x].address, profile->lanaddr, strlen(profile->lanaddr))) ||
                                                 (strncasecmp(candidates[x].address, "10.", 3) && 
                                                  strncasecmp(candidates[x].address, "192.168.", 8) &&