[Freeswitch-svn] [commit] r13253 - in freeswitch/trunk/src: . include
FreeSWITCH SVN
anthm at freeswitch.org
Thu May 7 10:27:16 PDT 2009
Author: anthm
Date: Thu May 7 12:27:15 2009
New Revision: 13253
Log:
wait for cdr to be generated in failed cdr_x
Modified:
freeswitch/trunk/src/include/switch_channel.h
freeswitch/trunk/src/switch_channel.c
freeswitch/trunk/src/switch_ivr_originate.c
Modified: freeswitch/trunk/src/include/switch_channel.h
==============================================================================
--- freeswitch/trunk/src/include/switch_channel.h (original)
+++ freeswitch/trunk/src/include/switch_channel.h Thu May 7 12:27:15 2009
@@ -82,6 +82,7 @@
#define switch_channel_down(_channel) (switch_channel_get_state(_channel) >= CS_HANGUP)
SWITCH_DECLARE(void) switch_channel_wait_for_state(switch_channel_t *channel, switch_channel_t *other_channel, switch_channel_state_t want_state);
+SWITCH_DECLARE(void) switch_channel_wait_for_state_timeout(switch_channel_t *other_channel, switch_channel_state_t want_state, uint32_t timeout);
SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_flag(switch_channel_t *channel,
switch_channel_flag_t want_flag,
switch_bool_t pres,
Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c (original)
+++ freeswitch/trunk/src/switch_channel.c Thu May 7 12:27:15 2009
@@ -771,6 +771,25 @@
}
}
+
+SWITCH_DECLARE(void) switch_channel_wait_for_state_timeout(switch_channel_t *other_channel, switch_channel_state_t want_state, uint32_t timeout)
+{
+ switch_channel_state_t state;
+ uint32_t count = 0;
+
+ for (;;) {
+ state = switch_channel_get_running_state(other_channel);
+
+ if (state >= want_state) {
+ break;
+ }
+ switch_cond_next();
+ if (++count >= timeout) {
+ break;
+ }
+ }
+}
+
SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_flag(switch_channel_t *channel,
switch_channel_flag_t want_flag,
switch_bool_t pres,
Modified: freeswitch/trunk/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_originate.c (original)
+++ freeswitch/trunk/src/switch_ivr_originate.c Thu May 7 12:27:15 2009
@@ -2052,8 +2052,8 @@
continue;
}
- switch_channel_wait_for_state(caller_channel, switch_core_session_get_channel(originate_status[i].peer_session), CS_DESTROY);
-
+ switch_channel_wait_for_state_timeout(switch_core_session_get_channel(originate_status[i].peer_session), CS_DESTROY, 5000);
+
if (switch_ivr_generate_xml_cdr(originate_status[i].peer_session, &cdr) == SWITCH_STATUS_SUCCESS) {
if ((xml_text = switch_xml_toxml(cdr, SWITCH_FALSE))) {
switch_snprintf(buf, sizeof(buf), "%s_%d", cdr_var, ++cdr_total);
More information about the Freeswitch-svn
mailing list