git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1279 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2006-04-27 15:59:58 +00:00
parent 31e31566a5
commit 24627a7a4b
2 changed files with 98 additions and 92 deletions

View File

@ -55,7 +55,8 @@ typedef enum {
TFLAG_VAD_OUT = ( 1 << 12), TFLAG_VAD_OUT = ( 1 << 12),
TFLAG_VAD = ( 1 << 13), TFLAG_VAD = ( 1 << 13),
TFLAG_DO_CAND = ( 1 << 14), TFLAG_DO_CAND = ( 1 << 14),
TFLAG_DO_DESC = (1 << 15) TFLAG_DO_DESC = (1 << 15),
TFLAG_LANADDR = (1 << 16)
} TFLAGS; } TFLAGS;
typedef enum { typedef enum {
@ -330,6 +331,10 @@ static int do_candidates(struct private_object *tech_pvt, int force)
switch_stun_random_string(tech_pvt->local_user, 16, NULL); switch_stun_random_string(tech_pvt->local_user, 16, NULL);
switch_stun_random_string(tech_pvt->local_pass, 16, NULL); switch_stun_random_string(tech_pvt->local_pass, 16, NULL);
if (switch_test_flag(tech_pvt, TFLAG_LANADDR)) {
advip = tech_pvt->profile->ip;
}
cand[0].port = tech_pvt->local_port; cand[0].port = tech_pvt->local_port;
cand[0].address = advip; cand[0].address = advip;
@ -1277,7 +1282,6 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
switch_core_session *session = NULL; switch_core_session *session = NULL;
switch_channel *channel = NULL; switch_channel *channel = NULL;
struct private_object *tech_pvt = NULL; struct private_object *tech_pvt = NULL;
char *advip;
assert(dlsession != NULL); assert(dlsession != NULL);
assert(handle != NULL); assert(handle != NULL);
@ -1352,8 +1356,6 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
} }
} }
advip = profile->extip ? profile->extip : profile->ip;
switch(signal) { switch(signal) {
case LDL_SIGNAL_NONE: case LDL_SIGNAL_NONE:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR\n");
@ -1443,9 +1445,11 @@ 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); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%u candidates\n", len);
for(x = 0; x < len; x++) { for(x = 0; x < len; x++) {
uint8_t lanaddr = strncasecmp(candidates[x].address, profile->lanaddr, strlen(profile->lanaddr)) ? 0 : 1;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "candidates %s:%d\n", candidates[x].address, candidates[x].port); 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") && (!strcasecmp(candidates[x].type, "local") || !strcasecmp(candidates[x].type, "stun")) && 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))) || ((profile->lanaddr && lanaddr) ||
(strncasecmp(candidates[x].address, "10.", 3) && (strncasecmp(candidates[x].address, "10.", 3) &&
strncasecmp(candidates[x].address, "192.168.", 8) && strncasecmp(candidates[x].address, "192.168.", 8) &&
strncasecmp(candidates[x].address, "127.", 4) && strncasecmp(candidates[x].address, "127.", 4) &&
@ -1464,6 +1468,9 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
memset(payloads, 0, sizeof(payloads)); memset(payloads, 0, sizeof(payloads));
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Acceptable Candidate %s:%d\n", candidates[x].address, candidates[x].port); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Acceptable Candidate %s:%d\n", candidates[x].address, candidates[x].port);
if (lanaddr) {
switch_set_flag(tech_pvt, TFLAG_LANADDR);
}
if (!tech_pvt->num_codecs) { if (!tech_pvt->num_codecs) {
get_codecs(tech_pvt); get_codecs(tech_pvt);

View File

@ -1818,7 +1818,6 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
const switch_state_handler_table *driver_state_handler = NULL; const switch_state_handler_table *driver_state_handler = NULL;
const switch_state_handler_table *application_state_handler = NULL; const switch_state_handler_table *application_state_handler = NULL;
/* /*
Life of the channel. you have channel and pool in your session Life of the channel. you have channel and pool in your session
everywhere you go you use the session to malloc with everywhere you go you use the session to malloc with