[Freeswitch-svn] [commit] r7278 - freeswitch/trunk/src/mod/applications/mod_voicemail

Freeswitch SVN anthm at freeswitch.org
Thu Jan 17 19:17:42 EST 2008


Author: anthm
Date: Thu Jan 17 19:17:42 2008
New Revision: 7278

Modified:
   freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c

Log:
update

Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c	Thu Jan 17 19:17:42 2008
@@ -867,7 +867,8 @@
 } msg_type_t;
 
 
-static switch_status_t create_file(switch_core_session_t *session, vm_profile_t *profile, char *macro_name, char *file_path, switch_size_t *message_len)
+static switch_status_t create_file(switch_core_session_t *session, vm_profile_t *profile, 
+                                   char *macro_name, char *file_path, switch_size_t *message_len, switch_bool_t limit)
 {
 	switch_channel_t *channel;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -900,7 +901,7 @@
 		fh.silence_hits = profile->record_silence_hits;
 		fh.samplerate = profile->record_sample_rate;
 		switch_ivr_record_file(session, &fh, file_path, &args, profile->max_record_len);
-		if ((*message_len = fh.sample_count / read_codec->implementation->actual_samples_per_second) < profile->min_record_len) {
+		if (limit && (*message_len = fh.sample_count / read_codec->implementation->actual_samples_per_second) < profile->min_record_len) {
             switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Message is less than minimum record length: %d, discarding it.\n", 
                               profile->min_record_len);
 			if (unlink(file_path) != 0) {
@@ -1484,7 +1485,7 @@
 				TRY_CODE(switch_ivr_phrase_macro(session, VM_CHOOSE_GREETING_FAIL_MACRO, NULL, NULL, NULL));
 			} else {
 				file_path = switch_mprintf("%s%sgreeting_%d.%s", dir_path, SWITCH_PATH_SEPARATOR, num, profile->file_ext);
-				TRY_CODE(create_file(session, profile, VM_RECORD_GREETING_MACRO, file_path, &message_len));
+				TRY_CODE(create_file(session, profile, VM_RECORD_GREETING_MACRO, file_path, &message_len, SWITCH_TRUE));
 				sql = switch_mprintf("update voicemail_prefs set greeting_path='%s' where user='%s' and domain='%s'", file_path, myid, domain_name);
 				vm_execute_sql(profile, sql, profile->mutex);
 				switch_safe_free(sql);
@@ -1493,7 +1494,7 @@
 
 		} else if (!strcmp(input, profile->record_name_key)) {
 			file_path = switch_mprintf("%s%srecorded_name.%s", dir_path, SWITCH_PATH_SEPARATOR, profile->file_ext);
-			TRY_CODE(create_file(session, profile, VM_RECORD_NAME_MACRO, file_path, &message_len));
+			TRY_CODE(create_file(session, profile, VM_RECORD_NAME_MACRO, file_path, &message_len, SWITCH_FALSE));
 			sql = switch_mprintf("update voicemail_prefs set name_path='%s' where user='%s' and domain='%s'", file_path, myid, domain_name);
 			vm_execute_sql(profile, sql, profile->mutex);
 			switch_safe_free(file_path);
@@ -1863,7 +1864,7 @@
 	switch_channel_set_variable(channel, "RECORD_COMMENT", profile->record_comment);
 	switch_channel_set_variable(channel, "RECORD_COPYRIGHT", profile->record_copyright);
 
-	status = create_file(session, profile, VM_RECORD_MESSAGE_MACRO, file_path, &message_len);
+	status = create_file(session, profile, VM_RECORD_MESSAGE_MACRO, file_path, &message_len, SWITCH_TRUE);
 
 	if ((status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK) && switch_channel_ready(channel)) {
 		char input[10] = "", key_buf[80] = "", term = 0;



More information about the Freeswitch-svn mailing list