if (!strcasecmp(type, "initiate") || !strcasecmp(type, "accept")) {
dl_signal = LDL_SIGNAL_INITIATE;
+
if (!strcasecmp(type, "accept")) {
msg = "accept";
}
ldl_set_flag_locked(handle, LDL_FLAG_QUEUE_RUNNING);
- while (ldl_test_flag((&globals), LDL_FLAG_READY) && ldl_test_flag(handle, LDL_FLAG_RUNNING)) {
+ while (ldl_test_flag(handle, LDL_FLAG_RUNNING)) {
ldl_flush_queue(handle, 0);
- if (handle->loop_callback(handle) != LDL_STATUS_SUCCESS) {
+ if (handle->loop_callback(handle) != LDL_STATUS_SUCCESS || !ldl_test_flag((&globals), LDL_FLAG_READY)) {
int fd;
if ((fd = iks_fd(handle->parser)) > -1) {
while (ldl_test_flag((&globals), LDL_FLAG_READY) && ldl_test_flag(handle, LDL_FLAG_RUNNING)) {
int e;
char tmp[512], *sl;
+ int fd;
handle->parser = iks_stream_new(ldl_test_flag(handle, LDL_FLAG_COMPONENT) ? IKS_NS_COMPONENT : IKS_NS_CLIENT,
handle,
ldl_clear_flag_locked(handle, LDL_FLAG_CONNECTED);
ldl_clear_flag_locked(handle, LDL_FLAG_AUTHORIZED);
handle->state = CS_NEW;
+
+ if ((fd = iks_fd(handle->parser)) > -1) {
+ shutdown(fd, 0x02);
+ }
while(ldl_test_flag(handle, LDL_FLAG_QUEUE_RUNNING)) {
microsleep(100);
int8_t ldl_handle_ready(ldl_handle_t *handle)
{
- return (int8_t)ldl_test_flag(handle, LDL_FLAG_READY);
+ return (int8_t) (ldl_test_flag(handle, LDL_FLAG_READY) && ldl_test_flag((&globals), LDL_FLAG_READY));
}
ldl_status ldl_handle_init(ldl_handle_t **handle,
tech_pvt->local_port, tech_pvt->remote_ip, tech_pvt->remote_port);
flags = SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_GOOGLEHACK | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_RAW_WRITE | SWITCH_RTP_FLAG_AUTO_CNG;
+
if (switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) {
flags |= SWITCH_RTP_FLAG_USE_TIMER;
}
+ if (switch_true(switch_channel_get_variable(channel, "disable_rtp_auto_adjust"))) {
+ flags &= ~SWITCH_RTP_FLAG_AUTOADJ;
+ }
+
if (!(tech_pvt->rtp_session = switch_rtp_new(tech_pvt->profile->ip,
tech_pvt->local_port,
tech_pvt->remote_ip,
if (!do_candidates(tech_pvt, 0)) {
goto out;
}
- switch_channel_answer(channel);
+ if (switch_test_flag(tech_pvt, TFLAG_TRANSPORT_ACCEPT)) {
+ switch_channel_answer(channel);
+ }
}
ret = SWITCH_STATUS_SUCCESS;
status = LDL_STATUS_FALSE;
goto done;
}
-
+
} else {
if (dl_signal != LDL_SIGNAL_INITIATE && !msg) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Session is already dead\n");
if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
if (!strcasecmp(msg, "accept")) {
switch_set_flag_locked(tech_pvt, TFLAG_ANSWER);
+ switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT);
if (!do_candidates(tech_pvt, 0)) {
terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
status = LDL_STATUS_FALSE;
}
if (!strcasecmp(subject, "candidates")) {
- switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT);
+ //switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT);
switch_set_flag_locked(tech_pvt, TFLAG_ANSWER);
}