[Freeswitch-svn] [commit] r8232 - in freeswitch/trunk/src: . include mod/applications/mod_commands mod/applications/mod_dptools mod/endpoints/mod_sofia
Freeswitch SVN
anthm at freeswitch.org
Thu May 1 12:41:47 EDT 2008
Author: anthm
Date: Thu May 1 12:41:46 2008
New Revision: 8232
Modified:
freeswitch/trunk/src/include/switch_ivr.h
freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
freeswitch/trunk/src/switch_core_io.c
freeswitch/trunk/src/switch_core_rwlock.c
freeswitch/trunk/src/switch_ivr.c
freeswitch/trunk/src/switch_ivr_bridge.c
Log:
tewaks
Modified: freeswitch/trunk/src/include/switch_ivr.h
==============================================================================
--- freeswitch/trunk/src/include/switch_ivr.h (original)
+++ freeswitch/trunk/src/include/switch_ivr.h Thu May 1 12:41:46 2008
@@ -466,7 +466,7 @@
\param message optional message
\return SWITCH_STATUS_SUCCESS if all is well
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_hold_uuid(const char *uuid, const char *message);
+SWITCH_DECLARE(switch_status_t) switch_ivr_hold_uuid(const char *uuid, const char *message, switch_bool_t moh);
/*!
\brief Signal the session with a protocol specific unhold message.
@@ -481,7 +481,7 @@
\param message optional message
\return SWITCH_STATUS_SUCCESS if all is well
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_hold(switch_core_session_t *session, const char *message);
+SWITCH_DECLARE(switch_status_t) switch_ivr_hold(switch_core_session_t *session, const char *message, switch_bool_t moh);
/*!
\brief Signal the session with a protocol specific unhold message.
Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c Thu May 1 12:41:46 2008
@@ -1171,7 +1171,7 @@
if (!strcasecmp(argv[0], "off")) {
status = switch_ivr_unhold_uuid(argv[1]);
} else {
- status = switch_ivr_hold_uuid(argv[0], argv[1]);
+ status = switch_ivr_hold_uuid(argv[0], argv[1], 1);
}
}
Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c Thu May 1 12:41:46 2008
@@ -1897,7 +1897,7 @@
#define HOLD_SYNTAX "[<display message>]"
SWITCH_STANDARD_APP(hold_function)
{
- switch_ivr_hold_uuid(switch_core_session_get_uuid(session), data);
+ switch_ivr_hold_uuid(switch_core_session_get_uuid(session), data, 1);
}
#define UNHOLD_SYNTAX ""
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Thu May 1 12:41:46 2008
@@ -1829,7 +1829,13 @@
}
if (stream && strcasecmp(stream, "silence")) {
- switch_ivr_broadcast(switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE), stream, SMF_ECHO_ALEG | SMF_LOOP);
+ if (!strcasecmp(stream, "indicate_hold")) {
+ switch_channel_set_flag(tech_pvt->channel, CF_SUSPEND);
+ switch_channel_set_flag(tech_pvt->channel, CF_HOLD);
+ switch_ivr_hold_uuid(switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE), NULL, 0);
+ } else {
+ switch_ivr_broadcast(switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE), stream, SMF_ECHO_ALEG | SMF_LOOP);
+ }
}
}
} else {
@@ -1843,8 +1849,15 @@
if ((uuid = switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (b_session = switch_core_session_locate(uuid))) {
switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
- switch_channel_stop_broadcast(b_channel);
- switch_channel_wait_for_flag(b_channel, CF_BROADCAST, SWITCH_FALSE, 5000);
+
+ if (switch_channel_test_flag(tech_pvt->channel, CF_HOLD)) {
+ switch_ivr_unhold(b_session);
+ switch_channel_clear_flag(tech_pvt->channel, CF_SUSPEND);
+ switch_channel_clear_flag(tech_pvt->channel, CF_HOLD);
+ } else {
+ switch_channel_stop_broadcast(b_channel);
+ switch_channel_wait_for_flag(b_channel, CF_BROADCAST, SWITCH_FALSE, 5000);
+ }
switch_core_session_rwunlock(b_session);
}
Modified: freeswitch/trunk/src/switch_core_io.c
==============================================================================
--- freeswitch/trunk/src/switch_core_io.c (original)
+++ freeswitch/trunk/src/switch_core_io.c Thu May 1 12:41:46 2008
@@ -120,7 +120,7 @@
if (switch_channel_test_flag(session->channel, CF_HOLD)) {
status = SWITCH_STATUS_BREAK;
- goto done;
+ goto even_more_done;
}
if (session->endpoint_interface->io_routines->read_frame) {
@@ -459,6 +459,9 @@
switch_thread_rwlock_unlock(session->bug_rwlock);
}
}
+
+ even_more_done:
+
return status;
}
Modified: freeswitch/trunk/src/switch_core_rwlock.c
==============================================================================
--- freeswitch/trunk/src/switch_core_rwlock.c (original)
+++ freeswitch/trunk/src/switch_core_rwlock.c Thu May 1 12:41:46 2008
@@ -35,7 +35,6 @@
#include <switch.h>
#include "private/switch_core_pvt.h"
-
SWITCH_DECLARE(switch_status_t) switch_core_session_signal_lock(switch_core_session_t *session)
{
return switch_mutex_lock(session->signal_mutex);
@@ -58,12 +57,12 @@
if (switch_test_flag(session, SSF_DESTROYED)) {
status = SWITCH_STATUS_FALSE;
#ifdef SWITCH_DEBUG_RWLOCKS
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "%s Read lock FAIL\n", switch_channel_get_name(session->channel));
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "%s Read lock FAIL\n", switch_channel_get_name(session->channel));
#endif
} else {
status = (switch_status_t) switch_thread_rwlock_tryrdlock(session->rwlock);
#ifdef SWITCH_DEBUG_RWLOCKS
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "%s Read lock AQUIRED\n",
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "%s Read lock AQUIRED\n",
switch_channel_get_name(session->channel));
#endif
}
@@ -76,7 +75,7 @@
SWITCH_DECLARE(void) switch_core_session_perform_write_lock(switch_core_session_t *session, const char *file, const char *func, int line)
{
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "%s Write lock AQUIRED\n", switch_channel_get_name(session->channel));
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "%s Write lock AQUIRED\n", switch_channel_get_name(session->channel));
#else
SWITCH_DECLARE(void) switch_core_session_write_lock(switch_core_session_t *session)
{
@@ -87,7 +86,7 @@
#ifdef SWITCH_DEBUG_RWLOCKS
SWITCH_DECLARE(void) switch_core_session_perform_rwunlock(switch_core_session_t *session, const char *file, const char *func, int line)
{
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "%s Read/Write lock CLEARED\n",
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "%s Read/Write lock CLEARED\n",
switch_channel_get_name(session->channel));
#else
SWITCH_DECLARE(void) switch_core_session_rwunlock(switch_core_session_t *session)
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Thu May 1 12:41:46 2008
@@ -741,7 +741,7 @@
return status;
}
-SWITCH_DECLARE(switch_status_t) switch_ivr_hold(switch_core_session_t *session, const char *message)
+SWITCH_DECLARE(switch_status_t) switch_ivr_hold(switch_core_session_t *session, const char *message, switch_bool_t moh)
{
switch_core_session_message_t msg = { 0 };
switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -756,8 +756,8 @@
switch_channel_set_flag(channel, CF_SUSPEND);
switch_core_session_receive_message(session, &msg);
-
- if ((stream = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
+
+ if (moh && (stream = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
if ((other_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
switch_ivr_broadcast(other_uuid, stream, SMF_ECHO_ALEG | SMF_LOOP);
}
@@ -767,12 +767,12 @@
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status_t) switch_ivr_hold_uuid(const char *uuid, const char *message)
+SWITCH_DECLARE(switch_status_t) switch_ivr_hold_uuid(const char *uuid, const char *message, switch_bool_t moh)
{
switch_core_session_t *session;
if ((session = switch_core_session_locate(uuid))) {
- switch_ivr_hold(session, message);
+ switch_ivr_hold(session, message, moh);
switch_core_session_rwunlock(session);
}
Modified: freeswitch/trunk/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_bridge.c (original)
+++ freeswitch/trunk/src/switch_ivr_bridge.c Thu May 1 12:41:46 2008
@@ -161,8 +161,12 @@
}
if (!nosuspend && (switch_channel_test_flag(chan_a, CF_SUSPEND) || switch_channel_test_flag(chan_b, CF_SUSPEND))) {
- status = switch_core_session_read_frame(session_a, &read_frame, -1, stream_id);
-
+ if (switch_channel_test_flag(chan_a, CF_SUSPEND)) {
+ status = SWITCH_STATUS_SUCCESS;
+ } else {
+ status = switch_core_session_read_frame(session_a, &read_frame, -1, stream_id);
+ }
+
if (!SWITCH_READ_ACCEPTABLE(status)) {
goto end_of_bridge_loop;
}
More information about the Freeswitch-svn
mailing list