[Freeswitch-svn] [commit] r8411 - in freeswitch/trunk/src: . include mod/endpoints/mod_sofia
Freeswitch SVN
anthm at freeswitch.org
Thu May 15 10:49:12 EDT 2008
Author: anthm
Date: Thu May 15 10:49:11 2008
New Revision: 8411
Modified:
freeswitch/trunk/src/include/switch_utils.h
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
freeswitch/trunk/src/switch_ivr.c
Log:
update
Modified: freeswitch/trunk/src/include/switch_utils.h
==============================================================================
--- freeswitch/trunk/src/include/switch_utils.h (original)
+++ freeswitch/trunk/src/include/switch_utils.h Thu May 15 10:49:11 2008
@@ -55,6 +55,18 @@
#define switch_is_file_path(file) (file && ((*file == '/') || strstr(file, SWITCH_URL_SEPARATOR)))
#endif
+
+static inline switch_bool_t switch_is_moh(const char *s)
+{
+ if (!strcasecmp(s, "silence") || !strcasecmp(s, "indicate_hold")) {
+ return SWITCH_FALSE;
+ }
+ return SWITCH_TRUE;
+}
+
+
+
+
SWITCH_DECLARE(switch_status_t) switch_b64_encode(unsigned char *in, switch_size_t ilen, unsigned char *out, switch_size_t olen);
SWITCH_DECLARE(switch_size_t) switch_b64_decode(char *in, char *out, switch_size_t olen);
SWITCH_DECLARE(char *) switch_amp_encode(char *s, char *buf, switch_size_t len);
@@ -73,6 +85,7 @@
SWITCH_DECLARE(switch_size_t) switch_fd_read_line(int fd, char *buf, switch_size_t len);
+
/*!
\brief Evaluate the truthfullness of a string expression
\param expr a string expression
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 15 10:49:11 2008
@@ -1852,7 +1852,7 @@
stream = tech_pvt->profile->hold_music;
}
- if (stream && strcasecmp(stream, "silence")) {
+ if (stream && switch_is_moh(stream)) {
if (!strcasecmp(stream, "indicate_hold")) {
switch_channel_set_flag(tech_pvt->channel, CF_SUSPEND);
switch_channel_set_flag(tech_pvt->channel, CF_HOLD);
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Thu May 15 10:49:11 2008
@@ -321,7 +321,7 @@
stream = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE);
}
- if (stream) {
+ if (stream && switch_is_moh(stream)) {
if ((b_session = switch_core_session_locate(b_uuid))) {
switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
switch_ivr_broadcast(b_uuid, stream, SMF_ECHO_ALEG | SMF_LOOP);
@@ -334,10 +334,14 @@
}
}
for (x = 0; x < loops || loops < 0; x++) {
+ switch_time_t b4, aftr;
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Command Execute %s(%s)\n",
switch_channel_get_name(channel), app_name, app_arg);
+ b4 = switch_timestamp_now();
switch_core_session_exec(session, application_interface, app_arg);
- if (!switch_channel_ready(channel) || switch_channel_test_flag(channel, CF_STOP_BROADCAST)) {
+ aftr = switch_timestamp_now();
+ if (!switch_channel_ready(channel) || switch_channel_test_flag(channel, CF_STOP_BROADCAST) || aftr - b4 < 500000) {
break;
}
}
More information about the Freeswitch-svn
mailing list