From 50e9411c82f797e81f89a46f726d9e670c1c3082 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 24 Jun 2008 22:14:47 +0000 Subject: [PATCH] fix small originate issues git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8834 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch_ivr_originate.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 434664ffa4..946c8b64b7 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -771,7 +771,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess pass = 0; var = NULL; to = 0; - progress_timelimit_sec = 0; sent_ring = 0; progress = 0; @@ -1017,7 +1016,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess goto notready; } - if (!sent_ring && !progress && (switch_timestamp(NULL) - start) > (time_t) progress_timelimit_sec) { + if (!sent_ring && !progress && progress_timelimit_sec && (switch_timestamp(NULL) - start) > (time_t) progress_timelimit_sec) { to++; idx = IDX_TIMEOUT; goto notready; @@ -1417,9 +1416,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess continue; } switch_channel_clear_flag(peer_channels[i], CF_ORIGINATING); - if (status == SWITCH_STATUS_SUCCESS && bleg && *bleg && *bleg == peer_sessions[i]) { - continue; + if (status == SWITCH_STATUS_SUCCESS) { + if (bleg && *bleg && *bleg == peer_sessions[i]) { + continue; + } + } else if (switch_channel_get_state(switch_core_session_get_channel(peer_sessions[i])) < CS_HANGUP) { + switch_channel_hangup(switch_core_session_get_channel(peer_sessions[i]), *cause); } + switch_core_session_rwunlock(peer_sessions[i]); }