]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
update
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 15 May 2008 14:49:11 +0000 (14:49 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 15 May 2008 14:49:11 +0000 (14:49 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8411 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_utils.h
src/mod/endpoints/mod_sofia/sofia_glue.c
src/switch_ivr.c

index 2b439f157aa38bcc446f86809a7fa95f89213a11..9a67cd5e4e4bdb084a87cf46b84fa88d3ebc6951 100644 (file)
@@ -55,6 +55,18 @@ SWITCH_BEGIN_EXTERN_C
 #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 @@ static inline switch_bool_t switch_is_digit_string(const char *s) {
 
 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
index b93ac107e118bae8f5fd19b412e21892e08e59cd..54d2854061edc6aa04f46484e0d25a73047bbe5b 100644 (file)
@@ -1852,7 +1852,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
                                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);
index 0f0315abefb31c1500c45f5907fbdc75c0a4e020..4b8257d880133d8e082703ad46db1fe2060b4316 100644 (file)
@@ -321,7 +321,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se
                                                                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 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se
                                                }
                                        }
                                        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;
                                                }
                                        }