From 5d47cffc28c033ff2cdeadf62eebdd7329de26d7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 15 Apr 2006 05:00:51 +0000 Subject: [PATCH] update git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1162 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/libdingaling/src/libdingaling.c | 3 ++- src/mod/endpoints/mod_dingaling/mod_dingaling.c | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/libs/libdingaling/src/libdingaling.c b/libs/libdingaling/src/libdingaling.c index 9b1fd0981a..18553a35d1 100644 --- a/libs/libdingaling/src/libdingaling.c +++ b/libs/libdingaling/src/libdingaling.c @@ -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; } diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index 8159e05015..29235a5da8 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -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) &&